tweakcc 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +37 -33
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -58,7 +58,7 @@ $ pnpm dlx tweakcc
58
58
  2. **`$XDG_CONFIG_HOME/tweakcc`** - If `~/.tweakcc/` doesn't exist and `$XDG_CONFIG_HOME` is set
59
59
 
60
60
 
61
- `tweakcc` is verified to work with Claude Code **2.0.25.**
61
+ `tweakcc` is verified to work with Claude Code **2.0.31.**
62
62
 
63
63
  ## Running
64
64
 
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import{Box as u,Text as l,render as Mn,useInput as ge,useStdout as Nn}from"ink";import{Command as Bn}from"commander";import Pe,{Fragment as Se,createContext as kn,useCallback as cn,useContext as be,useEffect as ae,useState as O}from"react";import On from"ink-link";import{Fragment as ce,jsx as o,jsxs as g}from"react/jsx-runtime";import*as se from"node:path";import Ze from"node:path";import*as xe from"node:os";import*as Me from"node:fs";import{globbySync as Tn}from"globby";import En from"node:process";import*as re from"node:fs/promises";import ue from"node:fs/promises";import*as ye from"node:child_process";import*as dn from"node:crypto";import He from"figlet";import ke from"gray-matter";import te from"chalk";function An({items:e,selectedIndex:r,onSelect:n,onSubmit:t}){return ge((i,s)=>{s.upArrow?n(r>0?r-1:e.length-1):s.downArrow?n(r<e.length-1?r+1:0):s.return&&t(e[r].name)}),o(u,{flexDirection:"column",children:e.map((i,s)=>o(u,{children:g(l,{children:[g(l,{bold:s===r,color:s===r?"cyan":void 0,...s===r?i.selectedStyles??{}:i.styles??{},children:[s===r?"❯ ":" ",i.name]}),i.desc&&s===r&&g(l,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",i.desc]})]})},s))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations to cli.js",e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const K={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Dn=()=>{const e=se.join(xe.homedir(),".tweakcc"),r=process.env.XDG_CONFIG_HOME;try{if(Me.existsSync(e))return e}catch{}return r?se.join(r,"tweakcc"):e},pe=Dn(),de=se.join(pe,"config.json"),_e=se.join(pe,"cli.js.backup"),me=se.join(pe,"system-prompts"),Ln=()=>{const e=[],r=process.platform=="win32"?xe.homedir().replace(/\\/g,"/"):xe.homedir(),n="node_modules/@anthropic-ai/claude-code",t=(i,s=!1)=>{if(s){const a=Tn(i,{onlyFiles:!1});e.push({pattern:i,isGlob:!0,expandedPaths:a})}else e.push({pattern:i,isGlob:!1,expandedPaths:[i]})};return t(`${xe.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&t(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&t(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&t(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&t(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&t(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&t(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&t(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&t(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(t(`${r}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),t(`${r}/AppData/Roaming/npm/${n}`),t(`${r}/AppData/Roaming/nvm/*/${n}`,!0),t(`${r}/AppData/Local/Yarn/config/global/${n}`),t(`${r}/AppData/Local/pnpm/global/*/${n}`,!0),t(`C:/nvm4w/nodejs/${n}`),t(`${r}/n/versions/node/*/lib/${n}`,!0),t(`${r}/AppData/Roaming/Yarn/config/global/${n}`),t(`${r}/AppData/Roaming/pnpm-global/${n}`),t(`${r}/AppData/Roaming/pnpm-global/*/${n}`,!0),t(`${r}/.bun/install/global/${n}`),t(`${r}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(t(`${r}/Library/${n}`),t(`/opt/local/lib/${n}`)),t(`${r}/.local/lib/${n}`),t(`${r}/.local/share/${n}`),t(`${r}/.npm-global/lib/${n}`),t(`${r}/.npm-packages/lib/${n}`),t(`${r}/.npm/lib/${n}`),t(`${r}/npm/lib/${n}`),t(`/etc/${n}`),t(`/lib/${n}`),t(`/opt/node/lib/${n}`),t(`/usr/lib/${n}`),t(`/usr/local/lib/${n}`),t(`/usr/share/${n}`),t(`/var/lib/${n}`),t(`/opt/homebrew/lib/${n}`),t(`${r}/.config/yarn/global/${n}`),t(`${r}/.yarn/global/${n}`),t(`${r}/.bun/install/global/${n}`),t(`${r}/.pnpm-global/${n}`),t(`${r}/.pnpm-global/*/${n}`,!0),t(`${r}/pnpm-global/${n}`),t(`${r}/pnpm-global/*/${n}`,!0),t(`${r}/.local/share/pnpm/global/${n}`),t(`${r}/.local/share/pnpm/global/*/${n}`,!0),t(`${r}/.bun/install/global/${n}`),t(`/usr/local/n/versions/node/*/lib/${n}`,!0),t(`${r}/n/versions/node/*/lib/${n}`,!0),t(`${r}/n/lib/${n}`),t(`${r}/.volta/tools/image/node/*/lib/${n}`,!0),t(`${r}/.fnm/node-versions/*/installation/lib/${n}`,!0),t(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),t(`${r}/.nvm/versions/node/*/lib/${n}`,!0),t(`${r}/.nodenv/versions/*/lib/${n}`,!0),t(`${r}/.nvs/*/lib/${n}`,!0),t(`${r}/.asdf/installs/nodejs/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(i=>{i.pattern=i.pattern.replace(/\//g,"\\"),i.expandedPaths=i.expandedPaths.map(s=>s.replace(/\//g,"\\"))}),e},Ge=Ln(),Qe=Ge.flatMap(e=>e.expandedPaths),Pn=({children:e,...r})=>g(l,{bold:!0,backgroundColor:"#ffd500",color:"#000",...r,children:[" ",e," "]});var fe=Pn;const Rn=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],Fn=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${de})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function Vn({onSubmit:e,notification:r}){const n=[...be(he).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...Rn,...Fn],[t,i]=O(0);return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Tweak Claude Code"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize your Claude Code installation."})," ",o(l,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(u,{marginBottom:1,children:g(l,{color:"yellow",children:["⭐ ",o(l,{bold:!0,children:"Star the repo at "}),o(On,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(l,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(l,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),r&&o(u,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:r?.type==="success"?"green":r?.type==="error"?"red":r?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(l,{color:r?.type==="success"?"green":r?.type==="error"?"red":r?.type==="info"?"blue":"yellow",children:r?.message})}),o(An,{items:n,selectedIndex:t,onSelect:i,onSubmit:s=>e(s)})]})}async function We(e){const r=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const n=await fetch(r);if(!n.ok)throw new Error(`Failed to download strings file: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw n instanceof Error?new Error(`Error downloading strings file for version ${e}: ${n.message}`):n}}const jn="modulepreload",Un=function(e){return"/"+e},en={},Hn=function(r,n,t){let i=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(f=>Promise.resolve(f).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};const a=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");i=c(n.map(m=>{if(m=Un(m,t),m in en)return;en[m]=!0;const f=m.endsWith(".css"),S=f?'[rel="stylesheet"]':"";if(!!t)for(let $=a.length-1;$>=0;$--){const M=a[$];if(M.href===m&&(!f||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${S}`))return;const C=document.createElement("link");if(C.rel=f?"stylesheet":jn,f||(C.as="script"),C.crossOrigin="",C.href=m,h&&C.setAttribute("nonce",h),document.head.appendChild(C),f)return new Promise(($,M)=>{C.addEventListener("load",$),C.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function s(a){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=a,window.dispatchEvent(d),!d.defaultPrevented)throw a}return i.then(a=>{for(const d of a||[])d.status==="rejected"&&s(d.reason);return r().catch(s)})},gn=se.join(pe,"systemPromptOriginalHashes.json"),hn=se.join(pe,"systemPromptAppliedHashes.json"),un=(e,r)=>`${e}-${r}`,Te=e=>dn.createHash("md5").update(e.trim(),"utf8").digest("hex"),mn=async()=>{try{const e=await re.readFile(gn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Gn=async e=>{await re.mkdir(pe,{recursive:!0});const r={},n=Object.keys(e).sort();for(const t of n)r[t]=e[t];await re.writeFile(gn,JSON.stringify(r,null,2),"utf8")},Yn=async e=>{const r=await mn();let n=0;for(const t of e.prompts){const i=un(t.id,t.version);if(!r[i]){const s=Oe(t.pieces,t.identifiers,t.identifierMap),a=Te(s);r[i]=a,n++}}return await Gn(r),n},Wn=async(e,r)=>{const n=await mn(),t=un(e,r);return n[t]},ze=async()=>{try{const e=await re.readFile(hn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},fn=async e=>{await re.mkdir(pe,{recursive:!0});const r={},n=Object.keys(e).sort();for(const t of n)r[t]=e[t];await re.writeFile(hn,JSON.stringify(r,null,2),"utf8")},zn=async(e,r)=>{const n=await ze();n[e]=r,await fn(n)},Jn=async()=>{const e=await ze(),r={};for(const n of Object.keys(e))r[n]=null;await fn(r)},Xn=async e=>{try{const r=await ze();if(Object.keys(r).length===0)return!1;const t=(await re.readdir(e)).filter(i=>i.endsWith(".md"));for(const i of t){const s=i.replace(".md",""),a=r[s];if(a===void 0||a===null)continue;const d=se.join(e,i),h=await re.readFile(d,"utf8"),m=(await Hn(()=>import("gray-matter"),[])).default(h,{delimiters:["<!--","-->"]});if(Te(m.content)!==a)return!0}return!1}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return!1;throw r}},bn=e=>{const r=ke(e,{delimiters:["<!--","-->"]}),{name:n,description:t,ccVersion:i,variables:s}=r.data;return{name:n||"",description:t||"",ccVersion:i||"",variables:s||[],content:r.content.trim()}},nn=(e,r)=>{const n=r||Oe(e.pieces,e.identifiers,e.identifierMap),t=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return t&&t.length>0&&(i.variables=t),ke.stringify(n,i,{delimiters:["<!--","-->"]})},Oe=(e,r,n)=>{let t="";for(let i=0;i<e.length;i++)if(t+=e[i],i<r.length){const s=r[i],a=n[String(s)]||`UNKNOWN_${s}`;t+=a}return t},Kn=(e,r)=>{const n=e.split(".").map(Number),t=r.split(".").map(Number);for(let i=0;i<Math.max(n.length,t.length);i++){const s=n[i]||0,a=t[i]||0;if(s<a)return-1;if(s>a)return 1}return 0},Ne=e=>se.join(me,`${e}.md`),qn=async e=>{try{return await re.access(Ne(e)),!0}catch{return!1}},Zn=async e=>{const r=Ne(e),n=await re.readFile(r,"utf-8");return bn(n)},Ye=async(e,r)=>{const n=Ne(e);await re.writeFile(n,r,"utf-8")},Qn=async(e,r)=>{const n=Ne(e),t=await re.readFile(n,"utf-8"),i=ke(t,{delimiters:["<!--","-->"]}),s=Object.keys(r).length>0?[...new Set(Object.values(r))]:void 0,a={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};s&&s.length>0&&(a.variables=s);const d=ke.stringify(i.content,a,{delimiters:["<!--","-->"]});await Ye(e,d)},er=(e,r)=>{const n=$=>$.split(/(\s+)/),t=n(e),i=n(r),s=t.length,a=i.length,d=Array(s+1).fill(0).map(()=>Array(a+1).fill(0));for(let $=1;$<=s;$++)for(let M=1;M<=a;M++)t[$-1]===i[M-1]?d[$][M]=d[$-1][M-1]+1:d[$][M]=Math.max(d[$-1][M],d[$][M-1]);const h=Array(s).fill(!1),c=Array(a).fill(!1);let m=s,f=a;for(;m>0||f>0;)m>0&&f>0&&t[m-1]===i[f-1]?(m--,f--):f>0&&(m===0||d[m][f-1]>=d[m-1][f])?(c[f-1]=!0,f--):m>0&&(h[m-1]=!0,m--);const S=$=>$.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");let I="";for(let $=0;$<t.length;$++){const M=S(t[$]);I+=h[$]?`<mark>${M}</mark>`:M}let C="";for(let $=0;$<i.length;$++){const M=S(i[$]);C+=c[$]?`<mark>${M}</mark>`:M}return{oldHtml:I,newHtml:C}},rn=(e,r)=>{const n=e.length,t=r.length,i=Array(n+1).fill(0).map(()=>Array(t+1).fill(0));for(let c=1;c<=n;c++)for(let m=1;m<=t;m++)e[c-1]===r[m-1]?i[c][m]=i[c-1][m-1]+1:i[c][m]=Math.max(i[c-1][m],i[c][m-1]);const s=[];let a=n,d=t;const h=[];for(;a>0||d>0;)a>0&&d>0&&e[a-1]===r[d-1]?(h.unshift({type:"unchanged",line:e[a-1],oldLineNo:a,newLineNo:d}),a--,d--):d>0&&(a===0||i[a][d-1]>=i[a-1][d])?(h.unshift({type:"added",line:r[d-1],newLineNo:d}),d--):a>0&&(h.unshift({type:"removed",line:e[a-1],oldLineNo:a}),a--);for(let c=0;c<h.length;c++){const m=h[c],f=h[c+1];if(m.type==="removed"&&f?.type==="added"){const S=er(m.line,f.line);s.push({type:"modified",line:m.line,oldLineNo:m.oldLineNo,newLineNo:f.newLineNo,oldHtml:S.oldHtml,newHtml:S.newHtml}),c++}else s.push(m)}return s},nr=async(e,r,n,t,i,s,a,d)=>{const h=n.split(`
3
- `),c=t.split(`
2
+ import{Box as u,Text as l,render as Mr,useInput as ge,useStdout as Br}from"ink";import{Command as kr}from"commander";import X from"chalk";import Pe,{Fragment as _e,createContext as Or,useCallback as dr,useContext as be,useEffect as ae,useState as O}from"react";import Tr from"ink-link";import{Fragment as ce,jsx as o,jsxs as g}from"react/jsx-runtime";import*as ie from"node:path";import Qe from"node:path";import*as xe from"node:os";import*as Ne from"node:fs";import{globbySync as Er}from"globby";import Ar from"node:process";import*as ne from"node:fs/promises";import ue from"node:fs/promises";import*as Se from"node:child_process";import*as gr from"node:crypto";import Ge from"figlet";import ke from"gray-matter";function Dr({items:e,selectedIndex:t,onSelect:r,onSubmit:n}){return ge((i,s)=>{s.upArrow?r(t>0?t-1:e.length-1):s.downArrow?r(t<e.length-1?t+1:0):s.return&&n(e[t].name)}),o(u,{flexDirection:"column",children:e.map((i,s)=>o(u,{children:g(l,{children:[g(l,{bold:s===t,color:s===t?"cyan":void 0,...s===t?i.selectedStyles??{}:i.styles??{},children:[s===t?"❯ ":" ",i.name]}),i.desc&&s===t&&g(l,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",i.desc]})]})},s))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations to cli.js",e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const q={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Lr=()=>{const e=ie.join(xe.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Ne.existsSync(e))return e}catch{}return t?ie.join(t,"tweakcc"):e},pe=Lr(),de=ie.join(pe,"config.json"),ye=ie.join(pe,"cli.js.backup"),me=ie.join(pe,"system-prompts"),er=ie.join(pe,"prompt-data-cache"),Rr=()=>{const e=[],t=process.platform=="win32"?xe.homedir().replace(/\\/g,"/"):xe.homedir(),r="node_modules/@anthropic-ai/claude-code",n=(i,s=!1)=>{if(s){const a=Er(i,{onlyFiles:!1});e.push({pattern:i,isGlob:!0,expandedPaths:a})}else e.push({pattern:i,isGlob:!1,expandedPaths:[i]})};return n(`${xe.homedir()}/.claude/local/${r}`),process.env.NPM_PREFIX&&n(`${process.env.NPM_PREFIX}/lib/${r}`),process.env.N_PREFIX&&n(`${process.env.N_PREFIX}/lib/${r}`),process.env.VOLTA_HOME&&n(`${process.env.VOLTA_HOME}/lib/${r}`),process.env.FNM_DIR&&n(`${process.env.FNM_DIR}/lib/${r}`),process.env.NVM_DIR&&n(`${process.env.NVM_DIR}/lib/${r}`),process.env.NODENV_ROOT&&n(`${process.env.NODENV_ROOT}/versions/*/lib/${r}`,!0),process.env.NVS_HOME&&n(`${process.env.NVS_HOME}/node/*/*/lib/${r}`,!0),process.env.ASDF_DATA_DIR&&n(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`,!0),process.platform=="win32"?(n(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),n(`${t}/AppData/Roaming/npm/${r}`),n(`${t}/AppData/Roaming/nvm/*/${r}`,!0),n(`${t}/AppData/Local/Yarn/config/global/${r}`),n(`${t}/AppData/Local/pnpm/global/*/${r}`,!0),n(`C:/nvm4w/nodejs/${r}`),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/AppData/Roaming/Yarn/config/global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`${t}/AppData/Local/fnm_multishells/*/node_modules/${r}`,!0)):(process.platform=="darwin"&&(n(`${t}/Library/${r}`),n(`/opt/local/lib/${r}`)),n(`${t}/.local/lib/${r}`),n(`${t}/.local/share/${r}`),n(`${t}/.npm-global/lib/${r}`),n(`${t}/.npm-packages/lib/${r}`),n(`${t}/.npm/lib/${r}`),n(`${t}/npm/lib/${r}`),n(`/etc/${r}`),n(`/lib/${r}`),n(`/opt/node/lib/${r}`),n(`/usr/lib/${r}`),n(`/usr/local/lib/${r}`),n(`/usr/share/${r}`),n(`/var/lib/${r}`),n(`/opt/homebrew/lib/${r}`),n(`${t}/.linuxbrew/lib/${r}`),n(`${t}/.config/yarn/global/${r}`),n(`${t}/.yarn/global/${r}`),n(`${t}/.bun/install/global/${r}`),n(`${t}/.pnpm-global/${r}`),n(`${t}/.pnpm-global/*/${r}`,!0),n(`${t}/pnpm-global/${r}`),n(`${t}/pnpm-global/*/${r}`,!0),n(`${t}/.local/share/pnpm/global/${r}`),n(`${t}/.local/share/pnpm/global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`/usr/local/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/lib/${r}`),n(`${t}/.volta/tools/image/node/*/lib/${r}`,!0),n(`${t}/.fnm/node-versions/*/installation/lib/${r}`,!0),n(`${t}/.local/state/fnm_multishells/*/lib/${r}`,!0),n(`/usr/local/nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nodenv/versions/*/lib/${r}`,!0),n(`${t}/.nvs/*/lib/${r}`,!0),n(`${t}/.asdf/installs/nodejs/*/lib/${r}`,!0)),process.platform=="win32"&&e.forEach(i=>{i.pattern=i.pattern.replace(/\//g,"\\"),i.expandedPaths=i.expandedPaths.map(s=>s.replace(/\//g,"\\"))}),e},He=Rr(),rr=He.flatMap(e=>e.expandedPaths),Pr=({children:e,...t})=>g(l,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var fe=Pr;const Fr=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],Vr=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${de})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function Ur({onSubmit:e,notification:t}){const r=[...be(he).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...Fr,...Vr],[n,i]=O(0);return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Tweak Claude Code"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize your Claude Code installation."})," ",o(l,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(u,{marginBottom:1,children:g(l,{color:"yellow",children:["⭐ ",o(l,{bold:!0,children:"Star the repo at "}),o(Tr,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(l,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(l,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&o(u,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(l,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),o(Dr,{items:r,selectedIndex:n,onSelect:i,onSubmit:s=>e(s)})]})}async function ze(e){const t=ie.join(er,`prompts-${e}.json`);try{const n=await ne.readFile(t,"utf-8");return JSON.parse(n)}catch{}const r=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const n=await fetch(r);if(!n.ok){let s;throw n.status===429?s="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":n.status===404?s=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:n.status>=500?s=`GitHub server error (${n.status}). Please try again later.`:s=`HTTP ${n.status}: ${n.statusText}`,new Error(s)}const i=await n.json();try{await ne.mkdir(er,{recursive:!0}),await ne.writeFile(t,JSON.stringify(i,null,2),"utf-8")}catch(s){console.warn(`Failed to write to cache to ${t}: ${s}`)}return i}catch(n){if(n instanceof Error){if(n.message.includes("Rate limit")||n.message.includes("not found")||n.message.includes("server error")||n.message.includes("HTTP"))throw n;const i=`Failed to download prompts for version ${e}: ${n.message}`;throw new Error(i)}throw n}}const jr="modulepreload",Gr=function(e){return"/"+e},nr={},Hr=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(f=>Promise.resolve(f).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};const a=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),h=c?.nonce||c?.getAttribute("nonce");i=d(r.map(m=>{if(m=Gr(m,n),m in nr)return;nr[m]=!0;const f=m.endsWith(".css"),_=f?'[rel="stylesheet"]':"";if(!!n)for(let $=a.length-1;$>=0;$--){const N=a[$];if(N.href===m&&(!f||N.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${_}`))return;const C=document.createElement("link");if(C.rel=f?"stylesheet":jr,f||(C.as="script"),C.crossOrigin="",C.href=m,h&&C.setAttribute("nonce",h),document.head.appendChild(C),f)return new Promise(($,N)=>{C.addEventListener("load",$),C.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})},hr=ie.join(pe,"systemPromptOriginalHashes.json"),ur=ie.join(pe,"systemPromptAppliedHashes.json"),mr=(e,t)=>`${e}-${t}`,Ee=e=>gr.createHash("md5").update(e.trim(),"utf8").digest("hex"),fr=async()=>{try{const e=await ne.readFile(hr,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Yr=async e=>{await ne.mkdir(pe,{recursive:!0});const t={},r=Object.keys(e).sort();for(const n of r)t[n]=e[n];await ne.writeFile(hr,JSON.stringify(t,null,2),"utf8")},Wr=async e=>{const t=await fr();let r=0;for(const n of e.prompts){const i=mr(n.id,n.version);if(!t[i]){const s=Oe(n.pieces,n.identifiers,n.identifierMap),a=Ee(s);t[i]=a,r++}}return await Yr(t),r},zr=async(e,t)=>{const r=await fr(),n=mr(e,t);return r[n]},Je=async()=>{try{const e=await ne.readFile(ur,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},br=async e=>{await ne.mkdir(pe,{recursive:!0});const t={},r=Object.keys(e).sort();for(const n of r)t[n]=e[n];await ne.writeFile(ur,JSON.stringify(t,null,2),"utf8")},Jr=async(e,t)=>{const r=await Je();r[e]=t,await br(r)},Xr=async()=>{const e=await Je(),t={};for(const r of Object.keys(e))t[r]=null;await br(t)},Kr=async e=>{try{const t=await Je();if(Object.keys(t).length===0)return!1;const n=(await ne.readdir(e)).filter(i=>i.endsWith(".md"));for(const i of n){const s=i.replace(".md",""),a=t[s];if(a===void 0||a===null)continue;const c=ie.join(e,i),h=await ne.readFile(c,"utf8"),m=(await Hr(()=>import("gray-matter"),[])).default(h,{delimiters:["<!--","-->"]});if(Ee(m.content)!==a)return!0}return!1}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},pr=e=>{const t=ke(e,{delimiters:["<!--","-->"]}),{name:r,description:n,ccVersion:i,variables:s}=t.data;return{name:r||"",description:n||"",ccVersion:i||"",variables:s||[],content:t.content.trim()}},tr=(e,t)=>{const r=t||Oe(e.pieces,e.identifiers,e.identifierMap),n=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return n&&n.length>0&&(i.variables=n),ke.stringify(r,i,{delimiters:["<!--","-->"]})},Oe=(e,t,r)=>{let n="";for(let i=0;i<e.length;i++)if(n+=e[i],i<t.length){const s=t[i],a=r[String(s)]||`UNKNOWN_${s}`;n+=a}return n},qr=(e,t)=>{const r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<Math.max(r.length,n.length);i++){const s=r[i]||0,a=n[i]||0;if(s<a)return-1;if(s>a)return 1}return 0},Me=e=>ie.join(me,`${e}.md`),Zr=async e=>{try{return await ne.access(Me(e)),!0}catch{return!1}},Qr=async e=>{const t=Me(e),r=await ne.readFile(t,"utf-8");return pr(r)},Ye=async(e,t)=>{const r=Me(e);await ne.writeFile(r,t,"utf-8")},en=async(e,t)=>{const r=Me(e),n=await ne.readFile(r,"utf-8"),i=ke(n,{delimiters:["<!--","-->"]}),s=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,a={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};s&&s.length>0&&(a.variables=s);const c=ke.stringify(i.content,a,{delimiters:["<!--","-->"]});await Ye(e,c)},rn=(e,t)=>{const r=$=>$.split(/(\s+)/),n=r(e),i=r(t),s=n.length,a=i.length,c=Array(s+1).fill(0).map(()=>Array(a+1).fill(0));for(let $=1;$<=s;$++)for(let N=1;N<=a;N++)n[$-1]===i[N-1]?c[$][N]=c[$-1][N-1]+1:c[$][N]=Math.max(c[$-1][N],c[$][N-1]);const h=Array(s).fill(!1),d=Array(a).fill(!1);let m=s,f=a;for(;m>0||f>0;)m>0&&f>0&&n[m-1]===i[f-1]?(m--,f--):f>0&&(m===0||c[m][f-1]>=c[m-1][f])?(d[f-1]=!0,f--):m>0&&(h[m-1]=!0,m--);const _=$=>$.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");let v="";for(let $=0;$<n.length;$++){const N=_(n[$]);v+=h[$]?`<mark>${N}</mark>`:N}let C="";for(let $=0;$<i.length;$++){const N=_(i[$]);C+=d[$]?`<mark>${N}</mark>`:N}return{oldHtml:v,newHtml:C}},or=(e,t)=>{const r=e.length,n=t.length,i=Array(r+1).fill(0).map(()=>Array(n+1).fill(0));for(let d=1;d<=r;d++)for(let m=1;m<=n;m++)e[d-1]===t[m-1]?i[d][m]=i[d-1][m-1]+1:i[d][m]=Math.max(i[d-1][m],i[d][m-1]);const s=[];let a=r,c=n;const h=[];for(;a>0||c>0;)a>0&&c>0&&e[a-1]===t[c-1]?(h.unshift({type:"unchanged",line:e[a-1],oldLineNo:a,newLineNo:c}),a--,c--):c>0&&(a===0||i[a][c-1]>=i[a-1][c])?(h.unshift({type:"added",line:t[c-1],newLineNo:c}),c--):a>0&&(h.unshift({type:"removed",line:e[a-1],oldLineNo:a}),a--);for(let d=0;d<h.length;d++){const m=h[d],f=h[d+1];if(m.type==="removed"&&f?.type==="added"){const _=rn(m.line,f.line);s.push({type:"modified",line:m.line,oldLineNo:m.oldLineNo,newLineNo:f.newLineNo,oldHtml:_.oldHtml,newHtml:_.newHtml}),d++}else s.push(m)}return s},nn=async(e,t,r,n,i,s,a,c)=>{const h=r.split(`
3
+ `),d=n.split(`
4
4
  `),m=i.split(`
5
- `),f=B=>B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),S=rn(h,c),I=rn(h,m);let C="";for(const B of S){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
5
+ `),f=B=>B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),_=or(h,d),v=or(h,m);let C="";for(const B of _){const Y=f(B.line);if(B.type==="modified"){const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${U}</span><span class="prefix">- </span>${B.oldHtml}</div>
6
6
  `,C+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
7
- `}else if(B.type==="removed"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${Y}</div>
8
- `}else if(B.type==="added"){const j=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line added"><span class="line-num">${j}</span><span class="prefix">+ </span>${Y}</div>
9
- `}else{const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line unchanged"><span class="line-num">${j} ${V}</span><span class="prefix"> </span>${Y}</div>
10
- `}}let $="";for(const B of I){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
7
+ `}else if(B.type==="removed"){const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${U}</span><span class="prefix">- </span>${Y}</div>
8
+ `}else if(B.type==="added"){const U=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line added"><span class="line-num">${U}</span><span class="prefix">+ </span>${Y}</div>
9
+ `}else{const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line unchanged"><span class="line-num">${U} ${V}</span><span class="prefix"> </span>${Y}</div>
10
+ `}}let $="";for(const B of v){const Y=f(B.line);if(B.type==="modified"){const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${U}</span><span class="prefix">- </span>${B.oldHtml}</div>
11
11
  `,$+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
12
- `}else if(B.type==="removed"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${Y}</div>
13
- `}else if(B.type==="added"){const j=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line added"><span class="line-num">${j}</span><span class="prefix">+ </span>${Y}</div>
14
- `}else{const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line unchanged"><span class="line-num">${j} ${V}</span><span class="prefix"> </span>${Y}</div>
15
- `}}const M=`<!DOCTYPE html>
12
+ `}else if(B.type==="removed"){const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${U}</span><span class="prefix">- </span>${Y}</div>
13
+ `}else if(B.type==="added"){const U=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line added"><span class="line-num">${U}</span><span class="prefix">+ </span>${Y}</div>
14
+ `}else{const U=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line unchanged"><span class="line-num">${U} ${V}</span><span class="prefix"> </span>${Y}</div>
15
+ `}}const N=`<!DOCTYPE html>
16
16
  <html>
17
17
  <head>
18
18
  <meta charset="UTF-8">
19
- <title>Diff: ${f(r)} (${f(e)})</title>
19
+ <title>Diff: ${f(t)} (${f(e)})</title>
20
20
  <style>
21
21
  body {
22
22
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
@@ -143,7 +143,7 @@ import{Box as u,Text as l,render as Mn,useInput as ge,useStdout as Nn}from"ink";
143
143
  </head>
144
144
  <body>
145
145
  <div class="header">
146
- <h1>${f(r)}</h1>
146
+ <h1>${f(t)}</h1>
147
147
  <div class="version-info">
148
148
  <strong>Old Version:</strong> ${f(s)} →
149
149
  <strong>New Version:</strong> ${f(a)}
@@ -155,7 +155,7 @@ import{Box as u,Text as l,render as Mn,useInput as ge,useStdout as Nn}from"ink";
155
155
  Your customized prompt file is based on version ${f(s)},
156
156
  but Claude Code is now using version ${f(a)}.
157
157
  Review the differences below to understand both your customizations and the upstream changes.<br><br>
158
- <strong>File:</strong> <code>${f(d)}</code><br><br>
158
+ <strong>File:</strong> <code>${f(c)}</code><br><br>
159
159
  When you're done reviewing, update the <code>ccVersion</code> in the file to <strong>${f(a)}</strong>.
160
160
  </div>
161
161
 
@@ -173,10 +173,10 @@ ${$} </div>
173
173
  </div>
174
174
  </div>
175
175
  </body>
176
- </html>`,F=se.join(me,`${e}.diff.html`);return await re.writeFile(F,M,"utf-8"),F},rr=async e=>{const r={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await qn(e.id)){const i=nn(e);return await Ye(e.id,i),r.action="created",r}const t=await Zn(e.id);if(r.oldVersion=t.ccVersion,await Qn(e.id,e.identifierMap),t.ccVersion&&e.version){const i=Kn(t.ccVersion,e.version);if(i===0)return r.action="skipped",r;if(i!=0){const s=await Wn(e.id,t.ccVersion),a=Te(t.content);if(!s||s!==a){r.action="conflict";const c=(await We(t.ccVersion)).prompts.find(C=>C.id===e.id),m=c?Oe(c.pieces,c.identifiers,c.identifierMap):t.content,f=Oe(e.pieces,e.identifiers,e.identifierMap),S=Ne(e.id),I=await nr(e.id,e.name,m,t.content,f,t.ccVersion,e.version,S);r.diffHtmlPath=I}else{const h=nn(e);await Ye(e.id,h),r.action="updated"}}}return r},tr=async e=>{const r={ccVersion:e,results:[]},n=await We(e);await Yn(n),await re.mkdir(me,{recursive:!0});for(const t of n.prompts)try{const i=await rr(t);r.results.push(i)}catch(i){throw console.log(te.red(`Failed to sync prompt ${t.id}:`)),i}return r};let Re=null,tn=null;const or=async e=>{if(Re&&tn===e)return Re;const r=await We(e);return Re=r,tn=e,r},ir=(e,r)=>{let n="";for(let t=0;t<e.length;t++){const s=e[t].replace(/<<CCVERSION>>/g,r).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n+=s,t<e.length-1&&(n+="([\\w$]+)")}return n},sr=(e,r,n,t,i)=>{const s={};for(let h=0;h<t.length;h++){const c=t[h],m=String(r[h]),f=n[m];f&&(s[f]=c)}let a=e;const d=Object.entries(s).sort((h,c)=>c[0].length-h[0].length);for(const[h,c]of d){const m=new RegExp(`\\b${h}\\b`,"g");a=a.replace(m,c)}return a=a.replace(/<<CCVERSION>>/g,i),a},lr=async e=>{const r=await or(e),n=[];for(const t of r.prompts){const i=ir(t.pieces,e),s=se.join(me,`${t.id}.md`);let a;try{a=await re.readFile(s,"utf8")}catch(c){console.error(`Failed to read markdown file ${s}:`,c);continue}const d=bn(a),h=c=>{const m=c.slice(1);return sr(d.content,t.identifiers,t.identifierMap,m,e)};n.push({promptId:t.id,prompt:d,regex:i,getInterpolatedContent:h})}return n},ar=e=>{const r=e.results.filter(s=>s.action==="created"),n=e.results.filter(s=>s.action==="updated"),t=e.results.filter(s=>s.action==="conflict"),i=e.results.filter(s=>s.action==="skipped");if((r.length>0||n.length>0||t.length>0)&&i.length>0&&(console.log(te.dim(`Skipped ${i.length} up-to-date file(s)`)),console.log()),r.length>0){console.log(te.bold.green(`Created ${r.length} new prompt file(s):`));for(const s of r)console.log(te.green(` ${me}/${s.id}.md`)),console.log(te.green.dim(` ${s.description}`));console.log()}if(n.length>0){console.log(te.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const s of n)s.oldVersion?console.log(te.blue(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)):console.log(te.blue(` ${s.id}.md (→ ${s.newVersion})`));console.log()}if(t.length>0){console.log(te.bold.yellow(`WARNING: Conflicts detected for ${t.length} system prompt file(s)`));for(const s of t)console.log(te.yellow(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)),console.log(te.yellow(` Open the diff in your browser: ${s.diffHtmlPath}`));console.log()}if(r.length>0&&(console.log(te.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(te.green(`You can now customize the markdown files at ${me} in a text editor.`)),console.log(te.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),t.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(te.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const s of t)console.log(te.yellow(` ${s.id}.md → `)+te.bold.magenta(s.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},pn=async()=>{await ue.mkdir(pe,{recursive:!0}),await ue.mkdir(me,{recursive:!0})};let $e={settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Je=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:K};try{oe()&&console.log(`Reading config at ${de}`);const r=await ue.readFile(de,"utf8"),n={...e,...JSON.parse(r)},t=n?.settings?.thinkingVerbs;t?.punctuation&&(t.format="{}"+t.punctuation,delete t.punctuation),n.settings.inputBox||(n.settings.inputBox=K.inputBox);for(const s of K.themes){const a=n?.settings?.themes.find(d=>d.id===s.id||d.name===s.name);if(a){for(const[d,h]of Object.entries(s))d!=="colors"&&!Object.hasOwn(a,d)&&(a[d]=h);a.colors||(a.colors={});for(const[d,h]of Object.entries(s.colors))Object.hasOwn(a.colors,d)||(a.colors[d]=h)}}for(const s of n?.settings?.themes||[]){if(K.themes.some(h=>h.id===s.id||h.name===s.name))continue;const d=K.themes[0];s.colors||(s.colors={});for(const[h,c]of Object.entries(d.colors))Object.hasOwn(s.colors,h)||(s.colors[h]=c)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||K,n.settings.userMessageDisplay=K.userMessageDisplay),await Xn(me)&&(n.changesApplied=!1),$e=n,n}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return e;throw r}},Ee=async e=>(oe()&&console.log(`Updating config at ${de}`),e($e),$e.lastModified=new Date().toISOString(),await cr($e),$e),cr=async e=>{try{e.lastModified=new Date().toISOString(),await pn(),await ue.writeFile(de,JSON.stringify(e,null,2))}catch(r){throw console.error("Error saving config:",r),r}},wn=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const r=await ue.readFile(_e);return await In(e.cliPath,r,"restore"),await Jn(),await Ee(n=>{n.changesApplied=!1}),!0},dr=async e=>{e.ccInstallationDir&&Qe.unshift(e.ccInstallationDir);for(const r of Qe)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${r}`);const n=Ze.join(r,"cli.js");if(!await xn(n))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${r}; checking hash...`),console.log(`SHA256 hash: ${await et(n)}`));const t=Ze.join(r,"package.json");let i;try{i=JSON.parse(await ue.readFile(t,"utf8"))}catch(s){if(!(s instanceof Error&&"code"in s&&s.code==="ENOENT"))throw s}return{cliPath:n,packageJsonPath:t,version:i?.version}}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")continue;throw n}return null},on=async e=>{await pn(),oe()&&console.log(`Backing up cli.js to ${_e}`),await ue.copyFile(e.cliPath,_e),await Ee(r=>{r.changesApplied=!1,r.ccVersion=e.version})};async function xn(e){try{return await ue.stat(e),!0}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return!1;throw r}}async function sn(){const e=await Je(),r=await dr(e);if(!r)return null;if(r.version){const s=await tr(r.version);ar(s)}const n=r.version,t=e.ccVersion;let i=!1;return await xn(_e)||(oe()&&console.log(`startupCheck: ${_e} not found; backing up cli.js`),await on(r),i=!0),n!==t?(i||(oe()&&console.log(`startupCheck: real version (${n}) != backed up version (${t}); backing up cli.js`),await ue.unlink(_e),await on(r)),{wasUpdated:!0,oldVersion:t,newVersion:n,ccInstInfo:r}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:r}}const gr=e=>{const r=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let t;for(;(t=n.exec(e))!==null;){const i=t.index+t[0].indexOf("=")+1;r.push({startIndex:i,endIndex:i+t[1].length})}return r},hr=(e,r)=>{const n=gr(e);if(n.length===0)return null;const t=n.sort((s,a)=>a.startIndex-s.startIndex);let i=e;for(const s of t){const a=r.toString(),d=i.slice(0,s.startIndex)+a+i.slice(s.endIndex);Z(i,d,a,s.startIndex,s.endIndex),i=d}return i};function ur(e){const r=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(r);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const t=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,s=e.match(t),a=e.match(i);return!s||s.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!a||a.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:s.index,endIndex:s.index+s[0].length},obj:{startIndex:a.index,endIndex:a.index+a[0].length}}}const mr=(e,r)=>{const n=ur(e);if(!n)return null;if(r.length===0)return e;let t=e;const i="return"+JSON.stringify(Object.fromEntries(r.map(d=>[d.id,d.name])));t=t.slice(0,n.obj.startIndex)+i+t.slice(n.obj.endIndex),Z(e,t,i,n.obj.startIndex,n.obj.endIndex),e=t;const s=JSON.stringify(r.map(d=>({label:d.name,value:d.id})));t=t.slice(0,n.objArr.startIndex)+s+t.slice(n.objArr.endIndex),Z(e,t,s,n.objArr.startIndex,n.objArr.endIndex),e=t;let a=`switch(${n.switchStatement.identifiers?.[0]}){
177
- `;return r.forEach(d=>{a+=`case"${d.id}":return${JSON.stringify(d.colors)};
178
- `}),a+=`default:return${JSON.stringify(r[0].colors)};
179
- }`,t=t.slice(0,n.switchStatement.startIndex)+a+t.slice(n.switchStatement.endIndex),Z(e,t,a,n.switchStatement.startIndex,n.switchStatement.endIndex),t},fr=e=>{const r=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(r);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},br=e=>{const r=fr(e);if(!r)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",t=e.slice(0,r)+n+e.slice(r);return Z(e,t,n,r,r),t},pr=e=>{const r=e.indexOf('bash:"bashBorder"');if(r===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(r,r+500),t=/borderStyle:"[^"]*"/,i=n.match(t);return!i||i.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:r+i.index,endIndex:r+i.index+i[0].length}},wr=(e,r)=>{const n=pr(e);if(!n)return null;if(r){const t="borderColor:undefined",i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i}else return e};function xr(e){const r=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
176
+ </html>`,F=ie.join(me,`${e}.diff.html`);return await ne.writeFile(F,N,"utf-8"),F},tn=async e=>{const t={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await Zr(e.id)){const i=tr(e);return await Ye(e.id,i),t.action="created",t}const n=await Qr(e.id);if(t.oldVersion=n.ccVersion,await en(e.id,e.identifierMap),n.ccVersion&&e.version){const i=qr(n.ccVersion,e.version);if(i===0)return t.action="skipped",t;if(i!=0){const s=await zr(e.id,n.ccVersion),a=Ee(n.content);if(!s||s!==a){t.action="conflict";let h=n.content;try{const v=(await ze(n.ccVersion)).prompts.find(C=>C.id===e.id);v&&(h=Oe(v.pieces,v.identifiers,v.identifierMap))}catch{console.log(X.yellow(`Warning: Could not fetch old version ${n.ccVersion} for comparison. Using current file as baseline.`))}const d=Oe(e.pieces,e.identifiers,e.identifierMap),m=Me(e.id),f=await nn(e.id,e.name,h,n.content,d,n.ccVersion,e.version,m);t.diffHtmlPath=f}else{const h=tr(e);await Ye(e.id,h),t.action="updated"}}}return t},on=async e=>{const t={ccVersion:e,results:[]},r=await ze(e);await Wr(r),await ne.mkdir(me,{recursive:!0});for(const n of r.prompts)try{const i=await tn(n);t.results.push(i)}catch(i){throw console.log(X.red(`Failed to sync prompt ${n.id}:`)),i}return t};let Te=null,We=null;const ir=async e=>{try{return Te=await ze(e),We=e,{success:!0}}catch(t){return Te=null,We=null,t instanceof Error?{success:!1,errorMessage:t.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},sn=(e,t)=>{let r="";for(let n=0;n<e.length;n++){const s=e[n].replace(/<<CCVERSION>>/g,t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r+=s,n<e.length-1&&(r+="([\\w$]+)")}return r},ln=(e,t,r,n,i)=>{const s={};for(let h=0;h<n.length;h++){const d=n[h],m=String(t[h]),f=r[m];f&&(s[f]=d)}let a=e;const c=Object.entries(s).sort((h,d)=>d[0].length-h[0].length);for(const[h,d]of c){const m=new RegExp(`\\b${h}\\b`,"g");a=a.replace(m,d)}return a=a.replace(/<<CCVERSION>>/g,i),a},an=async e=>{if(!Te||We!==e)return[];const t=Te,r=[];for(const n of t.prompts){const i=sn(n.pieces,e),s=ie.join(me,`${n.id}.md`);let a;try{a=await ne.readFile(s,"utf8")}catch(d){console.error(`Failed to read markdown file ${s}:`,d);continue}const c=pr(a),h=d=>{const m=d.slice(1);return ln(c.content,n.identifiers,n.identifierMap,m,e)};r.push({promptId:n.id,prompt:c,regex:i,getInterpolatedContent:h})}return r},cn=e=>{const t=e.results.filter(s=>s.action==="created"),r=e.results.filter(s=>s.action==="updated"),n=e.results.filter(s=>s.action==="conflict"),i=e.results.filter(s=>s.action==="skipped");if((t.length>0||r.length>0||n.length>0)&&i.length>0&&(console.log(X.dim(`Skipped ${i.length} up-to-date file(s)`)),console.log()),t.length>0){console.log(X.bold.green(`Created ${t.length} new prompt file(s):`));for(const s of t)console.log(X.green(` ${me}/${s.id}.md`)),console.log(X.green.dim(` ${s.description}`));console.log()}if(r.length>0){console.log(X.bold.blue(`Updated ${r.length} system prompt file(s):`));for(const s of r)s.oldVersion?console.log(X.blue(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)):console.log(X.blue(` ${s.id}.md (→ ${s.newVersion})`));console.log()}if(n.length>0){console.log(X.bold.yellow(`WARNING: Conflicts detected for ${n.length} system prompt file(s)`));for(const s of n)console.log(X.yellow(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)),console.log(X.yellow(` Open the diff in your browser: ${s.diffHtmlPath}`));console.log()}if(t.length>0&&(console.log(X.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(X.green(`You can now customize the markdown files at ${me} in a text editor.`)),console.log(X.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),n.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(X.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const s of n)console.log(X.yellow(` ${s.id}.md → `)+X.bold.magenta(s.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},wr=async()=>{await ue.mkdir(pe,{recursive:!0}),await ue.mkdir(me,{recursive:!0})};let $e={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Xe=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};try{oe()&&console.log(`Reading config at ${de}`);const t=await ue.readFile(de,"utf8"),r={...e,...JSON.parse(t)},n=r?.settings?.thinkingVerbs;n?.punctuation&&(n.format="{}"+n.punctuation,delete n.punctuation),r.settings.inputBox||(r.settings.inputBox=q.inputBox);for(const s of q.themes){const a=r?.settings?.themes.find(c=>c.id===s.id||c.name===s.name);if(a){for(const[c,h]of Object.entries(s))c!=="colors"&&!Object.hasOwn(a,c)&&(a[c]=h);a.colors||(a.colors={});for(const[c,h]of Object.entries(s.colors))Object.hasOwn(a.colors,c)||(a.colors[c]=h)}}for(const s of r?.settings?.themes||[]){if(q.themes.some(h=>h.id===s.id||h.name===s.name))continue;const c=q.themes[0];s.colors||(s.colors={});for(const[h,d]of Object.entries(c.colors))Object.hasOwn(s.colors,h)||(s.colors[h]=d)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||q,r.settings.userMessageDisplay=q.userMessageDisplay),await Kr(me)&&(r.changesApplied=!1),$e=r,r}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},Ae=async e=>(oe()&&console.log(`Updating config at ${de}`),e($e),$e.lastModified=new Date().toISOString(),await dn($e),$e),dn=async e=>{try{e.lastModified=new Date().toISOString(),await wr(),await ue.writeFile(de,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},xr=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await ue.readFile(ye);return await Cr(e.cliPath,t,"restore"),await Xr(),await Ae(r=>{r.changesApplied=!1}),!0},gn=async e=>{e.ccInstallationDir&&rr.unshift(e.ccInstallationDir);for(const t of rr)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const r=Qe.join(t,"cli.js");if(!await _r(r))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await rt(r)}`));const n=Qe.join(t,"package.json");let i;try{i=JSON.parse(await ue.readFile(n,"utf8"))}catch(s){if(!(s instanceof Error&&"code"in s&&s.code==="ENOENT"))throw s}return{cliPath:r,packageJsonPath:n,version:i?.version}}catch(r){if(r instanceof Error&&"code"in r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))continue;throw r}return null},sr=async e=>{await wr(),oe()&&console.log(`Backing up cli.js to ${ye}`),await ue.copyFile(e.cliPath,ye),await Ae(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function _r(e){try{return await ue.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return!1;throw t}}async function lr(){const e=await Xe(),t=await gn(e);if(!t)return null;if(t.version)try{const s=await on(t.version);cn(s)}catch{}const r=t.version,n=e.ccVersion;let i=!1;return await _r(ye)||(oe()&&console.log(`startupCheck: ${ye} not found; backing up cli.js`),await sr(t),i=!0),r!==n?(i||(oe()&&console.log(`startupCheck: real version (${r}) != backed up version (${n}); backing up cli.js`),await ue.unlink(ye),await sr(t)),{wasUpdated:!0,oldVersion:n,newVersion:r,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const hn=e=>{const t=[],r=/visibleOptionCount:[\w$]+=(\d+)/g;let n;for(;(n=r.exec(e))!==null;){const i=n.index+n[0].indexOf("=")+1;t.push({startIndex:i,endIndex:i+n[1].length})}return t},un=(e,t)=>{const r=hn(e);if(r.length===0)return null;const n=r.sort((s,a)=>a.startIndex-s.startIndex);let i=e;for(const s of n){const a=t.toString(),c=i.slice(0,s.startIndex)+a+i.slice(s.endIndex);Q(i,c,a,s.startIndex,s.endIndex),i=c}return i};function mn(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,r=e.match(t);if(!r||r.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const n=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,s=e.match(n),a=e.match(i);return!s||s.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!a||a.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1].trim()]},objArr:{startIndex:s.index,endIndex:s.index+s[0].length},obj:{startIndex:a.index,endIndex:a.index+a[0].length}}}const fn=(e,t)=>{const r=mn(e);if(!r)return null;if(t.length===0)return e;let n=e;const i="return"+JSON.stringify(Object.fromEntries(t.map(c=>[c.id,c.name])));n=n.slice(0,r.obj.startIndex)+i+n.slice(r.obj.endIndex),Q(e,n,i,r.obj.startIndex,r.obj.endIndex),e=n;const s=JSON.stringify(t.map(c=>({label:c.name,value:c.id})));n=n.slice(0,r.objArr.startIndex)+s+n.slice(r.objArr.endIndex),Q(e,n,s,r.objArr.startIndex,r.objArr.endIndex),e=n;let a=`switch(${r.switchStatement.identifiers?.[0]}){
177
+ `;return t.forEach(c=>{a+=`case"${c.id}":return${JSON.stringify(c.colors)};
178
+ `}),a+=`default:return${JSON.stringify(t[0].colors)};
179
+ }`,n=n.slice(0,r.switchStatement.startIndex)+a+n.slice(r.switchStatement.endIndex),Q(e,n,a,r.switchStatement.startIndex,r.switchStatement.endIndex),n},bn=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(t);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):r.index+r[0].indexOf("{")+1},pn=e=>{const t=bn(e);if(!t)return null;const r="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",n=e.slice(0,t)+r+e.slice(t);return Q(e,n,r,t,t),n},wn=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const r=e.slice(t,t+500),n=/borderStyle:"[^"]*"/,i=r.match(n);return!i||i.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+i.index,endIndex:t+i.index+i[0].length}},xn=(e,t)=>{const r=wn(e);if(!r)return null;if(t){const n="borderColor:undefined",i=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Q(e,i,n,r.startIndex,r.endIndex),i}else return e};function _n(e){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
180
180
  ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
181
181
  ██║ ██║ ███████║██║ ██║██║ ██║█████╗
182
182
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -187,23 +187,27 @@ ${$} </div>
187
187
  ██║ ██║ ██║██║ ██║█████╗
188
188
  ██║ ██║ ██║██║ ██║██╔══╝
189
189
  ╚██████╗╚██████╔╝██████╔╝███████╗
190
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(r);return n!==-1?{startIndex:n-1,endIndex:n+r.length+1}:null}function Sr(e,r){const n=xr(e);if(!n)return e;const t=JSON.stringify(r),i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i}const yr=e=>{const r=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const t=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,i=n[0].match(t);if(!i||i.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const s=n.index+i.index,a=s+i[0].length;return{startIndex:s,endIndex:a}},_r=e=>{const r=yr(e);if(!r)return null;const n=e.slice(0,r.startIndex)+e.slice(r.endIndex);return Z(e,n,"",r.startIndex,r.endIndex),n},vr=e=>{const r=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const t=e.slice(n.index,n.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,s=t.match(i);return!s||s.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+s.index+s[1].length,endIndex:n.index+s.index+s[1].length+s[2].length,identifiers:[s[3]]}},Ir=(e,r)=>{const n=vr(e);if(!n)return null;const t=n,i=r.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),s=t.identifiers?.[0],d=`=${"`"+i.replace(/\{\}/g,"${"+s+"}")+"`"}`,h=e.slice(0,t.startIndex)+d+e.slice(t.endIndex);return Z(e,h,d,t.startIndex,t.endIndex),h},Cr=e=>{const r=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},$r=(e,r)=>{const n=Cr(e);if(!n)return null;const t=n.identifiers?.[0],i=r?`=[...${t},...[...${t}].reverse()]`:`=[...${t}]`,s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return Z(e,s,i,n.startIndex,n.endIndex),s},Mr=e=>{const r=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let t;for(;(t=n.exec(e))!==null;)r.push({startIndex:t.index,endIndex:t.index+t[0].length});return r},Nr=(e,r)=>{const n=Mr(e);if(n.length===0)return null;const t=JSON.stringify(r),i=n.sort((a,d)=>d.startIndex-a.startIndex);let s=e;for(let a=0;a<i.length;a++){const d=s.slice(0,i[a].startIndex)+t+s.slice(i[a].endIndex);Z(s,d,t,i[a].startIndex,i[a].endIndex),s=d}return s},Br=e=>{const r=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const t=n[0],i=n[1],s=t.lastIndexOf(i),a=n.index+s,d=a+i.length;return{startIndex:a,endIndex:d}},kr=(e,r)=>{const n=Br(e);if(!n)return null;const t=JSON.stringify(r),i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i},Or=e=>{const r=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length}},Tr=(e,r)=>{const n=Or(e);if(!n)return null;const t=`{flexWrap:"wrap",height:1,width:${r}}`,i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i},Er=e=>{const r=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Ar=e=>{const r=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Dr=(e,r)=>{const n=Er(e);if(!n)return null;const t=n,i=t.identifiers?.[0],s=`${i}=${JSON.stringify({words:r})}`,a=e.slice(0,t.startIndex)+s+e.slice(t.endIndex);Z(e,a,s,t.startIndex,t.endIndex);const d=Ar(a);if(!d)return null;const h=d,m=`function ${h.identifiers?.[0]}(){return ${i}.words}`,f=a.slice(0,h.startIndex)+m+a.slice(h.endIndex);return Z(a,f,m,h.startIndex,h.endIndex),f},Lr=e=>{const r=e.indexOf("No content found in user prompt message")-700;if(r===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,r+700),t=e.slice(r,n),i=/("> "),([$\w]+)/,s=t.match(i);if(!s)return{prefixLocation:null,messageLocation:null};const a=r+t.indexOf(s[1]),d=a+s[1].length,h=d+1,c=h+s[2].length;return{prefixLocation:{startIndex:a,endIndex:d},messageLocation:{startIndex:h,endIndex:c}}},Pr=(e,r,n,t,i=!1,s=!1,a=!1,d=!1,h=!1,c,m,f=!1,S=!1,I=!1,C=!1,$=!1)=>{const M=Lr(e);if(!M)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!M.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!M.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const F=Sn(e);if(!F)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const B=[],Y=n==="rgb(0,0,0)"&&t==="rgb(0,0,0)",V=!Y||(i||s||a||d||h),ne=c==="rgb(0,0,0)"&&m==="rgb(0,0,0)",q=!ne||(f||S||I||C||$);if(V){const N=an(F,Y?null:n.match(/\d+/g)?.join(",")||null,Y?null:t.match(/\d+/g)?.join(",")||null,i,s,a,d,h);B.push({startIndex:M.prefixLocation.startIndex,endIndex:M.prefixLocation.endIndex,newContent:`${N}("${r}")+" "`})}if(q){const N=an(F,ne?null:c.match(/\d+/g)?.join(",")||null,ne?null:m.match(/\d+/g)?.join(",")||null,f,S,I,C,$);B.push({startIndex:M.messageLocation.startIndex,endIndex:M.messageLocation.endIndex,newContent:e.slice(M.messageLocation.startIndex,M.messageLocation.endIndex).replace(/([$\w]+)/,`${N}($1)`)})}B.sort((N,v)=>v.startIndex-N.startIndex);let A=e;for(const N of B){const v=A;A=A.slice(0,N.startIndex)+N.newContent+A.slice(N.endIndex),Z(v,A,N.newContent,N.startIndex,N.endIndex)}return A},Rr=e=>{const r=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const t=n[0],i=/verbose:[^,}]+/,s=t.match(i);if(!s||s.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const a=n.index+s.index,d=a+s[0].length;return{startIndex:a,endIndex:d}},Fr=e=>{const r=Rr(e);if(!r)return null;const n="verbose:true",t=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Z(e,t,n,r.startIndex,r.endIndex),t},Vr=e=>{const n=e.indexOf("subscription, no need to monitor cost");if(n===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const t=Math.max(0,n-60),i=n,s=e.slice(t,i),a=/if\(([$\w]+)\(\)\)/g;let d=null;for(const m of s.matchAll(a))d=m;if(!d||d.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const h=t+d.index,c=h+d[0].length;return{startIndex:h,endIndex:c}},jr=e=>{const r=Vr(e);if(!r)return null;const n="if(!1)",t=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Z(e,t,n,r.startIndex,r.endIndex),t},Ur=e=>{const r=/\}\.VERSION\} \(Claude Code\)/,n=e.match(r);if(!n||n.index===void 0)return null;const t=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,i=e.match(t);if(!i||i.index===void 0)return null;const s=i.index+i[0].length;return{versionLocation:{startIndex:n.index,endIndex:n.index+n[0].length},sessionIdLocation:{startIndex:s,endIndex:s,identifiers:[i[1],i[2],i[3]]}}},Hr=(e,r)=>{const n=Ur(e);if(!n)return null;const{versionLocation:t,sessionIdLocation:i}=n,a=`${e.slice(t.startIndex,t.endIndex)}\\n${r} (tweakcc)`,d=e.slice(0,t.startIndex)+a+e.slice(t.endIndex);Z(e,d,a,t.startIndex,t.endIndex);const[h,c,m]=i.identifiers,f=Sn(e);if(!f)return console.error("patch: versionOutput: failed to find chalk variable"),null;const S=`,${h}.createElement(${c},null,${h}.createElement(${m},{dimColor:!0}," L "),${h}.createElement(${m},null,${f}.rgb(235, 109, 13).bold("tweakcc: v${r}")))`,I=e.slice(0,i.startIndex)+S+e.slice(i.endIndex);return Z(e,I,S,i.startIndex,i.endIndex),I},Gr=async(e,r)=>{const n=await lr(r);oe()&&console.log(`Loaded ${n.length} system prompts with regexes`);for(const{promptId:t,prompt:i,regex:s,getInterpolatedContent:a}of n){const d=new RegExp(s,"s"),h=e.match(d);if(h&&h.index!==void 0){const c=a(h);oe()&&(console.log(`
191
- Found match for prompt: ${i.name}`),console.log(` Match location: index ${h.index}, length ${h[0].length}`),console.log(` Original content (first 100 chars): ${h[0].substring(0,100)}...`),console.log(` Replacement content (first 100 chars): ${c.substring(0,100)}...`),console.log(` Captured variables: ${h.slice(1).join(", ")}`),console.log(` Content identical: ${h[0]===c}`));const m=e,f=h.index,S=h[0].length;e=e.replace(d,c);const I=Te(i.content);await zn(t,I),oe()&&Z(m,e,c,f,f+S)}else if(console.log(te.yellow(`Could not find system prompt "${i.name}" in cli.js (using regex /${s}/)`)),oe()){console.log(`
192
- Debug info for ${i.name}:`),console.log(` Regex pattern (first 200 chars): ${s.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const c=e.match(new RegExp(s.substring(0,100)));console.log(` Partial match result: ${c?"found partial":"no match"}`)}}return e},Z=(e,r,n,t,i)=>{const s=Math.max(0,t-20),a=Math.min(e.length,i+20),d=Math.min(r.length,t+n.length+20),h=e.slice(s,t),c=e.slice(t,i),m=e.slice(i,a),f=r.slice(s,t),S=r.slice(t,t+n.length),I=r.slice(t+n.length,d);oe()&&c!==S&&(console.log(`
193
- --- Diff ---`),console.log("OLD:",h+`\x1B[31m${c}\x1B[0m`+m),console.log("NEW:",f+`\x1B[32m${S}\x1B[0m`+I),console.log(`--- End Diff ---
194
- `))},Sn=e=>{const r=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(r)),t={};for(const a of n){const d=a[1];t[d]=(t[d]||0)+1}let i,s=0;for(const[a,d]of Object.entries(t))d>s&&(s=d,i=a);return i},yn=async(e,r)=>{await wn(r);let n=await re.readFile(r.cliPath,{encoding:"utf8"});n=await Gr(n,r.version);let t=null;if(e.settings.themes&&e.settings.themes.length>0&&(t=mr(n,e.settings.themes))&&(n=t),e.settings.launchText){const i=e.settings.launchText;let s="";i.method==="custom"&&i.customText?s=i.customText:i.method==="figlet"&&i.figletText&&(s=await new Promise(a=>He.text(i.figletText.replace(`
195
- `," "),i.figletFont,(d,h)=>{d?(console.error("patch: figlet: failed to generate text",d),a("")):a(h||"")}))),(t=Sr(n,s))&&(n=t)}return e.settings.thinkingVerbs&&((t=Dr(n,e.settings.thinkingVerbs.verbs))&&(n=t),(t=Ir(n,e.settings.thinkingVerbs.format))&&(n=t)),(t=Nr(n,e.settings.thinkingStyle.phases))&&(n=t),(t=kr(n,e.settings.thinkingStyle.updateInterval))&&(n=t),(t=Tr(n,Math.max(...e.settings.thinkingStyle.phases.map(i=>i.length))+1))&&(n=t),(t=$r(n,e.settings.thinkingStyle.reverseMirror))&&(n=t),e.settings.userMessageDisplay&&(t=Pr(n,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(n=t),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(t=wr(n,e.settings.inputBox.removeBorder))&&(n=t),(t=Fr(n))&&(n=t),(t=_r(n))&&(n=t),(t=br(n))&&(n=t),(t=Xr(n))&&(n=t),(t=hr(n,25))&&(n=t),(t=jr(n))&&(n=t),(t=Hr(n,"2.0.1"))&&(n=t),await In(r.cliPath,n,"patch"),await Ee(i=>{i.changesApplied=!0})},Ae=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],Yr=e=>{const r=e.indexOf("Switch between Claude models");if(r===-1)return null;const n=Math.max(0,r-600),t=r,s=e.slice(n,t).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!s||s.index===void 0)return null;let d=n+s.index;for(;d<e.length&&e[d]!==";";)d++;if(d>=e.length)return null;const h=d+1,c=s[1];return{insertionIndex:h,optionsVar:c}},Wr=e=>{const r=Yr(e);if(!r)return null;const{insertionIndex:n,optionsVar:t}=r,i=Ae.map(a=>{const d=JSON.stringify(a.label),h=JSON.stringify(a.slug);return`${t}.push({value:${h},label:${d}});`}).join(""),s=e.slice(0,n)+i+e.slice(n);return Z(e,s,i,n,n),s},zr=e=>{const r=e.match(/"sonnet\[1m\]"/);if(!r||r.index===void 0)return null;let t=r.index;for(;t>=0&&e[t]!=="[";)t--;if(t<0)return null;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0||e[i]!=="=")return null;let s=t,a=0,d=-1;for(;s<e.length;){const C=e[s];if(C==="["&&a++,C==="]"&&(a--,a===0)){d=s;break}s++}if(d===-1)return null;const h=e.slice(t,d+1);let c;try{c=JSON.parse(h)}catch{return null}const m=Ae.map(C=>C.slug),f=new Set(c);for(const C of m)f.add(C);const S=JSON.stringify(Array.from(f)),I=e.slice(0,t)+S+e.slice(d+1);return Z(e,I,S,t,d+1),I},Jr=e=>{const n=e.indexOf('case"sonnet[1m]"');if(n===-1)return null;let t=n;for(;t>=0&&e[t]!=="{";)t--;if(t<0)return null;let i=n;for(;i<e.length&&e[i]!=="}";)i++;if(i>=e.length)return null;const s=e.slice(t,i+1),a=Ae.map(S=>`case${JSON.stringify(S.slug)}:return${JSON.stringify(S.internal)};`).join(""),d=s.slice(0,-1),c=(/;\s*$/.test(d)?"":";")+a,m=d+c+"}",f=e.slice(0,t)+m+e.slice(i+1);return Z(e,f,a,t+s.length-1,t+s.length-1),f},Xr=e=>{let r=e;const n=zr(r);n&&(r=n);const t=Jr(r);t&&(r=t);const i=Wr(r);return i&&(r=i),r===e?null:r};let _n=!1;const oe=()=>_n,Kr=()=>{_n=!0};function De(){try{const e=se.join(xe.homedir(),".claude.json");return JSON.parse(Me.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function qr(){try{const e=se.join(xe.homedir(),".claude",".credentials.json");switch(JSON.parse(Me.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function Zr(){try{const e=se.join(xe.homedir(),".claude","settings.json"),n=JSON.parse(Me.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const t=Ae.find(i=>i.slug===n);if(t)return t.label}catch{}return"Sonnet 4.5"}function Qr(e){process.platform==="win32"?ye.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?ye.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():ye.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function ln(e){if(process.platform==="win32")ye.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")ye.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const r=se.dirname(e);ye.spawn("xdg-open",[r],{detached:!0,stdio:"ignore"}).unref()}}function Xe(e){if(!e||typeof e!="string")return!1;const r=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(r))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(r)){const n=r.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,t,i,s]=n;return parseInt(t)<=255&&parseInt(i)<=255&&parseInt(s)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(r)){const n=r.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,t,i,s]=n;return parseInt(t)<=360&&parseInt(i)<=100&&parseInt(s)<=100}}return!1}function vn(e){if(!Xe(e))return e;const r=e.trim();if(r.startsWith("rgb("))return r;if(r.startsWith("#")){let n=r.slice(1);n.length===3&&(n=n.split("").map(a=>a+a).join(""));const t=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16);return`rgb(${t},${i},${s})`}if(r.startsWith("hsl(")){const n=r.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const t=parseInt(n[1])/360,i=parseInt(n[2])/100,s=parseInt(n[3])/100,a=(S,I,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<1/6?S+(I-S)*6*C:C<1/2?I:C<2/3?S+(I-S)*(2/3-C)*6:S),d=s<.5?s*(1+i):s+i-s*i,h=2*s-d,c=Math.round(a(h,d,t+1/3)*255),m=Math.round(a(h,d,t)*255),f=Math.round(a(h,d,t-1/3)*255);return`rgb(${c},${m},${f})`}}return e}async function et(e,r="sha256",n=64*1024){return new Promise((t,i)=>{const s=dn.createHash(r),a=Me.createReadStream(e,{highWaterMark:n});a.on("data",d=>{s.update(d)}),a.on("end",()=>{t(s.digest("hex"))}),a.on("error",d=>{i(d)})})}const an=(e,r,n,t,i,s,a,d)=>{let h=e;return r&&(h+=`.rgb(${r})`),n&&n!=="transparent"&&(h+=`.bgRgb(${n})`),t&&(h+=".bold"),i&&(h+=".italic"),s&&(h+=".underline"),a&&(h+=".strikethrough"),d&&(h+=".inverse"),h};async function In(e,r,n="replace"){let t=493;try{t=(await re.stat(e)).mode,oe()&&console.log(`[${n}] Original file mode for ${e}: ${(t&parseInt("777",8)).toString(8)}`)}catch(i){oe()&&console.log(`[${n}] Could not stat ${e} (error: ${i}), using default mode 755`)}try{await re.unlink(e),oe()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(i){oe()&&console.log(`[${n}] Could not unlink ${e}: ${i}`)}await re.writeFile(e,r),await re.chmod(e,t),oe()&&console.log(`[${n}] Restored permissions to ${(t&parseInt("777",8)).toString(8)}`)}function R({color:e,backgroundColor:r,bold:n,dimColor:t,children:i}){const s=e?.startsWith("ansi:"),a=r?.startsWith("ansi:");if(s||a){if(Pe.Children.toArray(i).some(f=>Pe.isValidElement(f)))return o(l,{children:i});let h=te;if(s){const f=e.slice(5);h=h[f]||h}if(a){const f=r.slice(5),S=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;h=h[S]||h}n&&(h=h.bold),t&&(h=h.dim);const m=Pe.Children.toArray(i).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return o(l,{children:h(m)})}return o(l,{color:e,backgroundColor:r,bold:n,dimColor:t,children:i})}function nt({text:e,nonShimmerColors:r,shimmerColors:n,shimmerWidth:t=3,updateDuration:i=50,restartPoint:s=10}){const[a,d]=O(0);return ae(()=>{const h=setInterval(()=>{d(c=>{const m=c+1;return m>=e.length+s?-t:m})},i);return()=>clearInterval(h)},[e.length,s,i]),r.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),o(l,{children:e})):o(l,{children:e.split("").map((h,c)=>{const m=c>=a&&c<a+t&&a<e.length,f=c%r.length,S=m?n[f]:r[f];return o(l,{color:S,children:h},c)})})}const rt=En.cwd();function Cn({theme:e}){const{ccVersion:r}=be(he);return g(u,{flexDirection:"column",paddingLeft:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,children:["Preview: ",e.name]})}),o(u,{borderStyle:"single",borderColor:"gray",paddingX:1,children:g(u,{flexDirection:"column",children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(R,{color:e.colors.clawd_body,children:" ▐"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),g(l,{children:[o(R,{color:e.colors.clawd_body,children:"▌ "})," ",o(l,{bold:!0,children:"Claude Code"})," ",r?`v${r}`:"v2.0.14"]})]}),g(l,{children:[o(R,{color:e.colors.clawd_body,children:"▝▜"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),o(R,{color:e.colors.clawd_body,children:"▛▘"})," ",Zr()," · ",qr()]}),g(R,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",rt]}),g(l,{children:[g(R,{color:e.colors.success,children:["Login successful. Press"," "]}),o(R,{bold:!0,color:e.colors.success,children:"Enter"}),g(R,{color:e.colors.success,children:[" ","to continue…"]})]})]}),o(l,{children:"╭─────────────────────────────────────────────╮"}),g(l,{children:["│ 1 function greet() ","{"," ","│"]}),g(l,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),o(R,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),o(R,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),g(l,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),o(R,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),o(R,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),o(R,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),g(R,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),g(l,{children:[o(R,{color:e.colors.warning,children:"│ "}),o(l,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),g(R,{color:e.colors.warning,children:[" ","│"]})]}),o(R,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),g(l,{children:[o(R,{color:e.colors.bashBorder,children:"!"}),o(l,{children:" ls"})]}),o(R,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),o(l,{children:g(l,{children:["> list the dir"," ",o(nt,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),o(R,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(R,{color:e.colors.planMode,children:"│ "}),g(R,{color:e.colors.permission,children:["Ready to code?"," "]}),o(l,{children:"Here is Claude's plan:"}),g(R,{color:e.colors.planMode,children:[" ","│"]})]}),o(R,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(R,{color:e.colors.permission,children:"│ "}),o(l,{bold:!0,children:"Permissions:"})," ",g(R,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(R,{color:e.colors.permission,children:"│"})]}),o(l,{children:"> list the dir"}),g(l,{children:[o(R,{color:e.colors.error,children:"●"}),o(l,{children:" Update(__init__.py)"})]}),g(l,{children:[o(l,{children:" ⎿ "}),o(R,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),g(l,{children:[" ","1"," ",g(R,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),o(R,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),g(l,{children:[" ","2"," ",g(R,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),o(R,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),g(l,{children:[o(R,{color:e.colors.success,children:"●"}),o(l,{children:" List(.)"})]}),g(l,{children:[o(l,{children:"●"}),o(l,{children:" The directory "}),o(R,{color:e.colors.permission,children:"C:\\Users\\user"}),g(l,{children:[" ","contains ",o(l,{bold:!0,children:"123"})," files."]})]}),g(l,{children:[o(R,{color:e.colors.claude,children:"✻ Th"}),o(R,{color:e.colors.claudeShimmer,children:"ink"}),o(R,{color:e.colors.claude,children:"ing… "}),o(l,{children:"(esc to interrupt)"})]}),o(l,{children:o(R,{color:e.colors.autoAccept,children:"⏵⏵ auto-accept edits on (shift+tab to cycle)"})}),o(l,{children:o(R,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),o(l,{children:o(R,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Fe({colorKey:e,theme:r,bold:n=!1}){const t=r.colors[e];return e==="inverseText"?o(R,{color:t,backgroundColor:r.colors.permission,bold:n,children:e}):e.startsWith("diff")?o(R,{backgroundColor:t,bold:n,color:r.colors.text,children:e}):o(R,{color:t,bold:n,children:e})}function $n({initialValue:e,onColorChange:r,onExit:n,colorKey:t,theme:i}){const s=je(e)||{h:0,s:50,l:50},a=Ve(e)||{r:128,g:128,b:128},[d,h]=O(s),[c,m]=O(a),[f,S]=O("hsl"),[I,C]=O("h"),[$,M]=O(!1),[F,B]=O(!1);ae(()=>{const x=je(e),w=Ve(e);x&&w&&(M(!0),h(x),m(w),M(!1))},[e]),ae(()=>{if(!$&&F){const x=`rgb(${c.r},${c.g},${c.b})`;r(x)}},[d,c,$,F]),ae(()=>{B(!0)},[]);const Y=x=>{if(Xe(x)){const w=vn(x),p=je(w),k=Ve(w);p&&k&&(M(!0),h(p),m(k),M(!1))}};ge((x,w)=>{if(x.length>1&&!w.ctrl&&!w.meta){Y(x);return}if(w.return)n();else if(w.escape)n();else if(w.ctrl&&x==="a")S(p=>p==="hsl"?"rgb":"hsl"),C(p=>f==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(w.upArrow)C(f==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(w.downArrow||w.tab)C(f==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(w.leftArrow){const p=w.shift||w.ctrl||w.meta?-10:-1;j(p)}else if(w.rightArrow){const p=w.shift||w.ctrl||w.meta?10:1;j(p)}});const j=x=>{M(!0),f==="hsl"?h(w=>{const p={...w};I==="h"?p.h=Math.max(0,Math.min(359,w.h+x)):I==="s"?p.s=Math.max(0,Math.min(100,w.s+x)):I==="l"&&(p.l=Math.max(0,Math.min(100,w.l+x)));const[k,b,y]=ne(p.h,p.s,p.l);return m({r:k,g:b,b:y}),p}):m(w=>{const p={...w};I==="r"?p.r=Math.max(0,Math.min(255,w.r+x)):I==="g"?p.g=Math.max(0,Math.min(255,w.g+x)):I==="b"&&(p.b=Math.max(0,Math.min(255,w.b+x)));const k=V(p.r,p.g,p.b);return h(k),p}),M(!1)},V=(x,w,p)=>{const k=x/255,b=w/255,y=p/255,T=Math.max(k,b,y),_=Math.min(k,b,y),L=T-_,ee=(T+_)/2;let le=0;L!==0&&(le=ee>.5?L/(2-T-_):L/(T+_));let ie=0;return L!==0&&(T===k?ie=((b-y)/L+(b<y?6:0))/6:T===b?ie=((y-k)/L+2)/6:ie=((k-b)/L+4)/6),{h:Math.round(ie*360),s:Math.round(le*100),l:Math.round(ee*100)}},ne=(x,w,p)=>{x/=360,w/=100,p/=100;const k=(1-Math.abs(2*p-1))*w,b=k*(1-Math.abs(x*6%2-1)),y=p-k/2;let T=0,_=0,L=0;return 0<=x&&x<1/6?(T=k,_=b,L=0):1/6<=x&&x<2/6?(T=b,_=k,L=0):2/6<=x&&x<3/6?(T=0,_=k,L=b):3/6<=x&&x<4/6?(T=0,_=b,L=k):4/6<=x&&x<5/6?(T=b,_=0,L=k):5/6<=x&&x<1&&(T=k,_=0,L=b),[Math.round((T+y)*255),Math.round((_+y)*255),Math.round((L+y)*255)]},z=()=>{const x=[],w=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let p=0;p<40;p++){const b=p/39*(w.length-1),y=Math.floor(b),T=Math.ceil(b),_=b-y,[L,ee,le]=w[y],[ie,P,E]=w[T],D=Math.round(L+(ie-L)*_),X=Math.round(ee+(P-ee)*_),W=Math.round(le+(E-le)*_);x.push(o(l,{backgroundColor:`rgb(${D},${X},${W})`,children:" "},p))}return x},q=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,y]=ne(d.h,p,d.l);x.push(o(l,{backgroundColor:`rgb(${k},${b},${y})`,children:" "},w))}return x},A=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,y]=ne(d.h,d.s,p);x.push(o(l,{backgroundColor:`rgb(${k},${b},${y})`,children:" "},w))}return x},N=()=>{const[x,w,p]=ne(d.h,d.s,d.l);return`rgb(${x},${w},${p})`},v=(x,w,p)=>{const k=b=>b.toString(16).padStart(2,"0");return`#${k(x)}${k(w)}${k(p)}`},U=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${p},${c.g},${c.b})`,children:" "},w))}return x},H=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${c.r},${p},${c.b})`,children:" "},w))}return x},Q=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${c.r},${c.g},${p})`,children:" "},w))}return x},G=(x,w)=>Math.round(x/w*39);return g(u,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[g(u,{flexDirection:"column",children:[o(l,{bold:!0,children:"Color Picker"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(l,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(l,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(l,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(l,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(l,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="h"?"yellow":"white",children:[I==="h"?"❯ ":" ","Hue (",d.h,"°):"]})}),o(u,{children:z().map((x,w)=>o(Se,{children:w===G(d.h,360)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="s"?"yellow":"white",children:[I==="s"?"❯ ":" ","Saturation (",d.s,"%):"]})}),o(u,{children:q().map((x,w)=>o(Se,{children:w===G(d.s,100)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="l"?"yellow":"white",children:[I==="l"?"❯ ":" ","Lightness (",d.l,"%):"]})}),o(u,{children:A().map((x,w)=>o(Se,{children:w===G(d.l,100)?o(l,{children:"|"}):x},w))})]})]}):g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="r"?"yellow":"white",children:[I==="r"?"❯ ":" ","Red (",c.r,"):"]})}),o(u,{children:U().map((x,w)=>o(Se,{children:w===G(c.r,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="g"?"yellow":"white",children:[I==="g"?"❯ ":" ","Green (",c.g,"):"]})}),o(u,{children:H().map((x,w)=>o(Se,{children:w===G(c.g,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="b"?"yellow":"white",children:[I==="b"?"❯ ":" ","Blue (",c.b,"):"]})}),o(u,{children:Q().map((x,w)=>o(Se,{children:w===G(c.b,255)?o(l,{children:"|"}):x},w))})]})]}),g(u,{marginBottom:1,children:[o(l,{children:"Current: "}),o(l,{backgroundColor:N(),children:" "})]}),g(u,{flexDirection:"row",justifyContent:"space-between",children:[g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"Hex "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:v(c.r,c.g,c.b)}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:v(c.r,c.g,c.b)}):o(l,{color:N(),bold:!0,children:v(c.r,c.g,c.b)})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"RGB "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):o(l,{color:N(),bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"HSL "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`}):o(l,{color:N(),bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`})]})]})]})}function Ve(e){const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r)return{r:parseInt(r[1]),g:parseInt(r[2]),b:parseInt(r[3])};const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const t=n[1];return{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16)}}return null}function je(e){const r=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r)return{h:parseInt(r[1]),s:parseInt(r[2]),l:parseInt(r[3])};const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const i=parseInt(n[1])/255,s=parseInt(n[2])/255,a=parseInt(n[3])/255,d=Math.max(i,s,a),h=Math.min(i,s,a),c=d-h,m=(d+h)/2;let f=0;c!==0&&(f=m>.5?c/(2-d-h):c/(d+h));let S=0;return c!==0&&(d===i?S=((s-a)/c+(s<a?6:0))/6:d===s?S=((a-i)/c+2)/6:S=((i-s)/c+4)/6),{h:Math.round(S*360),s:Math.round(f*100),l:Math.round(m*100)}}const t=e.match(/^#([a-fA-F0-9]{6})$/);if(t){const i=t[1],s=parseInt(i.substr(0,2),16)/255,a=parseInt(i.substr(2,2),16)/255,d=parseInt(i.substr(4,2),16)/255,h=Math.max(s,a,d),c=Math.min(s,a,d),m=h-c,f=(h+c)/2;let S=0;m!==0&&(S=f>.5?m/(2-h-c):m/(h+c));let I=0;return m!==0&&(h===s?I=((a-d)/m+(a<d?6:0))/6:h===a?I=((d-s)/m+2)/6:I=((s-a)/m+4)/6),{h:Math.round(I*360),s:Math.round(S*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function tt({onBack:e,themeId:r}){const{settings:{themes:n},updateSettings:t}=be(he),[i,s]=O(r),a=n.find(A=>A.id===i)||n[0],[d,h]=O("rgb"),[c,m]=O(0),[f,S]=O(null),[I,C]=O(null),[$,M]=O(""),[F,B]=O(""),Y=cn(A=>{t(N=>{const v=N.themes.findIndex(U=>U.id===i);v!==-1&&A(N.themes[v])})},[i,t]),j=A=>{if(c>=2&&Xe(A)){const N=vn(A),v=c-2,U=V[v];Y(H=>{H.colors[U]=N})}};ge((A,N)=>{if(f===null&&I===null){if(A.length>1&&!N.ctrl&&!N.meta){j(A);return}if(N.escape)e();else if(N.ctrl&&A==="a")h(v=>v==="rgb"?"hex":v==="hex"?"hsl":"rgb");else if(N.upArrow)m(v=>Math.max(0,v-1));else if(N.downArrow)m(v=>Math.min(V.length+1,v+1));else if(N.return)if(c===0)C("name"),M(a.name),B(a.name);else if(c===1)C("id"),M(a.id),B(a.id);else{const v=c-2,U=V[v],H=a.colors[U];S(v),M(H),B(H)}}else if(f!==null)N.ctrl&&A==="a"&&h(v=>v==="rgb"?"hex":v==="hex"?"hsl":"rgb");else if(I!==null)if(N.return){if(I==="id"){const v=i;s($),t(U=>{const H=U.themes.findIndex(Q=>Q.id===v);H!==-1&&(U.themes[H].id=$)})}else Y(v=>{v.name=$});C(null),M(""),B("")}else N.escape?(C(null),M(""),B("")):N.backspace||N.delete?M(v=>v.slice(0,-1)):A&&M(v=>v+A)});const V=Object.keys(a.colors),ne=(A,N)=>{const v=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!v)return A;const U=parseInt(v[1]),H=parseInt(v[2]),Q=parseInt(v[3]);switch(N){case"hex":{const G=x=>x.toString(16).padStart(2,"0");return`#${G(U)}${G(H)}${G(Q)}`}case"hsl":{const G=U/255,x=H/255,w=Q/255,p=Math.max(G,x,w),k=Math.min(G,x,w),b=p-k,y=(p+k)/2;let T=0;b!==0&&(T=y>.5?b/(2-p-k):b/(p+k));let _=0;return b!==0&&(p===G?_=((x-w)/b+(x<w?6:0))/6:p===x?_=((w-G)/b+2)/6:_=((G-x)/b+4)/6),`hsl(${Math.round(_*360)}, ${Math.round(T*100)}%, ${Math.round(y*100)}%)`}case"rgb":default:return A}},z=A=>({autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",q=Math.max(...V.map(A=>A.length));return g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{children:g(fe,{children:["Editing theme “",a.name,"” (",a.id,")"]})}),f===null&&I===null?g(ce,{children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(l,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(l,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(l,{dimColor:!0,children:"esc to go back"})]}),c<2?g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(l,{bold:!0,children:c===0?"Theme Name":"Theme ID"}),o(l,{children:c===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:a.colors[V[c-2]],flexDirection:"column",paddingLeft:1,children:[o(Fe,{colorKey:V[c-2],theme:a,bold:!0}),o(l,{children:z(V[c-2])})]}),g(u,{flexDirection:"column",children:[g(u,{children:[o(l,{color:c===0?"yellow":"white",children:c===0?"❯ ":" "}),o(l,{bold:!0,children:"Name: "}),o(l,{children:a.name})]}),g(u,{marginBottom:1,children:[o(l,{color:c===1?"yellow":"white",children:c===1?"❯ ":" "}),o(l,{bold:!0,children:"ID: "}),o(l,{children:a.id})]}),(()=>{if(c<2){const G=V.slice(0,20);return g(ce,{children:[G.map((x,w)=>{const p=w+2;return g(u,{children:[o(l,{color:c===p?"yellow":"white",children:c===p?"❯ ":" "}),o(u,{width:q+2,children:o(l,{children:o(Fe,{colorKey:x,theme:a,bold:!0})})}),o(R,{color:a.colors[x],children:ne(a.colors[x],d)})]},x)}),V.length>20&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-20," more below"]})]})}const N=c-2,v=Math.max(0,N-Math.floor(20/2)),U=Math.min(V.length,v+20),H=Math.max(0,U-20),Q=V.slice(H,U);return g(ce,{children:[H>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",H," more above"]}),Q.map((G,x)=>{const p=H+x+2;return g(u,{children:[o(l,{color:c===p?"yellow":"white",children:c===p?"❯ ":" "}),o(u,{width:q+2,children:o(l,{children:o(Fe,{colorKey:G,theme:a,bold:!0})})}),o(R,{color:a.colors[G],children:ne(a.colors[G],d)})]},G)}),U<V.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-U," more below"]})]})})()]})]}):I?g(u,{flexDirection:"column",marginTop:1,children:[g(l,{children:["Editing ",I==="name"?"theme name":"theme ID",":"]}),o(u,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(l,{children:$})}),o(l,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o($n,{initialValue:F,colorKey:V[f],theme:a,onColorChange:A=>{M(A),Y(N=>{N.colors[V[f]]=A})},onExit:()=>{Y(A=>{A.colors[V[f]]=$}),S(null),M(""),B("")}})]}),o(u,{width:"50%",children:o(Cn,{theme:a})})]})}function ot(e){return e.map(r=>`${r.name} (${r.id})`)}function it({onBack:e}){const{settings:{themes:r},updateSettings:n}=be(he),[t,i]=O(0),[s,a]=O(null),[d,h]=O(!0),c=()=>{const $={colors:{...(r[0]||K.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(M=>{M.themes.push($)}),a($.id),h(!1)},m=C=>{r.length<=1||(n($=>{$.themes=$.themes.filter(M=>M.id!==C)}),t>=r.length-1&&i(Math.max(0,r.length-2)))},f=()=>{n(C=>{C.themes=[...K.themes]}),i(0)};if(ge((C,$)=>{if($.escape)e();else if($.upArrow)i(M=>Math.max(0,M-1));else if($.downArrow)i(M=>Math.min(r.length-1,M+1));else if($.return){const M=r[t];M&&(a(M.id),h(!1))}else if(C==="n")c();else if(C==="d"){const M=r[t];M&&m(M.id)}else $.ctrl&&C==="r"&&f()},{isActive:d}),s)return o(tt,{themeId:s,onBack:()=>{a(null),h(!0)}});const S=ot(r),I=r.find(C=>S[t]?.includes(`(${C.id})`))||r[0];return r.length===0?o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(l,{children:"No themes available!"})]})}):g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"d to delete a theme"}),o(l,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(l,{dimColor:!0,children:"enter to edit theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(u,{flexDirection:"column",children:S.map((C,$)=>g(l,{color:t===$?"yellow":void 0,children:[t===$?"❯ ":" ",C]},$))})]}),o(u,{width:"50%",children:o(Cn,{theme:I})})]})}let Ue=["ANSI Shadow"];function st({onBack:e}){const{stdout:r}=Nn(),n=r?.columns||120,{settings:{launchText:{method:t,figletText:i,figletFont:s,customText:a},themes:d},updateSettings:h}=be(he),c=t==="figlet"?["method","text","font"]:["method","text"],[m,f]=O(0),S=c[m],[I,C]=O(t==="figlet"?0:1),[$,M]=O(Ue),[F,B]=O(Ue),[Y,j]=O(""),[V,ne]=O(!1),[z,q]=O(0),[A,N]=O(""),[v,U]=O(50),[H,Q]=O(!1),[G,x]=O(t==="figlet"?i:a),w=De(),k=(d.find(y=>y.id===w)||d.find(y=>y.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{He.fonts((y,T)=>{if(!y&&T){const _=T.sort();M(_),B(_),Ue=_;const L=_.indexOf(s);q(L>=0?L:_.indexOf("ANSI Shadow")||0)}})},[]),ae(()=>{b()},[t,i,s,a,G,H]);const b=()=>{if(t==="figlet")try{const y=H?G:i,T=He.textSync(y.replace(`
196
- `," "),{font:s}),_=Math.floor(n*.7),ee=T.split(`
197
- `).map(E=>E.length>_?E.substring(0,_-3)+"…":E),le=ee.join(`
198
- `);N(le);const ie=Math.max(...ee.map(E=>E.length)),P=Math.min(75,Math.max(50,Math.ceil(ie/n*100)));U(P+5)}catch{N("Error generating figlet text"),U(50)}else{const y=Math.floor(n*.6),L=(H?G:a).split(`
199
- `).map(P=>P.length>y?P.substring(0,y-3)+"...":P),ee=L.join(`
200
- `);N(ee);const le=Math.max(...L.map(P=>P.length)),ie=Math.min(75,Math.max(50,Math.ceil(le/n*100)));U(ie+5)}};return ae(()=>{if(Y){const y=$.filter(T=>T.toLowerCase().includes(Y.toLowerCase()));B(y),q(0)}else{B($);const y=$.indexOf(s);q(y>=0?y:0)}},[Y,$]),ae(()=>{if(!V){const y=F.indexOf(s);y>=0&&q(y)}},[s,F,V]),ge((y,T)=>{if(H){T.return?(h(t==="figlet"?_=>{_.launchText.figletText=G}:_=>{_.launchText.customText=G}),Q(!1)):T.escape?(x(t==="figlet"?i:a),Q(!1)):T.backspace||T.delete?x(_=>_.slice(0,-1)):y&&x(_=>_+y);return}if(V){if(T.return)F.length>0&&h(_=>{_.launchText.figletFont=F[z]}),ne(!1),j("");else if(T.escape)ne(!1),j("");else if(T.backspace||T.delete)j(_=>_.slice(0,-1));else if(T.upArrow){const _=z>0?z-1:F.length-1;q(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else if(T.downArrow){const _=z<F.length-1?z+1:0;q(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else y&&y.match(/^[a-zA-Z0-9\s\-_]$/)&&j(_=>_+y);return}if(T.escape)e();else if(T.return)S==="text"&&(x(t==="figlet"?i:a),Q(!0));else if(T.tab)T.shift?f(_=>_===0?c.length-1:_-1):f(_=>_===c.length-1?0:_+1);else if(T.upArrow){if(S==="method"){const _=I>0?I-1:1;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&t==="figlet"){const _=z>0?z-1:F.length-1;q(_),h(L=>{L.launchText.figletFont=F[_]})}}else if(T.downArrow){if(S==="method"){const _=I<1?I+1:0;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&t==="figlet"){const _=z<F.length-1?z+1:0;q(_),h(L=>{L.launchText.figletFont=F[_]})}}else y&&S==="font"&&t==="figlet"&&y.match(/^[a-zA-Z0-9]$/)&&(ne(!0),j(y))}),g(u,{children:[g(u,{flexDirection:"column",width:`${100-v}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Setup banner"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to ",S==="text"?"edit text":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{children:g(l,{children:[o(l,{color:S==="method"?"yellow":void 0,children:S==="method"?"❯ ":" "}),o(l,{bold:!0,color:S==="method"?"yellow":void 0,children:"Method"})]})}),S==="method"&&g(l,{dimColor:!0,children:[" ","select one of ",F.length," Figlet fonts or enter your own text"]}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[g(l,{color:I===0?"cyan":"white",children:[I===0?"❯ ":" ","Figlet"]}),g(l,{color:I===1?"cyan":"white",children:[I===1?"❯ ":" ","Custom"]})]})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:S==="text"?"yellow":void 0,children:S==="text"?"❯ ":" "}),o(l,{bold:!0,color:S==="text"?"yellow":void 0,children:"Text"})]}),S==="text"&&(H?g(l,{dimColor:!0,children:[" ","esc to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:H?"yellow":"gray",children:o(l,{children:H?G:t==="figlet"?i:a})})}),t==="figlet"&&g(ce,{children:[o(u,{children:g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:S==="font"?"yellow":void 0,children:S==="font"?"❯ ":" "}),o(l,{bold:!0,color:S==="font"?"yellow":void 0,children:"Font"})]}),S==="font"&&g(l,{dimColor:!0,children:[" ","type to filter"]}),o(l,{children:V&&g(l,{color:"gray",dimColor:!0,children:[" ","(filtering: “",Y,"”)"]})})]})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const T=Math.max(0,z-Math.floor(4)),_=Math.min(F.length,T+8),L=Math.max(0,_-8),ee=F.slice(L,_);return g(ce,{children:[L>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),ee.map((le,ie)=>{const P=L+ie;return g(l,{color:z===P?"cyan":void 0,children:[z===P?"❯ ":" ",le]},le)}),_<F.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-_," more below"]})]})})()})})]})]}),g(u,{width:`${v}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{color:k,children:"╭──────────────────────────╮"}),g(l,{children:[o(l,{color:k,children:"│ ✻"})," Welcome to Claude Code"," ",o(l,{color:k,children:"│"})]}),o(l,{color:k,children:"╰──────────────────────────╯"})]}),A.split(`
201
- `).map((y,T)=>o(l,{color:k,children:y},T)),o(u,{marginTop:1,children:o(l,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function lt({onBack:e}){const{settings:{thinkingVerbs:{format:r,verbs:n},themes:t},updateSettings:i}=be(he),s=["format","verbs"],[a,d]=O(0),h=s[a],[c,m]=O(0),[f,S]=O(!1),[I,C]=O(""),[$,M]=O(!1),[F,B]=O(!1),[Y,j]=O(r),V=De(),z=(t.find(A=>A.id===V)||t.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";ge((A,N)=>{if(F){N.return?(i(v=>{v.thinkingVerbs.format=Y}),B(!1)):N.escape?(j(r),B(!1)):N.backspace||N.delete?j(v=>v.slice(0,-1)):A&&j(v=>v+A);return}if(f||$){N.return&&I.trim()?($?(i(v=>{v.thinkingVerbs.verbs.push(I.trim())}),M(!1)):(i(v=>{v.thinkingVerbs.verbs[c]=I.trim()}),S(!1)),C("")):N.escape?(C(""),S(!1),M(!1)):N.backspace||N.delete?C(v=>v.slice(0,-1)):A&&C(v=>v+A);return}N.escape?e():N.return?h==="format"&&(j(r),B(!0)):N.tab?N.shift?d(v=>v===0?s.length-1:v-1):d(v=>v===s.length-1?0:v+1):N.upArrow?h==="verbs"&&n.length>0&&m(v=>v>0?v-1:n.length-1):N.downArrow?h==="verbs"&&n.length>0&&m(v=>v<n.length-1?v+1:0):A==="e"&&h==="verbs"?n.length>0&&(C(n[c]),S(!0)):A==="d"&&h==="verbs"?n.length>1&&(i(v=>{v.thinkingVerbs.verbs=v.thinkingVerbs.verbs.filter((U,H)=>H!==c)}),c>=n.length-1&&m(Math.max(0,n.length-2))):A==="n"&&h==="verbs"?(M(!0),C("")):N.ctrl&&A==="r"&&h==="verbs"&&(i(v=>{v.thinkingVerbs.verbs=[...K.thinkingVerbs.verbs]}),m(0))});const q=50;return g(u,{children:[g(u,{flexDirection:"column",width:`${100-q}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Thinking Verbs"}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:h==="format"?"enter to edit format":"changes auto-saved"}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{marginBottom:1,children:o(l,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:h==="format"?"yellow":void 0,children:h==="format"?"❯ ":" "}),o(l,{bold:!0,color:h==="format"?"yellow":void 0,children:"Format"})]}),h==="format"&&(F?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:F?"yellow":"gray",children:o(l,{children:F?Y:r})})}),o(u,{children:g(l,{children:[o(l,{color:h==="verbs"?"yellow":void 0,children:h==="verbs"?"❯ ":" "}),o(l,{bold:!0,color:h==="verbs"?"yellow":void 0,children:"Verbs"})]})}),h==="verbs"&&o(u,{flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const N=Math.max(0,c-Math.floor(4)),v=Math.min(n.length,N+8),U=Math.max(0,v-8),H=n.slice(U,v);return g(ce,{children:[U>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),H.map((Q,G)=>{const x=U+G;return g(l,{color:h==="verbs"&&x===c?"cyan":void 0,children:[h==="verbs"&&x===c?"❯ ":" ",Q]},x)}),v<n.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-v," more below"]})]})})(),$&&g(u,{alignItems:"center",children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:I})})]}),f&&g(u,{marginTop:1,alignItems:"center",children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:I})})]})]})})]}),g(u,{width:`${q}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),o(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:g(l,{children:[g(l,{color:z,children:["✻ ",r.replace(/\{\}/g,n[c])," "]}),o(l,{children:"(esc to interrupt)"})]})})]})]})}const we=[{name:"Default",phases:K.thinkingStyle.phases,reverseMirror:K.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function at({onBack:e}){const{settings:{thinkingStyle:{phases:r,updateInterval:n,reverseMirror:t},themes:i},updateSettings:s}=be(he),a=["reverseMirror","updateInterval","phases","presets"],[d,h]=O(0),c=a[d],[m,f]=O(0),[S,I]=O(0),[C,$]=O(!1),[M,F]=O(""),[B,Y]=O(!1),[j,V]=O(!1),[ne,z]=O(n.toString()),[q,A]=O(0),N=De(),U=(i.find(p=>p.id===N)||i.find(p=>p.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{if(r.length>0){const p=t?[...r,...[...r].reverse().slice(1,-1)]:r,k=setInterval(()=>{A(b=>(b+1)%p.length)},n);return()=>clearInterval(k)}},[r,n,t]),ge((p,k)=>{if(j){if(k.return){const b=parseInt(ne);!isNaN(b)&&b>0&&s(y=>{y.thinkingStyle.updateInterval=b}),V(!1)}else k.escape?(z(n.toString()),V(!1)):k.backspace||k.delete?z(b=>b.slice(0,-1)):p&&p.match(/^[0-9]$/)&&z(b=>b+p);return}if(C||B){if(k.return&&M.length){const b=B?[...r,M]:r.map((y,T)=>T===m?M:y);s(y=>{y.thinkingStyle.phases=b}),$(!1),F("")}else k.escape?(F(""),$(!1),Y(!1)):k.backspace||k.delete?F(b=>b.slice(0,-1)):p&&F(b=>b+p);return}if(k.escape)e();else if(k.return)if(c==="updateInterval")z(n.toString()),V(!0);else if(c==="presets"){const b=we[S];s(y=>{y.thinkingStyle.phases=[...b.phases],y.thinkingStyle.reverseMirror=b.reverseMirror})}else c==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(k.tab)k.shift?h(b=>b===0?a.length-1:b-1):h(b=>b===a.length-1?0:b+1);else if(k.upArrow)c==="phases"&&r.length>0?f(b=>b>0?b-1:r.length-1):c==="presets"&&I(b=>b>0?b-1:we.length-1);else if(k.downArrow)c==="phases"&&r.length>0?f(b=>b<r.length-1?b+1:0):c==="presets"&&I(b=>b<we.length-1?b+1:0);else if(p===" ")c==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(p==="e"&&c==="phases")r.length>0&&(F(r[m]),$(!0));else if(p==="a"&&c==="phases")Y(!0),F("");else if(p==="d"&&c==="phases")r.length>1&&(s(b=>{b.thinkingStyle.phases=r.filter((y,T)=>T!==m)}),m>=r.length&&f(Math.max(0,r.length-1)));else if(p==="w"&&c==="phases"){if(m>0){const b=[...r];[b[m-1],b[m]]=[b[m],b[m-1]],s(y=>{y.thinkingStyle.phases=b}),f(y=>y-1)}}else if(p==="s"&&c==="phases"){if(m<r.length-1){const b=[...r];[b[m],b[m+1]]=[b[m+1],b[m]],s(y=>{y.thinkingStyle.phases=b}),f(y=>y+1)}}else k.ctrl&&p==="r"&&(s(b=>{b.thinkingStyle=K.thinkingStyle}),f(0),I(0))});const H=t?"●":"○",Q=50,x=t?[...r,...[...r].reverse().slice(1,-1)]:r,w=x.length>0?x[q]:"·";return o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[g(u,{flexDirection:"row",width:"100%",children:[g(u,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[o(fe,{children:"Thinking style"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to"," ",c==="updateInterval"?"edit interval":c==="presets"?"apply preset":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),g(u,{width:`${Q}%`,flexDirection:"column",children:[o(u,{children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(u,{width:(w?.length??0)+1,children:o(l,{color:U,children:w})}),g(l,{children:[o(l,{color:U,children:"Thinking… "}),o(l,{children:"(esc to interrupt)"})]})]})]})]}),g(u,{flexDirection:"row",gap:4,children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:c==="reverseMirror"?"yellow":void 0,children:c==="reverseMirror"?"❯ ":" "}),o(l,{bold:!0,color:c==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),c==="reverseMirror"&&g(l,{dimColor:!0,children:[" ","space to toggle"]}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[H," ",t?"Enabled":"Disabled"]})})]}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:c==="updateInterval"?"yellow":void 0,children:c==="updateInterval"?"❯ ":" "}),o(l,{bold:!0,color:c==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),c==="updateInterval"&&(j?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]})),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:j?"yellow":"gray",children:o(l,{children:j?ne:n})})})]})]}),o(u,{children:g(l,{children:[o(l,{color:c==="phases"?"yellow":void 0,children:c==="phases"?"❯ ":" "}),o(l,{bold:!0,color:c==="phases"?"yellow":void 0,children:"Phases"})]})}),c==="phases"&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const k=Math.max(0,m-Math.floor(4)),b=Math.min(r.length,k+8),y=Math.max(0,b-8),T=r.slice(y,b);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),T.map((_,L)=>{const ee=y+L;return g(l,{color:c==="phases"&&ee===m?"cyan":void 0,children:[c==="phases"&&ee===m?"❯ ":" ",_]},ee)}),b<r.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-b," more below"]})]})})(),B&&g(u,{children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:M})})]}),C&&g(u,{marginTop:1,children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:M})})]})]})}),o(u,{children:g(l,{children:[o(l,{color:c==="presets"?"yellow":void 0,children:c==="presets"?"❯ ":" "}),o(l,{bold:!0,color:c==="presets"?"yellow":void 0,children:"Presets"})]})}),c==="presets"&&g(l,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const k=Math.max(0,S-Math.floor(4)),b=Math.min(we.length,k+8),y=Math.max(0,b-8),T=we.slice(y,b);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),T.map((_,L)=>{const ee=y+L;return g(l,{color:c==="presets"&&ee===S?"cyan":void 0,children:[c==="presets"&&ee===S?"❯ ":" ",_.name," ",_.phases.join("")]},ee)}),b<we.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",we.length-b," more below"]})]})})()})}),o(u,{marginTop:1,children:o(l,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const Ce=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function ct({onBack:e}){const{settings:r,updateSettings:n}=be(he),[t,i]=O("prefix"),[s,a]=O(0),[d,h]=O(!1),[c,m]=O(()=>r.userMessageDisplay.prefix.format),[f,S]=O(0),[I,C]=O(()=>[...r.userMessageDisplay.prefix.styling]),[$,M]=O(()=>r.userMessageDisplay.prefix.foreground_color),[F,B]=O(()=>r.userMessageDisplay.prefix.background_color),[Y,j]=O(0),[V,ne]=O(0),[z,q]=O(()=>[...r.userMessageDisplay.message.styling]),[A,N]=O(()=>r.userMessageDisplay.message.foreground_color),[v,U]=O(()=>r.userMessageDisplay.message.background_color),[H,Q]=O(null),[G,x]=O(""),w=De(),p=r.themes?.find(P=>P.id===w)||r.themes?.[0],k=["format","styling","foreground","background"],b=["styling","foreground","background"],y=k[s],T=b[Y],_=(P,E)=>{n(D=>{const X=P==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;E(X)})},L=P=>{n(E=>{P==="prefix"?E.userMessageDisplay.prefix={...K.userMessageDisplay.prefix}:E.userMessageDisplay.message={...K.userMessageDisplay.message}}),P==="prefix"?(m(K.userMessageDisplay.prefix.format),C([...K.userMessageDisplay.prefix.styling]),M(K.userMessageDisplay.prefix.foreground_color),B(K.userMessageDisplay.prefix.background_color)):(q([...K.userMessageDisplay.message.styling]),N(K.userMessageDisplay.message.foreground_color),U(K.userMessageDisplay.message.background_color))};ae(()=>{const P=r.userMessageDisplay.prefix;m(P.format),C([...P.styling]),M(P.foreground_color),B(P.background_color);const E=r.userMessageDisplay.message;q([...E.styling]),N(E.foreground_color),U(E.background_color)},[]),ge((P,E)=>{if(d){if(E.return)_("prefix",D=>{D.format=c}),h(!1);else if(E.escape){const D=r.userMessageDisplay.prefix;m(D.format),h(!1)}else E.backspace||E.delete?m(D=>D.slice(0,-1)):P&&m(D=>D+P);return}if(H===null){if(E.escape)e();else if(E.ctrl&&P==="r")L(t);else if(E.leftArrow||E.rightArrow)i(D=>D==="prefix"?"message":"prefix");else if(E.tab)t==="prefix"?E.shift?a(D=>D===0?k.length-1:D-1):a(D=>D===k.length-1?0:D+1):E.shift?j(D=>D===0?b.length-1:D-1):j(D=>D===b.length-1?0:D+1);else if(E.return)t==="prefix"?y==="format"?h(!0):y==="foreground"?(x($),Q({column:"prefix",type:"foreground"})):y==="background"&&(x(F),Q({column:"prefix",type:"background"})):T==="foreground"?(x(A),Q({column:"message",type:"foreground"})):T==="background"&&(x(v),Q({column:"message",type:"background"}));else if(E.upArrow)t==="prefix"&&y==="styling"?S(D=>Math.max(0,D-1)):t==="message"&&T==="styling"&&ne(D=>Math.max(0,D-1));else if(E.downArrow)t==="prefix"&&y==="styling"?S(D=>Math.min(Ce.length-1,D+1)):t==="message"&&T==="styling"&&ne(D=>Math.min(Ce.length-1,D+1));else if(P===" "){if(t==="prefix"&&y==="styling"){const D=Ce[f].value,X=I.indexOf(D)>=0?I.filter(W=>W!==D):[...I,D];C(X),_("prefix",W=>{W.styling=[...X]})}else if(t==="message"&&T==="styling"){const D=Ce[V].value,X=z.indexOf(D)>=0?z.filter(W=>W!==D):[...z,D];q(X),_("message",W=>{W.styling=[...X]})}}}});const ee=(P,E,D=!0)=>{const X=D?E==="prefix"?I:z:[],W=D?E==="prefix"?$:A:"rgb(255,255,255)",ve=D?E==="prefix"?F:v:"rgb(0,0,0)",Ie=W==="rgb(0,0,0)"&&ve==="rgb(0,0,0)",Be=X.length>0;return Ie&&!Be?o(l,{children:P}):o(l,{bold:X.includes("bold"),italic:X.includes("italic"),underline:X.includes("underline"),strikethrough:X.includes("strikethrough"),inverse:X.includes("inverse"),color:Ie?void 0:W,backgroundColor:Ie?void 0:ve,children:P})},le=(P=!0)=>g(l,{children:[c&&g(ce,{children:[ee(c,"prefix",P)," "]}),ee("list the dir","message",P)]}),ie=P=>{const E=t===P,W=(P==="prefix"?k:b)[P==="prefix"?s:Y],ve=P==="prefix"?f:V,Ie=P==="prefix"?I:z,Be=P==="prefix"?$:A,Ke=P==="prefix"?F:v;return g(u,{flexDirection:"column",width:"45%",borderStyle:E?"round":"single",borderColor:E?"yellow":"gray",padding:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,color:E?"yellow":void 0,children:[P.charAt(0).toUpperCase()+P.slice(1)," ","Configuration"]})}),P==="prefix"&&g(ce,{children:[o(u,{children:g(l,{color:E&&W==="format"?"yellow":void 0,bold:E&&W==="format",children:[E&&W==="format"?"❯ ":" ","Prefix Text"]})}),E&&W==="format"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:d?"enter to save":"enter to edit (appears before message)"})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:d?"yellow":"gray",children:o(l,{children:c})})})]}),o(u,{children:g(l,{color:E&&W==="styling"?"yellow":void 0,bold:E&&W==="styling",children:[E&&W==="styling"?"❯ ":" ","Styling"]})}),E&&W==="styling"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(u,{marginLeft:2,marginBottom:1,flexDirection:"column",children:Ce.map((Le,qe)=>o(u,{children:g(l,{color:E&&W==="styling"&&ve===qe?"cyan":void 0,children:[E&&W==="styling"&&ve===qe?"❯ ":" ",Ie.includes(Le.value)?"●":"○"," ",Le.label]})},Le.value))}),o(u,{children:g(l,{color:E&&W==="foreground"?"yellow":void 0,bold:E&&W==="foreground",children:[E&&W==="foreground"?"❯ ":" ","Foreground color"]})}),E&&W==="foreground"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,marginBottom:1,children:o(l,{color:Be,children:Be})}),o(u,{children:g(l,{color:E&&W==="background"?"yellow":void 0,bold:E&&W==="background",children:[E&&W==="background"?"❯ ":" ","Background color"]})}),E&&W==="background"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,children:o(l,{backgroundColor:Ke,children:Ke})})]})};if(H){const{column:P,type:E}=H;return o($n,{initialValue:G,theme:p,onColorChange:D=>{P==="prefix"?E==="foreground"?(M(D),_("prefix",X=>{X.foreground_color=D})):(B(D),_("prefix",X=>{X.background_color=D})):E==="foreground"?(N(D),_("message",X=>{X.foreground_color=D})):(U(D),_("message",X=>{X.background_color=D}))},onExit:()=>{Q(null),x("")}})}return g(u,{flexDirection:"column",children:[o(fe,{children:"Customize how user messages are displayed"}),g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(l,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),g(u,{flexDirection:"row",gap:1,children:[ie("prefix"),ie("message")]}),o(u,{borderStyle:"round",padding:1,marginTop:1,children:g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{flexDirection:"row",gap:2,children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"Before (Claude Code default):"})}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]}),g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"After (Your customization):"})}),o(u,{marginLeft:1,children:le(!0)}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]})]})]})})]})}function dt({onSubmit:e}){const{settings:r,updateSettings:n}=be(he),[t,i]=O(0),s=()=>{n(d=>{d.inputBox||(d.inputBox={removeBorder:!1}),d.inputBox.removeBorder=!d.inputBox.removeBorder})};ge((d,h)=>{h.return||h.escape?e():d===" "&&t===0&&s()});const a=r.inputBox?.removeBorder?"☑":"☐";return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Input Box Settings"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(l,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(u,{children:g(l,{children:[o(l,{color:t===0?"cyan":void 0,children:t===0?"❯ ":" "}),o(l,{bold:!0,color:t===0?"cyan":void 0,children:"Remove border"})]})}),t===0&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","space to toggle"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[a," ",r.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(u,{marginBottom:1,children:o(l,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const he=kn({settings:K,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function gt({startupCheckInfo:e}){const[r,n]=O({settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ae(()=>{(async()=>{n(await Je())})()},[]);const t=cn(m=>{const f=JSON.parse(JSON.stringify(r.settings));m(f),n(S=>({...S,settings:f,changesApplied:!1})),Ee(S=>{S.settings=f,S.changesApplied=!1})},[r.settings]),[i,s]=O(null),[a,d]=O(null);ae(()=>{e.wasUpdated&&e.oldVersion&&(d({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
190
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,r=e.indexOf(t);return r!==-1?{startIndex:r-1,endIndex:r+t.length+1}:null}function Sn(e,t){const r=_n(e);if(!r)return e;const n=JSON.stringify(t),i=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Q(e,i,n,r.startIndex,r.endIndex),i}const yn=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const n=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,i=r[0].match(n);if(!i||i.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const s=r.index+i.index,a=s+i[0].length;return{startIndex:s,endIndex:a}},vn=e=>{const t=yn(e);if(!t)return null;const r=e.slice(0,t.startIndex)+e.slice(t.endIndex);return Q(e,r,"",t.startIndex,t.endIndex),r},In=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const n=e.slice(r.index,r.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,s=n.match(i);return!s||s.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:r.index+s.index+s[1].length,endIndex:r.index+s.index+s[1].length+s[2].length,identifiers:[s[3]]}},Cn=(e,t)=>{const r=In(e);if(!r)return null;const n=r,i=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),s=n.identifiers?.[0],c=`=${"`"+i.replace(/\{\}/g,"${"+s+"}")+"`"}`,h=e.slice(0,n.startIndex)+c+e.slice(n.endIndex);return Q(e,h,c,n.startIndex,n.endIndex),h},$n=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Nn=(e,t)=>{const r=$n(e);if(!r)return null;const n=r.identifiers?.[0],i=t?`=[...${n},...[...${n}].reverse()]`:`=[...${n}]`,s=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return Q(e,s,i,r.startIndex,r.endIndex),s},Mn=e=>{const t=[],r=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let n;for(;(n=r.exec(e))!==null;)t.push({startIndex:n.index,endIndex:n.index+n[0].length});return t},Bn=(e,t)=>{const r=Mn(e);if(r.length===0)return null;const n=JSON.stringify(t),i=r.sort((a,c)=>c.startIndex-a.startIndex);let s=e;for(let a=0;a<i.length;a++){const c=s.slice(0,i[a].startIndex)+n+s.slice(i[a].endIndex);Q(s,c,n,i[a].startIndex,i[a].endIndex),s=c}return s},kn=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const n=r[0],i=r[1],s=n.lastIndexOf(i),a=r.index+s,c=a+i.length;return{startIndex:a,endIndex:c}},On=(e,t)=>{const r=kn(e);if(!r)return null;const n=JSON.stringify(t),i=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Q(e,i,n,r.startIndex,r.endIndex),i},Tn=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length}},En=(e,t)=>{const r=Tn(e);if(!r)return null;const n=`{flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Q(e,i,n,r.startIndex,r.endIndex),i},An=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:r.index+1,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Dn=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Ln=(e,t)=>{const r=An(e);if(!r)return null;const n=r,i=n.identifiers?.[0],s=`${i}=${JSON.stringify({words:t})}`,a=e.slice(0,n.startIndex)+s+e.slice(n.endIndex);Q(e,a,s,n.startIndex,n.endIndex);const c=Dn(a);if(!c)return null;const h=c,m=`function ${h.identifiers?.[0]}(){return ${i}.words}`,f=a.slice(0,h.startIndex)+m+a.slice(h.endIndex);return Q(a,f,m,h.startIndex,h.endIndex),f},Rn=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const r=Math.min(e.length,t+700),n=e.slice(t,r),i=/("> "),([$\w]+)/,s=n.match(i);if(!s)return{prefixLocation:null,messageLocation:null};const a=t+n.indexOf(s[1]),c=a+s[1].length,h=c+1,d=h+s[2].length;return{prefixLocation:{startIndex:a,endIndex:c},messageLocation:{startIndex:h,endIndex:d}}},Pn=(e,t,r,n,i=!1,s=!1,a=!1,c=!1,h=!1,d,m,f=!1,_=!1,v=!1,C=!1,$=!1)=>{const N=Rn(e);if(!N)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!N.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!N.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const F=Sr(e);if(!F)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const B=[],Y=r==="rgb(0,0,0)"&&n==="rgb(0,0,0)",V=!Y||(i||s||a||c||h),te=d==="rgb(0,0,0)"&&m==="rgb(0,0,0)",Z=!te||(f||_||v||C||$);if(V){const M=cr(F,Y?null:r.match(/\d+/g)?.join(",")||null,Y?null:n.match(/\d+/g)?.join(",")||null,i,s,a,c,h);B.push({startIndex:N.prefixLocation.startIndex,endIndex:N.prefixLocation.endIndex,newContent:`${M}("${t}")+" "`})}if(Z){const M=cr(F,te?null:d.match(/\d+/g)?.join(",")||null,te?null:m.match(/\d+/g)?.join(",")||null,f,_,v,C,$);B.push({startIndex:N.messageLocation.startIndex,endIndex:N.messageLocation.endIndex,newContent:e.slice(N.messageLocation.startIndex,N.messageLocation.endIndex).replace(/([$\w]+)/,`${M}($1)`)})}B.sort((M,I)=>I.startIndex-M.startIndex);let A=e;for(const M of B){const I=A;A=A.slice(0,M.startIndex)+M.newContent+A.slice(M.endIndex),Q(I,A,M.newContent,M.startIndex,M.endIndex)}return A},Fn=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const n=r[0],i=/verbose:[^,}]+/,s=n.match(i);if(!s||s.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const a=r.index+s.index,c=a+s[0].length;return{startIndex:a,endIndex:c}},Vn=e=>{const t=Fn(e);if(!t)return null;const r="verbose:true",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return Q(e,n,r,t.startIndex,t.endIndex),n},Un=e=>{const r=e.indexOf("subscription, no need to monitor cost");if(r===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const n=Math.max(0,r-60),i=r,s=e.slice(n,i),a=/if\(([$\w]+)\(\)\)/g;let c=null;for(const m of s.matchAll(a))c=m;if(!c||c.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const h=n+c.index,d=h+c[0].length;return{startIndex:h,endIndex:d}},jn=e=>{const t=Un(e);if(!t)return null;const r="if(!1)",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return Q(e,n,r,t.startIndex,t.endIndex),n},Gn=e=>{const t=/\}\.VERSION\} \(Claude Code\)/,r=e.match(t);if(!r||r.index===void 0)return null;const n=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,i=e.match(n);if(!i||i.index===void 0)return null;const s=i.index+i[0].length;return{versionLocation:{startIndex:r.index,endIndex:r.index+r[0].length},sessionIdLocation:{startIndex:s,endIndex:s,identifiers:[i[1],i[2],i[3]]}}},Hn=(e,t)=>{const r=Gn(e);if(!r)return null;const{versionLocation:n,sessionIdLocation:i}=r,a=`${e.slice(n.startIndex,n.endIndex)}\\n${t} (tweakcc)`,c=e.slice(0,n.startIndex)+a+e.slice(n.endIndex);Q(e,c,a,n.startIndex,n.endIndex);const[h,d,m]=i.identifiers,f=Sr(e);if(!f)return console.error("patch: versionOutput: failed to find chalk variable"),null;const _=`,${h}.createElement(${d},null,${h}.createElement(${m},{dimColor:!0}," L "),${h}.createElement(${m},null,${f}.rgb(235, 109, 13).bold("tweakcc: v${t}")))`,v=e.slice(0,i.startIndex)+_+e.slice(i.endIndex);return Q(e,v,_,i.startIndex,i.endIndex),v},Yn=async(e,t)=>{const r=await an(t);oe()&&console.log(`Loaded ${r.length} system prompts with regexes`);for(const{promptId:n,prompt:i,regex:s,getInterpolatedContent:a}of r){const c=new RegExp(s,"s"),h=e.match(c);if(h&&h.index!==void 0){const d=a(h);oe()&&(console.log(`
191
+ Found match for prompt: ${i.name}`),console.log(` Match location: index ${h.index}, length ${h[0].length}`),console.log(` Original content (first 100 chars): ${h[0].substring(0,100)}...`),console.log(` Replacement content (first 100 chars): ${d.substring(0,100)}...`),console.log(` Captured variables: ${h.slice(1).join(", ")}`),console.log(` Content identical: ${h[0]===d}`));const m=e,f=h.index,_=h[0].length;e=e.replace(c,d);const v=Ee(i.content);await Jr(n,v),oe()&&Q(m,e,d,f,f+_)}else if(console.log(X.yellow(`Could not find system prompt "${i.name}" in cli.js (using regex /${s}/)`)),oe()){console.log(`
192
+ Debug info for ${i.name}:`),console.log(` Regex pattern (first 200 chars): ${s.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const d=e.match(new RegExp(s.substring(0,100)));console.log(` Partial match result: ${d?"found partial":"no match"}`)}}return e},Q=(e,t,r,n,i)=>{const s=Math.max(0,n-20),a=Math.min(e.length,i+20),c=Math.min(t.length,n+r.length+20),h=e.slice(s,n),d=e.slice(n,i),m=e.slice(i,a),f=t.slice(s,n),_=t.slice(n,n+r.length),v=t.slice(n+r.length,c);oe()&&d!==_&&(console.log(`
193
+ --- Diff ---`),console.log("OLD:",h+`\x1B[31m${d}\x1B[0m`+m),console.log("NEW:",f+`\x1B[32m${_}\x1B[0m`+v),console.log(`--- End Diff ---
194
+ `))},Sr=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,r=Array.from(e.matchAll(t)),n={};for(const a of r){const c=a[1];n[c]=(n[c]||0)+1}let i,s=0;for(const[a,c]of Object.entries(n))c>s&&(s=c,i=a);return i},yr=async(e,t)=>{await xr(t);let r=await ne.readFile(t.cliPath,{encoding:"utf8"});r=await Yn(r,t.version);let n=null;if(e.settings.themes&&e.settings.themes.length>0&&(n=fn(r,e.settings.themes))&&(r=n),e.settings.launchText){const i=e.settings.launchText;let s="";i.method==="custom"&&i.customText?s=i.customText:i.method==="figlet"&&i.figletText&&(s=await new Promise(a=>Ge.text(i.figletText.replace(`
195
+ `," "),i.figletFont,(c,h)=>{c?(console.error("patch: figlet: failed to generate text",c),a("")):a(h||"")}))),(n=Sn(r,s))&&(r=n)}return e.settings.thinkingVerbs&&((n=Ln(r,e.settings.thinkingVerbs.verbs))&&(r=n),(n=Cn(r,e.settings.thinkingVerbs.format))&&(r=n)),(n=Bn(r,e.settings.thinkingStyle.phases))&&(r=n),(n=On(r,e.settings.thinkingStyle.updateInterval))&&(r=n),(n=En(r,Math.max(...e.settings.thinkingStyle.phases.map(i=>i.length))+1))&&(r=n),(n=Nn(r,e.settings.thinkingStyle.reverseMirror))&&(r=n),e.settings.userMessageDisplay&&(n=Pn(r,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(r=n),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(n=xn(r,e.settings.inputBox.removeBorder))&&(r=n),(n=Vn(r))&&(r=n),(n=vn(r))&&(r=n),(n=pn(r))&&(r=n),(n=Kn(r))&&(r=n),(n=un(r,25))&&(r=n),(n=jn(r))&&(r=n),(n=Hn(r,"2.0.3"))&&(r=n),await Cr(t.cliPath,r,"patch"),await Ae(i=>{i.changesApplied=!0})},De=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],Wn=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return null;const r=Math.max(0,t-600),n=t,s=e.slice(r,n).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!s||s.index===void 0)return null;let c=r+s.index;for(;c<e.length&&e[c]!==";";)c++;if(c>=e.length)return null;const h=c+1,d=s[1];return{insertionIndex:h,optionsVar:d}},zn=e=>{const t=Wn(e);if(!t)return null;const{insertionIndex:r,optionsVar:n}=t,i=De.map(a=>{const c=JSON.stringify(a.label),h=JSON.stringify(a.slug);return`${n}.push({value:${h},label:${c}});`}).join(""),s=e.slice(0,r)+i+e.slice(r);return Q(e,s,i,r,r),s},Jn=e=>{const t=e.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let n=t.index;for(;n>=0&&e[n]!=="[";)n--;if(n<0)return null;let i=n-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0||e[i]!=="=")return null;let s=n,a=0,c=-1;for(;s<e.length;){const C=e[s];if(C==="["&&a++,C==="]"&&(a--,a===0)){c=s;break}s++}if(c===-1)return null;const h=e.slice(n,c+1);let d;try{d=JSON.parse(h)}catch{return null}const m=De.map(C=>C.slug),f=new Set(d);for(const C of m)f.add(C);const _=JSON.stringify(Array.from(f)),v=e.slice(0,n)+_+e.slice(c+1);return Q(e,v,_,n,c+1),v},Xn=e=>{const r=e.indexOf('case"sonnet[1m]"');if(r===-1)return null;let n=r;for(;n>=0&&e[n]!=="{";)n--;if(n<0)return null;let i=r;for(;i<e.length&&e[i]!=="}";)i++;if(i>=e.length)return null;const s=e.slice(n,i+1),a=De.map(_=>`case${JSON.stringify(_.slug)}:return${JSON.stringify(_.internal)};`).join(""),c=s.slice(0,-1),d=(/;\s*$/.test(c)?"":";")+a,m=c+d+"}",f=e.slice(0,n)+m+e.slice(i+1);return Q(e,f,a,n+s.length-1,n+s.length-1),f},Kn=e=>{let t=e;const r=Jn(t);r&&(t=r);const n=Xn(t);n&&(t=n);const i=zn(t);return i&&(t=i),t===e?null:t};let vr=!1;const oe=()=>vr,qn=()=>{vr=!0};function Le(){try{const e=ie.join(xe.homedir(),".claude.json");return JSON.parse(Ne.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Zn(){try{const e=ie.join(xe.homedir(),".claude",".credentials.json");switch(JSON.parse(Ne.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function Qn(){try{const e=ie.join(xe.homedir(),".claude","settings.json"),r=JSON.parse(Ne.readFileSync(e,"utf8"))?.model||"default";if(r==="opus")return"Opus 4.1";const n=De.find(i=>i.slug===r);if(n)return n.label}catch{}return"Sonnet 4.5"}function et(e){process.platform==="win32"?Se.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Se.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Se.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function ar(e){if(process.platform==="win32")Se.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Se.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=ie.dirname(e);Se.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function Ke(e){if(!e||typeof e!="string")return!1;const t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){const r=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,n,i,s]=r;return parseInt(n)<=255&&parseInt(i)<=255&&parseInt(s)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,n,i,s]=r;return parseInt(n)<=360&&parseInt(i)<=100&&parseInt(s)<=100}}return!1}function Ir(e){if(!Ke(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let r=t.slice(1);r.length===3&&(r=r.split("").map(a=>a+a).join(""));const n=parseInt(r.slice(0,2),16),i=parseInt(r.slice(2,4),16),s=parseInt(r.slice(4,6),16);return`rgb(${n},${i},${s})`}if(t.startsWith("hsl(")){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const n=parseInt(r[1])/360,i=parseInt(r[2])/100,s=parseInt(r[3])/100,a=(_,v,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<1/6?_+(v-_)*6*C:C<1/2?v:C<2/3?_+(v-_)*(2/3-C)*6:_),c=s<.5?s*(1+i):s+i-s*i,h=2*s-c,d=Math.round(a(h,c,n+1/3)*255),m=Math.round(a(h,c,n)*255),f=Math.round(a(h,c,n-1/3)*255);return`rgb(${d},${m},${f})`}}return e}async function rt(e,t="sha256",r=64*1024){return new Promise((n,i)=>{const s=gr.createHash(t),a=Ne.createReadStream(e,{highWaterMark:r});a.on("data",c=>{s.update(c)}),a.on("end",()=>{n(s.digest("hex"))}),a.on("error",c=>{i(c)})})}const cr=(e,t,r,n,i,s,a,c)=>{let h=e;return t&&(h+=`.rgb(${t})`),r&&r!=="transparent"&&(h+=`.bgRgb(${r})`),n&&(h+=".bold"),i&&(h+=".italic"),s&&(h+=".underline"),a&&(h+=".strikethrough"),c&&(h+=".inverse"),h};async function Cr(e,t,r="replace"){let n=493;try{n=(await ne.stat(e)).mode,oe()&&console.log(`[${r}] Original file mode for ${e}: ${(n&parseInt("777",8)).toString(8)}`)}catch(i){oe()&&console.log(`[${r}] Could not stat ${e} (error: ${i}), using default mode 755`)}try{await ne.unlink(e),oe()&&console.log(`[${r}] Unlinked ${e} to break hard links`)}catch(i){oe()&&console.log(`[${r}] Could not unlink ${e}: ${i}`)}await ne.writeFile(e,t),await ne.chmod(e,n),oe()&&console.log(`[${r}] Restored permissions to ${(n&parseInt("777",8)).toString(8)}`)}function P({color:e,backgroundColor:t,bold:r,dimColor:n,children:i}){const s=e?.startsWith("ansi:"),a=t?.startsWith("ansi:");if(s||a){if(Pe.Children.toArray(i).some(f=>Pe.isValidElement(f)))return o(l,{children:i});let h=X;if(s){const f=e.slice(5);h=h[f]||h}if(a){const f=t.slice(5),_=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;h=h[_]||h}r&&(h=h.bold),n&&(h=h.dim);const m=Pe.Children.toArray(i).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return o(l,{children:h(m)})}return o(l,{color:e,backgroundColor:t,bold:r,dimColor:n,children:i})}function nt({text:e,nonShimmerColors:t,shimmerColors:r,shimmerWidth:n=3,updateDuration:i=50,restartPoint:s=10}){const[a,c]=O(0);return ae(()=>{const h=setInterval(()=>{c(d=>{const m=d+1;return m>=e.length+s?-n:m})},i);return()=>clearInterval(h)},[e.length,s,i]),t.length!==r.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),o(l,{children:e})):o(l,{children:e.split("").map((h,d)=>{const m=d>=a&&d<a+n&&a<e.length,f=d%t.length,_=m?r[f]:t[f];return o(l,{color:_,children:h},d)})})}const tt=Ar.cwd();function $r({theme:e}){const{ccVersion:t}=be(he);return g(u,{flexDirection:"column",paddingLeft:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,children:["Preview: ",e.name]})}),o(u,{borderStyle:"single",borderColor:"gray",paddingX:1,children:g(u,{flexDirection:"column",children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(P,{color:e.colors.clawd_body,children:" ▐"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),g(l,{children:[o(P,{color:e.colors.clawd_body,children:"▌ "})," ",o(l,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),g(l,{children:[o(P,{color:e.colors.clawd_body,children:"▝▜"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),o(P,{color:e.colors.clawd_body,children:"▛▘"})," ",Qn()," · ",Zn()]}),g(P,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",tt]}),g(l,{children:[g(P,{color:e.colors.success,children:["Login successful. Press"," "]}),o(P,{bold:!0,color:e.colors.success,children:"Enter"}),g(P,{color:e.colors.success,children:[" ","to continue…"]})]})]}),o(l,{children:"╭─────────────────────────────────────────────╮"}),g(l,{children:["│ 1 function greet() ","{"," ","│"]}),g(l,{children:["│ 2"," ",o(P,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),o(P,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),o(P,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),g(l,{children:["│ 2"," ",o(P,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),o(P,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),o(P,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),o(P,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),g(P,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),g(l,{children:[o(P,{color:e.colors.warning,children:"│ "}),o(l,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),g(P,{color:e.colors.warning,children:[" ","│"]})]}),o(P,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),g(l,{children:[o(P,{color:e.colors.bashBorder,children:"!"}),o(l,{children:" ls"})]}),o(P,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),o(l,{children:g(l,{children:["> list the dir"," ",o(nt,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),o(P,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(P,{color:e.colors.planMode,children:"│ "}),g(P,{color:e.colors.permission,children:["Ready to code?"," "]}),o(l,{children:"Here is Claude's plan:"}),g(P,{color:e.colors.planMode,children:[" ","│"]})]}),o(P,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(P,{color:e.colors.permission,children:"│ "}),o(l,{bold:!0,children:"Permissions:"})," ",g(P,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(P,{color:e.colors.permission,children:"│"})]}),o(l,{children:"> list the dir"}),g(l,{children:[o(P,{color:e.colors.error,children:"●"}),o(l,{children:" Update(__init__.py)"})]}),g(l,{children:[o(l,{children:" ⎿ "}),o(P,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),g(l,{children:[" ","1"," ",g(P,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),o(P,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),g(l,{children:[" ","2"," ",g(P,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),o(P,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),g(l,{children:[o(P,{color:e.colors.success,children:"●"}),o(l,{children:" List(.)"})]}),g(l,{children:[o(l,{children:"●"}),o(l,{children:" The directory "}),o(P,{color:e.colors.permission,children:"C:\\Users\\user"}),g(l,{children:[" ","contains ",o(l,{bold:!0,children:"123"})," files."]})]}),g(l,{children:[o(P,{color:e.colors.claude,children:"✻ Th"}),o(P,{color:e.colors.claudeShimmer,children:"ink"}),o(P,{color:e.colors.claude,children:"ing… "}),o(l,{children:"(esc to interrupt)"})]}),o(l,{children:o(P,{color:e.colors.autoAccept,children:"⏵⏵ auto-accept edits on (shift+tab to cycle)"})}),o(l,{children:o(P,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),o(l,{children:o(P,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Fe({colorKey:e,theme:t,bold:r=!1}){const n=t.colors[e];return e==="inverseText"?o(P,{color:n,backgroundColor:t.colors.permission,bold:r,children:e}):e.startsWith("diff")?o(P,{backgroundColor:n,bold:r,color:t.colors.text,children:e}):o(P,{color:n,bold:r,children:e})}function Nr({initialValue:e,onColorChange:t,onExit:r,colorKey:n,theme:i}){const s=Ue(e)||{h:0,s:50,l:50},a=Ve(e)||{r:128,g:128,b:128},[c,h]=O(s),[d,m]=O(a),[f,_]=O("hsl"),[v,C]=O("h"),[$,N]=O(!1),[F,B]=O(!1);ae(()=>{const x=Ue(e),w=Ve(e);x&&w&&(N(!0),h(x),m(w),N(!1))},[e]),ae(()=>{if(!$&&F){const x=`rgb(${d.r},${d.g},${d.b})`;t(x)}},[c,d,$,F]),ae(()=>{B(!0)},[]);const Y=x=>{if(Ke(x)){const w=Ir(x),p=Ue(w),k=Ve(w);p&&k&&(N(!0),h(p),m(k),N(!1))}};ge((x,w)=>{if(x.length>1&&!w.ctrl&&!w.meta){Y(x);return}if(w.return)r();else if(w.escape)r();else if(w.ctrl&&x==="a")_(p=>p==="hsl"?"rgb":"hsl"),C(p=>f==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(w.upArrow)C(f==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(w.downArrow||w.tab)C(f==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(w.leftArrow){const p=w.shift||w.ctrl||w.meta?-10:-1;U(p)}else if(w.rightArrow){const p=w.shift||w.ctrl||w.meta?10:1;U(p)}});const U=x=>{N(!0),f==="hsl"?h(w=>{const p={...w};v==="h"?p.h=Math.max(0,Math.min(359,w.h+x)):v==="s"?p.s=Math.max(0,Math.min(100,w.s+x)):v==="l"&&(p.l=Math.max(0,Math.min(100,w.l+x)));const[k,b,S]=te(p.h,p.s,p.l);return m({r:k,g:b,b:S}),p}):m(w=>{const p={...w};v==="r"?p.r=Math.max(0,Math.min(255,w.r+x)):v==="g"?p.g=Math.max(0,Math.min(255,w.g+x)):v==="b"&&(p.b=Math.max(0,Math.min(255,w.b+x)));const k=V(p.r,p.g,p.b);return h(k),p}),N(!1)},V=(x,w,p)=>{const k=x/255,b=w/255,S=p/255,T=Math.max(k,b,S),y=Math.min(k,b,S),L=T-y,re=(T+y)/2;let le=0;L!==0&&(le=re>.5?L/(2-T-y):L/(T+y));let se=0;return L!==0&&(T===k?se=((b-S)/L+(b<S?6:0))/6:T===b?se=((S-k)/L+2)/6:se=((k-b)/L+4)/6),{h:Math.round(se*360),s:Math.round(le*100),l:Math.round(re*100)}},te=(x,w,p)=>{x/=360,w/=100,p/=100;const k=(1-Math.abs(2*p-1))*w,b=k*(1-Math.abs(x*6%2-1)),S=p-k/2;let T=0,y=0,L=0;return 0<=x&&x<1/6?(T=k,y=b,L=0):1/6<=x&&x<2/6?(T=b,y=k,L=0):2/6<=x&&x<3/6?(T=0,y=k,L=b):3/6<=x&&x<4/6?(T=0,y=b,L=k):4/6<=x&&x<5/6?(T=b,y=0,L=k):5/6<=x&&x<1&&(T=k,y=0,L=b),[Math.round((T+S)*255),Math.round((y+S)*255),Math.round((L+S)*255)]},z=()=>{const x=[],w=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let p=0;p<40;p++){const b=p/39*(w.length-1),S=Math.floor(b),T=Math.ceil(b),y=b-S,[L,re,le]=w[S],[se,R,E]=w[T],D=Math.round(L+(se-L)*y),K=Math.round(re+(R-re)*y),W=Math.round(le+(E-le)*y);x.push(o(l,{backgroundColor:`rgb(${D},${K},${W})`,children:" "},p))}return x},Z=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,S]=te(c.h,p,c.l);x.push(o(l,{backgroundColor:`rgb(${k},${b},${S})`,children:" "},w))}return x},A=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,S]=te(c.h,c.s,p);x.push(o(l,{backgroundColor:`rgb(${k},${b},${S})`,children:" "},w))}return x},M=()=>{const[x,w,p]=te(c.h,c.s,c.l);return`rgb(${x},${w},${p})`},I=(x,w,p)=>{const k=b=>b.toString(16).padStart(2,"0");return`#${k(x)}${k(w)}${k(p)}`},j=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${p},${d.g},${d.b})`,children:" "},w))}return x},G=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${d.r},${p},${d.b})`,children:" "},w))}return x},ee=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${d.r},${d.g},${p})`,children:" "},w))}return x},H=(x,w)=>Math.round(x/w*39);return g(u,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[g(u,{flexDirection:"column",children:[o(l,{bold:!0,children:"Color Picker"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(l,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(l,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(l,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(l,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(l,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",c.h,"°):"]})}),o(u,{children:z().map((x,w)=>o(_e,{children:w===H(c.h,360)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",c.s,"%):"]})}),o(u,{children:Z().map((x,w)=>o(_e,{children:w===H(c.s,100)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",c.l,"%):"]})}),o(u,{children:A().map((x,w)=>o(_e,{children:w===H(c.l,100)?o(l,{children:"|"}):x},w))})]})]}):g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",d.r,"):"]})}),o(u,{children:j().map((x,w)=>o(_e,{children:w===H(d.r,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",d.g,"):"]})}),o(u,{children:G().map((x,w)=>o(_e,{children:w===H(d.g,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),o(u,{children:ee().map((x,w)=>o(_e,{children:w===H(d.b,255)?o(l,{children:"|"}):x},w))})]})]}),g(u,{marginBottom:1,children:[o(l,{children:"Current: "}),o(l,{backgroundColor:M(),children:" "})]}),g(u,{flexDirection:"row",justifyContent:"space-between",children:[g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"Hex "}),n?.startsWith("diff")?o(l,{backgroundColor:M(),color:i?.colors?.text||"white",bold:!0,children:I(d.r,d.g,d.b)}):n==="inverseText"?o(l,{color:M(),backgroundColor:i?.colors?.permission,bold:!0,children:I(d.r,d.g,d.b)}):o(l,{color:M(),bold:!0,children:I(d.r,d.g,d.b)})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"RGB "}),n?.startsWith("diff")?o(l,{backgroundColor:M(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):n==="inverseText"?o(l,{color:M(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):o(l,{color:M(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"HSL "}),n?.startsWith("diff")?o(l,{backgroundColor:M(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):n==="inverseText"?o(l,{color:M(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):o(l,{color:M(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function Ve(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const n=r[1];return{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16)}}return null}function Ue(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const i=parseInt(r[1])/255,s=parseInt(r[2])/255,a=parseInt(r[3])/255,c=Math.max(i,s,a),h=Math.min(i,s,a),d=c-h,m=(c+h)/2;let f=0;d!==0&&(f=m>.5?d/(2-c-h):d/(c+h));let _=0;return d!==0&&(c===i?_=((s-a)/d+(s<a?6:0))/6:c===s?_=((a-i)/d+2)/6:_=((i-s)/d+4)/6),{h:Math.round(_*360),s:Math.round(f*100),l:Math.round(m*100)}}const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const i=n[1],s=parseInt(i.substr(0,2),16)/255,a=parseInt(i.substr(2,2),16)/255,c=parseInt(i.substr(4,2),16)/255,h=Math.max(s,a,c),d=Math.min(s,a,c),m=h-d,f=(h+d)/2;let _=0;m!==0&&(_=f>.5?m/(2-h-d):m/(h+d));let v=0;return m!==0&&(h===s?v=((a-c)/m+(a<c?6:0))/6:h===a?v=((c-s)/m+2)/6:v=((s-a)/m+4)/6),{h:Math.round(v*360),s:Math.round(_*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function ot({onBack:e,themeId:t}){const{settings:{themes:r},updateSettings:n}=be(he),[i,s]=O(t),a=r.find(A=>A.id===i)||r[0],[c,h]=O("rgb"),[d,m]=O(0),[f,_]=O(null),[v,C]=O(null),[$,N]=O(""),[F,B]=O(""),Y=dr(A=>{n(M=>{const I=M.themes.findIndex(j=>j.id===i);I!==-1&&A(M.themes[I])})},[i,n]),U=A=>{if(d>=2&&Ke(A)){const M=Ir(A),I=d-2,j=V[I];Y(G=>{G.colors[j]=M})}};ge((A,M)=>{if(f===null&&v===null){if(A.length>1&&!M.ctrl&&!M.meta){U(A);return}if(M.escape)e();else if(M.ctrl&&A==="a")h(I=>I==="rgb"?"hex":I==="hex"?"hsl":"rgb");else if(M.upArrow)m(I=>Math.max(0,I-1));else if(M.downArrow)m(I=>Math.min(V.length+1,I+1));else if(M.return)if(d===0)C("name"),N(a.name),B(a.name);else if(d===1)C("id"),N(a.id),B(a.id);else{const I=d-2,j=V[I],G=a.colors[j];_(I),N(G),B(G)}}else if(f!==null)M.ctrl&&A==="a"&&h(I=>I==="rgb"?"hex":I==="hex"?"hsl":"rgb");else if(v!==null)if(M.return){if(v==="id"){const I=i;s($),n(j=>{const G=j.themes.findIndex(ee=>ee.id===I);G!==-1&&(j.themes[G].id=$)})}else Y(I=>{I.name=$});C(null),N(""),B("")}else M.escape?(C(null),N(""),B("")):M.backspace||M.delete?N(I=>I.slice(0,-1)):A&&N(I=>I+A)});const V=Object.keys(a.colors),te=(A,M)=>{const I=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!I)return A;const j=parseInt(I[1]),G=parseInt(I[2]),ee=parseInt(I[3]);switch(M){case"hex":{const H=x=>x.toString(16).padStart(2,"0");return`#${H(j)}${H(G)}${H(ee)}`}case"hsl":{const H=j/255,x=G/255,w=ee/255,p=Math.max(H,x,w),k=Math.min(H,x,w),b=p-k,S=(p+k)/2;let T=0;b!==0&&(T=S>.5?b/(2-p-k):b/(p+k));let y=0;return b!==0&&(p===H?y=((x-w)/b+(x<w?6:0))/6:p===x?y=((w-H)/b+2)/6:y=((H-x)/b+4)/6),`hsl(${Math.round(y*360)}, ${Math.round(T*100)}%, ${Math.round(S*100)}%)`}case"rgb":default:return A}},z=A=>({autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",Z=Math.max(...V.map(A=>A.length));return g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{children:g(fe,{children:["Editing theme “",a.name,"” (",a.id,")"]})}),f===null&&v===null?g(ce,{children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(l,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(l,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(l,{dimColor:!0,children:"esc to go back"})]}),d<2?g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(l,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),o(l,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:a.colors[V[d-2]],flexDirection:"column",paddingLeft:1,children:[o(Fe,{colorKey:V[d-2],theme:a,bold:!0}),o(l,{children:z(V[d-2])})]}),g(u,{flexDirection:"column",children:[g(u,{children:[o(l,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),o(l,{bold:!0,children:"Name: "}),o(l,{children:a.name})]}),g(u,{marginBottom:1,children:[o(l,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),o(l,{bold:!0,children:"ID: "}),o(l,{children:a.id})]}),(()=>{if(d<2){const H=V.slice(0,20);return g(ce,{children:[H.map((x,w)=>{const p=w+2;return g(u,{children:[o(l,{color:d===p?"yellow":"white",children:d===p?"❯ ":" "}),o(u,{width:Z+2,children:o(l,{children:o(Fe,{colorKey:x,theme:a,bold:!0})})}),o(P,{color:a.colors[x],children:te(a.colors[x],c)})]},x)}),V.length>20&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-20," more below"]})]})}const M=d-2,I=Math.max(0,M-Math.floor(20/2)),j=Math.min(V.length,I+20),G=Math.max(0,j-20),ee=V.slice(G,j);return g(ce,{children:[G>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",G," more above"]}),ee.map((H,x)=>{const p=G+x+2;return g(u,{children:[o(l,{color:d===p?"yellow":"white",children:d===p?"❯ ":" "}),o(u,{width:Z+2,children:o(l,{children:o(Fe,{colorKey:H,theme:a,bold:!0})})}),o(P,{color:a.colors[H],children:te(a.colors[H],c)})]},H)}),j<V.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-j," more below"]})]})})()]})]}):v?g(u,{flexDirection:"column",marginTop:1,children:[g(l,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),o(u,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(l,{children:$})}),o(l,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o(Nr,{initialValue:F,colorKey:V[f],theme:a,onColorChange:A=>{N(A),Y(M=>{M.colors[V[f]]=A})},onExit:()=>{Y(A=>{A.colors[V[f]]=$}),_(null),N(""),B("")}})]}),o(u,{width:"50%",children:o($r,{theme:a})})]})}function it(e){return e.map(t=>`${t.name} (${t.id})`)}function st({onBack:e}){const{settings:{themes:t},updateSettings:r}=be(he),[n,i]=O(0),[s,a]=O(null),[c,h]=O(!0),d=()=>{const $={colors:{...(t[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(N=>{N.themes.push($)}),a($.id),h(!1)},m=C=>{t.length<=1||(r($=>{$.themes=$.themes.filter(N=>N.id!==C)}),n>=t.length-1&&i(Math.max(0,t.length-2)))},f=()=>{r(C=>{C.themes=[...q.themes]}),i(0)};if(ge((C,$)=>{if($.escape)e();else if($.upArrow)i(N=>Math.max(0,N-1));else if($.downArrow)i(N=>Math.min(t.length-1,N+1));else if($.return){const N=t[n];N&&(a(N.id),h(!1))}else if(C==="n")d();else if(C==="d"){const N=t[n];N&&m(N.id)}else $.ctrl&&C==="r"&&f()},{isActive:c}),s)return o(ot,{themeId:s,onBack:()=>{a(null),h(!0)}});const _=it(t),v=t.find(C=>_[n]?.includes(`(${C.id})`))||t[0];return t.length===0?o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(l,{children:"No themes available!"})]})}):g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"d to delete a theme"}),o(l,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(l,{dimColor:!0,children:"enter to edit theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(u,{flexDirection:"column",children:_.map((C,$)=>g(l,{color:n===$?"yellow":void 0,children:[n===$?"❯ ":" ",C]},$))})]}),o(u,{width:"50%",children:o($r,{theme:v})})]})}let je=["ANSI Shadow"];function lt({onBack:e}){const{stdout:t}=Br(),r=t?.columns||120,{settings:{launchText:{method:n,figletText:i,figletFont:s,customText:a},themes:c},updateSettings:h}=be(he),d=n==="figlet"?["method","text","font"]:["method","text"],[m,f]=O(0),_=d[m],[v,C]=O(n==="figlet"?0:1),[$,N]=O(je),[F,B]=O(je),[Y,U]=O(""),[V,te]=O(!1),[z,Z]=O(0),[A,M]=O(""),[I,j]=O(50),[G,ee]=O(!1),[H,x]=O(n==="figlet"?i:a),w=Le(),k=(c.find(S=>S.id===w)||c.find(S=>S.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{Ge.fonts((S,T)=>{if(!S&&T){const y=T.sort();N(y),B(y),je=y;const L=y.indexOf(s);Z(L>=0?L:y.indexOf("ANSI Shadow")||0)}})},[]),ae(()=>{b()},[n,i,s,a,H,G]);const b=()=>{if(n==="figlet")try{const S=G?H:i,T=Ge.textSync(S.replace(`
196
+ `," "),{font:s}),y=Math.floor(r*.7),re=T.split(`
197
+ `).map(E=>E.length>y?E.substring(0,y-3)+"…":E),le=re.join(`
198
+ `);M(le);const se=Math.max(...re.map(E=>E.length)),R=Math.min(75,Math.max(50,Math.ceil(se/r*100)));j(R+5)}catch{M("Error generating figlet text"),j(50)}else{const S=Math.floor(r*.6),L=(G?H:a).split(`
199
+ `).map(R=>R.length>S?R.substring(0,S-3)+"...":R),re=L.join(`
200
+ `);M(re);const le=Math.max(...L.map(R=>R.length)),se=Math.min(75,Math.max(50,Math.ceil(le/r*100)));j(se+5)}};return ae(()=>{if(Y){const S=$.filter(T=>T.toLowerCase().includes(Y.toLowerCase()));B(S),Z(0)}else{B($);const S=$.indexOf(s);Z(S>=0?S:0)}},[Y,$]),ae(()=>{if(!V){const S=F.indexOf(s);S>=0&&Z(S)}},[s,F,V]),ge((S,T)=>{if(G){T.return?(h(n==="figlet"?y=>{y.launchText.figletText=H}:y=>{y.launchText.customText=H}),ee(!1)):T.escape?(x(n==="figlet"?i:a),ee(!1)):T.backspace||T.delete?x(y=>y.slice(0,-1)):S&&x(y=>y+S);return}if(V){if(T.return)F.length>0&&h(y=>{y.launchText.figletFont=F[z]}),te(!1),U("");else if(T.escape)te(!1),U("");else if(T.backspace||T.delete)U(y=>y.slice(0,-1));else if(T.upArrow){const y=z>0?z-1:F.length-1;Z(y),F.length>0&&h(L=>{L.launchText.figletFont=F[y]})}else if(T.downArrow){const y=z<F.length-1?z+1:0;Z(y),F.length>0&&h(L=>{L.launchText.figletFont=F[y]})}else S&&S.match(/^[a-zA-Z0-9\s\-_]$/)&&U(y=>y+S);return}if(T.escape)e();else if(T.return)_==="text"&&(x(n==="figlet"?i:a),ee(!0));else if(T.tab)T.shift?f(y=>y===0?d.length-1:y-1):f(y=>y===d.length-1?0:y+1);else if(T.upArrow){if(_==="method"){const y=v>0?v-1:1;C(y),h(L=>{L.launchText.method=y===0?"figlet":"custom"})}else if(_==="font"&&n==="figlet"){const y=z>0?z-1:F.length-1;Z(y),h(L=>{L.launchText.figletFont=F[y]})}}else if(T.downArrow){if(_==="method"){const y=v<1?v+1:0;C(y),h(L=>{L.launchText.method=y===0?"figlet":"custom"})}else if(_==="font"&&n==="figlet"){const y=z<F.length-1?z+1:0;Z(y),h(L=>{L.launchText.figletFont=F[y]})}}else S&&_==="font"&&n==="figlet"&&S.match(/^[a-zA-Z0-9]$/)&&(te(!0),U(S))}),g(u,{children:[g(u,{flexDirection:"column",width:`${100-I}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Setup banner"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to ",_==="text"?"edit text":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{children:g(l,{children:[o(l,{color:_==="method"?"yellow":void 0,children:_==="method"?"❯ ":" "}),o(l,{bold:!0,color:_==="method"?"yellow":void 0,children:"Method"})]})}),_==="method"&&g(l,{dimColor:!0,children:[" ","select one of ",F.length," Figlet fonts or enter your own text"]}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[g(l,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),g(l,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:_==="text"?"yellow":void 0,children:_==="text"?"❯ ":" "}),o(l,{bold:!0,color:_==="text"?"yellow":void 0,children:"Text"})]}),_==="text"&&(G?g(l,{dimColor:!0,children:[" ","esc to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:G?"yellow":"gray",children:o(l,{children:G?H:n==="figlet"?i:a})})}),n==="figlet"&&g(ce,{children:[o(u,{children:g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:_==="font"?"yellow":void 0,children:_==="font"?"❯ ":" "}),o(l,{bold:!0,color:_==="font"?"yellow":void 0,children:"Font"})]}),_==="font"&&g(l,{dimColor:!0,children:[" ","type to filter"]}),o(l,{children:V&&g(l,{color:"gray",dimColor:!0,children:[" ","(filtering: “",Y,"”)"]})})]})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const T=Math.max(0,z-Math.floor(4)),y=Math.min(F.length,T+8),L=Math.max(0,y-8),re=F.slice(L,y);return g(ce,{children:[L>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),re.map((le,se)=>{const R=L+se;return g(l,{color:z===R?"cyan":void 0,children:[z===R?"❯ ":" ",le]},le)}),y<F.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-y," more below"]})]})})()})})]})]}),g(u,{width:`${I}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{color:k,children:"╭──────────────────────────╮"}),g(l,{children:[o(l,{color:k,children:"│ ✻"})," Welcome to Claude Code"," ",o(l,{color:k,children:"│"})]}),o(l,{color:k,children:"╰──────────────────────────╯"})]}),A.split(`
201
+ `).map((S,T)=>o(l,{color:k,children:S},T)),o(u,{marginTop:1,children:o(l,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function at({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:r},themes:n},updateSettings:i}=be(he),s=["format","verbs"],[a,c]=O(0),h=s[a],[d,m]=O(0),[f,_]=O(!1),[v,C]=O(""),[$,N]=O(!1),[F,B]=O(!1),[Y,U]=O(t),V=Le(),z=(n.find(A=>A.id===V)||n.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";ge((A,M)=>{if(F){M.return?(i(I=>{I.thinkingVerbs.format=Y}),B(!1)):M.escape?(U(t),B(!1)):M.backspace||M.delete?U(I=>I.slice(0,-1)):A&&U(I=>I+A);return}if(f||$){M.return&&v.trim()?($?(i(I=>{I.thinkingVerbs.verbs.push(v.trim())}),N(!1)):(i(I=>{I.thinkingVerbs.verbs[d]=v.trim()}),_(!1)),C("")):M.escape?(C(""),_(!1),N(!1)):M.backspace||M.delete?C(I=>I.slice(0,-1)):A&&C(I=>I+A);return}M.escape?e():M.return?h==="format"&&(U(t),B(!0)):M.tab?M.shift?c(I=>I===0?s.length-1:I-1):c(I=>I===s.length-1?0:I+1):M.upArrow?h==="verbs"&&r.length>0&&m(I=>I>0?I-1:r.length-1):M.downArrow?h==="verbs"&&r.length>0&&m(I=>I<r.length-1?I+1:0):A==="e"&&h==="verbs"?r.length>0&&(C(r[d]),_(!0)):A==="d"&&h==="verbs"?r.length>1&&(i(I=>{I.thinkingVerbs.verbs=I.thinkingVerbs.verbs.filter((j,G)=>G!==d)}),d>=r.length-1&&m(Math.max(0,r.length-2))):A==="n"&&h==="verbs"?(N(!0),C("")):M.ctrl&&A==="r"&&h==="verbs"&&(i(I=>{I.thinkingVerbs.verbs=[...q.thinkingVerbs.verbs]}),m(0))});const Z=50;return g(u,{children:[g(u,{flexDirection:"column",width:`${100-Z}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Thinking Verbs"}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:h==="format"?"enter to edit format":"changes auto-saved"}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{marginBottom:1,children:o(l,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:h==="format"?"yellow":void 0,children:h==="format"?"❯ ":" "}),o(l,{bold:!0,color:h==="format"?"yellow":void 0,children:"Format"})]}),h==="format"&&(F?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:F?"yellow":"gray",children:o(l,{children:F?Y:t})})}),o(u,{children:g(l,{children:[o(l,{color:h==="verbs"?"yellow":void 0,children:h==="verbs"?"❯ ":" "}),o(l,{bold:!0,color:h==="verbs"?"yellow":void 0,children:"Verbs"})]})}),h==="verbs"&&o(u,{flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const M=Math.max(0,d-Math.floor(4)),I=Math.min(r.length,M+8),j=Math.max(0,I-8),G=r.slice(j,I);return g(ce,{children:[j>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",j," more above"]}),G.map((ee,H)=>{const x=j+H;return g(l,{color:h==="verbs"&&x===d?"cyan":void 0,children:[h==="verbs"&&x===d?"❯ ":" ",ee]},x)}),I<r.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-I," more below"]})]})})(),$&&g(u,{alignItems:"center",children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:v})})]}),f&&g(u,{marginTop:1,alignItems:"center",children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:v})})]})]})})]}),g(u,{width:`${Z}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),o(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:g(l,{children:[g(l,{color:z,children:["✻ ",t.replace(/\{\}/g,r[d])," "]}),o(l,{children:"(esc to interrupt)"})]})})]})]})}const we=[{name:"Default",phases:q.thinkingStyle.phases,reverseMirror:q.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function ct({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:r,reverseMirror:n},themes:i},updateSettings:s}=be(he),a=["reverseMirror","updateInterval","phases","presets"],[c,h]=O(0),d=a[c],[m,f]=O(0),[_,v]=O(0),[C,$]=O(!1),[N,F]=O(""),[B,Y]=O(!1),[U,V]=O(!1),[te,z]=O(r.toString()),[Z,A]=O(0),M=Le(),j=(i.find(p=>p.id===M)||i.find(p=>p.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{if(t.length>0){const p=n?[...t,...[...t].reverse().slice(1,-1)]:t,k=setInterval(()=>{A(b=>(b+1)%p.length)},r);return()=>clearInterval(k)}},[t,r,n]),ge((p,k)=>{if(U){if(k.return){const b=parseInt(te);!isNaN(b)&&b>0&&s(S=>{S.thinkingStyle.updateInterval=b}),V(!1)}else k.escape?(z(r.toString()),V(!1)):k.backspace||k.delete?z(b=>b.slice(0,-1)):p&&p.match(/^[0-9]$/)&&z(b=>b+p);return}if(C||B){if(k.return&&N.length){const b=B?[...t,N]:t.map((S,T)=>T===m?N:S);s(S=>{S.thinkingStyle.phases=b}),$(!1),F("")}else k.escape?(F(""),$(!1),Y(!1)):k.backspace||k.delete?F(b=>b.slice(0,-1)):p&&F(b=>b+p);return}if(k.escape)e();else if(k.return)if(d==="updateInterval")z(r.toString()),V(!0);else if(d==="presets"){const b=we[_];s(S=>{S.thinkingStyle.phases=[...b.phases],S.thinkingStyle.reverseMirror=b.reverseMirror})}else d==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(k.tab)k.shift?h(b=>b===0?a.length-1:b-1):h(b=>b===a.length-1?0:b+1);else if(k.upArrow)d==="phases"&&t.length>0?f(b=>b>0?b-1:t.length-1):d==="presets"&&v(b=>b>0?b-1:we.length-1);else if(k.downArrow)d==="phases"&&t.length>0?f(b=>b<t.length-1?b+1:0):d==="presets"&&v(b=>b<we.length-1?b+1:0);else if(p===" ")d==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(p==="e"&&d==="phases")t.length>0&&(F(t[m]),$(!0));else if(p==="a"&&d==="phases")Y(!0),F("");else if(p==="d"&&d==="phases")t.length>1&&(s(b=>{b.thinkingStyle.phases=t.filter((S,T)=>T!==m)}),m>=t.length&&f(Math.max(0,t.length-1)));else if(p==="w"&&d==="phases"){if(m>0){const b=[...t];[b[m-1],b[m]]=[b[m],b[m-1]],s(S=>{S.thinkingStyle.phases=b}),f(S=>S-1)}}else if(p==="s"&&d==="phases"){if(m<t.length-1){const b=[...t];[b[m],b[m+1]]=[b[m+1],b[m]],s(S=>{S.thinkingStyle.phases=b}),f(S=>S+1)}}else k.ctrl&&p==="r"&&(s(b=>{b.thinkingStyle=q.thinkingStyle}),f(0),v(0))});const G=n?"●":"○",ee=50,x=n?[...t,...[...t].reverse().slice(1,-1)]:t,w=x.length>0?x[Z]:"·";return o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[g(u,{flexDirection:"row",width:"100%",children:[g(u,{marginBottom:1,flexDirection:"column",width:`${100-ee}%`,children:[o(fe,{children:"Thinking style"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),g(u,{width:`${ee}%`,flexDirection:"column",children:[o(u,{children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(u,{width:(w?.length??0)+1,children:o(l,{color:j,children:w})}),g(l,{children:[o(l,{color:j,children:"Thinking… "}),o(l,{children:"(esc to interrupt)"})]})]})]})]}),g(u,{flexDirection:"row",gap:4,children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),o(l,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&g(l,{dimColor:!0,children:[" ","space to toggle"]}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[G," ",n?"Enabled":"Disabled"]})})]}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),o(l,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(U?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]})),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:U?"yellow":"gray",children:o(l,{children:U?te:r})})})]})]}),o(u,{children:g(l,{children:[o(l,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),o(l,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const k=Math.max(0,m-Math.floor(4)),b=Math.min(t.length,k+8),S=Math.max(0,b-8),T=t.slice(S,b);return g(ce,{children:[S>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",S," more above"]}),T.map((y,L)=>{const re=S+L;return g(l,{color:d==="phases"&&re===m?"cyan":void 0,children:[d==="phases"&&re===m?"❯ ":" ",y]},re)}),b<t.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-b," more below"]})]})})(),B&&g(u,{children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:N})})]}),C&&g(u,{marginTop:1,children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:N})})]})]})}),o(u,{children:g(l,{children:[o(l,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),o(l,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&g(l,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const k=Math.max(0,_-Math.floor(4)),b=Math.min(we.length,k+8),S=Math.max(0,b-8),T=we.slice(S,b);return g(ce,{children:[S>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",S," more above"]}),T.map((y,L)=>{const re=S+L;return g(l,{color:d==="presets"&&re===_?"cyan":void 0,children:[d==="presets"&&re===_?"❯ ":" ",y.name," ",y.phases.join("")]},re)}),b<we.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",we.length-b," more below"]})]})})()})}),o(u,{marginTop:1,children:o(l,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const Ce=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function dt({onBack:e}){const{settings:t,updateSettings:r}=be(he),[n,i]=O("prefix"),[s,a]=O(0),[c,h]=O(!1),[d,m]=O(()=>t.userMessageDisplay.prefix.format),[f,_]=O(0),[v,C]=O(()=>[...t.userMessageDisplay.prefix.styling]),[$,N]=O(()=>t.userMessageDisplay.prefix.foreground_color),[F,B]=O(()=>t.userMessageDisplay.prefix.background_color),[Y,U]=O(0),[V,te]=O(0),[z,Z]=O(()=>[...t.userMessageDisplay.message.styling]),[A,M]=O(()=>t.userMessageDisplay.message.foreground_color),[I,j]=O(()=>t.userMessageDisplay.message.background_color),[G,ee]=O(null),[H,x]=O(""),w=Le(),p=t.themes?.find(R=>R.id===w)||t.themes?.[0],k=["format","styling","foreground","background"],b=["styling","foreground","background"],S=k[s],T=b[Y],y=(R,E)=>{r(D=>{const K=R==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;E(K)})},L=R=>{r(E=>{R==="prefix"?E.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:E.userMessageDisplay.message={...q.userMessageDisplay.message}}),R==="prefix"?(m(q.userMessageDisplay.prefix.format),C([...q.userMessageDisplay.prefix.styling]),N(q.userMessageDisplay.prefix.foreground_color),B(q.userMessageDisplay.prefix.background_color)):(Z([...q.userMessageDisplay.message.styling]),M(q.userMessageDisplay.message.foreground_color),j(q.userMessageDisplay.message.background_color))};ae(()=>{const R=t.userMessageDisplay.prefix;m(R.format),C([...R.styling]),N(R.foreground_color),B(R.background_color);const E=t.userMessageDisplay.message;Z([...E.styling]),M(E.foreground_color),j(E.background_color)},[]),ge((R,E)=>{if(c){if(E.return)y("prefix",D=>{D.format=d}),h(!1);else if(E.escape){const D=t.userMessageDisplay.prefix;m(D.format),h(!1)}else E.backspace||E.delete?m(D=>D.slice(0,-1)):R&&m(D=>D+R);return}if(G===null){if(E.escape)e();else if(E.ctrl&&R==="r")L(n);else if(E.leftArrow||E.rightArrow)i(D=>D==="prefix"?"message":"prefix");else if(E.tab)n==="prefix"?E.shift?a(D=>D===0?k.length-1:D-1):a(D=>D===k.length-1?0:D+1):E.shift?U(D=>D===0?b.length-1:D-1):U(D=>D===b.length-1?0:D+1);else if(E.return)n==="prefix"?S==="format"?h(!0):S==="foreground"?(x($),ee({column:"prefix",type:"foreground"})):S==="background"&&(x(F),ee({column:"prefix",type:"background"})):T==="foreground"?(x(A),ee({column:"message",type:"foreground"})):T==="background"&&(x(I),ee({column:"message",type:"background"}));else if(E.upArrow)n==="prefix"&&S==="styling"?_(D=>Math.max(0,D-1)):n==="message"&&T==="styling"&&te(D=>Math.max(0,D-1));else if(E.downArrow)n==="prefix"&&S==="styling"?_(D=>Math.min(Ce.length-1,D+1)):n==="message"&&T==="styling"&&te(D=>Math.min(Ce.length-1,D+1));else if(R===" "){if(n==="prefix"&&S==="styling"){const D=Ce[f].value,K=v.indexOf(D)>=0?v.filter(W=>W!==D):[...v,D];C(K),y("prefix",W=>{W.styling=[...K]})}else if(n==="message"&&T==="styling"){const D=Ce[V].value,K=z.indexOf(D)>=0?z.filter(W=>W!==D):[...z,D];Z(K),y("message",W=>{W.styling=[...K]})}}}});const re=(R,E,D=!0)=>{const K=D?E==="prefix"?v:z:[],W=D?E==="prefix"?$:A:"rgb(255,255,255)",ve=D?E==="prefix"?F:I:"rgb(0,0,0)",Ie=W==="rgb(0,0,0)"&&ve==="rgb(0,0,0)",Be=K.length>0;return Ie&&!Be?o(l,{children:R}):o(l,{bold:K.includes("bold"),italic:K.includes("italic"),underline:K.includes("underline"),strikethrough:K.includes("strikethrough"),inverse:K.includes("inverse"),color:Ie?void 0:W,backgroundColor:Ie?void 0:ve,children:R})},le=(R=!0)=>g(l,{children:[d&&g(ce,{children:[re(d,"prefix",R)," "]}),re("list the dir","message",R)]}),se=R=>{const E=n===R,W=(R==="prefix"?k:b)[R==="prefix"?s:Y],ve=R==="prefix"?f:V,Ie=R==="prefix"?v:z,Be=R==="prefix"?$:A,qe=R==="prefix"?F:I;return g(u,{flexDirection:"column",width:"45%",borderStyle:E?"round":"single",borderColor:E?"yellow":"gray",padding:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,color:E?"yellow":void 0,children:[R.charAt(0).toUpperCase()+R.slice(1)," ","Configuration"]})}),R==="prefix"&&g(ce,{children:[o(u,{children:g(l,{color:E&&W==="format"?"yellow":void 0,bold:E&&W==="format",children:[E&&W==="format"?"❯ ":" ","Prefix Text"]})}),E&&W==="format"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:c?"enter to save":"enter to edit (appears before message)"})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:c?"yellow":"gray",children:o(l,{children:d})})})]}),o(u,{children:g(l,{color:E&&W==="styling"?"yellow":void 0,bold:E&&W==="styling",children:[E&&W==="styling"?"❯ ":" ","Styling"]})}),E&&W==="styling"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(u,{marginLeft:2,marginBottom:1,flexDirection:"column",children:Ce.map((Re,Ze)=>o(u,{children:g(l,{color:E&&W==="styling"&&ve===Ze?"cyan":void 0,children:[E&&W==="styling"&&ve===Ze?"❯ ":" ",Ie.includes(Re.value)?"●":"○"," ",Re.label]})},Re.value))}),o(u,{children:g(l,{color:E&&W==="foreground"?"yellow":void 0,bold:E&&W==="foreground",children:[E&&W==="foreground"?"❯ ":" ","Foreground color"]})}),E&&W==="foreground"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,marginBottom:1,children:o(l,{color:Be,children:Be})}),o(u,{children:g(l,{color:E&&W==="background"?"yellow":void 0,bold:E&&W==="background",children:[E&&W==="background"?"❯ ":" ","Background color"]})}),E&&W==="background"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,children:o(l,{backgroundColor:qe,children:qe})})]})};if(G){const{column:R,type:E}=G;return o(Nr,{initialValue:H,theme:p,onColorChange:D=>{R==="prefix"?E==="foreground"?(N(D),y("prefix",K=>{K.foreground_color=D})):(B(D),y("prefix",K=>{K.background_color=D})):E==="foreground"?(M(D),y("message",K=>{K.foreground_color=D})):(j(D),y("message",K=>{K.background_color=D}))},onExit:()=>{ee(null),x("")}})}return g(u,{flexDirection:"column",children:[o(fe,{children:"Customize how user messages are displayed"}),g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(l,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),g(u,{flexDirection:"row",gap:1,children:[se("prefix"),se("message")]}),o(u,{borderStyle:"round",padding:1,marginTop:1,children:g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{flexDirection:"row",gap:2,children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"Before (Claude Code default):"})}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]}),g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"After (Your customization):"})}),o(u,{marginLeft:1,children:le(!0)}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]})]})]})})]})}function gt({onSubmit:e}){const{settings:t,updateSettings:r}=be(he),[n,i]=O(0),s=()=>{r(c=>{c.inputBox||(c.inputBox={removeBorder:!1}),c.inputBox.removeBorder=!c.inputBox.removeBorder})};ge((c,h)=>{h.return||h.escape?e():c===" "&&n===0&&s()});const a=t.inputBox?.removeBorder?"☑":"☐";return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Input Box Settings"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(l,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(u,{children:g(l,{children:[o(l,{color:n===0?"cyan":void 0,children:n===0?"❯ ":" "}),o(l,{bold:!0,color:n===0?"cyan":void 0,children:"Remove border"})]})}),n===0&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","space to toggle"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[a," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(u,{marginBottom:1,children:o(l,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const he=Or({settings:q,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function ht({startupCheckInfo:e}){const[t,r]=O({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ae(()=>{(async()=>{r(await Xe())})()},[]);const n=dr(m=>{const f=JSON.parse(JSON.stringify(t.settings));m(f),r(_=>({..._,settings:f,changesApplied:!1})),Ae(_=>{_.settings=f,_.changesApplied=!1})},[t.settings]),[i,s]=O(null),[a,c]=O(null);ae(()=>{e.wasUpdated&&e.oldVersion&&(c({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
202
202
  (However, your customization are still remembered in ${de}.)
203
- Please reapply your changes below.`,type:"warning"}),t(()=>{}))},[]),ge((m,f)=>{(f.ctrl&&m==="c"||(m==="q"||f.escape)&&!i)&&process.exit(0)},{isActive:!i});const h=m=>{switch(d(null),m){case J.APPLY_CHANGES:e.ccInstInfo&&(d({message:"Applying patches...",type:"info"}),yn(r,e.ccInstInfo).then(f=>{n(f),d({message:"Customization patches applied successfully!",type:"success"})}));break;case J.THEMES:case J.LAUNCH_TEXT:case J.THINKING_VERBS:case J.THINKING_STYLE:case J.USER_MESSAGE_DISPLAY:case J.INPUT_BOX:s(m);break;case J.VIEW_SYSTEM_PROMPTS:Qr(me);break;case J.RESTORE_ORIGINAL:e.ccInstInfo&&wn(e.ccInstInfo).then(()=>{d({message:"Original Claude Code restored successfully!",type:"success"}),t(()=>{})});break;case J.OPEN_CONFIG:ln(de);break;case J.OPEN_CLI:e.ccInstInfo&&ln(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},c=()=>{s(null)};return o(he.Provider,{value:{settings:r.settings,updateSettings:t,changesApplied:r.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(u,{flexDirection:"column",children:i===null?o(Vn,{onSubmit:h,notification:a}):i===J.THEMES?o(it,{onBack:c}):i===J.LAUNCH_TEXT?o(st,{onBack:c}):i===J.THINKING_VERBS?o(lt,{onBack:c}):i===J.THINKING_STYLE?o(at,{onBack:c}):i===J.USER_MESSAGE_DISPLAY?o(ct,{onBack:c}):i===J.INPUT_BOX?o(dt,{onSubmit:c}):null})})}const ht=async()=>{const e=new Bn;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("2.0.1").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const r=e.opts();if(r.debug&&Kr(),r.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${de}`);const t=await Je();(!t.settings||Object.keys(t.settings).length===0)&&(console.error("No saved customizations found in "+de),process.exit(1));const i=await sn();(!i||!i.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Ge.forEach(s=>{s.isGlob?s.expandedPaths.length===0?console.error(` - ${s.pattern} (no matches)`):(console.error(` - ${s.pattern}`),s.expandedPaths.forEach(a=>{console.error(` - ${a}`)})):console.error(` - ${s.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${i.ccInstInfo.cliPath}`),console.log(`Version: ${i.ccInstInfo.version}`),console.log("Applying customizations..."),await yn(t,i.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await sn();n?Mn(o(gt,{startupCheckInfo:n})):(console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
203
+ Please reapply your changes below.`,type:"warning"}),n(()=>{}))},[]),ge((m,f)=>{(f.ctrl&&m==="c"||(m==="q"||f.escape)&&!i)&&process.exit(0)},{isActive:!i});const h=m=>{switch(c(null),m){case J.APPLY_CHANGES:e.ccInstInfo&&(c({message:"Applying patches...",type:"info"}),yr(t,e.ccInstInfo).then(f=>{r(f),c({message:"Customization patches applied successfully!",type:"success"})}));break;case J.THEMES:case J.LAUNCH_TEXT:case J.THINKING_VERBS:case J.THINKING_STYLE:case J.USER_MESSAGE_DISPLAY:case J.INPUT_BOX:s(m);break;case J.VIEW_SYSTEM_PROMPTS:et(me);break;case J.RESTORE_ORIGINAL:e.ccInstInfo&&xr(e.ccInstInfo).then(()=>{c({message:"Original Claude Code restored successfully!",type:"success"}),n(()=>{})});break;case J.OPEN_CONFIG:ar(de);break;case J.OPEN_CLI:e.ccInstInfo&&ar(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},d=()=>{s(null)};return o(he.Provider,{value:{settings:t.settings,updateSettings:n,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(u,{flexDirection:"column",children:i===null?o(Ur,{onSubmit:h,notification:a}):i===J.THEMES?o(st,{onBack:d}):i===J.LAUNCH_TEXT?o(lt,{onBack:d}):i===J.THINKING_VERBS?o(at,{onBack:d}):i===J.THINKING_STYLE?o(ct,{onBack:d}):i===J.USER_MESSAGE_DISPLAY?o(dt,{onBack:d}):i===J.INPUT_BOX?o(gt,{onSubmit:d}):null})})}const ut=async()=>{const e=new kr;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("2.0.3").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&qn(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${de}`);const n=await Xe();(!n.settings||Object.keys(n.settings).length===0)&&(console.error("No saved customizations found in "+de),process.exit(1));const i=await lr();(!i||!i.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),He.forEach(a=>{a.isGlob?a.expandedPaths.length===0?console.error(` - ${a.pattern} (no matches)`):(console.error(` - ${a.pattern}`),a.expandedPaths.forEach(c=>{console.error(` - ${c}`)})):console.error(` - ${a.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${i.ccInstInfo.cliPath}`),console.log(`Version: ${i.ccInstInfo.version}`),console.log("Loading system prompts...");const s=await ir(i.ccInstInfo.version);s.success||(console.log(X.red(`
204
+ ✖ Error downloading system prompts:`)),console.log(X.red(` ${s.errorMessage}`)),console.log(X.yellow(`
205
+ ⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await yr(n,i.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const r=await lr();if(r){const n=await ir(r.ccInstInfo.version);n.success||(console.log(X.red(`
206
+ ✖ Error downloading system prompts:`)),console.log(X.red(` ${n.errorMessage}`)),console.log(X.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
207
+ `))),Mr(o(ht,{startupCheckInfo:r}))}else console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
204
208
 
205
209
  Searched at the following locations:
206
- ${Ge.map(i=>{if(i.isGlob){if(i.expandedPaths.length===0)return`- ${i.pattern} (no matches)`;{const s=[`- ${i.pattern}`];return i.expandedPaths.forEach(a=>{s.push(` - ${a}`)}),s.join(`
210
+ ${He.map(i=>{if(i.isGlob){if(i.expandedPaths.length===0)return`- ${i.pattern} (no matches)`;{const s=[`- ${i.pattern}`];return i.expandedPaths.forEach(a=>{s.push(` - ${a}`)}),s.join(`
207
211
  `)}}else return`- ${i.pattern}`}).join(`
208
212
  `)}
209
213
 
@@ -221,4 +225,4 @@ Notes:
221
225
  - Don't specify the path to your Claude Code executable's directory. It needs to be the path
222
226
  to the folder that contains **cli.js**.
223
227
  - Please also open an issue so that we can add your path to the search list for all users!
224
- `),process.exit(1))};ht();
228
+ `),process.exit(1)};ut();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "description": "Command-line tool to customize your Claude Code theme colors, thinking verbs and more.",
6
6
  "main": "dist/index.js",