tweakcc 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");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
|
-
`),
|
|
2
|
+
import{Box as u,Text as l,render as Bn,useInput as ge,useStdout as kn}from"ink";import{Command as Tn}from"commander";import X from"chalk";import Re,{Fragment as Se,createContext as On,useCallback as gn,useContext as pe,useEffect as ae,useState as T}from"react";import En 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 Me from"node:fs";import{globbySync as An}from"globby";import Dn 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 hn from"node:crypto";import He from"figlet";import ke from"gray-matter";function Ln({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return ge((i,s)=>{s.upArrow?n(t>0?t-1:e.length-1):s.downArrow?n(t<e.length-1?t+1:0):s.return&&r(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)"}}],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}},Pn=()=>{const e=ie.join(xe.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Me.existsSync(e))return e}catch{}return t?ie.join(t,"tweakcc"):e},be=Pn(),de=ie.join(be,"config.json"),_e=ie.join(be,"cli.js.backup"),me=ie.join(be,"system-prompts"),en=ie.join(be,"prompt-data-cache"),Rn=()=>{const e=[],t=process.platform=="win32"?xe.homedir().replace(/\\/g,"/"):xe.homedir(),n="node_modules/@anthropic-ai/claude-code",r=(i,s=!1)=>{if(s){const a=An(i,{onlyFiles:!1});e.push({pattern:i,isGlob:!0,expandedPaths:a})}else e.push({pattern:i,isGlob:!1,expandedPaths:[i]})};return r(`${xe.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.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=Rn(),nn=Ge.flatMap(e=>e.expandedPaths),Fn=({children:e,...t})=>g(l,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var fe=Fn;const Vn=[{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"}],jn=[{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 Un({onSubmit:e,notification:t}){const n=[...pe(he).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...Vn,...jn],[r,i]=T(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(En,{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(Ln,{items:n,selectedIndex:r,onSelect:i,onSubmit:s=>e(s)})]})}async function ze(e){const t=ie.join(en,`prompts-${e}.json`);try{const r=await re.readFile(t,"utf-8");return JSON.parse(r)}catch{}const n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const r=await fetch(n);if(!r.ok){let s;throw r.status===429?s="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":r.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.`:r.status>=500?s=`GitHub server error (${r.status}). Please try again later.`:s=`HTTP ${r.status}: ${r.statusText}`,new Error(s)}const i=await r.json();try{await re.mkdir(en,{recursive:!0}),await re.writeFile(t,JSON.stringify(i,null,2),"utf-8")}catch(s){console.warn(`Failed to write to cache to ${t}: ${s}`)}return i}catch(r){if(r instanceof Error){if(r.message.includes("Rate limit")||r.message.includes("not found")||r.message.includes("server error")||r.message.includes("HTTP"))throw r;const i=`Failed to download prompts for version ${e}: ${r.message}`;throw new Error(i)}throw r}}const Hn="modulepreload",Gn=function(e){return"/"+e},rn={},Yn=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let d=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"),c=document.querySelector("meta[property=csp-nonce]"),h=c?.nonce||c?.getAttribute("nonce");i=d(n.map(m=>{if(m=Gn(m,r),m in rn)return;rn[m]=!0;const f=m.endsWith(".css"),S=f?'[rel="stylesheet"]':"";if(!!r)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":Hn,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 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)})},un=ie.join(be,"systemPromptOriginalHashes.json"),mn=ie.join(be,"systemPromptAppliedHashes.json"),fn=(e,t)=>`${e}-${t}`,Ee=e=>hn.createHash("md5").update(e.trim(),"utf8").digest("hex"),pn=async()=>{try{const e=await re.readFile(un,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Wn=async e=>{await re.mkdir(be,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await re.writeFile(un,JSON.stringify(t,null,2),"utf8")},zn=async e=>{const t=await pn();let n=0;for(const r of e.prompts){const i=fn(r.id,r.version);if(!t[i]){const s=Te(r.pieces,r.identifiers,r.identifierMap),a=Ee(s);t[i]=a,n++}}return await Wn(t),n},Jn=async(e,t)=>{const n=await pn(),r=fn(e,t);return n[r]},Je=async()=>{try{const e=await re.readFile(mn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},bn=async e=>{await re.mkdir(be,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await re.writeFile(mn,JSON.stringify(t,null,2),"utf8")},Xn=async(e,t)=>{const n=await Je();n[e]=t,await bn(n)},Kn=async()=>{const e=await Je(),t={};for(const n of Object.keys(e))t[n]=null;await bn(t)},qn=async e=>{try{const t=await Je();if(Object.keys(t).length===0)return!1;const r=(await re.readdir(e)).filter(i=>i.endsWith(".md"));for(const i of r){const s=i.replace(".md",""),a=t[s];if(a===void 0||a===null)continue;const c=ie.join(e,i),h=await re.readFile(c,"utf8"),m=(await Yn(()=>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}},wn=e=>{const t=ke(e,{delimiters:["<!--","-->"]}),{name:n,description:r,ccVersion:i,variables:s}=t.data;return{name:n||"",description:r||"",ccVersion:i||"",variables:s||[],content:t.content.trim()}},tn=(e,t)=>{const n=t||Te(e.pieces,e.identifiers,e.identifierMap),r=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 r&&r.length>0&&(i.variables=r),ke.stringify(n,i,{delimiters:["<!--","-->"]})},Te=(e,t,n)=>{let r="";for(let i=0;i<e.length;i++)if(r+=e[i],i<t.length){const s=t[i],a=n[String(s)]||`UNKNOWN_${s}`;r+=a}return r},Zn=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<Math.max(n.length,r.length);i++){const s=n[i]||0,a=r[i]||0;if(s<a)return-1;if(s>a)return 1}return 0},Ne=e=>ie.join(me,`${e}.md`),Qn=async e=>{try{return await re.access(Ne(e)),!0}catch{return!1}},er=async e=>{const t=Ne(e),n=await re.readFile(t,"utf-8");return wn(n)},Ye=async(e,t)=>{const n=Ne(e);await re.writeFile(n,t,"utf-8")},nr=async(e,t)=>{const n=Ne(e),r=await re.readFile(n,"utf-8"),i=ke(r,{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)},rr=(e,t)=>{const n=$=>$.split(/(\s+)/),r=n(e),i=n(t),s=r.length,a=i.length,c=Array(s+1).fill(0).map(()=>Array(a+1).fill(0));for(let $=1;$<=s;$++)for(let M=1;M<=a;M++)r[$-1]===i[M-1]?c[$][M]=c[$-1][M-1]+1:c[$][M]=Math.max(c[$-1][M],c[$][M-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&&r[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 S=$=>$.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");let v="";for(let $=0;$<r.length;$++){const M=S(r[$]);v+=h[$]?`<mark>${M}</mark>`:M}let C="";for(let $=0;$<i.length;$++){const M=S(i[$]);C+=d[$]?`<mark>${M}</mark>`:M}return{oldHtml:v,newHtml:C}},on=(e,t)=>{const n=e.length,r=t.length,i=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let d=1;d<=n;d++)for(let m=1;m<=r;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=n,c=r;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 S=rr(m.line,f.line);s.push({type:"modified",line:m.line,oldLineNo:m.oldLineNo,newLineNo:f.newLineNo,oldHtml:S.oldHtml,newHtml:S.newHtml}),d++}else s.push(m)}return s},tr=async(e,t,n,r,i,s,a,c)=>{const h=n.split(`
|
|
3
|
+
`),d=r.split(`
|
|
4
4
|
`),m=i.split(`
|
|
5
|
-
`),f=B=>B.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),S=
|
|
5
|
+
`),f=B=>B.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),S=on(h,d),v=on(h,m);let C="";for(const B of S){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
|
|
6
6
|
`,C+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
|
|
7
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
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
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
|
|
10
|
+
`}}let $="";for(const B of v){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
|
|
11
11
|
`,$+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
|
|
12
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
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>
|
|
@@ -16,7 +16,7 @@ import{Box as u,Text as l,render as Mn,useInput as ge,useStdout as Nn}from"ink";
|
|
|
16
16
|
<html>
|
|
17
17
|
<head>
|
|
18
18
|
<meta charset="UTF-8">
|
|
19
|
-
<title>Diff: ${f(
|
|
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(
|
|
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(
|
|
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=
|
|
177
|
-
`;return
|
|
178
|
-
`}),a+=`default:return${JSON.stringify(
|
|
179
|
-
}`,
|
|
176
|
+
</html>`,F=ie.join(me,`${e}.diff.html`);return await re.writeFile(F,M,"utf-8"),F},or=async e=>{const t={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await Qn(e.id)){const i=tn(e);return await Ye(e.id,i),t.action="created",t}const r=await er(e.id);if(t.oldVersion=r.ccVersion,await nr(e.id,e.identifierMap),r.ccVersion&&e.version){const i=Zn(r.ccVersion,e.version);if(i===0)return t.action="skipped",t;if(i!=0){const s=await Jn(e.id,r.ccVersion),a=Ee(r.content);if(!s||s!==a){t.action="conflict";let h=r.content;try{const v=(await ze(r.ccVersion)).prompts.find(C=>C.id===e.id);v&&(h=Te(v.pieces,v.identifiers,v.identifierMap))}catch{console.log(X.yellow(`Warning: Could not fetch old version ${r.ccVersion} for comparison. Using current file as baseline.`))}const d=Te(e.pieces,e.identifiers,e.identifierMap),m=Ne(e.id),f=await tr(e.id,e.name,h,r.content,d,r.ccVersion,e.version,m);t.diffHtmlPath=f}else{const h=tn(e);await Ye(e.id,h),t.action="updated"}}}return t},ir=async e=>{const t={ccVersion:e,results:[]},n=await ze(e);await zn(n),await re.mkdir(me,{recursive:!0});for(const r of n.prompts)try{const i=await or(r);t.results.push(i)}catch(i){throw console.log(X.red(`Failed to sync prompt ${r.id}:`)),i}return t};let Oe=null,We=null;const sn=async e=>{try{return Oe=await ze(e),We=e,{success:!0}}catch(t){return Oe=null,We=null,t instanceof Error?{success:!1,errorMessage:t.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},sr=(e,t)=>{let n="";for(let r=0;r<e.length;r++){const s=e[r].replace(/<<CCVERSION>>/g,t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n+=s,r<e.length-1&&(n+="([\\w$]+)")}return n},lr=(e,t,n,r,i)=>{const s={};for(let h=0;h<r.length;h++){const d=r[h],m=String(t[h]),f=n[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},ar=async e=>{if(!Oe||We!==e)return[];const t=Oe,n=[];for(const r of t.prompts){const i=sr(r.pieces,e),s=ie.join(me,`${r.id}.md`);let a;try{a=await re.readFile(s,"utf8")}catch(d){console.error(`Failed to read markdown file ${s}:`,d);continue}const c=wn(a),h=d=>{const m=d.slice(1);return lr(c.content,r.identifiers,r.identifierMap,m,e)};n.push({promptId:r.id,prompt:c,regex:i,getInterpolatedContent:h})}return n},cr=e=>{const t=e.results.filter(s=>s.action==="created"),n=e.results.filter(s=>s.action==="updated"),r=e.results.filter(s=>s.action==="conflict"),i=e.results.filter(s=>s.action==="skipped");if((t.length>0||n.length>0||r.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(n.length>0){console.log(X.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const s of n)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(r.length>0){console.log(X.bold.yellow(`WARNING: Conflicts detected for ${r.length} system prompt file(s)`));for(const s of r)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()),r.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 r)console.log(X.yellow(` ${s.id}.md → `)+X.bold.magenta(s.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},xn=async()=>{await ue.mkdir(be,{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"),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),n.settings.inputBox||(n.settings.inputBox=q.inputBox);for(const s of q.themes){const a=n?.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 n?.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 n?.settings?.userMessageDisplay||(n.settings=n.settings||q,n.settings.userMessageDisplay=q.userMessageDisplay),await qn(me)&&(n.changesApplied=!1),$e=n,n}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 dr($e),$e),dr=async e=>{try{e.lastModified=new Date().toISOString(),await xn(),await ue.writeFile(de,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Sn=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await ue.readFile(_e);return await $n(e.cliPath,t,"restore"),await Kn(),await Ae(n=>{n.changesApplied=!1}),!0},gr=async e=>{e.ccInstallationDir&&nn.unshift(e.ccInstallationDir);for(const t of nn)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const n=Qe.join(t,"cli.js");if(!await yn(n))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await nt(n)}`));const r=Qe.join(t,"package.json");let i;try{i=JSON.parse(await ue.readFile(r,"utf8"))}catch(s){if(!(s instanceof Error&&"code"in s&&s.code==="ENOENT"))throw s}return{cliPath:n,packageJsonPath:r,version:i?.version}}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")continue;throw n}return null},ln=async e=>{await xn(),oe()&&console.log(`Backing up cli.js to ${_e}`),await ue.copyFile(e.cliPath,_e),await Ae(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function yn(e){try{return await ue.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}async function an(){const e=await Xe(),t=await gr(e);if(!t)return null;if(t.version)try{const s=await ir(t.version);cr(s)}catch{}const n=t.version,r=e.ccVersion;let i=!1;return await yn(_e)||(oe()&&console.log(`startupCheck: ${_e} not found; backing up cli.js`),await ln(t),i=!0),n!==r?(i||(oe()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await ue.unlink(_e),await ln(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const hr=e=>{const t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let r;for(;(r=n.exec(e))!==null;){const i=r.index+r[0].indexOf("=")+1;t.push({startIndex:i,endIndex:i+r[1].length})}return t},ur=(e,t)=>{const n=hr(e);if(n.length===0)return null;const r=n.sort((s,a)=>a.startIndex-s.startIndex);let i=e;for(const s of r){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 mr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(t);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,s=e.match(r),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 fr=(e,t)=>{const n=mr(e);if(!n)return null;if(t.length===0)return e;let r=e;const i="return"+JSON.stringify(Object.fromEntries(t.map(c=>[c.id,c.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),Q(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r;const s=JSON.stringify(t.map(c=>({label:c.name,value:c.id})));r=r.slice(0,n.objArr.startIndex)+s+r.slice(n.objArr.endIndex),Q(e,r,s,n.objArr.startIndex,n.objArr.endIndex),e=r;let a=`switch(${n.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
|
+
}`,r=r.slice(0,n.switchStatement.startIndex)+a+r.slice(n.switchStatement.endIndex),Q(e,r,a,n.switchStatement.startIndex,n.switchStatement.endIndex),r},pr=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);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 t=pr(e);if(!t)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=e.slice(0,t)+n+e.slice(t);return Q(e,r,n,t,t),r},wr=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(t,t+500),r=/borderStyle:"[^"]*"/,i=n.match(r);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}},xr=(e,t)=>{const n=wr(e);if(!n)return null;if(t){const r="borderColor:undefined",i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i}else return e};function Sr(e){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
|
|
180
180
|
██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
|
|
181
181
|
██║ ██║ ███████║██║ ██║██║ ██║█████╗
|
|
182
182
|
██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
|
|
@@ -187,20 +187,24 @@ ${$} </div>
|
|
|
187
187
|
██║ ██║ ██║██║ ██║█████╗
|
|
188
188
|
██║ ██║ ██║██║ ██║██╔══╝
|
|
189
189
|
╚██████╗╚██████╔╝██████╔╝███████╗
|
|
190
|
-
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(
|
|
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): ${
|
|
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
|
|
193
|
-
--- Diff ---`),console.log("OLD:",h+`\x1B[31m${
|
|
194
|
-
`))},
|
|
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),
|
|
197
|
-
`).map(E=>E.length>_?E.substring(0,_-3)+"…":E),le=
|
|
198
|
-
`);N(le);const
|
|
199
|
-
`).map(P=>P.length>y?P.substring(0,y-3)+"...":P),
|
|
200
|
-
`);N(
|
|
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
|
+
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(t);return n!==-1?{startIndex:n-1,endIndex:n+t.length+1}:null}function yr(e,t){const n=Sr(e);if(!n)return e;const r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i}const _r=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,i=n[0].match(r);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}},vr=e=>{const t=_r(e);if(!t)return null;const n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return Q(e,n,"",t.startIndex,t.endIndex),n},Ir=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const r=e.slice(n.index,n.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,s=r.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]]}},Cr=(e,t)=>{const n=Ir(e);if(!n)return null;const r=n,i=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),s=r.identifiers?.[0],c=`=${"`"+i.replace(/\{\}/g,"${"+s+"}")+"`"}`,h=e.slice(0,r.startIndex)+c+e.slice(r.endIndex);return Q(e,h,c,r.startIndex,r.endIndex),h},$r=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(t);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]]}},Mr=(e,t)=>{const n=$r(e);if(!n)return null;const r=n.identifiers?.[0],i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return Q(e,s,i,n.startIndex,n.endIndex),s},Nr=e=>{const t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},Br=(e,t)=>{const n=Nr(e);if(n.length===0)return null;const r=JSON.stringify(t),i=n.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)+r+s.slice(i[a].endIndex);Q(s,c,r,i[a].startIndex,i[a].endIndex),s=c}return s},kr=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const r=n[0],i=n[1],s=r.lastIndexOf(i),a=n.index+s,c=a+i.length;return{startIndex:a,endIndex:c}},Tr=(e,t)=>{const n=kr(e);if(!n)return null;const r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i},Or=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(t);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}},Er=(e,t)=>{const n=Or(e);if(!n)return null;const r=`{flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i},Ar=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);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]]}},Dr=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(t);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]]}},Lr=(e,t)=>{const n=Ar(e);if(!n)return null;const r=n,i=r.identifiers?.[0],s=`${i}=${JSON.stringify({words:t})}`,a=e.slice(0,r.startIndex)+s+e.slice(r.endIndex);Q(e,a,s,r.startIndex,r.endIndex);const c=Dr(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},Pr=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 n=Math.min(e.length,t+700),r=e.slice(t,n),i=/("> "),([$\w]+)/,s=r.match(i);if(!s)return{prefixLocation:null,messageLocation:null};const a=t+r.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}}},Rr=(e,t,n,r,i=!1,s=!1,a=!1,c=!1,h=!1,d,m,f=!1,S=!1,v=!1,C=!1,$=!1)=>{const M=Pr(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=_n(e);if(!F)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const B=[],Y=n==="rgb(0,0,0)"&&r==="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||S||v||C||$);if(V){const N=dn(F,Y?null:n.match(/\d+/g)?.join(",")||null,Y?null:r.match(/\d+/g)?.join(",")||null,i,s,a,c,h);B.push({startIndex:M.prefixLocation.startIndex,endIndex:M.prefixLocation.endIndex,newContent:`${N}("${t}")+" "`})}if(Z){const N=dn(F,te?null:d.match(/\d+/g)?.join(",")||null,te?null:m.match(/\d+/g)?.join(",")||null,f,S,v,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,I)=>I.startIndex-N.startIndex);let A=e;for(const N of B){const I=A;A=A.slice(0,N.startIndex)+N.newContent+A.slice(N.endIndex),Q(I,A,N.newContent,N.startIndex,N.endIndex)}return A},Fr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=n[0],i=/verbose:[^,}]+/,s=r.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,c=a+s[0].length;return{startIndex:a,endIndex:c}},Vr=e=>{const t=Fr(e);if(!t)return null;const n="verbose:true",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return Q(e,r,n,t.startIndex,t.endIndex),r},jr=e=>{const n=e.indexOf("subscription, no need to monitor cost");if(n===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const r=Math.max(0,n-60),i=n,s=e.slice(r,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=r+c.index,d=h+c[0].length;return{startIndex:h,endIndex:d}},Ur=e=>{const t=jr(e);if(!t)return null;const n="if(!1)",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return Q(e,r,n,t.startIndex,t.endIndex),r},Hr=e=>{const t=/\}\.VERSION\} \(Claude Code\)/,n=e.match(t);if(!n||n.index===void 0)return null;const r=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,i=e.match(r);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]]}}},Gr=(e,t)=>{const n=Hr(e);if(!n)return null;const{versionLocation:r,sessionIdLocation:i}=n,a=`${e.slice(r.startIndex,r.endIndex)}\\n${t} (tweakcc)`,c=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);Q(e,c,a,r.startIndex,r.endIndex);const[h,d,m]=i.identifiers,f=_n(e);if(!f)return console.error("patch: versionOutput: failed to find chalk variable"),null;const S=`,${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)+S+e.slice(i.endIndex);return Q(e,v,S,i.startIndex,i.endIndex),v},Yr=async(e,t)=>{const n=await ar(t);oe()&&console.log(`Loaded ${n.length} system prompts with regexes`);for(const{promptId:r,prompt:i,regex:s,getInterpolatedContent:a}of n){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,S=h[0].length;e=e.replace(c,d);const v=Ee(i.content);await Xn(r,v),oe()&&Q(m,e,d,f,f+S)}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,n,r,i)=>{const s=Math.max(0,r-20),a=Math.min(e.length,i+20),c=Math.min(t.length,r+n.length+20),h=e.slice(s,r),d=e.slice(r,i),m=e.slice(i,a),f=t.slice(s,r),S=t.slice(r,r+n.length),v=t.slice(r+n.length,c);oe()&&d!==S&&(console.log(`
|
|
193
|
+
--- Diff ---`),console.log("OLD:",h+`\x1B[31m${d}\x1B[0m`+m),console.log("NEW:",f+`\x1B[32m${S}\x1B[0m`+v),console.log(`--- End Diff ---
|
|
194
|
+
`))},_n=e=>{const t=/\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(t)),r={};for(const a of n){const c=a[1];r[c]=(r[c]||0)+1}let i,s=0;for(const[a,c]of Object.entries(r))c>s&&(s=c,i=a);return i},vn=async(e,t)=>{await Sn(t);let n=await re.readFile(t.cliPath,{encoding:"utf8"});n=await Yr(n,t.version);let r=null;if(e.settings.themes&&e.settings.themes.length>0&&(r=fr(n,e.settings.themes))&&(n=r),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,(c,h)=>{c?(console.error("patch: figlet: failed to generate text",c),a("")):a(h||"")}))),(r=yr(n,s))&&(n=r)}return e.settings.thinkingVerbs&&((r=Lr(n,e.settings.thinkingVerbs.verbs))&&(n=r),(r=Cr(n,e.settings.thinkingVerbs.format))&&(n=r)),(r=Br(n,e.settings.thinkingStyle.phases))&&(n=r),(r=Tr(n,e.settings.thinkingStyle.updateInterval))&&(n=r),(r=Er(n,Math.max(...e.settings.thinkingStyle.phases.map(i=>i.length))+1))&&(n=r),(r=Mr(n,e.settings.thinkingStyle.reverseMirror))&&(n=r),e.settings.userMessageDisplay&&(r=Rr(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=r),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(r=xr(n,e.settings.inputBox.removeBorder))&&(n=r),(r=Vr(n))&&(n=r),(r=vr(n))&&(n=r),(r=br(n))&&(n=r),(r=Kr(n))&&(n=r),(r=ur(n,25))&&(n=r),(r=Ur(n))&&(n=r),(r=Gr(n,"2.0.2"))&&(n=r),await $n(t.cliPath,n,"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"}],Wr=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return null;const n=Math.max(0,t-600),r=t,s=e.slice(n,r).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!s||s.index===void 0)return null;let c=n+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}},zr=e=>{const t=Wr(e);if(!t)return null;const{insertionIndex:n,optionsVar:r}=t,i=De.map(a=>{const c=JSON.stringify(a.label),h=JSON.stringify(a.slug);return`${r}.push({value:${h},label:${c}});`}).join(""),s=e.slice(0,n)+i+e.slice(n);return Q(e,s,i,n,n),s},Jr=e=>{const t=e.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let r=t.index;for(;r>=0&&e[r]!=="[";)r--;if(r<0)return null;let i=r-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0||e[i]!=="=")return null;let s=r,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(r,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 S=JSON.stringify(Array.from(f)),v=e.slice(0,r)+S+e.slice(c+1);return Q(e,v,S,r,c+1),v},Xr=e=>{const n=e.indexOf('case"sonnet[1m]"');if(n===-1)return null;let r=n;for(;r>=0&&e[r]!=="{";)r--;if(r<0)return null;let i=n;for(;i<e.length&&e[i]!=="}";)i++;if(i>=e.length)return null;const s=e.slice(r,i+1),a=De.map(S=>`case${JSON.stringify(S.slug)}:return${JSON.stringify(S.internal)};`).join(""),c=s.slice(0,-1),d=(/;\s*$/.test(c)?"":";")+a,m=c+d+"}",f=e.slice(0,r)+m+e.slice(i+1);return Q(e,f,a,r+s.length-1,r+s.length-1),f},Kr=e=>{let t=e;const n=Jr(t);n&&(t=n);const r=Xr(t);r&&(t=r);const i=zr(t);return i&&(t=i),t===e?null:t};let In=!1;const oe=()=>In,qr=()=>{In=!0};function Le(){try{const e=ie.join(xe.homedir(),".claude.json");return JSON.parse(Me.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Zr(){try{const e=ie.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 Qr(){try{const e=ie.join(xe.homedir(),".claude","settings.json"),n=JSON.parse(Me.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const r=De.find(i=>i.slug===n);if(r)return r.label}catch{}return"Sonnet 4.5"}function et(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 cn(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 t=ie.dirname(e);ye.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 n=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,r,i,s]=n;return parseInt(r)<=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 n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,r,i,s]=n;return parseInt(r)<=360&&parseInt(i)<=100&&parseInt(s)<=100}}return!1}function Cn(e){if(!Ke(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let n=t.slice(1);n.length===3&&(n=n.split("").map(a=>a+a).join(""));const r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16);return`rgb(${r},${i},${s})`}if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const r=parseInt(n[1])/360,i=parseInt(n[2])/100,s=parseInt(n[3])/100,a=(S,v,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<1/6?S+(v-S)*6*C:C<1/2?v:C<2/3?S+(v-S)*(2/3-C)*6:S),c=s<.5?s*(1+i):s+i-s*i,h=2*s-c,d=Math.round(a(h,c,r+1/3)*255),m=Math.round(a(h,c,r)*255),f=Math.round(a(h,c,r-1/3)*255);return`rgb(${d},${m},${f})`}}return e}async function nt(e,t="sha256",n=64*1024){return new Promise((r,i)=>{const s=hn.createHash(t),a=Me.createReadStream(e,{highWaterMark:n});a.on("data",c=>{s.update(c)}),a.on("end",()=>{r(s.digest("hex"))}),a.on("error",c=>{i(c)})})}const dn=(e,t,n,r,i,s,a,c)=>{let h=e;return t&&(h+=`.rgb(${t})`),n&&n!=="transparent"&&(h+=`.bgRgb(${n})`),r&&(h+=".bold"),i&&(h+=".italic"),s&&(h+=".underline"),a&&(h+=".strikethrough"),c&&(h+=".inverse"),h};async function $n(e,t,n="replace"){let r=493;try{r=(await re.stat(e)).mode,oe()&&console.log(`[${n}] Original file mode for ${e}: ${(r&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,t),await re.chmod(e,r),oe()&&console.log(`[${n}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}function R({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){const s=e?.startsWith("ansi:"),a=t?.startsWith("ansi:");if(s||a){if(Re.Children.toArray(i).some(f=>Re.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),S=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;h=h[S]||h}n&&(h=h.bold),r&&(h=h.dim);const m=Re.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:n,dimColor:r,children:i})}function rt({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:s=10}){const[a,c]=T(0);return ae(()=>{const h=setInterval(()=>{c(d=>{const m=d+1;return m>=e.length+s?-r:m})},i);return()=>clearInterval(h)},[e.length,s,i]),t.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,d)=>{const m=d>=a&&d<a+r&&a<e.length,f=d%t.length,S=m?n[f]:t[f];return o(l,{color:S,children:h},d)})})}const tt=Dn.cwd();function Mn({theme:e}){const{ccVersion:t}=pe(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"})," ",t?`v${t}`:"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:"▛▘"})," ",Qr()," · ",Zr()]}),g(R,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",tt]}),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(rt,{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:t,bold:n=!1}){const r=t.colors[e];return e==="inverseText"?o(R,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith("diff")?o(R,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):o(R,{color:r,bold:n,children:e})}function Nn({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:i}){const s=je(e)||{h:0,s:50,l:50},a=Ve(e)||{r:128,g:128,b:128},[c,h]=T(s),[d,m]=T(a),[f,S]=T("hsl"),[v,C]=T("h"),[$,M]=T(!1),[F,B]=T(!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(${d.r},${d.g},${d.b})`;t(x)}},[c,d,$,F]),ae(()=>{B(!0)},[]);const Y=x=>{if(Ke(x)){const w=Cn(x),b=je(w),k=Ve(w);b&&k&&(M(!0),h(b),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(b=>b==="hsl"?"rgb":"hsl"),C(b=>f==="hsl"?b==="h"?"r":b==="s"?"g":"b":b==="r"?"h":b==="g"?"s":"l");else if(w.upArrow)C(f==="hsl"?b=>b==="h"?"l":b==="s"?"h":"s":b=>b==="r"?"b":b==="g"?"r":"g");else if(w.downArrow||w.tab)C(f==="hsl"?b=>b==="h"?"s":b==="s"?"l":"h":b=>b==="r"?"g":b==="g"?"b":"r");else if(w.leftArrow){const b=w.shift||w.ctrl||w.meta?-10:-1;j(b)}else if(w.rightArrow){const b=w.shift||w.ctrl||w.meta?10:1;j(b)}});const j=x=>{M(!0),f==="hsl"?h(w=>{const b={...w};v==="h"?b.h=Math.max(0,Math.min(359,w.h+x)):v==="s"?b.s=Math.max(0,Math.min(100,w.s+x)):v==="l"&&(b.l=Math.max(0,Math.min(100,w.l+x)));const[k,p,y]=te(b.h,b.s,b.l);return m({r:k,g:p,b:y}),b}):m(w=>{const b={...w};v==="r"?b.r=Math.max(0,Math.min(255,w.r+x)):v==="g"?b.g=Math.max(0,Math.min(255,w.g+x)):v==="b"&&(b.b=Math.max(0,Math.min(255,w.b+x)));const k=V(b.r,b.g,b.b);return h(k),b}),M(!1)},V=(x,w,b)=>{const k=x/255,p=w/255,y=b/255,O=Math.max(k,p,y),_=Math.min(k,p,y),L=O-_,ne=(O+_)/2;let le=0;L!==0&&(le=ne>.5?L/(2-O-_):L/(O+_));let se=0;return L!==0&&(O===k?se=((p-y)/L+(p<y?6:0))/6:O===p?se=((y-k)/L+2)/6:se=((k-p)/L+4)/6),{h:Math.round(se*360),s:Math.round(le*100),l:Math.round(ne*100)}},te=(x,w,b)=>{x/=360,w/=100,b/=100;const k=(1-Math.abs(2*b-1))*w,p=k*(1-Math.abs(x*6%2-1)),y=b-k/2;let O=0,_=0,L=0;return 0<=x&&x<1/6?(O=k,_=p,L=0):1/6<=x&&x<2/6?(O=p,_=k,L=0):2/6<=x&&x<3/6?(O=0,_=k,L=p):3/6<=x&&x<4/6?(O=0,_=p,L=k):4/6<=x&&x<5/6?(O=p,_=0,L=k):5/6<=x&&x<1&&(O=k,_=0,L=p),[Math.round((O+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 b=0;b<40;b++){const p=b/39*(w.length-1),y=Math.floor(p),O=Math.ceil(p),_=p-y,[L,ne,le]=w[y],[se,P,E]=w[O],D=Math.round(L+(se-L)*_),K=Math.round(ne+(P-ne)*_),W=Math.round(le+(E-le)*_);x.push(o(l,{backgroundColor:`rgb(${D},${K},${W})`,children:" "},b))}return x},Z=()=>{const x=[];for(let w=0;w<40;w++){const b=w/39*100,[k,p,y]=te(c.h,b,c.l);x.push(o(l,{backgroundColor:`rgb(${k},${p},${y})`,children:" "},w))}return x},A=()=>{const x=[];for(let w=0;w<40;w++){const b=w/39*100,[k,p,y]=te(c.h,c.s,b);x.push(o(l,{backgroundColor:`rgb(${k},${p},${y})`,children:" "},w))}return x},N=()=>{const[x,w,b]=te(c.h,c.s,c.l);return`rgb(${x},${w},${b})`},I=(x,w,b)=>{const k=p=>p.toString(16).padStart(2,"0");return`#${k(x)}${k(w)}${k(b)}`},U=()=>{const x=[];for(let w=0;w<40;w++){const b=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${b},${d.g},${d.b})`,children:" "},w))}return x},H=()=>{const x=[];for(let w=0;w<40;w++){const b=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${d.r},${b},${d.b})`,children:" "},w))}return x},ee=()=>{const x=[];for(let w=0;w<40;w++){const b=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${d.r},${d.g},${b})`,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:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",c.h,"°):"]})}),o(u,{children:z().map((x,w)=>o(Se,{children:w===G(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(Se,{children:w===G(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(Se,{children:w===G(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:U().map((x,w)=>o(Se,{children:w===G(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:H().map((x,w)=>o(Se,{children:w===G(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(Se,{children:w===G(d.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 "}),r?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:I(d.r,d.g,d.b)}):r==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:I(d.r,d.g,d.b)}):o(l,{color:N(),bold:!0,children:I(d.r,d.g,d.b)})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):o(l,{color:N(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):r==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):o(l,{color:N(),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 n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const r=n[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function je(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 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,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 S=0;return d!==0&&(c===i?S=((s-a)/d+(s<a?6:0))/6:c===s?S=((a-i)/d+2)/6:S=((i-s)/d+4)/6),{h:Math.round(S*360),s:Math.round(f*100),l:Math.round(m*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[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 S=0;m!==0&&(S=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(S*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function ot({onBack:e,themeId:t}){const{settings:{themes:n},updateSettings:r}=pe(he),[i,s]=T(t),a=n.find(A=>A.id===i)||n[0],[c,h]=T("rgb"),[d,m]=T(0),[f,S]=T(null),[v,C]=T(null),[$,M]=T(""),[F,B]=T(""),Y=gn(A=>{r(N=>{const I=N.themes.findIndex(U=>U.id===i);I!==-1&&A(N.themes[I])})},[i,r]),j=A=>{if(d>=2&&Ke(A)){const N=Cn(A),I=d-2,U=V[I];Y(H=>{H.colors[U]=N})}};ge((A,N)=>{if(f===null&&v===null){if(A.length>1&&!N.ctrl&&!N.meta){j(A);return}if(N.escape)e();else if(N.ctrl&&A==="a")h(I=>I==="rgb"?"hex":I==="hex"?"hsl":"rgb");else if(N.upArrow)m(I=>Math.max(0,I-1));else if(N.downArrow)m(I=>Math.min(V.length+1,I+1));else if(N.return)if(d===0)C("name"),M(a.name),B(a.name);else if(d===1)C("id"),M(a.id),B(a.id);else{const I=d-2,U=V[I],H=a.colors[U];S(I),M(H),B(H)}}else if(f!==null)N.ctrl&&A==="a"&&h(I=>I==="rgb"?"hex":I==="hex"?"hsl":"rgb");else if(v!==null)if(N.return){if(v==="id"){const I=i;s($),r(U=>{const H=U.themes.findIndex(ee=>ee.id===I);H!==-1&&(U.themes[H].id=$)})}else Y(I=>{I.name=$});C(null),M(""),B("")}else N.escape?(C(null),M(""),B("")):N.backspace||N.delete?M(I=>I.slice(0,-1)):A&&M(I=>I+A)});const V=Object.keys(a.colors),te=(A,N)=>{const I=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!I)return A;const U=parseInt(I[1]),H=parseInt(I[2]),ee=parseInt(I[3]);switch(N){case"hex":{const G=x=>x.toString(16).padStart(2,"0");return`#${G(U)}${G(H)}${G(ee)}`}case"hsl":{const G=U/255,x=H/255,w=ee/255,b=Math.max(G,x,w),k=Math.min(G,x,w),p=b-k,y=(b+k)/2;let O=0;p!==0&&(O=y>.5?p/(2-b-k):p/(b+k));let _=0;return p!==0&&(b===G?_=((x-w)/p+(x<w?6:0))/6:b===x?_=((w-G)/p+2)/6:_=((G-x)/p+4)/6),`hsl(${Math.round(_*360)}, ${Math.round(O*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]||"",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 G=V.slice(0,20);return g(ce,{children:[G.map((x,w)=>{const b=w+2;return g(u,{children:[o(l,{color:d===b?"yellow":"white",children:d===b?"❯ ":" "}),o(u,{width:Z+2,children:o(l,{children:o(Fe,{colorKey:x,theme:a,bold:!0})})}),o(R,{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 N=d-2,I=Math.max(0,N-Math.floor(20/2)),U=Math.min(V.length,I+20),H=Math.max(0,U-20),ee=V.slice(H,U);return g(ce,{children:[H>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",H," more above"]}),ee.map((G,x)=>{const b=H+x+2;return g(u,{children:[o(l,{color:d===b?"yellow":"white",children:d===b?"❯ ":" "}),o(u,{width:Z+2,children:o(l,{children:o(Fe,{colorKey:G,theme:a,bold:!0})})}),o(R,{color:a.colors[G],children:te(a.colors[G],c)})]},G)}),U<V.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-U," 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(Nn,{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(Mn,{theme:a})})]})}function it(e){return e.map(t=>`${t.name} (${t.id})`)}function st({onBack:e}){const{settings:{themes:t},updateSettings:n}=pe(he),[r,i]=T(0),[s,a]=T(null),[c,h]=T(!0),d=()=>{const $={colors:{...(t[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(M=>{M.themes.push($)}),a($.id),h(!1)},m=C=>{t.length<=1||(n($=>{$.themes=$.themes.filter(M=>M.id!==C)}),r>=t.length-1&&i(Math.max(0,t.length-2)))},f=()=>{n(C=>{C.themes=[...q.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(t.length-1,M+1));else if($.return){const M=t[r];M&&(a(M.id),h(!1))}else if(C==="n")d();else if(C==="d"){const M=t[r];M&&m(M.id)}else $.ctrl&&C==="r"&&f()},{isActive:c}),s)return o(ot,{themeId:s,onBack:()=>{a(null),h(!0)}});const S=it(t),v=t.find(C=>S[r]?.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:S.map((C,$)=>g(l,{color:r===$?"yellow":void 0,children:[r===$?"❯ ":" ",C]},$))})]}),o(u,{width:"50%",children:o(Mn,{theme:v})})]})}let Ue=["ANSI Shadow"];function lt({onBack:e}){const{stdout:t}=kn(),n=t?.columns||120,{settings:{launchText:{method:r,figletText:i,figletFont:s,customText:a},themes:c},updateSettings:h}=pe(he),d=r==="figlet"?["method","text","font"]:["method","text"],[m,f]=T(0),S=d[m],[v,C]=T(r==="figlet"?0:1),[$,M]=T(Ue),[F,B]=T(Ue),[Y,j]=T(""),[V,te]=T(!1),[z,Z]=T(0),[A,N]=T(""),[I,U]=T(50),[H,ee]=T(!1),[G,x]=T(r==="figlet"?i:a),w=Le(),k=(c.find(y=>y.id===w)||c.find(y=>y.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{He.fonts((y,O)=>{if(!y&&O){const _=O.sort();M(_),B(_),Ue=_;const L=_.indexOf(s);Z(L>=0?L:_.indexOf("ANSI Shadow")||0)}})},[]),ae(()=>{p()},[r,i,s,a,G,H]);const p=()=>{if(r==="figlet")try{const y=H?G:i,O=He.textSync(y.replace(`
|
|
196
|
+
`," "),{font:s}),_=Math.floor(n*.7),ne=O.split(`
|
|
197
|
+
`).map(E=>E.length>_?E.substring(0,_-3)+"…":E),le=ne.join(`
|
|
198
|
+
`);N(le);const se=Math.max(...ne.map(E=>E.length)),P=Math.min(75,Math.max(50,Math.ceil(se/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),ne=L.join(`
|
|
200
|
+
`);N(ne);const le=Math.max(...L.map(P=>P.length)),se=Math.min(75,Math.max(50,Math.ceil(le/n*100)));U(se+5)}};return ae(()=>{if(Y){const y=$.filter(O=>O.toLowerCase().includes(Y.toLowerCase()));B(y),Z(0)}else{B($);const y=$.indexOf(s);Z(y>=0?y:0)}},[Y,$]),ae(()=>{if(!V){const y=F.indexOf(s);y>=0&&Z(y)}},[s,F,V]),ge((y,O)=>{if(H){O.return?(h(r==="figlet"?_=>{_.launchText.figletText=G}:_=>{_.launchText.customText=G}),ee(!1)):O.escape?(x(r==="figlet"?i:a),ee(!1)):O.backspace||O.delete?x(_=>_.slice(0,-1)):y&&x(_=>_+y);return}if(V){if(O.return)F.length>0&&h(_=>{_.launchText.figletFont=F[z]}),te(!1),j("");else if(O.escape)te(!1),j("");else if(O.backspace||O.delete)j(_=>_.slice(0,-1));else if(O.upArrow){const _=z>0?z-1:F.length-1;Z(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else if(O.downArrow){const _=z<F.length-1?z+1:0;Z(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else y&&y.match(/^[a-zA-Z0-9\s\-_]$/)&&j(_=>_+y);return}if(O.escape)e();else if(O.return)S==="text"&&(x(r==="figlet"?i:a),ee(!0));else if(O.tab)O.shift?f(_=>_===0?d.length-1:_-1):f(_=>_===d.length-1?0:_+1);else if(O.upArrow){if(S==="method"){const _=v>0?v-1:1;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&r==="figlet"){const _=z>0?z-1:F.length-1;Z(_),h(L=>{L.launchText.figletFont=F[_]})}}else if(O.downArrow){if(S==="method"){const _=v<1?v+1:0;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&r==="figlet"){const _=z<F.length-1?z+1:0;Z(_),h(L=>{L.launchText.figletFont=F[_]})}}else y&&S==="font"&&r==="figlet"&&y.match(/^[a-zA-Z0-9]$/)&&(te(!0),j(y))}),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 ",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: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: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:r==="figlet"?i:a})})}),r==="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 O=Math.max(0,z-Math.floor(4)),_=Math.min(F.length,O+8),L=Math.max(0,_-8),ne=F.slice(L,_);return g(ce,{children:[L>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),ne.map((le,se)=>{const P=L+se;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:`${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((y,O)=>o(l,{color:k,children:y},O)),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:n},themes:r},updateSettings:i}=pe(he),s=["format","verbs"],[a,c]=T(0),h=s[a],[d,m]=T(0),[f,S]=T(!1),[v,C]=T(""),[$,M]=T(!1),[F,B]=T(!1),[Y,j]=T(t),V=Le(),z=(r.find(A=>A.id===V)||r.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";ge((A,N)=>{if(F){N.return?(i(I=>{I.thinkingVerbs.format=Y}),B(!1)):N.escape?(j(t),B(!1)):N.backspace||N.delete?j(I=>I.slice(0,-1)):A&&j(I=>I+A);return}if(f||$){N.return&&v.trim()?($?(i(I=>{I.thinkingVerbs.verbs.push(v.trim())}),M(!1)):(i(I=>{I.thinkingVerbs.verbs[d]=v.trim()}),S(!1)),C("")):N.escape?(C(""),S(!1),M(!1)):N.backspace||N.delete?C(I=>I.slice(0,-1)):A&&C(I=>I+A);return}N.escape?e():N.return?h==="format"&&(j(t),B(!0)):N.tab?N.shift?c(I=>I===0?s.length-1:I-1):c(I=>I===s.length-1?0:I+1):N.upArrow?h==="verbs"&&n.length>0&&m(I=>I>0?I-1:n.length-1):N.downArrow?h==="verbs"&&n.length>0&&m(I=>I<n.length-1?I+1:0):A==="e"&&h==="verbs"?n.length>0&&(C(n[d]),S(!0)):A==="d"&&h==="verbs"?n.length>1&&(i(I=>{I.thinkingVerbs.verbs=I.thinkingVerbs.verbs.filter((U,H)=>H!==d)}),d>=n.length-1&&m(Math.max(0,n.length-2))):A==="n"&&h==="verbs"?(M(!0),C("")):N.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 N=Math.max(0,d-Math.floor(4)),I=Math.min(n.length,N+8),U=Math.max(0,I-8),H=n.slice(U,I);return g(ce,{children:[U>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),H.map((ee,G)=>{const x=U+G;return g(l,{color:h==="verbs"&&x===d?"cyan":void 0,children:[h==="verbs"&&x===d?"❯ ":" ",ee]},x)}),I<n.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",n.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,n[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:n,reverseMirror:r},themes:i},updateSettings:s}=pe(he),a=["reverseMirror","updateInterval","phases","presets"],[c,h]=T(0),d=a[c],[m,f]=T(0),[S,v]=T(0),[C,$]=T(!1),[M,F]=T(""),[B,Y]=T(!1),[j,V]=T(!1),[te,z]=T(n.toString()),[Z,A]=T(0),N=Le(),U=(i.find(b=>b.id===N)||i.find(b=>b.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{if(t.length>0){const b=r?[...t,...[...t].reverse().slice(1,-1)]:t,k=setInterval(()=>{A(p=>(p+1)%b.length)},n);return()=>clearInterval(k)}},[t,n,r]),ge((b,k)=>{if(j){if(k.return){const p=parseInt(te);!isNaN(p)&&p>0&&s(y=>{y.thinkingStyle.updateInterval=p}),V(!1)}else k.escape?(z(n.toString()),V(!1)):k.backspace||k.delete?z(p=>p.slice(0,-1)):b&&b.match(/^[0-9]$/)&&z(p=>p+b);return}if(C||B){if(k.return&&M.length){const p=B?[...t,M]:t.map((y,O)=>O===m?M:y);s(y=>{y.thinkingStyle.phases=p}),$(!1),F("")}else k.escape?(F(""),$(!1),Y(!1)):k.backspace||k.delete?F(p=>p.slice(0,-1)):b&&F(p=>p+b);return}if(k.escape)e();else if(k.return)if(d==="updateInterval")z(n.toString()),V(!0);else if(d==="presets"){const p=we[S];s(y=>{y.thinkingStyle.phases=[...p.phases],y.thinkingStyle.reverseMirror=p.reverseMirror})}else d==="reverseMirror"&&s(p=>{p.thinkingStyle.reverseMirror=!p.thinkingStyle.reverseMirror});else if(k.tab)k.shift?h(p=>p===0?a.length-1:p-1):h(p=>p===a.length-1?0:p+1);else if(k.upArrow)d==="phases"&&t.length>0?f(p=>p>0?p-1:t.length-1):d==="presets"&&v(p=>p>0?p-1:we.length-1);else if(k.downArrow)d==="phases"&&t.length>0?f(p=>p<t.length-1?p+1:0):d==="presets"&&v(p=>p<we.length-1?p+1:0);else if(b===" ")d==="reverseMirror"&&s(p=>{p.thinkingStyle.reverseMirror=!p.thinkingStyle.reverseMirror});else if(b==="e"&&d==="phases")t.length>0&&(F(t[m]),$(!0));else if(b==="a"&&d==="phases")Y(!0),F("");else if(b==="d"&&d==="phases")t.length>1&&(s(p=>{p.thinkingStyle.phases=t.filter((y,O)=>O!==m)}),m>=t.length&&f(Math.max(0,t.length-1)));else if(b==="w"&&d==="phases"){if(m>0){const p=[...t];[p[m-1],p[m]]=[p[m],p[m-1]],s(y=>{y.thinkingStyle.phases=p}),f(y=>y-1)}}else if(b==="s"&&d==="phases"){if(m<t.length-1){const p=[...t];[p[m],p[m+1]]=[p[m+1],p[m]],s(y=>{y.thinkingStyle.phases=p}),f(y=>y+1)}}else k.ctrl&&b==="r"&&(s(p=>{p.thinkingStyle=q.thinkingStyle}),f(0),v(0))});const H=r?"●":"○",ee=50,x=r?[...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: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: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:[H," ",r?"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"&&(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?te:n})})})]})]}),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)),p=Math.min(t.length,k+8),y=Math.max(0,p-8),O=t.slice(y,p);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),O.map((_,L)=>{const ne=y+L;return g(l,{color:d==="phases"&&ne===m?"cyan":void 0,children:[d==="phases"&&ne===m?"❯ ":" ",_]},ne)}),p<t.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-p," 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: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,S-Math.floor(4)),p=Math.min(we.length,k+8),y=Math.max(0,p-8),O=we.slice(y,p);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),O.map((_,L)=>{const ne=y+L;return g(l,{color:d==="presets"&&ne===S?"cyan":void 0,children:[d==="presets"&&ne===S?"❯ ":" ",_.name," ",_.phases.join("")]},ne)}),p<we.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",we.length-p," 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:n}=pe(he),[r,i]=T("prefix"),[s,a]=T(0),[c,h]=T(!1),[d,m]=T(()=>t.userMessageDisplay.prefix.format),[f,S]=T(0),[v,C]=T(()=>[...t.userMessageDisplay.prefix.styling]),[$,M]=T(()=>t.userMessageDisplay.prefix.foreground_color),[F,B]=T(()=>t.userMessageDisplay.prefix.background_color),[Y,j]=T(0),[V,te]=T(0),[z,Z]=T(()=>[...t.userMessageDisplay.message.styling]),[A,N]=T(()=>t.userMessageDisplay.message.foreground_color),[I,U]=T(()=>t.userMessageDisplay.message.background_color),[H,ee]=T(null),[G,x]=T(""),w=Le(),b=t.themes?.find(P=>P.id===w)||t.themes?.[0],k=["format","styling","foreground","background"],p=["styling","foreground","background"],y=k[s],O=p[Y],_=(P,E)=>{n(D=>{const K=P==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;E(K)})},L=P=>{n(E=>{P==="prefix"?E.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:E.userMessageDisplay.message={...q.userMessageDisplay.message}}),P==="prefix"?(m(q.userMessageDisplay.prefix.format),C([...q.userMessageDisplay.prefix.styling]),M(q.userMessageDisplay.prefix.foreground_color),B(q.userMessageDisplay.prefix.background_color)):(Z([...q.userMessageDisplay.message.styling]),N(q.userMessageDisplay.message.foreground_color),U(q.userMessageDisplay.message.background_color))};ae(()=>{const P=t.userMessageDisplay.prefix;m(P.format),C([...P.styling]),M(P.foreground_color),B(P.background_color);const E=t.userMessageDisplay.message;Z([...E.styling]),N(E.foreground_color),U(E.background_color)},[]),ge((P,E)=>{if(c){if(E.return)_("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)):P&&m(D=>D+P);return}if(H===null){if(E.escape)e();else if(E.ctrl&&P==="r")L(r);else if(E.leftArrow||E.rightArrow)i(D=>D==="prefix"?"message":"prefix");else if(E.tab)r==="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?p.length-1:D-1):j(D=>D===p.length-1?0:D+1);else if(E.return)r==="prefix"?y==="format"?h(!0):y==="foreground"?(x($),ee({column:"prefix",type:"foreground"})):y==="background"&&(x(F),ee({column:"prefix",type:"background"})):O==="foreground"?(x(A),ee({column:"message",type:"foreground"})):O==="background"&&(x(I),ee({column:"message",type:"background"}));else if(E.upArrow)r==="prefix"&&y==="styling"?S(D=>Math.max(0,D-1)):r==="message"&&O==="styling"&&te(D=>Math.max(0,D-1));else if(E.downArrow)r==="prefix"&&y==="styling"?S(D=>Math.min(Ce.length-1,D+1)):r==="message"&&O==="styling"&&te(D=>Math.min(Ce.length-1,D+1));else if(P===" "){if(r==="prefix"&&y==="styling"){const D=Ce[f].value,K=v.indexOf(D)>=0?v.filter(W=>W!==D):[...v,D];C(K),_("prefix",W=>{W.styling=[...K]})}else if(r==="message"&&O==="styling"){const D=Ce[V].value,K=z.indexOf(D)>=0?z.filter(W=>W!==D):[...z,D];Z(K),_("message",W=>{W.styling=[...K]})}}}});const ne=(P,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:P}):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:P})},le=(P=!0)=>g(l,{children:[d&&g(ce,{children:[ne(d,"prefix",P)," "]}),ne("list the dir","message",P)]}),se=P=>{const E=r===P,W=(P==="prefix"?k:p)[P==="prefix"?s:Y],ve=P==="prefix"?f:V,Ie=P==="prefix"?v:z,Be=P==="prefix"?$:A,qe=P==="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:[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: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((Pe,Ze)=>o(u,{children:g(l,{color:E&&W==="styling"&&ve===Ze?"cyan":void 0,children:[E&&W==="styling"&&ve===Ze?"❯ ":" ",Ie.includes(Pe.value)?"●":"○"," ",Pe.label]})},Pe.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(H){const{column:P,type:E}=H;return o(Nn,{initialValue:G,theme:b,onColorChange:D=>{P==="prefix"?E==="foreground"?(M(D),_("prefix",K=>{K.foreground_color=D})):(B(D),_("prefix",K=>{K.background_color=D})):E==="foreground"?(N(D),_("message",K=>{K.foreground_color=D})):(U(D),_("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:b?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:b?.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:b?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:b?.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:n}=pe(he),[r,i]=T(0),s=()=>{n(c=>{c.inputBox||(c.inputBox={removeBorder:!1}),c.inputBox.removeBorder=!c.inputBox.removeBorder})};ge((c,h)=>{h.return||h.escape?e():c===" "&&r===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:r===0?"cyan":void 0,children:r===0?"❯ ":" "}),o(l,{bold:!0,color:r===0?"cyan":void 0,children:"Remove border"})]})}),r===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=On({settings:q,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function ht({startupCheckInfo:e}){const[t,n]=T({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ae(()=>{(async()=>{n(await Xe())})()},[]);const r=gn(m=>{const f=JSON.parse(JSON.stringify(t.settings));m(f),n(S=>({...S,settings:f,changesApplied:!1})),Ae(S=>{S.settings=f,S.changesApplied=!1})},[t.settings]),[i,s]=T(null),[a,c]=T(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"}),
|
|
203
|
+
Please reapply your changes below.`,type:"warning"}),r(()=>{}))},[]),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"}),vn(t,e.ccInstInfo).then(f=>{n(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&&Sn(e.ccInstInfo).then(()=>{c({message:"Original Claude Code restored successfully!",type:"success"}),r(()=>{})});break;case J.OPEN_CONFIG:cn(de);break;case J.OPEN_CLI:e.ccInstInfo&&cn(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},d=()=>{s(null)};return o(he.Provider,{value:{settings:t.settings,updateSettings:r,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(u,{flexDirection:"column",children:i===null?o(Un,{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 Tn;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("2.0.2").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&qr(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${de}`);const r=await Xe();(!r.settings||Object.keys(r.settings).length===0)&&(console.error("No saved customizations found in "+de),process.exit(1));const i=await an();(!i||!i.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Ge.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 sn(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 vn(r,i.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await an();if(n){const r=await sn(n.ccInstInfo.version);r.success||(console.log(X.red(`
|
|
206
|
+
✖ Error downloading system prompts:`)),console.log(X.red(` ${r.errorMessage}`)),console.log(X.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
|
|
207
|
+
`))),Bn(o(ht,{startupCheckInfo:n}))}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
210
|
${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(`
|
|
@@ -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)
|
|
228
|
+
`),process.exit(1)};ut();
|