tweakcc 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Box as a,Text as o,render as nr,useInput as ae,useStdout as tr}from"ink";import{Command as or}from"commander";import{Fragment as me,createContext as ir,useCallback as ze,useContext as ge,useEffect as se,useState as $}from"react";import sr from"ink-link";import{Fragment as ce,jsx as n,jsxs as l}from"react/jsx-runtime";import*as Ce from"node:path";import Ge from"node:path";import*as Ie from"node:os";import{globbySync as ee}from"globby";import*as He from"node:fs";import*as Se from"node:fs/promises";import ue from"node:fs/promises";import*as Ae from"node:child_process";import*as lr from"node:crypto";import Be from"figlet";import ne from"chalk";function cr({items:e,selectedIndex:t,onSelect:r,onSubmit:i}){return ae((s,c)=>{c.upArrow?r(t>0?t-1:e.length-1):c.downArrow?r(t<e.length-1?t+1:0):c.return&&i(e[t].name)}),n(a,{flexDirection:"column",children:e.map((s,c)=>n(a,{children:l(o,{children:[l(o,{bold:c===t,color:c===t?"cyan":void 0,...c===t?s.selectedStyles??{}:s.styles??{},children:[c===t?"❯ ":" ",s.name]}),s.desc&&c===t&&l(o,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",s.desc]})]})},c))})}let Y=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const 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)",permission:"rgb(177,185,249)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",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)"}},{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)",permission:"rgb(87,105,247)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",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)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"#cd00cd",bashBorder:"#cd00cd",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#0000ee",planMode:"#00cdcd",ide:"#4782C8",secondaryBorder:"#e5e5e5",text:"#000000",inverseText:"#ffffff",secondaryText:"#7f7f7f",suggestion:"#0000ee",remember:"#0000ee",success:"#00cd00",error:"#cd0000",warning:"#cdcd00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#cd0000",blue_FOR_SUBAGENTS_ONLY:"#0000cd",green_FOR_SUBAGENTS_ONLY:"#00cd00",yellow_FOR_SUBAGENTS_ONLY:"#cdcd00",purple_FOR_SUBAGENTS_ONLY:"#cd00cd",orange_FOR_SUBAGENTS_ONLY:"#cd8500",pink_FOR_SUBAGENTS_ONLY:"#ff1493",cyan_FOR_SUBAGENTS_ONLY:"#00cdcd"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"#ff00ff",bashBorder:"#ff00ff",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#5c5cff",planMode:"#00ffff",ide:"#4782c8",secondaryBorder:"#e5e5e5",text:"#ffffff",inverseText:"#000000",secondaryText:"#e5e5e5",suggestion:"#5c5cff",remember:"#5c5cff",success:"#00ff00",error:"#ff0000",warning:"#ffff00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#ff0000",blue_FOR_SUBAGENTS_ONLY:"#0000ff",green_FOR_SUBAGENTS_ONLY:"#00ff00",yellow_FOR_SUBAGENTS_ONLY:"#ffff00",purple_FOR_SUBAGENTS_ONLY:"#ff00ff",orange_FOR_SUBAGENTS_ONLY:"#ff8700",pink_FOR_SUBAGENTS_ONLY:"#ff69b4",cyan_FOR_SUBAGENTS_ONLY:"#00ffff"}},{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)",permission:"rgb(51,102,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",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)"}},{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)",permission:"rgb(153,204,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",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)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:{}.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Ee=Ce.join(Ie.homedir(),".tweakcc"),le=Ce.join(Ee,"config.json"),pe=Ce.join(Ee,"cli.js.backup"),ar=()=>{const e=[],t=process.platform=="win32"?Ie.homedir().replace(/\\/g,"/"):Ie.homedir(),r="node_modules/@anthropic-ai/claude-code";return e.push(`${Ie.homedir()}/.claude/local/${r}`),{}.NPM_PREFIX&&e.push(`${{}.NPM_PREFIX}/lib/${r}`),{}.N_PREFIX&&e.push(`${{}.N_PREFIX}/lib/${r}`),{}.VOLTA_HOME&&e.push(`${{}.VOLTA_HOME}/lib/${r}`),{}.FNM_DIR&&e.push(`${{}.FNM_DIR}/lib/${r}`),{}.NVM_DIR&&e.push(`${{}.NVM_DIR}/lib/${r}`),{}.NODENV_ROOT&&e.push(...ee(`${{}.NODENV_ROOT}/versions/*/lib/${r}`)),{}.NVS_HOME&&e.push(...ee(`${{}.NVS_HOME}/node/*/*/lib/${r}`)),{}.ASDF_DATA_DIR&&e.push(...ee(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`)),process.platform=="win32"?(e.push(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),e.push(`${t}/AppData/Roaming/npm/${r}`),e.push(...ee(`${t}/AppData/Roaming/nvm/*/${r}}`)),e.push(`${t}/AppData/Local/Yarn/config/global/${r}`),e.push(...ee(`${t}/AppData/Local/pnpm/global/*/${r}`)),e.push(...ee(`${t}/n/versions/node/*/lib/${r}`)),e.push(`${t}/AppData/Roaming/Yarn/config/global/${r}`),e.push(`${t}/AppData/Roaming/pnpm-global/${r}`),e.push(...ee(`${t}/AppData/Roaming/pnpm-global/*/${r}`)),e.push(`${t}/.bun/install/global/${r}`),e.push(...ee(`${t}/AppData/Local/fnm_multishells/*/node_modules/${r}`))):(process.platform=="darwin"&&(e.push(`${t}/Library/${r}`),e.push(`/opt/local/lib/${r}`)),e.push(`${t}/.local/lib/${r}`),e.push(`${t}/.local/share/${r}`),e.push(`${t}/.npm-global/lib/${r}`),e.push(`${t}/.npm-packages/lib/${r}`),e.push(`${t}/.npm/lib/${r}`),e.push(`${t}/npm/lib/${r}`),e.push(`/etc/${r}`),e.push(`/lib/${r}`),e.push(`/opt/node/lib/${r}`),e.push(`/usr/lib/${r}`),e.push(`/usr/local/lib/${r}`),e.push(`/usr/share/${r}`),e.push(`/var/lib/${r}`),e.push(`/opt/homebrew/lib/${r}`),e.push(`${t}/.config/yarn/global/${r}`),e.push(`${t}/.yarn/global/${r}`),e.push(`${t}/.bun/install/global/${r}`),e.push(`${t}/.pnpm-global/${r}`),e.push(...ee(`${t}/.pnpm-global/*/${r}`)),e.push(`${t}/pnpm-global/${r}`),e.push(...ee(`${t}/pnpm-global/*/${r}`)),e.push(`${t}/.local/share/pnpm/global/${r}`),e.push(...ee(`${t}/.local/share/pnpm/global/*/${r}`)),e.push(`${t}/.bun/install/global/${r}`),e.push(...ee(`/usr/local/n/versions/node/*/lib/${r}`)),e.push(...ee(`${t}/n/versions/node/*/lib/${r}`)),e.push(`${t}/n/lib/${r}`),e.push(...ee(`${t}/.volta/tools/image/node/*/lib/${r}`)),e.push(...ee(`${t}/.fnm/node-versions/*/installation/lib/${r}`)),e.push(...ee(`/usr/local/nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${t}/.nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${t}/.nodenv/versions/*/lib/${r}`)),e.push(...ee(`${t}/.nvs/*/lib/${r}`)),e.push(...ee(`${t}/.asdf/installs/nodejs/*/lib/${r}`))),process.platform=="win32"?e.map(i=>i.replace(/\//g,"\\")):e},Me=ar(),dr=({children:e,...t})=>l(o,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var de=dr;const hr=[{name:Y.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:Y.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:Y.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:Y.THINKING_STYLE,desc:"Choose custom spinners"},{name:Y.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:Y.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],gr=[{name:Y.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:Y.OPEN_CONFIG,desc:`Opens your tweakcc config file (${le})`},{name:Y.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Y.EXIT,desc:"Bye!"}];function ur({onSubmit:e,notification:t}){const r=[...ge(he).changesApplied?[]:[{name:Y.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...hr,...gr],[i,s]=$(0);return l(a,{flexDirection:"column",children:[n(a,{marginBottom:1,children:n(de,{children:"Tweak Claude Code"})}),n(a,{marginBottom:1,children:l(o,{color:"gray",children:[n(o,{bold:!0,children:"Customize your Claude Code installation."})," ",n(o,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),n(a,{marginBottom:1,children:l(o,{color:"yellow",children:["⭐ ",n(o,{bold:!0,children:"Star the repo at "}),n(sr,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:n(o,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),n(o,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&n(a,{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:n(o,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),n(cr,{items:r,selectedIndex:i,onSelect:s,onSubmit:c=>e(c)})]})}function Je({theme:e}){return l(a,{flexDirection:"column",paddingLeft:1,children:[n(a,{marginBottom:1,children:l(o,{bold:!0,children:["Preview: ",e.name]})}),n(a,{borderStyle:"single",borderColor:"gray",paddingX:1,children:l(a,{flexDirection:"column",children:[n(o,{children:"╭─────────────────────────────────────────────╮"}),l(o,{children:["│ ",n(o,{color:e.colors.secondaryText,children:"1"})," ",l(o,{color:e.colors.text,children:["function greet() ","{"]})," ","│"]}),l(o,{children:["│ ",n(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:['- console.log("',n(o,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),'");']})," ","│"]}),l(o,{children:["│ ",n(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:['+ console.log("',n(o,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),'");']})," ","│"]}),n(o,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),l(o,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),l(o,{children:[n(o,{color:e.colors.warning,children:"│ "}),n(o,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),l(o,{color:e.colors.warning,children:[" ","│"]})]}),n(o,{color:e.colors.claude,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[n(o,{color:e.colors.claude,children:"│ "}),n(o,{color:e.colors.claude,children:"✻"}),n(o,{children:" Welcome to Tweak Claude Code!"}),l(o,{color:e.colors.claude,children:[" ","│"]})]}),l(o,{children:[n(o,{color:e.colors.claude,children:"│"}),l(o,{color:e.colors.secondaryText,italic:!0,children:[" ","/help for help, /status for your current set"]}),n(o,{color:e.colors.claude,children:"│"})]}),l(o,{color:e.colors.success,children:["Login successful. Press ",n(o,{bold:!0,children:"Enter"})," to continue…"]}),n(o,{color:e.colors.bashBorder,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[n(o,{color:e.colors.bashBorder,children:"│ !"}),l(o,{children:[" ls"," "]}),n(o,{color:e.colors.bashBorder,children:"│"})]}),n(o,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[n(o,{color:e.colors.planMode,children:"│ "}),n(o,{color:e.colors.permission,children:"Ready to code?"}),l(o,{color:e.colors.planMode,children:[" ","│"]})]}),l(o,{children:[n(o,{color:e.colors.planMode,children:"│ "}),n(o,{children:"Here is Claude's plan:"}),l(o,{color:e.colors.planMode,children:[" ","│"]})]}),n(o,{color:e.colors.secondaryBorder,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[n(o,{color:e.colors.secondaryBorder,children:"│"})," ",l(o,{color:e.colors.secondaryText,children:["> Try “refactor <filepath>”"," ","│"]})]}),n(o,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[l(o,{color:e.colors.permission,children:["│ ",n(o,{bold:!0,children:"Permissions:"})]})," ",l(o,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",n(o,{color:e.colors.permission,children:"│"})]}),n(o,{color:e.colors.secondaryText,children:"> list the dir"}),l(o,{children:[n(o,{color:e.colors.error,children:"●"}),n(o,{children:" Update(__init__.py)"})]}),l(o,{children:[n(o,{children:" ⎿ "}),n(o,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),l(o,{children:[" ",n(o,{color:e.colors.secondaryText,children:"1"})," ",l(o,{backgroundColor:e.colors.diffRemovedDimmed,color:e.colors.text,children:["- import"," ",n(o,{backgroundColor:e.colors.diffRemovedWordDimmed,color:e.colors.text,children:"os"})]})]}),l(o,{children:[" ",n(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffAddedDimmed,color:e.colors.text,children:["+ import"," ",n(o,{backgroundColor:e.colors.diffAddedWordDimmed,color:e.colors.text,children:"random"})]})]}),l(o,{children:[n(o,{color:e.colors.success,children:"●"}),n(o,{children:" List(.)"})]}),n(o,{children:" ⎿ Listed 123 paths (ctrl+r to expand)"}),l(o,{children:[n(o,{color:e.colors.secondaryText,children:"●"}),n(o,{children:" The directory "}),n(o,{color:e.colors.permission,children:"C:\\Users\\user"}),l(o,{children:[" ","contains ",n(o,{bold:!0,children:"123"})," files."]})]}),l(o,{children:[l(o,{color:e.colors.claude,children:["✻ Th",n(o,{color:e.colors.claudeShimmer,children:"ink"}),"ing…"," "]}),n(o,{color:e.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]}),l(o,{children:[l(o,{color:e.colors.autoAccept,children:["⏵⏵ auto-accept edits on"," "]}),n(o,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),l(o,{children:[n(o,{color:e.colors.planMode,children:"⏸ plan mode on "}),n(o,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),n(o,{children:n(o,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Fe({colorKey:e,theme:t,bold:r=!1}){const i=t.colors[e];return e==="inverseText"?n(o,{color:i,backgroundColor:t.colors.permission,bold:r,children:e}):e.startsWith("diff")?n(o,{backgroundColor:i,bold:r,color:t.colors.text,children:e}):n(o,{color:i,bold:r,children:e})}let Xe=!1;const ie=()=>Xe,fr=()=>{Xe=!0};function Te(){try{const e=Ce.join(Ie.homedir(),".claude.json");return JSON.parse(He.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Ve(e){if(process.platform==="win32")Ae.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ae.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=Ce.dirname(e);Ae.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function Le(e){if(!e||typeof e!="string")return!1;const t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){const r=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,i,s,c]=r;return parseInt(i)<=255&&parseInt(s)<=255&&parseInt(c)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,i,s,c]=r;return parseInt(i)<=360&&parseInt(s)<=100&&parseInt(c)<=100}}return!1}function Ke(e){if(!Le(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let r=t.slice(1);r.length===3&&(r=r.split("").map(g=>g+g).join(""));const i=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),c=parseInt(r.slice(4,6),16);return`rgb(${i},${s},${c})`}if(t.startsWith("hsl(")){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const i=parseInt(r[1])/360,s=parseInt(r[2])/100,c=parseInt(r[3])/100,g=(C,v,D)=>(D<0&&(D+=1),D>1&&(D-=1),D<1/6?C+(v-C)*6*D:D<1/2?v:D<2/3?C+(v-C)*(2/3-D)*6:C),h=c<.5?c*(1+s):c+s-c*s,f=2*c-h,d=Math.round(g(f,h,i+1/3)*255),y=Math.round(g(f,h,i)*255),T=Math.round(g(f,h,i-1/3)*255);return`rgb(${d},${y},${T})`}}return e}async function mr(e,t="sha256",r=64*1024){return new Promise((i,s)=>{const c=lr.createHash(t),g=He.createReadStream(e,{highWaterMark:r});g.on("data",h=>{c.update(h)}),g.on("end",()=>{i(c.digest("hex"))}),g.on("error",h=>{s(h)})})}const We=(e,t,r,i,s,c,g,h)=>{let f=e;return t&&(f+=`.rgb(${t})`),r&&r!=="transparent"&&(f+=`.bgRgb(${r})`),i&&(f+=".bold"),s&&(f+=".italic"),c&&(f+=".underline"),g&&(f+=".strikethrough"),h&&(f+=".inverse"),f};async function Ze(e,t,r="replace"){let i=493;try{i=(await Se.stat(e)).mode,ie()&&console.log(`[${r}] Original file mode for ${e}: ${(i&parseInt("777",8)).toString(8)}`)}catch(s){ie()&&console.log(`[${r}] Could not stat ${e} (error: ${s}), using default mode 755`)}try{await Se.unlink(e),ie()&&console.log(`[${r}] Unlinked ${e} to break hard links`)}catch(s){ie()&&console.log(`[${r}] Could not unlink ${e}: ${s}`)}await Se.writeFile(e,t),await Se.chmod(e,i),ie()&&console.log(`[${r}] Restored permissions to ${(i&parseInt("777",8)).toString(8)}`)}function qe({initialValue:e,onColorChange:t,onExit:r,colorKey:i,theme:s}){const c=Ne(e)||{h:0,s:50,l:50},g=Oe(e)||{r:128,g:128,b:128},[h,f]=$(c),[d,y]=$(g),[T,C]=$("hsl"),[v,D]=$("h"),[k,_]=$(!1),[R,P]=$(!1);se(()=>{const b=Ne(e),m=Oe(e);b&&m&&(_(!0),f(b),y(m),_(!1))},[e]),se(()=>{if(!k&&R){const b=`rgb(${d.r},${d.g},${d.b})`;t(b)}},[h,d,k,R]),se(()=>{P(!0)},[]);const J=b=>{if(Le(b)){const m=Ke(b),p=Ne(m),M=Oe(m);p&&M&&(_(!0),f(p),y(M),_(!1))}};ae((b,m)=>{if(b.length>1&&!m.ctrl&&!m.meta){J(b);return}if(m.return)r();else if(m.escape)r();else if(m.ctrl&&b==="a")C(p=>p==="hsl"?"rgb":"hsl"),D(p=>T==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(m.upArrow)D(T==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(m.downArrow||m.tab)D(T==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(m.leftArrow){const p=m.shift||m.ctrl||m.meta?-10:-1;z(p)}else if(m.rightArrow){const p=m.shift||m.ctrl||m.meta?10:1;z(p)}});const z=b=>{_(!0),T==="hsl"?f(m=>{const p={...m};v==="h"?p.h=Math.max(0,Math.min(359,m.h+b)):v==="s"?p.s=Math.max(0,Math.min(100,m.s+b)):v==="l"&&(p.l=Math.max(0,Math.min(100,m.l+b)));const[M,u,w]=X(p.h,p.s,p.l);return y({r:M,g:u,b:w}),p}):y(m=>{const p={...m};v==="r"?p.r=Math.max(0,Math.min(255,m.r+b)):v==="g"?p.g=Math.max(0,Math.min(255,m.g+b)):v==="b"&&(p.b=Math.max(0,Math.min(255,m.b+b)));const M=W(p.r,p.g,p.b);return f(M),p}),_(!1)},W=(b,m,p)=>{const M=b/255,u=m/255,w=p/255,O=Math.max(M,u,w),S=Math.min(M,u,w),E=O-S,Z=(O+S)/2;let oe=0;E!==0&&(oe=Z>.5?E/(2-O-S):E/(O+S));let te=0;return E!==0&&(O===M?te=((u-w)/E+(u<w?6:0))/6:O===u?te=((w-M)/E+2)/6:te=((M-u)/E+4)/6),{h:Math.round(te*360),s:Math.round(oe*100),l:Math.round(Z*100)}},X=(b,m,p)=>{b/=360,m/=100,p/=100;const M=(1-Math.abs(2*p-1))*m,u=M*(1-Math.abs(b*6%2-1)),w=p-M/2;let O=0,S=0,E=0;return 0<=b&&b<1/6?(O=M,S=u,E=0):1/6<=b&&b<2/6?(O=u,S=M,E=0):2/6<=b&&b<3/6?(O=0,S=M,E=u):3/6<=b&&b<4/6?(O=0,S=u,E=M):4/6<=b&&b<5/6?(O=u,S=0,E=M):5/6<=b&&b<1&&(O=M,S=0,E=u),[Math.round((O+w)*255),Math.round((S+w)*255),Math.round((E+w)*255)]},U=()=>{const b=[],m=[[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 u=p/39*(m.length-1),w=Math.floor(u),O=Math.ceil(u),S=u-w,[E,Z,oe]=m[w],[te,L,N]=m[O],B=Math.round(E+(te-E)*S),H=Math.round(Z+(L-Z)*S),G=Math.round(oe+(N-oe)*S);b.push(n(o,{backgroundColor:`rgb(${B},${H},${G})`,children:" "},p))}return b},K=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(h.h,p,h.l);b.push(n(o,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},A=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(h.h,h.s,p);b.push(n(o,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},I=()=>{const[b,m,p]=X(h.h,h.s,h.l);return`rgb(${b},${m},${p})`},x=(b,m,p)=>{const M=u=>u.toString(16).padStart(2,"0");return`#${M(b)}${M(m)}${M(p)}`},F=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(n(o,{backgroundColor:`rgb(${p},${d.g},${d.b})`,children:" "},m))}return b},V=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(n(o,{backgroundColor:`rgb(${d.r},${p},${d.b})`,children:" "},m))}return b},Q=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(n(o,{backgroundColor:`rgb(${d.r},${d.g},${p})`,children:" "},m))}return b},j=(b,m)=>Math.round(b/m*39);return l(a,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[l(a,{flexDirection:"column",children:[n(o,{bold:!0,children:"Color Picker"}),l(a,{marginBottom:1,flexDirection:"column",children:[n(o,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),n(o,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),n(o,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),n(o,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),n(o,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),n(o,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),T==="hsl"?l(ce,{children:[l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",h.h,"°):"]})}),n(a,{children:U().map((b,m)=>n(me,{children:m===j(h.h,360)?n(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",h.s,"%):"]})}),n(a,{children:K().map((b,m)=>n(me,{children:m===j(h.s,100)?n(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",h.l,"%):"]})}),n(a,{children:A().map((b,m)=>n(me,{children:m===j(h.l,100)?n(o,{children:"|"}):b},m))})]})]}):l(ce,{children:[l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",d.r,"):"]})}),n(a,{children:F().map((b,m)=>n(me,{children:m===j(d.r,255)?n(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",d.g,"):"]})}),n(a,{children:V().map((b,m)=>n(me,{children:m===j(d.g,255)?n(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[n(a,{width:25,children:l(o,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),n(a,{children:Q().map((b,m)=>n(me,{children:m===j(d.b,255)?n(o,{children:"|"}):b},m))})]})]}),l(a,{marginBottom:1,children:[n(o,{children:"Current: "}),n(o,{backgroundColor:I(),children:" "})]}),l(a,{flexDirection:"row",justifyContent:"space-between",children:[l(a,{flexDirection:"column",children:[n(o,{dimColor:!0,children:"Hex "}),i?.startsWith("diff")?n(o,{backgroundColor:I(),color:s?.colors?.text||"white",bold:!0,children:x(d.r,d.g,d.b)}):i==="inverseText"?n(o,{color:I(),backgroundColor:s?.colors?.permission,bold:!0,children:x(d.r,d.g,d.b)}):n(o,{color:I(),bold:!0,children:x(d.r,d.g,d.b)})]}),l(a,{flexDirection:"column",children:[n(o,{dimColor:!0,children:"RGB "}),i?.startsWith("diff")?n(o,{backgroundColor:I(),color:s?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):i==="inverseText"?n(o,{color:I(),backgroundColor:s?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):n(o,{color:I(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),l(a,{flexDirection:"column",children:[n(o,{dimColor:!0,children:"HSL "}),i?.startsWith("diff")?n(o,{backgroundColor:I(),color:s?.colors?.text||"white",bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):i==="inverseText"?n(o,{color:I(),backgroundColor:s?.colors?.permission,bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):n(o,{color:I(),bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`})]})]})]})}function Oe(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[1];return{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16)}}return null}function Ne(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const s=parseInt(r[1])/255,c=parseInt(r[2])/255,g=parseInt(r[3])/255,h=Math.max(s,c,g),f=Math.min(s,c,g),d=h-f,y=(h+f)/2;let T=0;d!==0&&(T=y>.5?d/(2-h-f):d/(h+f));let C=0;return d!==0&&(h===s?C=((c-g)/d+(c<g?6:0))/6:h===c?C=((g-s)/d+2)/6:C=((s-c)/d+4)/6),{h:Math.round(C*360),s:Math.round(T*100),l:Math.round(y*100)}}const i=e.match(/^#([a-fA-F0-9]{6})$/);if(i){const s=i[1],c=parseInt(s.substr(0,2),16)/255,g=parseInt(s.substr(2,2),16)/255,h=parseInt(s.substr(4,2),16)/255,f=Math.max(c,g,h),d=Math.min(c,g,h),y=f-d,T=(f+d)/2;let C=0;y!==0&&(C=T>.5?y/(2-f-d):y/(f+d));let v=0;return y!==0&&(f===c?v=((g-h)/y+(g<h?6:0))/6:f===g?v=((h-c)/y+2)/6:v=((c-g)/y+4)/6),{h:Math.round(v*360),s:Math.round(C*100),l:Math.round(T*100)}}return{h:0,s:50,l:50}}function pr({onBack:e,themeId:t}){const{settings:{themes:r},updateSettings:i}=ge(he),[s,c]=$(t),g=r.find(A=>A.id===s)||r[0],[h,f]=$("rgb"),[d,y]=$(0),[T,C]=$(null),[v,D]=$(null),[k,_]=$(""),[R,P]=$(""),J=ze(A=>{i(I=>{const x=I.themes.findIndex(F=>F.id===s);x!==-1&&A(I.themes[x])})},[s,i]),z=A=>{if(d>=2&&Le(A)){const I=Ke(A),x=d-2,F=W[x];J(V=>{V.colors[F]=I})}};ae((A,I)=>{if(T===null&&v===null){if(A.length>1&&!I.ctrl&&!I.meta){z(A);return}if(I.escape)e();else if(I.ctrl&&A==="a")f(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(I.upArrow)y(x=>Math.max(0,x-1));else if(I.downArrow)y(x=>Math.min(W.length+1,x+1));else if(I.return)if(d===0)D("name"),_(g.name),P(g.name);else if(d===1)D("id"),_(g.id),P(g.id);else{const x=d-2,F=W[x],V=g.colors[F];C(x),_(V),P(V)}}else if(T!==null)I.ctrl&&A==="a"&&f(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(v!==null)if(I.return){if(v==="id"){const x=s;c(k),i(F=>{const V=F.themes.findIndex(Q=>Q.id===x);V!==-1&&(F.themes[V].id=k)})}else J(x=>{x.name=k});D(null),_(""),P("")}else I.escape?(D(null),_(""),P("")):I.backspace||I.delete?_(x=>x.slice(0,-1)):A&&_(x=>x+A)});const W=Object.keys(g.colors),X=(A,I)=>{const x=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!x)return A;const F=parseInt(x[1]),V=parseInt(x[2]),Q=parseInt(x[3]);switch(I){case"hex":{const j=b=>b.toString(16).padStart(2,"0");return`#${j(F)}${j(V)}${j(Q)}`}case"hsl":{const j=F/255,b=V/255,m=Q/255,p=Math.max(j,b,m),M=Math.min(j,b,m),u=p-M,w=(p+M)/2;let O=0;u!==0&&(O=w>.5?u/(2-p-M):u/(p+M));let S=0;return u!==0&&(p===j?S=((b-m)/u+(b<m?6:0))/6:p===b?S=((m-j)/u+2)/6:S=((j-b)/u+4)/6),`hsl(${Math.round(S*360)}, ${Math.round(O*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return A}},U=A=>({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.",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",secondaryText:"Secondary/dimmed text. Used for keyboard shortcuts and other help text.",secondaryBorder:"Secondary border color. Used for various boxes.",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.",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",autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",permission:"Permission prompt color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",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"})[A]||"",K=Math.max(...W.map(A=>A.length));return l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[n(a,{children:l(de,{children:["Editing theme “",g.name,"” (",g.id,")"]})}),T===null&&v===null?l(ce,{children:[l(a,{marginBottom:1,flexDirection:"column",children:[n(o,{dimColor:!0,children:"enter to edit theme name, id, or color"}),n(o,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),n(o,{dimColor:!0,children:"paste color from clipboard (when on color)"}),n(o,{dimColor:!0,children:"esc to go back"})]}),d<2?l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[n(o,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),n(o,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:g.colors[W[d-2]],flexDirection:"column",paddingLeft:1,children:[n(Fe,{colorKey:W[d-2],theme:g,bold:!0}),n(o,{children:U(W[d-2])})]}),l(a,{flexDirection:"column",children:[l(a,{children:[n(o,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),n(o,{bold:!0,children:"Name: "}),n(o,{children:g.name})]}),l(a,{marginBottom:1,children:[n(o,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),n(o,{bold:!0,children:"ID: "}),n(o,{children:g.id})]}),W.map((A,I)=>{const x=I+2;return l(a,{children:[n(o,{color:d===x?"yellow":"white",children:d===x?"❯ ":" "}),n(a,{width:K+2,children:n(o,{children:n(Fe,{colorKey:A,theme:g,bold:!0})})}),n(o,{color:g.colors[A],children:X(g.colors[A],h)})]},A)})]})]}):v?l(a,{flexDirection:"column",marginTop:1,children:[l(o,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),n(a,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:n(o,{children:k})}),n(o,{dimColor:!0,children:"enter to save, esc to cancel"})]}):n(qe,{initialValue:R,colorKey:W[T],theme:g,onColorChange:A=>{_(A),J(I=>{I.colors[W[T]]=A})},onExit:()=>{J(A=>{A.colors[W[T]]=k}),C(null),_(""),P("")}})]}),n(a,{width:"50%",children:n(Je,{theme:g})})]})}function br(e){return e.map(t=>`${t.name} (${t.id})`)}function xr({onBack:e}){const{settings:{themes:t},updateSettings:r}=ge(he),[i,s]=$(0),[c,g]=$(null),[h,f]=$(!0),d=()=>{const k={colors:{...(t[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(_=>{_.themes.push(k)}),g(k.id),f(!1)},y=D=>{t.length<=1||(r(k=>{k.themes=k.themes.filter(_=>_.id!==D)}),i>=t.length-1&&s(Math.max(0,t.length-2)))},T=()=>{r(D=>{D.themes=[...q.themes]}),s(0)};if(ae((D,k)=>{if(k.escape)e();else if(k.upArrow)s(_=>Math.max(0,_-1));else if(k.downArrow)s(_=>Math.min(t.length-1,_+1));else if(k.return){const _=t[i];_&&(g(_.id),f(!1))}else if(D==="n")d();else if(D==="d"){const _=t[i];_&&y(_.id)}else k.ctrl&&D==="r"&&T()},{isActive:h}),c)return n(pr,{themeId:c,onBack:()=>{g(null),f(!0)}});const C=br(t),v=t.find(D=>C[i]?.includes(`(${D.id})`))||t[0];return t.length===0?n(a,{children:l(a,{flexDirection:"column",width:"100%",children:[n(de,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[n(o,{dimColor:!0,children:"n to create a new theme"}),n(o,{dimColor:!0,children:"esc to go back"})]}),n(o,{children:"No themes available!"})]})}):l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[n(de,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[n(o,{dimColor:!0,children:"n to create a new theme"}),n(o,{dimColor:!0,children:"d to delete a theme"}),n(o,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),n(o,{dimColor:!0,children:"enter to edit theme"}),n(o,{dimColor:!0,children:"esc to go back"})]}),n(a,{flexDirection:"column",children:C.map((D,k)=>l(o,{color:i===k?"yellow":void 0,children:[i===k?"❯ ":" ",D]},k))})]}),n(a,{width:"50%",children:n(Je,{theme:v})})]})}let De=["ANSI Shadow"];function wr({onBack:e}){const{stdout:t}=tr(),r=t?.columns||120,{settings:{launchText:{method:i,figletText:s,figletFont:c,customText:g},themes:h},updateSettings:f}=ge(he),d=i==="figlet"?["method","text","font"]:["method","text"],[y,T]=$(0),C=d[y],[v,D]=$(i==="figlet"?0:1),[k,_]=$(De),[R,P]=$(De),[J,z]=$(""),[W,X]=$(!1),[U,K]=$(0),[A,I]=$(""),[x,F]=$(50),[V,Q]=$(!1),[j,b]=$(i==="figlet"?s:g),m=Te(),M=(h.find(w=>w.id===m)||h.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";se(()=>{Be.fonts((w,O)=>{if(!w&&O){const S=O.sort();_(S),P(S),De=S;const E=S.indexOf(c);K(E>=0?E:S.indexOf("ANSI Shadow")||0)}})},[]),se(()=>{u()},[i,s,c,g,j,V]);const u=()=>{if(i==="figlet")try{const w=V?j:s,O=Be.textSync(w.replace(`
|
|
3
|
-
`," "),{font:c}),S=Math.floor(
|
|
2
|
+
import{Box as a,Text as o,render as rn,useInput as ae,useStdout as tn}from"ink";import{Command as on}from"commander";import{Fragment as me,createContext as sn,useCallback as ze,useContext as ge,useEffect as se,useState as _}from"react";import ln from"ink-link";import{Fragment as ce,jsx as t,jsxs as l}from"react/jsx-runtime";import*as Ce from"node:path";import Ge from"node:path";import*as Ie from"node:os";import{globbySync as ne}from"globby";import*as He from"node:fs";import*as Se from"node:fs/promises";import ue from"node:fs/promises";import*as Ae from"node:child_process";import*as cn from"node:crypto";import Be from"figlet";import re from"chalk";function an({items:e,selectedIndex:r,onSelect:n,onSubmit:i}){return ae((s,c)=>{c.upArrow?n(r>0?r-1:e.length-1):c.downArrow?n(r<e.length-1?r+1:0):c.return&&i(e[r].name)}),t(a,{flexDirection:"column",children:e.map((s,c)=>t(a,{children:l(o,{children:[l(o,{bold:c===r,color:c===r?"cyan":void 0,...c===r?s.selectedStyles??{}:s.styles??{},children:[c===r?"❯ ":" ",s.name]}),s.desc&&c===r&&l(o,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",s.desc]})]})},c))})}let Y=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const 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)",permission:"rgb(177,185,249)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",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)"}},{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)",permission:"rgb(87,105,247)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",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)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"#cd00cd",bashBorder:"#cd00cd",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#0000ee",planMode:"#00cdcd",ide:"#4782C8",secondaryBorder:"#e5e5e5",text:"#000000",inverseText:"#ffffff",secondaryText:"#7f7f7f",suggestion:"#0000ee",remember:"#0000ee",success:"#00cd00",error:"#cd0000",warning:"#cdcd00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#cd0000",blue_FOR_SUBAGENTS_ONLY:"#0000cd",green_FOR_SUBAGENTS_ONLY:"#00cd00",yellow_FOR_SUBAGENTS_ONLY:"#cdcd00",purple_FOR_SUBAGENTS_ONLY:"#cd00cd",orange_FOR_SUBAGENTS_ONLY:"#cd8500",pink_FOR_SUBAGENTS_ONLY:"#ff1493",cyan_FOR_SUBAGENTS_ONLY:"#00cdcd"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"#ff00ff",bashBorder:"#ff00ff",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#5c5cff",planMode:"#00ffff",ide:"#4782c8",secondaryBorder:"#e5e5e5",text:"#ffffff",inverseText:"#000000",secondaryText:"#e5e5e5",suggestion:"#5c5cff",remember:"#5c5cff",success:"#00ff00",error:"#ff0000",warning:"#ffff00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#ff0000",blue_FOR_SUBAGENTS_ONLY:"#0000ff",green_FOR_SUBAGENTS_ONLY:"#00ff00",yellow_FOR_SUBAGENTS_ONLY:"#ffff00",purple_FOR_SUBAGENTS_ONLY:"#ff00ff",orange_FOR_SUBAGENTS_ONLY:"#ff8700",pink_FOR_SUBAGENTS_ONLY:"#ff69b4",cyan_FOR_SUBAGENTS_ONLY:"#00ffff"}},{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)",permission:"rgb(51,102,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",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)"}},{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)",permission:"rgb(153,204,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",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)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:{}.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Ee=Ce.join(Ie.homedir(),".tweakcc"),le=Ce.join(Ee,"config.json"),pe=Ce.join(Ee,"cli.js.backup"),dn=()=>{const e=[],r=process.platform=="win32"?Ie.homedir().replace(/\\/g,"/"):Ie.homedir(),n="node_modules/@anthropic-ai/claude-code";return e.push(`${Ie.homedir()}/.claude/local/${n}`),{}.NPM_PREFIX&&e.push(`${{}.NPM_PREFIX}/lib/${n}`),{}.N_PREFIX&&e.push(`${{}.N_PREFIX}/lib/${n}`),{}.VOLTA_HOME&&e.push(`${{}.VOLTA_HOME}/lib/${n}`),{}.FNM_DIR&&e.push(`${{}.FNM_DIR}/lib/${n}`),{}.NVM_DIR&&e.push(`${{}.NVM_DIR}/lib/${n}`),{}.NODENV_ROOT&&e.push(...ne(`${{}.NODENV_ROOT}/versions/*/lib/${n}`)),{}.NVS_HOME&&e.push(...ne(`${{}.NVS_HOME}/node/*/*/lib/${n}`)),{}.ASDF_DATA_DIR&&e.push(...ne(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`)),process.platform=="win32"?(e.push(`${r}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),e.push(`${r}/AppData/Roaming/npm/${n}`),e.push(...ne(`${r}/AppData/Roaming/nvm/*/${n}}`)),e.push(`${r}/AppData/Local/Yarn/config/global/${n}`),e.push(...ne(`${r}/AppData/Local/pnpm/global/*/${n}`)),e.push(...ne(`${r}/n/versions/node/*/lib/${n}`)),e.push(`${r}/AppData/Roaming/Yarn/config/global/${n}`),e.push(`${r}/AppData/Roaming/pnpm-global/${n}`),e.push(...ne(`${r}/AppData/Roaming/pnpm-global/*/${n}`)),e.push(`${r}/.bun/install/global/${n}`),e.push(...ne(`${r}/AppData/Local/fnm_multishells/*/node_modules/${n}`))):(process.platform=="darwin"&&(e.push(`${r}/Library/${n}`),e.push(`/opt/local/lib/${n}`)),e.push(`${r}/.local/lib/${n}`),e.push(`${r}/.local/share/${n}`),e.push(`${r}/.npm-global/lib/${n}`),e.push(`${r}/.npm-packages/lib/${n}`),e.push(`${r}/.npm/lib/${n}`),e.push(`${r}/npm/lib/${n}`),e.push(`/etc/${n}`),e.push(`/lib/${n}`),e.push(`/opt/node/lib/${n}`),e.push(`/usr/lib/${n}`),e.push(`/usr/local/lib/${n}`),e.push(`/usr/share/${n}`),e.push(`/var/lib/${n}`),e.push(`/opt/homebrew/lib/${n}`),e.push(`${r}/.config/yarn/global/${n}`),e.push(`${r}/.yarn/global/${n}`),e.push(`${r}/.bun/install/global/${n}`),e.push(`${r}/.pnpm-global/${n}`),e.push(...ne(`${r}/.pnpm-global/*/${n}`)),e.push(`${r}/pnpm-global/${n}`),e.push(...ne(`${r}/pnpm-global/*/${n}`)),e.push(`${r}/.local/share/pnpm/global/${n}`),e.push(...ne(`${r}/.local/share/pnpm/global/*/${n}`)),e.push(`${r}/.bun/install/global/${n}`),e.push(...ne(`/usr/local/n/versions/node/*/lib/${n}`)),e.push(...ne(`${r}/n/versions/node/*/lib/${n}`)),e.push(`${r}/n/lib/${n}`),e.push(...ne(`${r}/.volta/tools/image/node/*/lib/${n}`)),e.push(...ne(`${r}/.fnm/node-versions/*/installation/lib/${n}`)),e.push(...ne(`/usr/local/nvm/versions/node/*/lib/${n}`)),e.push(...ne(`${r}/.nvm/versions/node/*/lib/${n}`)),e.push(...ne(`${r}/.nodenv/versions/*/lib/${n}`)),e.push(...ne(`${r}/.nvs/*/lib/${n}`)),e.push(...ne(`${r}/.asdf/installs/nodejs/*/lib/${n}`))),process.platform=="win32"?e.map(i=>i.replace(/\//g,"\\")):e},Me=dn(),hn=({children:e,...r})=>l(o,{bold:!0,backgroundColor:"#ffd500",color:"#000",...r,children:[" ",e," "]});var de=hn;const gn=[{name:Y.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:Y.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:Y.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:Y.THINKING_STYLE,desc:"Choose custom spinners"},{name:Y.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:Y.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],un=[{name:Y.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:Y.OPEN_CONFIG,desc:`Opens your tweakcc config file (${le})`},{name:Y.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Y.EXIT,desc:"Bye!"}];function fn({onSubmit:e,notification:r}){const n=[...ge(he).changesApplied?[]:[{name:Y.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...gn,...un],[i,s]=_(0);return l(a,{flexDirection:"column",children:[t(a,{marginBottom:1,children:t(de,{children:"Tweak Claude Code"})}),t(a,{marginBottom:1,children:l(o,{color:"gray",children:[t(o,{bold:!0,children:"Customize your Claude Code installation."})," ",t(o,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),t(a,{marginBottom:1,children:l(o,{color:"yellow",children:["⭐ ",t(o,{bold:!0,children:"Star the repo at "}),t(ln,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:t(o,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),t(o,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),r&&t(a,{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:t(o,{color:r?.type==="success"?"green":r?.type==="error"?"red":r?.type==="info"?"blue":"yellow",children:r?.message})}),t(an,{items:n,selectedIndex:i,onSelect:s,onSubmit:c=>e(c)})]})}function Je({theme:e}){return l(a,{flexDirection:"column",paddingLeft:1,children:[t(a,{marginBottom:1,children:l(o,{bold:!0,children:["Preview: ",e.name]})}),t(a,{borderStyle:"single",borderColor:"gray",paddingX:1,children:l(a,{flexDirection:"column",children:[t(o,{children:"╭─────────────────────────────────────────────╮"}),l(o,{children:["│ ",t(o,{color:e.colors.secondaryText,children:"1"})," ",l(o,{color:e.colors.text,children:["function greet() ","{"]})," ","│"]}),l(o,{children:["│ ",t(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:['- console.log("',t(o,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),'");']})," ","│"]}),l(o,{children:["│ ",t(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:['+ console.log("',t(o,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),'");']})," ","│"]}),t(o,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),l(o,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),l(o,{children:[t(o,{color:e.colors.warning,children:"│ "}),t(o,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),l(o,{color:e.colors.warning,children:[" ","│"]})]}),t(o,{color:e.colors.claude,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[t(o,{color:e.colors.claude,children:"│ "}),t(o,{color:e.colors.claude,children:"✻"}),t(o,{children:" Welcome to Tweak Claude Code!"}),l(o,{color:e.colors.claude,children:[" ","│"]})]}),l(o,{children:[t(o,{color:e.colors.claude,children:"│"}),l(o,{color:e.colors.secondaryText,italic:!0,children:[" ","/help for help, /status for your current set"]}),t(o,{color:e.colors.claude,children:"│"})]}),l(o,{color:e.colors.success,children:["Login successful. Press ",t(o,{bold:!0,children:"Enter"})," to continue…"]}),t(o,{color:e.colors.bashBorder,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[t(o,{color:e.colors.bashBorder,children:"│ !"}),l(o,{children:[" ls"," "]}),t(o,{color:e.colors.bashBorder,children:"│"})]}),t(o,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[t(o,{color:e.colors.planMode,children:"│ "}),t(o,{color:e.colors.permission,children:"Ready to code?"}),l(o,{color:e.colors.planMode,children:[" ","│"]})]}),l(o,{children:[t(o,{color:e.colors.planMode,children:"│ "}),t(o,{children:"Here is Claude's plan:"}),l(o,{color:e.colors.planMode,children:[" ","│"]})]}),t(o,{color:e.colors.secondaryBorder,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[t(o,{color:e.colors.secondaryBorder,children:"│"})," ",l(o,{color:e.colors.secondaryText,children:["> Try “refactor <filepath>”"," ","│"]})]}),t(o,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),l(o,{children:[l(o,{color:e.colors.permission,children:["│ ",t(o,{bold:!0,children:"Permissions:"})]})," ",l(o,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",t(o,{color:e.colors.permission,children:"│"})]}),t(o,{color:e.colors.secondaryText,children:"> list the dir"}),l(o,{children:[t(o,{color:e.colors.error,children:"●"}),t(o,{children:" Update(__init__.py)"})]}),l(o,{children:[t(o,{children:" ⎿ "}),t(o,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),l(o,{children:[" ",t(o,{color:e.colors.secondaryText,children:"1"})," ",l(o,{backgroundColor:e.colors.diffRemovedDimmed,color:e.colors.text,children:["- import"," ",t(o,{backgroundColor:e.colors.diffRemovedWordDimmed,color:e.colors.text,children:"os"})]})]}),l(o,{children:[" ",t(o,{color:e.colors.secondaryText,children:"2"})," ",l(o,{backgroundColor:e.colors.diffAddedDimmed,color:e.colors.text,children:["+ import"," ",t(o,{backgroundColor:e.colors.diffAddedWordDimmed,color:e.colors.text,children:"random"})]})]}),l(o,{children:[t(o,{color:e.colors.success,children:"●"}),t(o,{children:" List(.)"})]}),t(o,{children:" ⎿ Listed 123 paths (ctrl+r to expand)"}),l(o,{children:[t(o,{color:e.colors.secondaryText,children:"●"}),t(o,{children:" The directory "}),t(o,{color:e.colors.permission,children:"C:\\Users\\user"}),l(o,{children:[" ","contains ",t(o,{bold:!0,children:"123"})," files."]})]}),l(o,{children:[l(o,{color:e.colors.claude,children:["✻ Th",t(o,{color:e.colors.claudeShimmer,children:"ink"}),"ing…"," "]}),t(o,{color:e.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]}),l(o,{children:[l(o,{color:e.colors.autoAccept,children:["⏵⏵ auto-accept edits on"," "]}),t(o,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),l(o,{children:[t(o,{color:e.colors.planMode,children:"⏸ plan mode on "}),t(o,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),t(o,{children:t(o,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Fe({colorKey:e,theme:r,bold:n=!1}){const i=r.colors[e];return e==="inverseText"?t(o,{color:i,backgroundColor:r.colors.permission,bold:n,children:e}):e.startsWith("diff")?t(o,{backgroundColor:i,bold:n,color:r.colors.text,children:e}):t(o,{color:i,bold:n,children:e})}let Xe=!1;const ie=()=>Xe,mn=()=>{Xe=!0};function Te(){try{const e=Ce.join(Ie.homedir(),".claude.json");return JSON.parse(He.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Ve(e){if(process.platform==="win32")Ae.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ae.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const r=Ce.dirname(e);Ae.spawn("xdg-open",[r],{detached:!0,stdio:"ignore"}).unref()}}function Le(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[,i,s,c]=n;return parseInt(i)<=255&&parseInt(s)<=255&&parseInt(c)<=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[,i,s,c]=n;return parseInt(i)<=360&&parseInt(s)<=100&&parseInt(c)<=100}}return!1}function Ke(e){if(!Le(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(g=>g+g).join(""));const i=parseInt(n.slice(0,2),16),s=parseInt(n.slice(2,4),16),c=parseInt(n.slice(4,6),16);return`rgb(${i},${s},${c})`}if(r.startsWith("hsl(")){const n=r.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const i=parseInt(n[1])/360,s=parseInt(n[2])/100,c=parseInt(n[3])/100,g=(C,v,D)=>(D<0&&(D+=1),D>1&&(D-=1),D<1/6?C+(v-C)*6*D:D<1/2?v:D<2/3?C+(v-C)*(2/3-D)*6:C),h=c<.5?c*(1+s):c+s-c*s,f=2*c-h,d=Math.round(g(f,h,i+1/3)*255),I=Math.round(g(f,h,i)*255),O=Math.round(g(f,h,i-1/3)*255);return`rgb(${d},${I},${O})`}}return e}async function pn(e,r="sha256",n=64*1024){return new Promise((i,s)=>{const c=cn.createHash(r),g=He.createReadStream(e,{highWaterMark:n});g.on("data",h=>{c.update(h)}),g.on("end",()=>{i(c.digest("hex"))}),g.on("error",h=>{s(h)})})}const We=(e,r,n,i,s,c,g,h)=>{let f=e;return r&&(f+=`.rgb(${r})`),n&&n!=="transparent"&&(f+=`.bgRgb(${n})`),i&&(f+=".bold"),s&&(f+=".italic"),c&&(f+=".underline"),g&&(f+=".strikethrough"),h&&(f+=".inverse"),f};async function Ze(e,r,n="replace"){let i=493;try{i=(await Se.stat(e)).mode,ie()&&console.log(`[${n}] Original file mode for ${e}: ${(i&parseInt("777",8)).toString(8)}`)}catch(s){ie()&&console.log(`[${n}] Could not stat ${e} (error: ${s}), using default mode 755`)}try{await Se.unlink(e),ie()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(s){ie()&&console.log(`[${n}] Could not unlink ${e}: ${s}`)}await Se.writeFile(e,r),await Se.chmod(e,i),ie()&&console.log(`[${n}] Restored permissions to ${(i&parseInt("777",8)).toString(8)}`)}function qe({initialValue:e,onColorChange:r,onExit:n,colorKey:i,theme:s}){const c=Ne(e)||{h:0,s:50,l:50},g=Oe(e)||{r:128,g:128,b:128},[h,f]=_(c),[d,I]=_(g),[O,C]=_("hsl"),[v,D]=_("h"),[k,T]=_(!1),[R,P]=_(!1);se(()=>{const b=Ne(e),m=Oe(e);b&&m&&(T(!0),f(b),I(m),T(!1))},[e]),se(()=>{if(!k&&R){const b=`rgb(${d.r},${d.g},${d.b})`;r(b)}},[h,d,k,R]),se(()=>{P(!0)},[]);const H=b=>{if(Le(b)){const m=Ke(b),p=Ne(m),M=Oe(m);p&&M&&(T(!0),f(p),I(M),T(!1))}};ae((b,m)=>{if(b.length>1&&!m.ctrl&&!m.meta){H(b);return}if(m.return)n();else if(m.escape)n();else if(m.ctrl&&b==="a")C(p=>p==="hsl"?"rgb":"hsl"),D(p=>O==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(m.upArrow)D(O==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(m.downArrow||m.tab)D(O==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(m.leftArrow){const p=m.shift||m.ctrl||m.meta?-10:-1;J(p)}else if(m.rightArrow){const p=m.shift||m.ctrl||m.meta?10:1;J(p)}});const J=b=>{T(!0),O==="hsl"?f(m=>{const p={...m};v==="h"?p.h=Math.max(0,Math.min(359,m.h+b)):v==="s"?p.s=Math.max(0,Math.min(100,m.s+b)):v==="l"&&(p.l=Math.max(0,Math.min(100,m.l+b)));const[M,u,w]=X(p.h,p.s,p.l);return I({r:M,g:u,b:w}),p}):I(m=>{const p={...m};v==="r"?p.r=Math.max(0,Math.min(255,m.r+b)):v==="g"?p.g=Math.max(0,Math.min(255,m.g+b)):v==="b"&&(p.b=Math.max(0,Math.min(255,m.b+b)));const M=W(p.r,p.g,p.b);return f(M),p}),T(!1)},W=(b,m,p)=>{const M=b/255,u=m/255,w=p/255,A=Math.max(M,u,w),S=Math.min(M,u,w),E=A-S,Z=(A+S)/2;let oe=0;E!==0&&(oe=Z>.5?E/(2-A-S):E/(A+S));let te=0;return E!==0&&(A===M?te=((u-w)/E+(u<w?6:0))/6:A===u?te=((w-M)/E+2)/6:te=((M-u)/E+4)/6),{h:Math.round(te*360),s:Math.round(oe*100),l:Math.round(Z*100)}},X=(b,m,p)=>{b/=360,m/=100,p/=100;const M=(1-Math.abs(2*p-1))*m,u=M*(1-Math.abs(b*6%2-1)),w=p-M/2;let A=0,S=0,E=0;return 0<=b&&b<1/6?(A=M,S=u,E=0):1/6<=b&&b<2/6?(A=u,S=M,E=0):2/6<=b&&b<3/6?(A=0,S=M,E=u):3/6<=b&&b<4/6?(A=0,S=u,E=M):4/6<=b&&b<5/6?(A=u,S=0,E=M):5/6<=b&&b<1&&(A=M,S=0,E=u),[Math.round((A+w)*255),Math.round((S+w)*255),Math.round((E+w)*255)]},G=()=>{const b=[],m=[[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 u=p/39*(m.length-1),w=Math.floor(u),A=Math.ceil(u),S=u-w,[E,Z,oe]=m[w],[te,L,N]=m[A],B=Math.round(E+(te-E)*S),z=Math.round(Z+(L-Z)*S),U=Math.round(oe+(N-oe)*S);b.push(t(o,{backgroundColor:`rgb(${B},${z},${U})`,children:" "},p))}return b},K=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(h.h,p,h.l);b.push(t(o,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},$=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(h.h,h.s,p);b.push(t(o,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},y=()=>{const[b,m,p]=X(h.h,h.s,h.l);return`rgb(${b},${m},${p})`},x=(b,m,p)=>{const M=u=>u.toString(16).padStart(2,"0");return`#${M(b)}${M(m)}${M(p)}`},F=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(t(o,{backgroundColor:`rgb(${p},${d.g},${d.b})`,children:" "},m))}return b},V=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(t(o,{backgroundColor:`rgb(${d.r},${p},${d.b})`,children:" "},m))}return b},Q=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(t(o,{backgroundColor:`rgb(${d.r},${d.g},${p})`,children:" "},m))}return b},j=(b,m)=>Math.round(b/m*39);return l(a,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[l(a,{flexDirection:"column",children:[t(o,{bold:!0,children:"Color Picker"}),l(a,{marginBottom:1,flexDirection:"column",children:[t(o,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),t(o,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),t(o,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),t(o,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),t(o,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),t(o,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),O==="hsl"?l(ce,{children:[l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",h.h,"°):"]})}),t(a,{children:G().map((b,m)=>t(me,{children:m===j(h.h,360)?t(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",h.s,"%):"]})}),t(a,{children:K().map((b,m)=>t(me,{children:m===j(h.s,100)?t(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",h.l,"%):"]})}),t(a,{children:$().map((b,m)=>t(me,{children:m===j(h.l,100)?t(o,{children:"|"}):b},m))})]})]}):l(ce,{children:[l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",d.r,"):"]})}),t(a,{children:F().map((b,m)=>t(me,{children:m===j(d.r,255)?t(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",d.g,"):"]})}),t(a,{children:V().map((b,m)=>t(me,{children:m===j(d.g,255)?t(o,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[t(a,{width:25,children:l(o,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),t(a,{children:Q().map((b,m)=>t(me,{children:m===j(d.b,255)?t(o,{children:"|"}):b},m))})]})]}),l(a,{marginBottom:1,children:[t(o,{children:"Current: "}),t(o,{backgroundColor:y(),children:" "})]}),l(a,{flexDirection:"row",justifyContent:"space-between",children:[l(a,{flexDirection:"column",children:[t(o,{dimColor:!0,children:"Hex "}),i?.startsWith("diff")?t(o,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:x(d.r,d.g,d.b)}):i==="inverseText"?t(o,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:x(d.r,d.g,d.b)}):t(o,{color:y(),bold:!0,children:x(d.r,d.g,d.b)})]}),l(a,{flexDirection:"column",children:[t(o,{dimColor:!0,children:"RGB "}),i?.startsWith("diff")?t(o,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):i==="inverseText"?t(o,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):t(o,{color:y(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),l(a,{flexDirection:"column",children:[t(o,{dimColor:!0,children:"HSL "}),i?.startsWith("diff")?t(o,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):i==="inverseText"?t(o,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):t(o,{color:y(),bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`})]})]})]})}function Oe(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 i=n[1];return{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16)}}return null}function Ne(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 s=parseInt(n[1])/255,c=parseInt(n[2])/255,g=parseInt(n[3])/255,h=Math.max(s,c,g),f=Math.min(s,c,g),d=h-f,I=(h+f)/2;let O=0;d!==0&&(O=I>.5?d/(2-h-f):d/(h+f));let C=0;return d!==0&&(h===s?C=((c-g)/d+(c<g?6:0))/6:h===c?C=((g-s)/d+2)/6:C=((s-c)/d+4)/6),{h:Math.round(C*360),s:Math.round(O*100),l:Math.round(I*100)}}const i=e.match(/^#([a-fA-F0-9]{6})$/);if(i){const s=i[1],c=parseInt(s.substr(0,2),16)/255,g=parseInt(s.substr(2,2),16)/255,h=parseInt(s.substr(4,2),16)/255,f=Math.max(c,g,h),d=Math.min(c,g,h),I=f-d,O=(f+d)/2;let C=0;I!==0&&(C=O>.5?I/(2-f-d):I/(f+d));let v=0;return I!==0&&(f===c?v=((g-h)/I+(g<h?6:0))/6:f===g?v=((h-c)/I+2)/6:v=((c-g)/I+4)/6),{h:Math.round(v*360),s:Math.round(C*100),l:Math.round(O*100)}}return{h:0,s:50,l:50}}function bn({onBack:e,themeId:r}){const{settings:{themes:n},updateSettings:i}=ge(he),[s,c]=_(r),g=n.find($=>$.id===s)||n[0],[h,f]=_("rgb"),[d,I]=_(0),[O,C]=_(null),[v,D]=_(null),[k,T]=_(""),[R,P]=_(""),H=ze($=>{i(y=>{const x=y.themes.findIndex(F=>F.id===s);x!==-1&&$(y.themes[x])})},[s,i]),J=$=>{if(d>=2&&Le($)){const y=Ke($),x=d-2,F=W[x];H(V=>{V.colors[F]=y})}};ae(($,y)=>{if(O===null&&v===null){if($.length>1&&!y.ctrl&&!y.meta){J($);return}if(y.escape)e();else if(y.ctrl&&$==="a")f(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(y.upArrow)I(x=>Math.max(0,x-1));else if(y.downArrow)I(x=>Math.min(W.length+1,x+1));else if(y.return)if(d===0)D("name"),T(g.name),P(g.name);else if(d===1)D("id"),T(g.id),P(g.id);else{const x=d-2,F=W[x],V=g.colors[F];C(x),T(V),P(V)}}else if(O!==null)y.ctrl&&$==="a"&&f(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(v!==null)if(y.return){if(v==="id"){const x=s;c(k),i(F=>{const V=F.themes.findIndex(Q=>Q.id===x);V!==-1&&(F.themes[V].id=k)})}else H(x=>{x.name=k});D(null),T(""),P("")}else y.escape?(D(null),T(""),P("")):y.backspace||y.delete?T(x=>x.slice(0,-1)):$&&T(x=>x+$)});const W=Object.keys(g.colors),X=($,y)=>{const x=$.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!x)return $;const F=parseInt(x[1]),V=parseInt(x[2]),Q=parseInt(x[3]);switch(y){case"hex":{const j=b=>b.toString(16).padStart(2,"0");return`#${j(F)}${j(V)}${j(Q)}`}case"hsl":{const j=F/255,b=V/255,m=Q/255,p=Math.max(j,b,m),M=Math.min(j,b,m),u=p-M,w=(p+M)/2;let A=0;u!==0&&(A=w>.5?u/(2-p-M):u/(p+M));let S=0;return u!==0&&(p===j?S=((b-m)/u+(b<m?6:0))/6:p===b?S=((m-j)/u+2)/6:S=((j-b)/u+4)/6),`hsl(${Math.round(S*360)}, ${Math.round(A*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return $}},G=$=>({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.",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",secondaryText:"Secondary/dimmed text. Used for keyboard shortcuts and other help text.",secondaryBorder:"Secondary border color. Used for various boxes.",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.",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",autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",permission:"Permission prompt color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",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"})[$]||"",K=Math.max(...W.map($=>$.length));return l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[t(a,{children:l(de,{children:["Editing theme “",g.name,"” (",g.id,")"]})}),O===null&&v===null?l(ce,{children:[l(a,{marginBottom:1,flexDirection:"column",children:[t(o,{dimColor:!0,children:"enter to edit theme name, id, or color"}),t(o,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),t(o,{dimColor:!0,children:"paste color from clipboard (when on color)"}),t(o,{dimColor:!0,children:"esc to go back"})]}),d<2?l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[t(o,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),t(o,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:g.colors[W[d-2]],flexDirection:"column",paddingLeft:1,children:[t(Fe,{colorKey:W[d-2],theme:g,bold:!0}),t(o,{children:G(W[d-2])})]}),l(a,{flexDirection:"column",children:[l(a,{children:[t(o,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),t(o,{bold:!0,children:"Name: "}),t(o,{children:g.name})]}),l(a,{marginBottom:1,children:[t(o,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),t(o,{bold:!0,children:"ID: "}),t(o,{children:g.id})]}),W.map(($,y)=>{const x=y+2;return l(a,{children:[t(o,{color:d===x?"yellow":"white",children:d===x?"❯ ":" "}),t(a,{width:K+2,children:t(o,{children:t(Fe,{colorKey:$,theme:g,bold:!0})})}),t(o,{color:g.colors[$],children:X(g.colors[$],h)})]},$)})]})]}):v?l(a,{flexDirection:"column",marginTop:1,children:[l(o,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),t(a,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:t(o,{children:k})}),t(o,{dimColor:!0,children:"enter to save, esc to cancel"})]}):t(qe,{initialValue:R,colorKey:W[O],theme:g,onColorChange:$=>{T($),H(y=>{y.colors[W[O]]=$})},onExit:()=>{H($=>{$.colors[W[O]]=k}),C(null),T(""),P("")}})]}),t(a,{width:"50%",children:t(Je,{theme:g})})]})}function xn(e){return e.map(r=>`${r.name} (${r.id})`)}function wn({onBack:e}){const{settings:{themes:r},updateSettings:n}=ge(he),[i,s]=_(0),[c,g]=_(null),[h,f]=_(!0),d=()=>{const k={colors:{...(r[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(T=>{T.themes.push(k)}),g(k.id),f(!1)},I=D=>{r.length<=1||(n(k=>{k.themes=k.themes.filter(T=>T.id!==D)}),i>=r.length-1&&s(Math.max(0,r.length-2)))},O=()=>{n(D=>{D.themes=[...q.themes]}),s(0)};if(ae((D,k)=>{if(k.escape)e();else if(k.upArrow)s(T=>Math.max(0,T-1));else if(k.downArrow)s(T=>Math.min(r.length-1,T+1));else if(k.return){const T=r[i];T&&(g(T.id),f(!1))}else if(D==="n")d();else if(D==="d"){const T=r[i];T&&I(T.id)}else k.ctrl&&D==="r"&&O()},{isActive:h}),c)return t(bn,{themeId:c,onBack:()=>{g(null),f(!0)}});const C=xn(r),v=r.find(D=>C[i]?.includes(`(${D.id})`))||r[0];return r.length===0?t(a,{children:l(a,{flexDirection:"column",width:"100%",children:[t(de,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[t(o,{dimColor:!0,children:"n to create a new theme"}),t(o,{dimColor:!0,children:"esc to go back"})]}),t(o,{children:"No themes available!"})]})}):l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[t(de,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[t(o,{dimColor:!0,children:"n to create a new theme"}),t(o,{dimColor:!0,children:"d to delete a theme"}),t(o,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),t(o,{dimColor:!0,children:"enter to edit theme"}),t(o,{dimColor:!0,children:"esc to go back"})]}),t(a,{flexDirection:"column",children:C.map((D,k)=>l(o,{color:i===k?"yellow":void 0,children:[i===k?"❯ ":" ",D]},k))})]}),t(a,{width:"50%",children:t(Je,{theme:v})})]})}let De=["ANSI Shadow"];function Sn({onBack:e}){const{stdout:r}=tn(),n=r?.columns||120,{settings:{launchText:{method:i,figletText:s,figletFont:c,customText:g},themes:h},updateSettings:f}=ge(he),d=i==="figlet"?["method","text","font"]:["method","text"],[I,O]=_(0),C=d[I],[v,D]=_(i==="figlet"?0:1),[k,T]=_(De),[R,P]=_(De),[H,J]=_(""),[W,X]=_(!1),[G,K]=_(0),[$,y]=_(""),[x,F]=_(50),[V,Q]=_(!1),[j,b]=_(i==="figlet"?s:g),m=Te(),M=(h.find(w=>w.id===m)||h.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";se(()=>{Be.fonts((w,A)=>{if(!w&&A){const S=A.sort();T(S),P(S),De=S;const E=S.indexOf(c);K(E>=0?E:S.indexOf("ANSI Shadow")||0)}})},[]),se(()=>{u()},[i,s,c,g,j,V]);const u=()=>{if(i==="figlet")try{const w=V?j:s,A=Be.textSync(w.replace(`
|
|
3
|
+
`," "),{font:c}),S=Math.floor(n*.7),Z=A.split(`
|
|
4
4
|
`).map(N=>N.length>S?N.substring(0,S-3)+"…":N),oe=Z.join(`
|
|
5
|
-
`);
|
|
5
|
+
`);y(oe);const te=Math.max(...Z.map(N=>N.length)),L=Math.min(75,Math.max(50,Math.ceil(te/n*100)));F(L+5)}catch{y("Error generating figlet text"),F(50)}else{const w=Math.floor(n*.6),E=(V?j:g).split(`
|
|
6
6
|
`).map(L=>L.length>w?L.substring(0,w-3)+"...":L),Z=E.join(`
|
|
7
|
-
`);
|
|
8
|
-
`).map((w,O)=>n(o,{color:M,children:w},O)),n(a,{marginTop:1,children:n(o,{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 Sr({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:r},themes:i},updateSettings:s}=ge(he),c=["format","verbs"],[g,h]=$(0),f=c[g],[d,y]=$(0),[T,C]=$(!1),[v,D]=$(""),[k,_]=$(!1),[R,P]=$(!1),[J,z]=$(t),W=Te(),X=i.find(A=>A.id===W)||i.find(A=>A.id==="dark"),U=X?.colors.claude||"rgb(215,119,87)";ae((A,I)=>{if(R){I.return?(s(x=>{x.thinkingVerbs.format=J}),P(!1)):I.escape?(z(t),P(!1)):I.backspace||I.delete?z(x=>x.slice(0,-1)):A&&z(x=>x+A);return}if(T||k){I.return&&v.trim()?(k?(s(x=>{x.thinkingVerbs.verbs.push(v.trim())}),_(!1)):(s(x=>{x.thinkingVerbs.verbs[d]=v.trim()}),C(!1)),D("")):I.escape?(D(""),C(!1),_(!1)):I.backspace||I.delete?D(x=>x.slice(0,-1)):A&&D(x=>x+A);return}I.escape?e():I.return?f==="format"&&(z(t),P(!0)):I.tab?I.shift?h(x=>x===0?c.length-1:x-1):h(x=>x===c.length-1?0:x+1):I.upArrow?f==="verbs"&&r.length>0&&y(x=>x>0?x-1:r.length-1):I.downArrow?f==="verbs"&&r.length>0&&y(x=>x<r.length-1?x+1:0):A==="e"&&f==="verbs"?r.length>0&&(D(r[d]),C(!0)):A==="d"&&f==="verbs"?r.length>1&&(s(x=>{x.thinkingVerbs.verbs=x.thinkingVerbs.verbs.filter((F,V)=>V!==d)}),d>=r.length-1&&y(Math.max(0,r.length-2))):A==="n"&&f==="verbs"?(_(!0),D("")):I.ctrl&&A==="r"&&f==="verbs"&&(s(x=>{x.thinkingVerbs.verbs=[...q.thinkingVerbs.verbs]}),y(0))});const K=50;return l(a,{children:[l(a,{flexDirection:"column",width:`${100-K}%`,children:[l(a,{marginBottom:1,flexDirection:"column",children:[n(de,{children:"Thinking Verbs"}),l(a,{flexDirection:"column",children:[n(o,{dimColor:!0,children:f==="format"?"enter to edit format":"changes auto-saved"}),n(o,{dimColor:!0,children:"esc to go back"}),n(o,{dimColor:!0,children:"tab to switch sections"})]})]}),n(a,{marginBottom:1,children:n(o,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),l(a,{flexDirection:"column",children:[l(o,{children:[n(o,{color:f==="format"?"yellow":void 0,children:f==="format"?"❯ ":" "}),n(o,{bold:!0,color:f==="format"?"yellow":void 0,children:"Format"})]}),f==="format"&&(R?l(o,{dimColor:!0,children:[" ","enter to save"]}):l(o,{dimColor:!0,children:[" ","enter to edit"]}))]}),n(a,{marginLeft:2,marginBottom:1,children:n(a,{borderStyle:"round",borderColor:R?"yellow":"gray",children:n(o,{children:R?J:t})})}),n(a,{children:l(o,{children:[n(o,{color:f==="verbs"?"yellow":void 0,children:f==="verbs"?"❯ ":" "}),n(o,{bold:!0,color:f==="verbs"?"yellow":void 0,children:"Verbs"})]})}),f==="verbs"&&n(a,{flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),n(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const I=Math.max(0,d-Math.floor(4)),x=Math.min(r.length,I+8),F=Math.max(0,x-8),V=r.slice(F,x);return l(ce,{children:[F>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",F," more above"]}),V.map((Q,j)=>{const b=F+j;return l(o,{color:f==="verbs"&&b===d?"cyan":void 0,children:[f==="verbs"&&b===d?"❯ ":" ",Q]},b)}),x<r.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-x," more below"]})]})})(),k&&l(a,{alignItems:"center",children:[n(o,{color:"yellow",children:"❯ "}),n(a,{borderStyle:"round",borderColor:"yellow",children:n(o,{children:v})})]}),T&&l(a,{marginTop:1,alignItems:"center",children:[n(o,{children:"Editing: "}),n(a,{borderStyle:"round",borderColor:"yellow",children:n(o,{children:v})})]})]})})]}),l(a,{width:`${K}%`,flexDirection:"column",children:[n(a,{marginBottom:1,children:n(o,{bold:!0,children:"Preview"})}),n(a,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:l(o,{children:[l(o,{color:U,children:["✻ ",t.replace(/\{\}/g,r[d])," "]}),n(o,{color:X?.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]})})]})]})}const fe=[{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 yr({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:r,reverseMirror:i},themes:s},updateSettings:c}=ge(he),g=["reverseMirror","updateInterval","phases","presets"],[h,f]=$(0),d=g[h],[y,T]=$(0),[C,v]=$(0),[D,k]=$(!1),[_,R]=$(""),[P,J]=$(!1),[z,W]=$(!1),[X,U]=$(r.toString()),[K,A]=$(0),I=Te(),x=s.find(p=>p.id===I)||s.find(p=>p.id==="dark"),F=x?.colors.claude||"rgb(215,119,87)";se(()=>{if(t.length>0){const p=i?[...t,...[...t].reverse().slice(1,-1)]:t,M=setInterval(()=>{A(u=>(u+1)%p.length)},r);return()=>clearInterval(M)}},[t,r,i]),ae((p,M)=>{if(z){if(M.return){const u=parseInt(X);!isNaN(u)&&u>0&&c(w=>{w.thinkingStyle.updateInterval=u}),W(!1)}else M.escape?(U(r.toString()),W(!1)):M.backspace||M.delete?U(u=>u.slice(0,-1)):p&&p.match(/^[0-9]$/)&&U(u=>u+p);return}if(D||P){if(M.return&&_.length){const u=P?[...t,_]:t.map((w,O)=>O===y?_:w);c(w=>{w.thinkingStyle.phases=u}),k(!1),R("")}else M.escape?(R(""),k(!1),J(!1)):M.backspace||M.delete?R(u=>u.slice(0,-1)):p&&R(u=>u+p);return}if(M.escape)e();else if(M.return)if(d==="updateInterval")U(r.toString()),W(!0);else if(d==="presets"){const u=fe[C];c(w=>{w.thinkingStyle.phases=[...u.phases],w.thinkingStyle.reverseMirror=u.reverseMirror})}else d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(M.tab)M.shift?f(u=>u===0?g.length-1:u-1):f(u=>u===g.length-1?0:u+1);else if(M.upArrow)d==="phases"&&t.length>0?T(u=>u>0?u-1:t.length-1):d==="presets"&&v(u=>u>0?u-1:fe.length-1);else if(M.downArrow)d==="phases"&&t.length>0?T(u=>u<t.length-1?u+1:0):d==="presets"&&v(u=>u<fe.length-1?u+1:0);else if(p===" ")d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(p==="e"&&d==="phases")t.length>0&&(R(t[y]),k(!0));else if(p==="a"&&d==="phases")J(!0),R("");else if(p==="d"&&d==="phases")t.length>1&&(c(u=>{u.thinkingStyle.phases=t.filter((w,O)=>O!==y)}),y>=t.length&&T(Math.max(0,t.length-1)));else if(p==="w"&&d==="phases"){if(y>0){const u=[...t];[u[y-1],u[y]]=[u[y],u[y-1]],c(w=>{w.thinkingStyle.phases=u}),T(w=>w-1)}}else if(p==="s"&&d==="phases"){if(y<t.length-1){const u=[...t];[u[y],u[y+1]]=[u[y+1],u[y]],c(w=>{w.thinkingStyle.phases=u}),T(w=>w+1)}}else M.ctrl&&p==="r"&&(c(u=>{u.thinkingStyle=q.thinkingStyle}),T(0),v(0))});const V=i?"●":"○",Q=50,b=i?[...t,...[...t].reverse().slice(1,-1)]:t,m=b.length>0?b[K]:"·";return n(a,{children:l(a,{flexDirection:"column",width:"100%",children:[l(a,{flexDirection:"row",width:"100%",children:[l(a,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[n(de,{children:"Thinking style"}),l(a,{flexDirection:"column",children:[l(o,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),n(o,{dimColor:!0,children:"esc to go back"}),n(o,{dimColor:!0,children:"tab to switch sections"})]})]}),l(a,{width:`${Q}%`,flexDirection:"column",children:[n(a,{children:n(o,{bold:!0,children:"Preview"})}),l(a,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[n(a,{width:(m?.length??0)+1,children:n(o,{color:F,children:m})}),l(o,{children:[n(o,{color:F,children:"Thinking… "}),n(o,{color:x?.colors.secondaryText,children:"(esc to interrupt)"})]})]})]})]}),l(a,{flexDirection:"row",gap:4,children:[l(a,{flexDirection:"column",children:[l(o,{children:[n(o,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),n(o,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&l(o,{dimColor:!0,children:[" ","space to toggle"]}),n(a,{marginLeft:2,marginBottom:1,children:l(o,{children:[V," ",i?"Enabled":"Disabled"]})})]}),l(a,{flexDirection:"column",children:[l(o,{children:[n(o,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),n(o,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(z?l(o,{dimColor:!0,children:[" ","enter to save"]}):l(o,{dimColor:!0,children:[" ","enter to edit"]})),n(a,{marginLeft:2,marginBottom:1,children:n(a,{borderStyle:"round",borderColor:z?"yellow":"gray",children:n(o,{children:z?X:r})})})]})]}),n(a,{children:l(o,{children:[n(o,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),n(o,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&n(a,{marginBottom:1,flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),n(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const M=Math.max(0,y-Math.floor(4)),u=Math.min(t.length,M+8),w=Math.max(0,u-8),O=t.slice(w,u);return l(ce,{children:[w>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),O.map((S,E)=>{const Z=w+E;return l(o,{color:d==="phases"&&Z===y?"cyan":void 0,children:[d==="phases"&&Z===y?"❯ ":" ",S]},Z)}),u<t.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-u," more below"]})]})})(),P&&l(a,{children:[n(o,{color:"yellow",children:"❯ "}),n(a,{borderStyle:"round",borderColor:"yellow",children:n(o,{children:_})})]}),D&&l(a,{marginTop:1,children:[n(o,{children:"Editing: "}),n(a,{borderStyle:"round",borderColor:"yellow",children:n(o,{children:_})})]})]})}),n(a,{children:l(o,{children:[n(o,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),n(o,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&l(o,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),n(a,{marginLeft:2,marginBottom:1,children:n(a,{flexDirection:"column",children:(()=>{const M=Math.max(0,C-Math.floor(4)),u=Math.min(fe.length,M+8),w=Math.max(0,u-8),O=fe.slice(w,u);return l(ce,{children:[w>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),O.map((S,E)=>{const Z=w+E;return l(o,{color:d==="presets"&&Z===C?"cyan":void 0,children:[d==="presets"&&Z===C?"❯ ":" ",S.name," ",S.phases.join("")]},Z)}),u<fe.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",fe.length-u," more below"]})]})})()})}),n(a,{marginTop:1,children:n(o,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const we=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Ir({onBack:e}){const{settings:t,updateSettings:r}=ge(he),[i,s]=$("prefix"),[c,g]=$(0),[h,f]=$(!1),[d,y]=$(()=>t.userMessageDisplay.prefix.format),[T,C]=$(0),[v,D]=$(()=>[...t.userMessageDisplay.prefix.styling]),[k,_]=$(()=>t.userMessageDisplay.prefix.foreground_color),[R,P]=$(()=>t.userMessageDisplay.prefix.background_color),[J,z]=$(0),[W,X]=$(0),[U,K]=$(()=>[...t.userMessageDisplay.message.styling]),[A,I]=$(()=>t.userMessageDisplay.message.foreground_color),[x,F]=$(()=>t.userMessageDisplay.message.background_color),[V,Q]=$(null),[j,b]=$(""),m=Te(),p=t.themes?.find(L=>L.id===m)||t.themes?.[0],M=["format","styling","foreground","background"],u=["styling","foreground","background"],w=M[c],O=u[J],S=(L,N)=>{r(B=>{const H=L==="prefix"?B.userMessageDisplay.prefix:B.userMessageDisplay.message;N(H)})},E=L=>{r(N=>{L==="prefix"?N.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:N.userMessageDisplay.message={...q.userMessageDisplay.message}}),L==="prefix"?(y(q.userMessageDisplay.prefix.format),D([...q.userMessageDisplay.prefix.styling]),_(q.userMessageDisplay.prefix.foreground_color),P(q.userMessageDisplay.prefix.background_color)):(K([...q.userMessageDisplay.message.styling]),I(q.userMessageDisplay.message.foreground_color),F(q.userMessageDisplay.message.background_color))};se(()=>{const L=t.userMessageDisplay.prefix;y(L.format),D([...L.styling]),_(L.foreground_color),P(L.background_color);const N=t.userMessageDisplay.message;K([...N.styling]),I(N.foreground_color),F(N.background_color)},[]),ae((L,N)=>{if(h){if(N.return)S("prefix",B=>{B.format=d}),f(!1);else if(N.escape){const B=t.userMessageDisplay.prefix;y(B.format),f(!1)}else N.backspace||N.delete?y(B=>B.slice(0,-1)):L&&y(B=>B+L);return}if(V===null){if(N.escape)e();else if(N.ctrl&&L==="r")E(i);else if(N.leftArrow||N.rightArrow)s(B=>B==="prefix"?"message":"prefix");else if(N.tab)i==="prefix"?N.shift?g(B=>B===0?M.length-1:B-1):g(B=>B===M.length-1?0:B+1):N.shift?z(B=>B===0?u.length-1:B-1):z(B=>B===u.length-1?0:B+1);else if(N.return)i==="prefix"?w==="format"?f(!0):w==="foreground"?(b(k),Q({column:"prefix",type:"foreground"})):w==="background"&&(b(R),Q({column:"prefix",type:"background"})):O==="foreground"?(b(A),Q({column:"message",type:"foreground"})):O==="background"&&(b(x),Q({column:"message",type:"background"}));else if(N.upArrow)i==="prefix"&&w==="styling"?C(B=>Math.max(0,B-1)):i==="message"&&O==="styling"&&X(B=>Math.max(0,B-1));else if(N.downArrow)i==="prefix"&&w==="styling"?C(B=>Math.min(we.length-1,B+1)):i==="message"&&O==="styling"&&X(B=>Math.min(we.length-1,B+1));else if(L===" "){if(i==="prefix"&&w==="styling"){const B=we[T].value,H=v.indexOf(B)>=0?v.filter(G=>G!==B):[...v,B];D(H),S("prefix",G=>{G.styling=[...H]})}else if(i==="message"&&O==="styling"){const B=we[W].value,H=U.indexOf(B)>=0?U.filter(G=>G!==B):[...U,B];K(H),S("message",G=>{G.styling=[...H]})}}}});const Z=(L,N,B=!0)=>{const H=B?N==="prefix"?v:U:[],G=B?N==="prefix"?k:A:"rgb(255,255,255)",be=B?N==="prefix"?R:x:"rgb(0,0,0)",xe=G==="rgb(0,0,0)"&&be==="rgb(0,0,0)",ve=H.length>0;return xe&&!ve?n(o,{children:L}):n(o,{bold:H.includes("bold"),italic:H.includes("italic"),underline:H.includes("underline"),strikethrough:H.includes("strikethrough"),inverse:H.includes("inverse"),color:xe?void 0:G,backgroundColor:xe?void 0:be,children:L})},oe=(L=!0)=>l(o,{children:[d&&l(ce,{children:[Z(d,"prefix",L)," "]}),Z("list the dir","message",L)]}),te=L=>{const N=i===L,G=(L==="prefix"?M:u)[L==="prefix"?c:J],be=L==="prefix"?T:W,xe=L==="prefix"?v:U,ve=L==="prefix"?k:A,Pe=L==="prefix"?R:x;return l(a,{flexDirection:"column",width:"45%",borderStyle:N?"round":"single",borderColor:N?"yellow":"gray",padding:1,children:[n(a,{marginBottom:1,children:l(o,{bold:!0,color:N?"yellow":void 0,children:[L.charAt(0).toUpperCase()+L.slice(1)," ","Configuration"]})}),L==="prefix"&&l(ce,{children:[n(a,{children:l(o,{color:N&&G==="format"?"yellow":void 0,bold:N&&G==="format",children:[N&&G==="format"?"❯ ":" ","Prefix Text"]})}),N&&G==="format"&&n(a,{marginLeft:2,children:n(o,{dimColor:!0,children:h?"enter to save":"enter to edit (appears before message)"})}),n(a,{marginLeft:2,marginBottom:1,children:n(a,{borderStyle:"round",borderColor:h?"yellow":"gray",children:n(o,{children:d})})})]}),n(a,{children:l(o,{color:N&&G==="styling"?"yellow":void 0,bold:N&&G==="styling",children:[N&&G==="styling"?"❯ ":" ","Styling"]})}),N&&G==="styling"&&n(a,{marginLeft:2,children:n(o,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),n(a,{marginLeft:2,marginBottom:1,flexDirection:"column",children:we.map(($e,Ue)=>n(a,{children:l(o,{color:N&&G==="styling"&&be===Ue?"cyan":void 0,children:[N&&G==="styling"&&be===Ue?"❯ ":" ",xe.includes($e.value)?"●":"○"," ",$e.label]})},$e.value))}),n(a,{children:l(o,{color:N&&G==="foreground"?"yellow":void 0,bold:N&&G==="foreground",children:[N&&G==="foreground"?"❯ ":" ","Foreground color"]})}),N&&G==="foreground"&&n(a,{marginLeft:2,children:n(o,{dimColor:!0,children:"enter to open color picker"})}),n(a,{marginLeft:2,marginBottom:1,children:n(o,{color:ve,children:ve})}),n(a,{children:l(o,{color:N&&G==="background"?"yellow":void 0,bold:N&&G==="background",children:[N&&G==="background"?"❯ ":" ","Background color"]})}),N&&G==="background"&&n(a,{marginLeft:2,children:n(o,{dimColor:!0,children:"enter to open color picker"})}),n(a,{marginLeft:2,children:n(o,{backgroundColor:Pe,children:Pe})})]})};if(V){const{column:L,type:N}=V;return n(qe,{initialValue:j,theme:p,onColorChange:B=>{L==="prefix"?N==="foreground"?(_(B),S("prefix",H=>{H.foreground_color=B})):(P(B),S("prefix",H=>{H.background_color=B})):N==="foreground"?(I(B),S("message",H=>{H.foreground_color=B})):(F(B),S("message",H=>{H.background_color=B}))},onExit:()=>{Q(null),b("")}})}return l(a,{flexDirection:"column",children:[n(de,{children:"Customize how user messages are displayed"}),l(a,{flexDirection:"column",marginBottom:1,children:[n(o,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),n(o,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),l(a,{flexDirection:"row",gap:1,children:[te("prefix"),te("message")]}),n(a,{borderStyle:"round",padding:1,marginTop:1,children:l(a,{flexDirection:"column",children:[n(a,{marginBottom:1,children:n(o,{bold:!0,children:"Preview"})}),l(a,{flexDirection:"row",gap:2,children:[l(a,{flexDirection:"column",width:"50%",children:[n(a,{marginBottom:1,children:n(o,{underline:!0,children:"Before (Claude Code default):"})}),n(a,{marginLeft:1,children:n(o,{color:p?.colors?.secondaryText||"#888888",children:"> list the dir"})}),n(a,{marginLeft:1,marginTop:1,children:l(o,{children:[n(o,{color:p?.colors?.secondaryText||"#888888",children:"●"}),n(o,{children:" The directory "}),n(o,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(o,{children:" contains "}),n(o,{bold:!0,children:"123"}),n(o,{children:" files."})]})})]}),l(a,{flexDirection:"column",width:"50%",children:[n(a,{marginBottom:1,children:n(o,{underline:!0,children:"After (Your customization):"})}),n(a,{marginLeft:1,children:oe(!0)}),n(a,{marginLeft:1,marginTop:1,children:l(o,{children:[n(o,{color:p?.colors?.secondaryText||"#888888",children:"●"}),n(o,{children:" The directory "}),n(o,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(o,{children:" contains "}),n(o,{bold:!0,children:"123"}),n(o,{children:" files."})]})})]})]})]})})]})}function Cr({onSubmit:e}){const{settings:t,updateSettings:r}=ge(he),[i,s]=$(0),c=()=>{r(h=>{h.inputBox||(h.inputBox={removeBorder:!1}),h.inputBox.removeBorder=!h.inputBox.removeBorder})};ae((h,f)=>{f.return||f.escape?e():h===" "&&i===0&&c()});const g=t.inputBox?.removeBorder?"☑":"☐";return l(a,{flexDirection:"column",children:[n(a,{marginBottom:1,children:n(de,{children:"Input Box Settings"})}),n(a,{marginBottom:1,children:l(o,{color:"gray",children:[n(o,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",n(o,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),n(a,{children:l(o,{children:[n(o,{color:i===0?"cyan":void 0,children:i===0?"❯ ":" "}),n(o,{bold:!0,color:i===0?"cyan":void 0,children:"Remove border"})]})}),i===0&&n(a,{marginBottom:1,flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","space to toggle"]})}),n(a,{marginLeft:2,marginBottom:1,children:l(o,{children:[g," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),n(a,{marginBottom:1,children:n(o,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const Qe=async()=>{await ue.mkdir(Ee,{recursive:!0})};let ye={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const ke=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};try{ie()&&console.log(`Reading config at ${le}`);const t=await ue.readFile(le,"utf8"),r={...e,...JSON.parse(t)},i=r?.settings?.thinkingVerbs;i?.punctuation&&(i.format="{}"+i.punctuation,delete i.punctuation),r.settings.inputBox||(r.settings.inputBox=q.inputBox);for(const s of q.themes){const c=r?.settings?.themes.find(g=>g.id===s.id||g.name===s.name);if(c)for(const[g,h]of Object.entries(s))Object.hasOwn(c,g)||(c[g]=h)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||q,r.settings.userMessageDisplay=q.userMessageDisplay),ye=r,r}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},_e=async e=>(ie()&&console.log(`Updating config at ${le}`),e(ye),ye.lastModified=new Date().toISOString(),await vr(ye),ye),vr=async e=>{try{e.lastModified=new Date().toISOString(),await Qe(),await ue.writeFile(le,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},er=async e=>{ie()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await ue.readFile(pe);return await Ze(e.cliPath,t,"restore"),await _e(r=>{r.changesApplied=!1}),!0},Mr=async e=>{e.ccInstallationDir&&Me.unshift(e.ccInstallationDir);for(const t of Me)try{ie()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const r=Ge.join(t,"cli.js"),i=Ge.join(t,"package.json"),s=JSON.parse(await ue.readFile(i,"utf8"));return ie()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await mr(r)}`)),{cliPath:r,packageJsonPath:i,version:s.version}}catch{continue}return null},je=async e=>{await Qe(),ie()&&console.log(`Backing up cli.js to ${pe}`),await ue.copyFile(e.cliPath,pe),await _e(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function Tr(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 Ye(){const e=await ke(),t=await Mr(e);if(!t)return null;const r=t.version,i=e.ccVersion;let s=!1;return await Tr(pe)||(ie()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await je(t),s=!0),r!==i?(s||(ie()&&console.log(`startupCheck: real version (${r}) != backed up version (${i}); backing up cli.js`),await ue.unlink(pe),await je(t)),{wasUpdated:!0,oldVersion:i,newVersion:r,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const Re=[{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{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:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"}];function _r(e){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
|
|
7
|
+
`);y(Z);const oe=Math.max(...E.map(L=>L.length)),te=Math.min(75,Math.max(50,Math.ceil(oe/n*100)));F(te+5)}};return se(()=>{if(H){const w=k.filter(A=>A.toLowerCase().includes(H.toLowerCase()));P(w),K(0)}else{P(k);const w=k.indexOf(c);K(w>=0?w:0)}},[H,k]),se(()=>{if(!W){const w=R.indexOf(c);w>=0&&K(w)}},[c,R,W]),ae((w,A)=>{if(V){A.return?(f(i==="figlet"?S=>{S.launchText.figletText=j}:S=>{S.launchText.customText=j}),Q(!1)):A.escape?(b(i==="figlet"?s:g),Q(!1)):A.backspace||A.delete?b(S=>S.slice(0,-1)):w&&b(S=>S+w);return}if(W){if(A.return)R.length>0&&f(S=>{S.launchText.figletFont=R[G]}),X(!1),J("");else if(A.escape)X(!1),J("");else if(A.backspace||A.delete)J(S=>S.slice(0,-1));else if(A.upArrow){const S=G>0?G-1:R.length-1;K(S),R.length>0&&f(E=>{E.launchText.figletFont=R[S]})}else if(A.downArrow){const S=G<R.length-1?G+1:0;K(S),R.length>0&&f(E=>{E.launchText.figletFont=R[S]})}else w&&w.match(/^[a-zA-Z0-9\s\-_]$/)&&J(S=>S+w);return}if(A.escape)e();else if(A.return)C==="text"&&(b(i==="figlet"?s:g),Q(!0));else if(A.tab)A.shift?O(S=>S===0?d.length-1:S-1):O(S=>S===d.length-1?0:S+1);else if(A.upArrow){if(C==="method"){const S=v>0?v-1:1;D(S),f(E=>{E.launchText.method=S===0?"figlet":"custom"})}else if(C==="font"&&i==="figlet"){const S=G>0?G-1:R.length-1;K(S),f(E=>{E.launchText.figletFont=R[S]})}}else if(A.downArrow){if(C==="method"){const S=v<1?v+1:0;D(S),f(E=>{E.launchText.method=S===0?"figlet":"custom"})}else if(C==="font"&&i==="figlet"){const S=G<R.length-1?G+1:0;K(S),f(E=>{E.launchText.figletFont=R[S]})}}else w&&C==="font"&&i==="figlet"&&w.match(/^[a-zA-Z0-9]$/)&&(X(!0),J(w))}),l(a,{children:[l(a,{flexDirection:"column",width:`${100-x}%`,children:[l(a,{marginBottom:1,flexDirection:"column",children:[t(de,{children:"Setup banner"}),l(a,{flexDirection:"column",children:[l(o,{dimColor:!0,children:["enter to ",C==="text"?"edit text":"save"]}),t(o,{dimColor:!0,children:"esc to go back"}),t(o,{dimColor:!0,children:"tab to switch sections"})]})]}),t(a,{children:l(o,{children:[t(o,{color:C==="method"?"yellow":void 0,children:C==="method"?"❯ ":" "}),t(o,{bold:!0,color:C==="method"?"yellow":void 0,children:"Method"})]})}),C==="method"&&l(o,{dimColor:!0,children:[" ","select one of ",R.length," Figlet fonts or enter your own text"]}),t(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[l(o,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),l(o,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),l(a,{flexDirection:"column",children:[l(o,{children:[t(o,{color:C==="text"?"yellow":void 0,children:C==="text"?"❯ ":" "}),t(o,{bold:!0,color:C==="text"?"yellow":void 0,children:"Text"})]}),C==="text"&&(V?l(o,{dimColor:!0,children:[" ","esc to save"]}):l(o,{dimColor:!0,children:[" ","enter to edit"]}))]}),t(a,{marginLeft:2,marginBottom:1,children:t(a,{borderStyle:"round",borderColor:V?"yellow":"gray",children:t(o,{children:V?j:i==="figlet"?s:g})})}),i==="figlet"&&l(ce,{children:[t(a,{children:l(a,{flexDirection:"column",children:[l(o,{children:[t(o,{color:C==="font"?"yellow":void 0,children:C==="font"?"❯ ":" "}),t(o,{bold:!0,color:C==="font"?"yellow":void 0,children:"Font"})]}),C==="font"&&l(o,{dimColor:!0,children:[" ","type to filter"]}),t(o,{children:W&&l(o,{color:"gray",dimColor:!0,children:[" ","(filtering: “",H,"”)"]})})]})}),t(a,{marginLeft:2,marginBottom:1,children:t(a,{flexDirection:"column",children:(()=>{const A=Math.max(0,G-Math.floor(4)),S=Math.min(R.length,A+8),E=Math.max(0,S-8),Z=R.slice(E,S);return l(ce,{children:[E>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",E," more above"]}),Z.map((oe,te)=>{const L=E+te;return l(o,{color:G===L?"cyan":void 0,children:[G===L?"❯ ":" ",oe]},oe)}),S<R.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",R.length-S," more below"]})]})})()})})]})]}),l(a,{width:`${x}%`,flexDirection:"column",children:[t(a,{marginBottom:1,children:t(o,{bold:!0,children:"Preview"})}),l(a,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[l(a,{flexDirection:"column",marginBottom:1,children:[t(o,{color:M,children:"╭──────────────────────────╮"}),l(o,{children:[t(o,{color:M,children:"│ ✻"})," Welcome to Claude Code"," ",t(o,{color:M,children:"│"})]}),t(o,{color:M,children:"╰──────────────────────────╯"})]}),$.split(`
|
|
8
|
+
`).map((w,A)=>t(o,{color:M,children:w},A)),t(a,{marginTop:1,children:t(o,{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 yn({onBack:e}){const{settings:{thinkingVerbs:{format:r,verbs:n},themes:i},updateSettings:s}=ge(he),c=["format","verbs"],[g,h]=_(0),f=c[g],[d,I]=_(0),[O,C]=_(!1),[v,D]=_(""),[k,T]=_(!1),[R,P]=_(!1),[H,J]=_(r),W=Te(),X=i.find($=>$.id===W)||i.find($=>$.id==="dark"),G=X?.colors.claude||"rgb(215,119,87)";ae(($,y)=>{if(R){y.return?(s(x=>{x.thinkingVerbs.format=H}),P(!1)):y.escape?(J(r),P(!1)):y.backspace||y.delete?J(x=>x.slice(0,-1)):$&&J(x=>x+$);return}if(O||k){y.return&&v.trim()?(k?(s(x=>{x.thinkingVerbs.verbs.push(v.trim())}),T(!1)):(s(x=>{x.thinkingVerbs.verbs[d]=v.trim()}),C(!1)),D("")):y.escape?(D(""),C(!1),T(!1)):y.backspace||y.delete?D(x=>x.slice(0,-1)):$&&D(x=>x+$);return}y.escape?e():y.return?f==="format"&&(J(r),P(!0)):y.tab?y.shift?h(x=>x===0?c.length-1:x-1):h(x=>x===c.length-1?0:x+1):y.upArrow?f==="verbs"&&n.length>0&&I(x=>x>0?x-1:n.length-1):y.downArrow?f==="verbs"&&n.length>0&&I(x=>x<n.length-1?x+1:0):$==="e"&&f==="verbs"?n.length>0&&(D(n[d]),C(!0)):$==="d"&&f==="verbs"?n.length>1&&(s(x=>{x.thinkingVerbs.verbs=x.thinkingVerbs.verbs.filter((F,V)=>V!==d)}),d>=n.length-1&&I(Math.max(0,n.length-2))):$==="n"&&f==="verbs"?(T(!0),D("")):y.ctrl&&$==="r"&&f==="verbs"&&(s(x=>{x.thinkingVerbs.verbs=[...q.thinkingVerbs.verbs]}),I(0))});const K=50;return l(a,{children:[l(a,{flexDirection:"column",width:`${100-K}%`,children:[l(a,{marginBottom:1,flexDirection:"column",children:[t(de,{children:"Thinking Verbs"}),l(a,{flexDirection:"column",children:[t(o,{dimColor:!0,children:f==="format"?"enter to edit format":"changes auto-saved"}),t(o,{dimColor:!0,children:"esc to go back"}),t(o,{dimColor:!0,children:"tab to switch sections"})]})]}),t(a,{marginBottom:1,children:t(o,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),l(a,{flexDirection:"column",children:[l(o,{children:[t(o,{color:f==="format"?"yellow":void 0,children:f==="format"?"❯ ":" "}),t(o,{bold:!0,color:f==="format"?"yellow":void 0,children:"Format"})]}),f==="format"&&(R?l(o,{dimColor:!0,children:[" ","enter to save"]}):l(o,{dimColor:!0,children:[" ","enter to edit"]}))]}),t(a,{marginLeft:2,marginBottom:1,children:t(a,{borderStyle:"round",borderColor:R?"yellow":"gray",children:t(o,{children:R?H:r})})}),t(a,{children:l(o,{children:[t(o,{color:f==="verbs"?"yellow":void 0,children:f==="verbs"?"❯ ":" "}),t(o,{bold:!0,color:f==="verbs"?"yellow":void 0,children:"Verbs"})]})}),f==="verbs"&&t(a,{flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),t(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const y=Math.max(0,d-Math.floor(4)),x=Math.min(n.length,y+8),F=Math.max(0,x-8),V=n.slice(F,x);return l(ce,{children:[F>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",F," more above"]}),V.map((Q,j)=>{const b=F+j;return l(o,{color:f==="verbs"&&b===d?"cyan":void 0,children:[f==="verbs"&&b===d?"❯ ":" ",Q]},b)}),x<n.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-x," more below"]})]})})(),k&&l(a,{alignItems:"center",children:[t(o,{color:"yellow",children:"❯ "}),t(a,{borderStyle:"round",borderColor:"yellow",children:t(o,{children:v})})]}),O&&l(a,{marginTop:1,alignItems:"center",children:[t(o,{children:"Editing: "}),t(a,{borderStyle:"round",borderColor:"yellow",children:t(o,{children:v})})]})]})})]}),l(a,{width:`${K}%`,flexDirection:"column",children:[t(a,{marginBottom:1,children:t(o,{bold:!0,children:"Preview"})}),t(a,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:l(o,{children:[l(o,{color:G,children:["✻ ",r.replace(/\{\}/g,n[d])," "]}),t(o,{color:X?.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]})})]})]})}const fe=[{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 In({onBack:e}){const{settings:{thinkingStyle:{phases:r,updateInterval:n,reverseMirror:i},themes:s},updateSettings:c}=ge(he),g=["reverseMirror","updateInterval","phases","presets"],[h,f]=_(0),d=g[h],[I,O]=_(0),[C,v]=_(0),[D,k]=_(!1),[T,R]=_(""),[P,H]=_(!1),[J,W]=_(!1),[X,G]=_(n.toString()),[K,$]=_(0),y=Te(),x=s.find(p=>p.id===y)||s.find(p=>p.id==="dark"),F=x?.colors.claude||"rgb(215,119,87)";se(()=>{if(r.length>0){const p=i?[...r,...[...r].reverse().slice(1,-1)]:r,M=setInterval(()=>{$(u=>(u+1)%p.length)},n);return()=>clearInterval(M)}},[r,n,i]),ae((p,M)=>{if(J){if(M.return){const u=parseInt(X);!isNaN(u)&&u>0&&c(w=>{w.thinkingStyle.updateInterval=u}),W(!1)}else M.escape?(G(n.toString()),W(!1)):M.backspace||M.delete?G(u=>u.slice(0,-1)):p&&p.match(/^[0-9]$/)&&G(u=>u+p);return}if(D||P){if(M.return&&T.length){const u=P?[...r,T]:r.map((w,A)=>A===I?T:w);c(w=>{w.thinkingStyle.phases=u}),k(!1),R("")}else M.escape?(R(""),k(!1),H(!1)):M.backspace||M.delete?R(u=>u.slice(0,-1)):p&&R(u=>u+p);return}if(M.escape)e();else if(M.return)if(d==="updateInterval")G(n.toString()),W(!0);else if(d==="presets"){const u=fe[C];c(w=>{w.thinkingStyle.phases=[...u.phases],w.thinkingStyle.reverseMirror=u.reverseMirror})}else d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(M.tab)M.shift?f(u=>u===0?g.length-1:u-1):f(u=>u===g.length-1?0:u+1);else if(M.upArrow)d==="phases"&&r.length>0?O(u=>u>0?u-1:r.length-1):d==="presets"&&v(u=>u>0?u-1:fe.length-1);else if(M.downArrow)d==="phases"&&r.length>0?O(u=>u<r.length-1?u+1:0):d==="presets"&&v(u=>u<fe.length-1?u+1:0);else if(p===" ")d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(p==="e"&&d==="phases")r.length>0&&(R(r[I]),k(!0));else if(p==="a"&&d==="phases")H(!0),R("");else if(p==="d"&&d==="phases")r.length>1&&(c(u=>{u.thinkingStyle.phases=r.filter((w,A)=>A!==I)}),I>=r.length&&O(Math.max(0,r.length-1)));else if(p==="w"&&d==="phases"){if(I>0){const u=[...r];[u[I-1],u[I]]=[u[I],u[I-1]],c(w=>{w.thinkingStyle.phases=u}),O(w=>w-1)}}else if(p==="s"&&d==="phases"){if(I<r.length-1){const u=[...r];[u[I],u[I+1]]=[u[I+1],u[I]],c(w=>{w.thinkingStyle.phases=u}),O(w=>w+1)}}else M.ctrl&&p==="r"&&(c(u=>{u.thinkingStyle=q.thinkingStyle}),O(0),v(0))});const V=i?"●":"○",Q=50,b=i?[...r,...[...r].reverse().slice(1,-1)]:r,m=b.length>0?b[K]:"·";return t(a,{children:l(a,{flexDirection:"column",width:"100%",children:[l(a,{flexDirection:"row",width:"100%",children:[l(a,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[t(de,{children:"Thinking style"}),l(a,{flexDirection:"column",children:[l(o,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),t(o,{dimColor:!0,children:"esc to go back"}),t(o,{dimColor:!0,children:"tab to switch sections"})]})]}),l(a,{width:`${Q}%`,flexDirection:"column",children:[t(a,{children:t(o,{bold:!0,children:"Preview"})}),l(a,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[t(a,{width:(m?.length??0)+1,children:t(o,{color:F,children:m})}),l(o,{children:[t(o,{color:F,children:"Thinking… "}),t(o,{color:x?.colors.secondaryText,children:"(esc to interrupt)"})]})]})]})]}),l(a,{flexDirection:"row",gap:4,children:[l(a,{flexDirection:"column",children:[l(o,{children:[t(o,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),t(o,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&l(o,{dimColor:!0,children:[" ","space to toggle"]}),t(a,{marginLeft:2,marginBottom:1,children:l(o,{children:[V," ",i?"Enabled":"Disabled"]})})]}),l(a,{flexDirection:"column",children:[l(o,{children:[t(o,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),t(o,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(J?l(o,{dimColor:!0,children:[" ","enter to save"]}):l(o,{dimColor:!0,children:[" ","enter to edit"]})),t(a,{marginLeft:2,marginBottom:1,children:t(a,{borderStyle:"round",borderColor:J?"yellow":"gray",children:t(o,{children:J?X:n})})})]})]}),t(a,{children:l(o,{children:[t(o,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),t(o,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&t(a,{marginBottom:1,flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),t(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const M=Math.max(0,I-Math.floor(4)),u=Math.min(r.length,M+8),w=Math.max(0,u-8),A=r.slice(w,u);return l(ce,{children:[w>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),A.map((S,E)=>{const Z=w+E;return l(o,{color:d==="phases"&&Z===I?"cyan":void 0,children:[d==="phases"&&Z===I?"❯ ":" ",S]},Z)}),u<r.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-u," more below"]})]})})(),P&&l(a,{children:[t(o,{color:"yellow",children:"❯ "}),t(a,{borderStyle:"round",borderColor:"yellow",children:t(o,{children:T})})]}),D&&l(a,{marginTop:1,children:[t(o,{children:"Editing: "}),t(a,{borderStyle:"round",borderColor:"yellow",children:t(o,{children:T})})]})]})}),t(a,{children:l(o,{children:[t(o,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),t(o,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&l(o,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),t(a,{marginLeft:2,marginBottom:1,children:t(a,{flexDirection:"column",children:(()=>{const M=Math.max(0,C-Math.floor(4)),u=Math.min(fe.length,M+8),w=Math.max(0,u-8),A=fe.slice(w,u);return l(ce,{children:[w>0&&l(o,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),A.map((S,E)=>{const Z=w+E;return l(o,{color:d==="presets"&&Z===C?"cyan":void 0,children:[d==="presets"&&Z===C?"❯ ":" ",S.name," ",S.phases.join("")]},Z)}),u<fe.length&&l(o,{color:"gray",dimColor:!0,children:[" ","↓ ",fe.length-u," more below"]})]})})()})}),t(a,{marginTop:1,children:t(o,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const we=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Cn({onBack:e}){const{settings:r,updateSettings:n}=ge(he),[i,s]=_("prefix"),[c,g]=_(0),[h,f]=_(!1),[d,I]=_(()=>r.userMessageDisplay.prefix.format),[O,C]=_(0),[v,D]=_(()=>[...r.userMessageDisplay.prefix.styling]),[k,T]=_(()=>r.userMessageDisplay.prefix.foreground_color),[R,P]=_(()=>r.userMessageDisplay.prefix.background_color),[H,J]=_(0),[W,X]=_(0),[G,K]=_(()=>[...r.userMessageDisplay.message.styling]),[$,y]=_(()=>r.userMessageDisplay.message.foreground_color),[x,F]=_(()=>r.userMessageDisplay.message.background_color),[V,Q]=_(null),[j,b]=_(""),m=Te(),p=r.themes?.find(L=>L.id===m)||r.themes?.[0],M=["format","styling","foreground","background"],u=["styling","foreground","background"],w=M[c],A=u[H],S=(L,N)=>{n(B=>{const z=L==="prefix"?B.userMessageDisplay.prefix:B.userMessageDisplay.message;N(z)})},E=L=>{n(N=>{L==="prefix"?N.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:N.userMessageDisplay.message={...q.userMessageDisplay.message}}),L==="prefix"?(I(q.userMessageDisplay.prefix.format),D([...q.userMessageDisplay.prefix.styling]),T(q.userMessageDisplay.prefix.foreground_color),P(q.userMessageDisplay.prefix.background_color)):(K([...q.userMessageDisplay.message.styling]),y(q.userMessageDisplay.message.foreground_color),F(q.userMessageDisplay.message.background_color))};se(()=>{const L=r.userMessageDisplay.prefix;I(L.format),D([...L.styling]),T(L.foreground_color),P(L.background_color);const N=r.userMessageDisplay.message;K([...N.styling]),y(N.foreground_color),F(N.background_color)},[]),ae((L,N)=>{if(h){if(N.return)S("prefix",B=>{B.format=d}),f(!1);else if(N.escape){const B=r.userMessageDisplay.prefix;I(B.format),f(!1)}else N.backspace||N.delete?I(B=>B.slice(0,-1)):L&&I(B=>B+L);return}if(V===null){if(N.escape)e();else if(N.ctrl&&L==="r")E(i);else if(N.leftArrow||N.rightArrow)s(B=>B==="prefix"?"message":"prefix");else if(N.tab)i==="prefix"?N.shift?g(B=>B===0?M.length-1:B-1):g(B=>B===M.length-1?0:B+1):N.shift?J(B=>B===0?u.length-1:B-1):J(B=>B===u.length-1?0:B+1);else if(N.return)i==="prefix"?w==="format"?f(!0):w==="foreground"?(b(k),Q({column:"prefix",type:"foreground"})):w==="background"&&(b(R),Q({column:"prefix",type:"background"})):A==="foreground"?(b($),Q({column:"message",type:"foreground"})):A==="background"&&(b(x),Q({column:"message",type:"background"}));else if(N.upArrow)i==="prefix"&&w==="styling"?C(B=>Math.max(0,B-1)):i==="message"&&A==="styling"&&X(B=>Math.max(0,B-1));else if(N.downArrow)i==="prefix"&&w==="styling"?C(B=>Math.min(we.length-1,B+1)):i==="message"&&A==="styling"&&X(B=>Math.min(we.length-1,B+1));else if(L===" "){if(i==="prefix"&&w==="styling"){const B=we[O].value,z=v.indexOf(B)>=0?v.filter(U=>U!==B):[...v,B];D(z),S("prefix",U=>{U.styling=[...z]})}else if(i==="message"&&A==="styling"){const B=we[W].value,z=G.indexOf(B)>=0?G.filter(U=>U!==B):[...G,B];K(z),S("message",U=>{U.styling=[...z]})}}}});const Z=(L,N,B=!0)=>{const z=B?N==="prefix"?v:G:[],U=B?N==="prefix"?k:$:"rgb(255,255,255)",be=B?N==="prefix"?R:x:"rgb(0,0,0)",xe=U==="rgb(0,0,0)"&&be==="rgb(0,0,0)",ve=z.length>0;return xe&&!ve?t(o,{children:L}):t(o,{bold:z.includes("bold"),italic:z.includes("italic"),underline:z.includes("underline"),strikethrough:z.includes("strikethrough"),inverse:z.includes("inverse"),color:xe?void 0:U,backgroundColor:xe?void 0:be,children:L})},oe=(L=!0)=>l(o,{children:[d&&l(ce,{children:[Z(d,"prefix",L)," "]}),Z("list the dir","message",L)]}),te=L=>{const N=i===L,U=(L==="prefix"?M:u)[L==="prefix"?c:H],be=L==="prefix"?O:W,xe=L==="prefix"?v:G,ve=L==="prefix"?k:$,Pe=L==="prefix"?R:x;return l(a,{flexDirection:"column",width:"45%",borderStyle:N?"round":"single",borderColor:N?"yellow":"gray",padding:1,children:[t(a,{marginBottom:1,children:l(o,{bold:!0,color:N?"yellow":void 0,children:[L.charAt(0).toUpperCase()+L.slice(1)," ","Configuration"]})}),L==="prefix"&&l(ce,{children:[t(a,{children:l(o,{color:N&&U==="format"?"yellow":void 0,bold:N&&U==="format",children:[N&&U==="format"?"❯ ":" ","Prefix Text"]})}),N&&U==="format"&&t(a,{marginLeft:2,children:t(o,{dimColor:!0,children:h?"enter to save":"enter to edit (appears before message)"})}),t(a,{marginLeft:2,marginBottom:1,children:t(a,{borderStyle:"round",borderColor:h?"yellow":"gray",children:t(o,{children:d})})})]}),t(a,{children:l(o,{color:N&&U==="styling"?"yellow":void 0,bold:N&&U==="styling",children:[N&&U==="styling"?"❯ ":" ","Styling"]})}),N&&U==="styling"&&t(a,{marginLeft:2,children:t(o,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),t(a,{marginLeft:2,marginBottom:1,flexDirection:"column",children:we.map(($e,Ue)=>t(a,{children:l(o,{color:N&&U==="styling"&&be===Ue?"cyan":void 0,children:[N&&U==="styling"&&be===Ue?"❯ ":" ",xe.includes($e.value)?"●":"○"," ",$e.label]})},$e.value))}),t(a,{children:l(o,{color:N&&U==="foreground"?"yellow":void 0,bold:N&&U==="foreground",children:[N&&U==="foreground"?"❯ ":" ","Foreground color"]})}),N&&U==="foreground"&&t(a,{marginLeft:2,children:t(o,{dimColor:!0,children:"enter to open color picker"})}),t(a,{marginLeft:2,marginBottom:1,children:t(o,{color:ve,children:ve})}),t(a,{children:l(o,{color:N&&U==="background"?"yellow":void 0,bold:N&&U==="background",children:[N&&U==="background"?"❯ ":" ","Background color"]})}),N&&U==="background"&&t(a,{marginLeft:2,children:t(o,{dimColor:!0,children:"enter to open color picker"})}),t(a,{marginLeft:2,children:t(o,{backgroundColor:Pe,children:Pe})})]})};if(V){const{column:L,type:N}=V;return t(qe,{initialValue:j,theme:p,onColorChange:B=>{L==="prefix"?N==="foreground"?(T(B),S("prefix",z=>{z.foreground_color=B})):(P(B),S("prefix",z=>{z.background_color=B})):N==="foreground"?(y(B),S("message",z=>{z.foreground_color=B})):(F(B),S("message",z=>{z.background_color=B}))},onExit:()=>{Q(null),b("")}})}return l(a,{flexDirection:"column",children:[t(de,{children:"Customize how user messages are displayed"}),l(a,{flexDirection:"column",marginBottom:1,children:[t(o,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),t(o,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),l(a,{flexDirection:"row",gap:1,children:[te("prefix"),te("message")]}),t(a,{borderStyle:"round",padding:1,marginTop:1,children:l(a,{flexDirection:"column",children:[t(a,{marginBottom:1,children:t(o,{bold:!0,children:"Preview"})}),l(a,{flexDirection:"row",gap:2,children:[l(a,{flexDirection:"column",width:"50%",children:[t(a,{marginBottom:1,children:t(o,{underline:!0,children:"Before (Claude Code default):"})}),t(a,{marginLeft:1,children:t(o,{color:p?.colors?.secondaryText||"#888888",children:"> list the dir"})}),t(a,{marginLeft:1,marginTop:1,children:l(o,{children:[t(o,{color:p?.colors?.secondaryText||"#888888",children:"●"}),t(o,{children:" The directory "}),t(o,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),t(o,{children:" contains "}),t(o,{bold:!0,children:"123"}),t(o,{children:" files."})]})})]}),l(a,{flexDirection:"column",width:"50%",children:[t(a,{marginBottom:1,children:t(o,{underline:!0,children:"After (Your customization):"})}),t(a,{marginLeft:1,children:oe(!0)}),t(a,{marginLeft:1,marginTop:1,children:l(o,{children:[t(o,{color:p?.colors?.secondaryText||"#888888",children:"●"}),t(o,{children:" The directory "}),t(o,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),t(o,{children:" contains "}),t(o,{bold:!0,children:"123"}),t(o,{children:" files."})]})})]})]})]})})]})}function vn({onSubmit:e}){const{settings:r,updateSettings:n}=ge(he),[i,s]=_(0),c=()=>{n(h=>{h.inputBox||(h.inputBox={removeBorder:!1}),h.inputBox.removeBorder=!h.inputBox.removeBorder})};ae((h,f)=>{f.return||f.escape?e():h===" "&&i===0&&c()});const g=r.inputBox?.removeBorder?"☑":"☐";return l(a,{flexDirection:"column",children:[t(a,{marginBottom:1,children:t(de,{children:"Input Box Settings"})}),t(a,{marginBottom:1,children:l(o,{color:"gray",children:[t(o,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",t(o,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),t(a,{children:l(o,{children:[t(o,{color:i===0?"cyan":void 0,children:i===0?"❯ ":" "}),t(o,{bold:!0,color:i===0?"cyan":void 0,children:"Remove border"})]})}),i===0&&t(a,{marginBottom:1,flexDirection:"column",children:l(o,{dimColor:!0,children:[" ","space to toggle"]})}),t(a,{marginLeft:2,marginBottom:1,children:l(o,{children:[g," ",r.inputBox?.removeBorder?"Enabled":"Disabled"]})}),t(a,{marginBottom:1,children:t(o,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const Qe=async()=>{await ue.mkdir(Ee,{recursive:!0})};let ye={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const ke=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};try{ie()&&console.log(`Reading config at ${le}`);const r=await ue.readFile(le,"utf8"),n={...e,...JSON.parse(r)},i=n?.settings?.thinkingVerbs;i?.punctuation&&(i.format="{}"+i.punctuation,delete i.punctuation),n.settings.inputBox||(n.settings.inputBox=q.inputBox);for(const s of q.themes){const c=n?.settings?.themes.find(g=>g.id===s.id||g.name===s.name);if(c)for(const[g,h]of Object.entries(s))Object.hasOwn(c,g)||(c[g]=h)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||q,n.settings.userMessageDisplay=q.userMessageDisplay),ye=n,n}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return e;throw r}},_e=async e=>(ie()&&console.log(`Updating config at ${le}`),e(ye),ye.lastModified=new Date().toISOString(),await Mn(ye),ye),Mn=async e=>{try{e.lastModified=new Date().toISOString(),await Qe(),await ue.writeFile(le,JSON.stringify(e,null,2))}catch(r){throw console.error("Error saving config:",r),r}},en=async e=>{ie()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const r=await ue.readFile(pe);return await Ze(e.cliPath,r,"restore"),await _e(n=>{n.changesApplied=!1}),!0},Tn=async e=>{e.ccInstallationDir&&Me.unshift(e.ccInstallationDir);for(const r of Me)try{ie()&&console.log(`Searching for Claude Code cli.js file at ${r}`);const n=Ge.join(r,"cli.js"),i=Ge.join(r,"package.json"),s=JSON.parse(await ue.readFile(i,"utf8"));return ie()&&(console.log(`Found Claude Code cli.js file at ${r}; checking hash...`),console.log(`SHA256 hash: ${await pn(n)}`)),{cliPath:n,packageJsonPath:i,version:s.version}}catch{continue}return null},je=async e=>{await Qe(),ie()&&console.log(`Backing up cli.js to ${pe}`),await ue.copyFile(e.cliPath,pe),await _e(r=>{r.changesApplied=!1,r.ccVersion=e.version})};async function _n(e){try{return await ue.stat(e),!0}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return!1;throw r}}async function Ye(){const e=await ke(),r=await Tn(e);if(!r)return null;const n=r.version,i=e.ccVersion;let s=!1;return await _n(pe)||(ie()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await je(r),s=!0),n!==i?(s||(ie()&&console.log(`startupCheck: real version (${n}) != backed up version (${i}); backing up cli.js`),await ue.unlink(pe),await je(r)),{wasUpdated:!0,oldVersion:i,newVersion:n,ccInstInfo:r}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:r}}const $n=e=>{const r=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let i;for(;(i=n.exec(e))!==null;){const s=i.index+i[0].indexOf("=")+1;r.push({startIndex:s,endIndex:s+i[1].length})}return r},An=(e,r)=>{const n=$n(e);if(n.length===0)return null;const i=n.sort((c,g)=>g.startIndex-c.startIndex);let s=e;for(const c of i){const g=r.toString(),h=s.slice(0,c.startIndex)+g+s.slice(c.endIndex);ee(s,h,g,c.startIndex,c.endIndex),s=h}return s};function On(e){const r=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(r);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const i=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,s=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,c=e.match(i),g=e.match(s);return!c||c.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!g||g.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:c.index,endIndex:c.index+c[0].length},obj:{startIndex:g.index,endIndex:g.index+g[0].length}}}const Nn=(e,r)=>{const n=On(e);if(!n)return null;if(r.length===0)return e;let i=e;const s="return"+JSON.stringify(Object.fromEntries(r.map(h=>[h.id,h.name])));i=i.slice(0,n.obj.startIndex)+s+i.slice(n.obj.endIndex),ee(e,i,s,n.obj.startIndex,n.obj.endIndex),e=i;const c=JSON.stringify(r.map(h=>({label:h.name,value:h.id})));i=i.slice(0,n.objArr.startIndex)+c+i.slice(n.objArr.endIndex),ee(e,i,c,n.objArr.startIndex,n.objArr.endIndex),e=i;let g=`switch(${n.switchStatement.identifiers?.[0]}){
|
|
9
|
+
`;return r.forEach(h=>{g+=`case"${h.id}":return${JSON.stringify(h.colors)};
|
|
10
|
+
`}),g+=`default:return${JSON.stringify(r[0].colors)};
|
|
11
|
+
}`,i=i.slice(0,n.switchStatement.startIndex)+g+i.slice(n.switchStatement.endIndex),ee(e,i,g,n.switchStatement.startIndex,n.switchStatement.endIndex),i},Dn=e=>{const r=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(r);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},Bn=e=>{const r=Dn(e);if(!r)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",i=e.slice(0,r)+n+e.slice(r);return ee(e,i,n,r,r),i},En=e=>{const r=/borderColor:[$\w]+==="bash"/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: input border: failed to find approxAreaMatch"),null;const i=n.index,s=Math.min(e.length,i+200),c=e.slice(i,s),g=/borderStyle:"round"/,h=c.match(g);if(!h||h.index===void 0)return console.error("patch: input border: failed to find borderStyle in section"),null;const f=i+h.index,d=f+h[0].length;return{startIndex:f,endIndex:d}},Ln=(e,r)=>{const n=En(e);if(!n)return null;const i=r?"borderStyle:undefined,marginBottom:1":'borderStyle:"round"',s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return ee(e,s,i,n.startIndex,n.endIndex),s};function kn(e){const r=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
|
|
9
12
|
██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
|
|
10
13
|
██║ ██║ ███████║██║ ██║██║ ██║█████╗
|
|
11
14
|
██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
|
|
@@ -16,15 +19,12 @@ import{Box as a,Text as o,render as nr,useInput as ae,useStdout as tr}from"ink";
|
|
|
16
19
|
██║ ██║ ██║██║ ██║█████╗
|
|
17
20
|
██║ ██║ ██║██║ ██║██╔══╝
|
|
18
21
|
╚██████╗╚██████╔╝██████╔╝███████╗
|
|
19
|
-
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,r=e.indexOf(t);return r===-1?null:{startIndex:r-1,endIndex:r+t.length+1}}function $r(e,t){const r=_r(e);if(!r)return e;const i=JSON.stringify(t),s=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return re(e,s,i,r.startIndex,r.endIndex),s}function Ar(e){const t=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,r=e.match(t);if(r&&r.index!==void 0){const i=r[0].indexOf('"Claude Code"');if(i!==-1)return{startIndex:r.index+i,endIndex:r.index+i+13}}return null}function Or(e,t){const r=Ar(e);if(!r)return console.error("patch: welcome message: failed to find location"),null;const i=`"${t}"`,s=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return re(e,s,i,r.startIndex,r.endIndex),s}function Nr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,r=e.match(t);if(!r||r.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const i=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,s=/return\{(?:[\w$]+?:"(?:Dark|Light).+?",?)+\}/,c=e.match(i),g=e.match(s);return!c||c.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!g||g.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1].trim()]},objArr:{startIndex:c.index,endIndex:c.index+c[0].length},obj:{startIndex:g.index,endIndex:g.index+g[0].length}}}const Dr=(e,t)=>{const r=Nr(e);if(!r)return null;if(t.length===0)return e;let i=e;const s="return"+JSON.stringify(Object.fromEntries(t.map(h=>[h.id,h.name])));i=i.slice(0,r.obj.startIndex)+s+i.slice(r.obj.endIndex),re(e,i,s,r.obj.startIndex,r.obj.endIndex),e=i;const c=JSON.stringify(t.map(h=>({label:h.name,value:h.id})));i=i.slice(0,r.objArr.startIndex)+c+i.slice(r.objArr.endIndex),re(e,i,c,r.objArr.startIndex,r.objArr.endIndex),e=i;let g=`switch(${r.switchStatement.identifiers?.[0]}){
|
|
20
|
-
|
|
21
|
-
`}),g
|
|
22
|
-
|
|
23
|
-
--- Diff ---`),console.log("OLD:",f+`\x1B[31m${d}\x1B[0m`+y),console.log("NEW:",T+`\x1B[32m${C}\x1B[0m`+v),console.log(`--- End Diff ---
|
|
24
|
-
`))}const Jr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const i=r[0],s=/verbose:[^,}]+/,c=i.match(s);if(!c||c.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const g=r.index+c.index,h=g+c[0].length;return{startIndex:g,endIndex:h}},Xr=e=>{const t=Jr(e);if(!t)return null;const r="verbose:true",i=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return re(e,i,r,t.startIndex,t.endIndex),i},Kr=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(t);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1],r[2],r[3]]}},Zr=e=>{const t=Kr(e);if(!t)return null;const r=t.identifiers?.[0],i=t.identifiers?.[1],s=t.identifiers?.[2],c=`function ${r}(${i}){if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);${s}}`,g=e.slice(0,t.startIndex)+c+e.slice(t.endIndex);return re(e,g,c,t.startIndex,t.endIndex),g},qr=e=>{const t=/([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,r=Array.from(e.matchAll(t)),i={};for(const g of r){const h=g[1];i[h]=(i[h]||0)+1}let s,c=0;for(const[g,h]of Object.entries(i))h>c&&(c=h,s=g);return s},Qr=e=>{const t=/No content found in user prompt message/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: userMessageDisplay: failed to find error message"),null;const i=r.index,s=Math.min(e.length,i+400),c=e.slice(i,s),g=/\{minWidth:(\d+),width:\d+\}/,h=c.match(g);if(!h||h.index===void 0)return console.error("patch: userMessageDisplay: failed to find minWidth pattern"),null;const f=/createElement\(\w+,\{color:"[^"]*"\},"([^"]+)"\)/,d=c.match(f),y=/(createElement\(\w+,\{[^}]*color:"[^"]*"[^}]*\},(\w+)\.trim\(\))/,T=c.match(y);return{minWidthLocation:h&&{startIndex:i+h.index,endIndex:i+h.index+h[0].length},prefixLocation:d?{startIndex:i+d.index,endIndex:i+d.index+d[0].length}:null,messageLocation:T&&{startIndex:i+T.index,endIndex:i+T.index+T[0].length}}},en=(e,t,r,i,s=!1,c=!1,g=!1,h=!1,f=!1,d,y,T=!1,C=!1,v=!1,D=!1,k=!1)=>{const _=Qr(e);if(!_)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!_.minWidthLocation)return console.error("patch: userMessageDisplay: failed to find minWidth location"),null;if(!_.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!_.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const R=qr(e);if(!R)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const P=[];P.push({startIndex:_.minWidthLocation.startIndex,endIndex:_.minWidthLocation.endIndex,newContent:`{minWidth:${t.length+1},width:${t.length+1}}`});const J=r==="rgb(0,0,0)"&&i==="rgb(0,0,0)",z=s||c||g||h||f,W=!J||z,X=d==="rgb(0,0,0)"&&y==="rgb(0,0,0)",U=T||C||v||D||k,K=!X||U;if(W){const I=We(R,J?null:r.match(/\d+/g)?.join(",")||null,J?null:i.match(/\d+/g)?.join(",")||null,s,c,g,h,f);P.push({startIndex:_.prefixLocation.startIndex,endIndex:_.prefixLocation.endIndex,newContent:e.slice(_.prefixLocation.startIndex,_.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`${I}("${t}"))`)})}else P.push({startIndex:_.prefixLocation.startIndex,endIndex:_.prefixLocation.endIndex,newContent:e.slice(_.prefixLocation.startIndex,_.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`"${t}")`)});if(K){const I=We(R,X?null:d.match(/\d+/g)?.join(",")||null,X?null:y.match(/\d+/g)?.join(",")||null,T,C,v,D,k);P.push({startIndex:_.messageLocation.startIndex,endIndex:_.messageLocation.endIndex,newContent:e.slice(_.messageLocation.startIndex,_.messageLocation.endIndex).replace(/(\w+\.trim\(\))/,`${I}($1)`)})}P.sort((I,x)=>x.startIndex-I.startIndex);let A=e;for(const I of P){const x=A;A=A.slice(0,I.startIndex)+I.newContent+A.slice(I.endIndex),re(x,A,I.newContent,I.startIndex,I.endIndex)}return A},rn=e=>{const t=/borderColor:[$\w]+==="bash"/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: input border: failed to find approxAreaMatch"),null;const i=r.index,s=Math.min(e.length,i+200),c=e.slice(i,s),g=/borderStyle:"round"/,h=c.match(g);if(!h||h.index===void 0)return console.error("patch: input border: failed to find borderStyle in section"),null;const f=i+h.index,d=f+h[0].length;return{startIndex:f,endIndex:d}},nn=(e,t)=>{const r=rn(e);if(!r)return null;const i=t?"borderStyle:undefined,marginBottom:1":'borderStyle:"round"',s=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return re(e,s,i,r.startIndex,r.endIndex),s},tn=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return null;const r=Math.max(0,t-600),i=t,s=e.slice(r,i),c=s.match(/\[[\w$]+,\s*[\w$]+\]\s*=\s*[\w$]+\.useState\([^)]*\)\s*,\s*([\w$]+)=/);if(!c||c.index===void 0)return null;let h=r+c.index;for(;h<e.length&&e[h]!==";";)h++;if(h>=e.length)return null;const f=h+1,d=c[1];return{insertionIndex:f,optionsVar:d}},on=e=>{const t=tn(e);if(!t)return null;const{insertionIndex:r,optionsVar:i}=t,s=Re.map(g=>{const h=JSON.stringify(g.label),f=JSON.stringify(g.slug);return`${i}.push({value:${f},label:${h}});`}).join(""),c=e.slice(0,r)+s+e.slice(r);return re(e,c,s,r,r),c},sn=e=>{const t=e.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let i=t.index;for(;i>=0&&e[i]!=="[";)i--;if(i<0)return null;let s=i-1;for(;s>=0&&/\s/.test(e[s]);)s--;if(s<0||e[s]!=="=")return null;let c=i,g=0,h=-1;for(;c<e.length;){const D=e[c];if(D==="["&&g++,D==="]"&&(g--,g===0)){h=c;break}c++}if(h===-1)return null;const f=e.slice(i,h+1);let d;try{d=JSON.parse(f)}catch{return null}const y=Re.map(D=>D.slug),T=new Set(d);for(const D of y)T.add(D);const C=JSON.stringify(Array.from(T)),v=e.slice(0,i)+C+e.slice(h+1);return re(e,v,C,i,h+1),v},ln=e=>{const t='case"sonnet[1m]"',r=e.indexOf(t);if(r===-1)return null;let i=r;for(;i>=0&&e[i]!=="{";)i--;if(i<0)return null;let s=r;for(;s<e.length&&e[s]!=="}";)s++;if(s>=e.length)return null;const c=e.slice(i,s+1),g=Re.map(C=>`case${JSON.stringify(C.slug)}:return${JSON.stringify(C.internal)};`).join(""),h=c.slice(0,-1),f=/;\s*$/.test(h),d=(f?"":";")+g,y=h+d+"}",T=e.slice(0,i)+y+e.slice(s+1);return re(e,T,g,i+c.length-1,i+c.length-1),T},cn=e=>{let t=e;const r=sn(t);r&&(t=r);const i=ln(t);i&&(t=i);const s=on(t);return s&&(t=s),t===e?null:t},rr=async(e,t)=>{await er(t);let r=await Se.readFile(t.cliPath,{encoding:"utf8"}),i=null;if(e.settings.themes&&e.settings.themes.length>0&&(i=Dr(r,e.settings.themes))&&(r=i),e.settings.launchText){const s=e.settings.launchText;let c="";s.method==="custom"&&s.customText?c=s.customText:s.method==="figlet"&&s.figletText&&(c=await new Promise(h=>Be.text(s.figletText.replace(`
|
|
25
|
-
`," "),s.figletFont,(f,d)=>{f?(console.error("patch: figlet: failed to generate text",f),h("")):h(d||"")}))),(i=$r(r,c))&&(r=i);const g=s.method==="custom"?s.customText:s.figletText;g&&(i=Or(r,g))&&(r=i)}return e.settings.thinkingVerbs&&((i=Fr(r,e.settings.thinkingVerbs.verbs))&&(r=i),(i=Wr(r,e.settings.thinkingVerbs.format))&&(r=i)),(i=Er(r,e.settings.thinkingStyle.phases))&&(r=i),(i=kr(r,e.settings.thinkingStyle.updateInterval))&&(r=i),(i=Hr(r,Math.max(...e.settings.thinkingStyle.phases.map(s=>s.length))+1))&&(r=i),(i=Yr(r,e.settings.thinkingStyle.reverseMirror))&&(r=i),e.settings.userMessageDisplay&&(i=en(r,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(r=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=nn(r,e.settings.inputBox.removeBorder))&&(r=i),(i=Xr(r))&&(r=i),(i=Pr(r))&&(r=i),(i=Zr(r))&&(r=i),(i=cn(r))&&(r=i),await Ze(t.cliPath,r,"patch"),await _e(s=>{s.changesApplied=!0})},he=ir({settings:q,updateSettings:e=>{},changesApplied:!1});function an({startupCheckInfo:e}){const[t,r]=$({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});se(()=>{(async()=>{r(await ke())})()},[]);const i=ze(y=>{const T=JSON.parse(JSON.stringify(t.settings));y(T),r(C=>({...C,settings:T,changesApplied:!1})),_e(C=>{C.settings=T,C.changesApplied=!1})},[t.settings]),[s,c]=$(null),[g,h]=$(null);se(()=>{e.wasUpdated&&e.oldVersion&&(h({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
22
|
+
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(r);return n!==-1?{startIndex:n-1,endIndex:n+r.length+1}:null}function Rn(e,r){const n=kn(e);if(!n)return e;const i=JSON.stringify(r),s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return ee(e,s,i,n.startIndex,n.endIndex),s}const Pn=e=>{const r=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const i=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,s=n[0].match(i);if(!s||s.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const c=n.index+s.index,g=c+s[0].length;return{startIndex:c,endIndex:g}},Un=e=>{const r=Pn(e);if(!r)return null;const n=e.slice(0,r.startIndex)+e.slice(r.endIndex);return ee(e,n,"",r.startIndex,r.endIndex),n},Gn=e=>{const r=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const i=e.slice(n.index,n.index+600),s=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,c=i.match(s);return!c||c.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+c.index+c[1].length,endIndex:n.index+c.index+c[1].length+c[2].length,identifiers:[c[3]]}},Fn=(e,r)=>{const n=Gn(e);if(!n)return null;const i=n,s=r.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),c=i.identifiers?.[0],h=`=${"`"+s.replace(/\{\}/g,"${"+c+"}")+"`"}`,f=e.slice(0,i.startIndex)+h+e.slice(i.endIndex);return ee(e,f,h,i.startIndex,i.endIndex),f},Vn=e=>{const r=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Wn=(e,r)=>{const n=Vn(e);if(!n)return null;const i=n.identifiers?.[0],s=r?`=[...${i},...[...${i}].reverse()]`:`=[...${i}]`,c=e.slice(0,n.startIndex)+s+e.slice(n.endIndex);return ee(e,c,s,n.startIndex,n.endIndex),c},jn=e=>{const r=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let i;for(;(i=n.exec(e))!==null;)r.push({startIndex:i.index,endIndex:i.index+i[0].length});return r},Yn=(e,r)=>{const n=jn(e);if(n.length===0)return null;const i=JSON.stringify(r),s=n.sort((g,h)=>h.startIndex-g.startIndex);let c=e;for(let g=0;g<s.length;g++){const h=c.slice(0,s[g].startIndex)+i+c.slice(s[g].endIndex);ee(c,h,i,s[g].startIndex,s[g].endIndex),c=h}return c},zn=e=>{const r=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const i=n[0],s=n[1],c=i.lastIndexOf(s),g=n.index+c,h=g+s.length;return{startIndex:g,endIndex:h}},Hn=(e,r)=>{const n=zn(e);if(!n)return null;const i=JSON.stringify(r),s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return ee(e,s,i,n.startIndex,n.endIndex),s},Jn=e=>{const r=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length}},Xn=(e,r)=>{const n=Jn(e);if(!n)return null;const i=`{flexWrap:"wrap",height:1,width:${r}}`,s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return ee(e,s,i,n.startIndex,n.endIndex),s},Kn=e=>{const r=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Zn=e=>{const r=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},qn=(e,r)=>{const n=Kn(e);if(!n)return null;const i=n,s=i.identifiers?.[0],c=`${s}=${JSON.stringify({words:r})}`,g=e.slice(0,i.startIndex)+c+e.slice(i.endIndex);ee(e,g,c,i.startIndex,i.endIndex);const h=Zn(g);if(!h)return null;const f=h,I=`function ${f.identifiers?.[0]}(){return ${s}.words}`,O=g.slice(0,f.startIndex)+I+g.slice(f.endIndex);return ee(g,O,I,f.startIndex,f.endIndex),O},Qn=e=>{const r=e.indexOf("No content found in user prompt message");if(r===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,r+400),i=e.slice(r,n),s=/\{minWidth:(\d+),width:\d+\}/,c=i.match(s);if(!c||c.index===void 0)return console.error("patch: userMessageDisplay: failed to find minWidth pattern"),null;const g=/createElement\(\w+,\{color:"[^"]*"\},"([^"]+)"\)/,h=i.match(g),f=/(createElement\(\w+,\{[^}]*color:"[^"]*"[^}]*\},(\w+)\.trim\(\))/,d=i.match(f);return{minWidthLocation:c&&{startIndex:r+c.index,endIndex:r+c.index+c[0].length},prefixLocation:h?{startIndex:r+h.index,endIndex:r+h.index+h[0].length}:null,messageLocation:d&&{startIndex:r+d.index,endIndex:r+d.index+d[0].length}}},er=(e,r,n,i,s=!1,c=!1,g=!1,h=!1,f=!1,d,I,O=!1,C=!1,v=!1,D=!1,k=!1)=>{const T=Qn(e);if(!T)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!T.minWidthLocation)return console.error("patch: userMessageDisplay: failed to find minWidth location"),null;if(!T.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!T.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const R=dr(e);if(!R)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const P=[];P.push({startIndex:T.minWidthLocation.startIndex,endIndex:T.minWidthLocation.endIndex,newContent:`{minWidth:${r.length+1},width:${r.length+1}}`});const H=n==="rgb(0,0,0)"&&i==="rgb(0,0,0)",W=!H||(s||c||g||h||f),X=d==="rgb(0,0,0)"&&I==="rgb(0,0,0)",K=!X||(O||C||v||D||k);if(W){const y=We(R,H?null:n.match(/\d+/g)?.join(",")||null,H?null:i.match(/\d+/g)?.join(",")||null,s,c,g,h,f);P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:e.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`${y}("${r}"))`)})}else P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:e.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`"${r}")`)});if(K){const y=We(R,X?null:d.match(/\d+/g)?.join(",")||null,X?null:I.match(/\d+/g)?.join(",")||null,O,C,v,D,k);P.push({startIndex:T.messageLocation.startIndex,endIndex:T.messageLocation.endIndex,newContent:e.slice(T.messageLocation.startIndex,T.messageLocation.endIndex).replace(/(\w+\.trim\(\))/,`${y}($1)`)})}P.sort((y,x)=>x.startIndex-y.startIndex);let $=e;for(const y of P){const x=$;$=$.slice(0,y.startIndex)+y.newContent+$.slice(y.endIndex),ee(x,$,y.newContent,y.startIndex,y.endIndex)}return $},nr=e=>{const r=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const i=n[0],s=/verbose:[^,}]+/,c=i.match(s);if(!c||c.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const g=n.index+c.index,h=g+c[0].length;return{startIndex:g,endIndex:h}},rr=e=>{const r=nr(e);if(!r)return null;const n="verbose:true",i=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return ee(e,i,n,r.startIndex,r.endIndex),i};function tr(e){const r=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,n=e.match(r);if(n&&n.index!==void 0){const i=n[0].indexOf('"Claude Code"');if(i!==-1)return{startIndex:n.index+i,endIndex:n.index+i+13}}return null}function or(e,r){const n=tr(e);if(!n)return console.error("patch: welcome message: failed to find location"),null;const i=`"${r}"`,s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return ee(e,s,i,n.startIndex,n.endIndex),s}const Re=[{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"}],ir=e=>{const r=e.indexOf("Switch between Claude models");if(r===-1)return null;const n=Math.max(0,r-600),i=r,c=e.slice(n,i).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!c||c.index===void 0)return null;let h=n+c.index;for(;h<e.length&&e[h]!==";";)h++;if(h>=e.length)return null;const f=h+1,d=c[1];return{insertionIndex:f,optionsVar:d}},sr=e=>{const r=ir(e);if(!r)return null;const{insertionIndex:n,optionsVar:i}=r,s=Re.map(g=>{const h=JSON.stringify(g.label),f=JSON.stringify(g.slug);return`${i}.push({value:${f},label:${h}});`}).join(""),c=e.slice(0,n)+s+e.slice(n);return ee(e,c,s,n,n),c},lr=e=>{const r=e.match(/"sonnet\[1m\]"/);if(!r||r.index===void 0)return null;let i=r.index;for(;i>=0&&e[i]!=="[";)i--;if(i<0)return null;let s=i-1;for(;s>=0&&/\s/.test(e[s]);)s--;if(s<0||e[s]!=="=")return null;let c=i,g=0,h=-1;for(;c<e.length;){const D=e[c];if(D==="["&&g++,D==="]"&&(g--,g===0)){h=c;break}c++}if(h===-1)return null;const f=e.slice(i,h+1);let d;try{d=JSON.parse(f)}catch{return null}const I=Re.map(D=>D.slug),O=new Set(d);for(const D of I)O.add(D);const C=JSON.stringify(Array.from(O)),v=e.slice(0,i)+C+e.slice(h+1);return ee(e,v,C,i,h+1),v},cr=e=>{const n=e.indexOf('case"sonnet[1m]"');if(n===-1)return null;let i=n;for(;i>=0&&e[i]!=="{";)i--;if(i<0)return null;let s=n;for(;s<e.length&&e[s]!=="}";)s++;if(s>=e.length)return null;const c=e.slice(i,s+1),g=Re.map(C=>`case${JSON.stringify(C.slug)}:return${JSON.stringify(C.internal)};`).join(""),h=c.slice(0,-1),d=(/;\s*$/.test(h)?"":";")+g,I=h+d+"}",O=e.slice(0,i)+I+e.slice(s+1);return ee(e,O,g,i+c.length-1,i+c.length-1),O},ar=e=>{let r=e;const n=lr(r);n&&(r=n);const i=cr(r);i&&(r=i);const s=sr(r);return s&&(r=s),r===e?null:r},ee=(e,r,n,i,s)=>{const c=Math.max(0,i-20),g=Math.min(e.length,s+20),h=Math.min(r.length,i+n.length+20),f=e.slice(c,i),d=e.slice(i,s),I=e.slice(s,g),O=r.slice(c,i),C=r.slice(i,i+n.length),v=r.slice(i+n.length,h);ie()&&d!==C&&(console.log(`
|
|
23
|
+
--- Diff ---`),console.log("OLD:",f+`\x1B[31m${d}\x1B[0m`+I),console.log("NEW:",O+`\x1B[32m${C}\x1B[0m`+v),console.log(`--- End Diff ---
|
|
24
|
+
`))},dr=e=>{const r=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(r)),i={};for(const g of n){const h=g[1];i[h]=(i[h]||0)+1}let s,c=0;for(const[g,h]of Object.entries(i))h>c&&(c=h,s=g);return s},nn=async(e,r)=>{await en(r);let n=await Se.readFile(r.cliPath,{encoding:"utf8"}),i=null;if(e.settings.themes&&e.settings.themes.length>0&&(i=Nn(n,e.settings.themes))&&(n=i),e.settings.launchText){const s=e.settings.launchText;let c="";s.method==="custom"&&s.customText?c=s.customText:s.method==="figlet"&&s.figletText&&(c=await new Promise(h=>Be.text(s.figletText.replace(`
|
|
25
|
+
`," "),s.figletFont,(f,d)=>{f?(console.error("patch: figlet: failed to generate text",f),h("")):h(d||"")}))),(i=Rn(n,c))&&(n=i);const g=s.method==="custom"?s.customText:s.figletText;g&&(i=or(n,g))&&(n=i)}return e.settings.thinkingVerbs&&((i=qn(n,e.settings.thinkingVerbs.verbs))&&(n=i),(i=Fn(n,e.settings.thinkingVerbs.format))&&(n=i)),(i=Yn(n,e.settings.thinkingStyle.phases))&&(n=i),(i=Hn(n,e.settings.thinkingStyle.updateInterval))&&(n=i),(i=Xn(n,Math.max(...e.settings.thinkingStyle.phases.map(s=>s.length))+1))&&(n=i),(i=Wn(n,e.settings.thinkingStyle.reverseMirror))&&(n=i),e.settings.userMessageDisplay&&(i=er(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=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=Ln(n,e.settings.inputBox.removeBorder))&&(n=i),(i=rr(n))&&(n=i),(i=Un(n))&&(n=i),(i=Bn(n))&&(n=i),(i=ar(n))&&(n=i),(i=An(n,25))&&(n=i),await Ze(r.cliPath,n,"patch"),await _e(s=>{s.changesApplied=!0})},he=sn({settings:q,updateSettings:e=>{},changesApplied:!1});function hr({startupCheckInfo:e}){const[r,n]=_({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});se(()=>{(async()=>{n(await ke())})()},[]);const i=ze(I=>{const O=JSON.parse(JSON.stringify(r.settings));I(O),n(C=>({...C,settings:O,changesApplied:!1})),_e(C=>{C.settings=O,C.changesApplied=!1})},[r.settings]),[s,c]=_(null),[g,h]=_(null);se(()=>{e.wasUpdated&&e.oldVersion&&(h({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
26
26
|
(However, your customization are still remembered in ${le}.)
|
|
27
|
-
Please reapply your changes below.`,type:"warning"}),i(()=>{}))},[]),ae((
|
|
27
|
+
Please reapply your changes below.`,type:"warning"}),i(()=>{}))},[]),ae((I,O)=>{(O.ctrl&&I==="c"||(I==="q"||O.escape)&&!s)&&process.exit(0)});const f=I=>{switch(h(null),I){case Y.THEMES:case Y.LAUNCH_TEXT:case Y.THINKING_VERBS:case Y.THINKING_STYLE:case Y.USER_MESSAGE_DISPLAY:case Y.INPUT_BOX:c(I);break;case Y.APPLY_CHANGES:e.ccInstInfo&&(h({message:"Applying patches...",type:"info"}),nn(r,e.ccInstInfo).then(O=>{n(O),h({message:"Customization patches applied successfully!",type:"success"})}));break;case Y.RESTORE_ORIGINAL:e.ccInstInfo&&en(e.ccInstInfo).then(()=>{h({message:"Original Claude Code restored successfully!",type:"success"}),i(()=>{})});break;case Y.OPEN_CONFIG:Ve(le);break;case Y.OPEN_CLI:e.ccInstInfo&&Ve(e.ccInstInfo.cliPath);break;case Y.EXIT:process.exit(0)}},d=()=>{c(null)};return t(he.Provider,{value:{settings:r.settings,updateSettings:i,changesApplied:r.changesApplied},children:t(a,{flexDirection:"column",children:s===null?t(fn,{onSubmit:f,notification:g}):s===Y.THEMES?t(wn,{onBack:d}):s===Y.LAUNCH_TEXT?t(Sn,{onBack:d}):s===Y.THINKING_VERBS?t(yn,{onBack:d}):s===Y.THINKING_STYLE?t(In,{onBack:d}):s===Y.USER_MESSAGE_DISPLAY?t(Cn,{onBack:d}):s===Y.INPUT_BOX?t(vn,{onSubmit:d}):null})})}const gr=async()=>{const e=new on;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.5.1").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const r=e.opts();if(r.debug&&mn(),r.apply){console.log(re.cyan("🔧 Applying saved customizations to Claude Code..."));try{const i=await ke();(!i.settings||Object.keys(i.settings).length===0)&&(console.error(re.red("❌ No saved customizations found in "+le)),process.exit(1));const s=await Ye();(!s||!s.ccInstInfo)&&(console.error(re.red("❌ Cannot find Claude Code's cli.js")),console.error(re.yellow("Searched at the following locations:")),Me.forEach(c=>console.error(re.gray(" - "+c))),process.exit(1)),console.log(re.gray(`📁 Found Claude Code at: ${s.ccInstInfo.cliPath}`)),console.log(re.gray(`📦 Version: ${s.ccInstInfo.version}`)),console.log(re.gray("✓ Backup handled by startup check")),console.log(re.cyan("🎨 Applying customizations..."));try{await nn(i,s.ccInstInfo),console.log(re.green("✅ Customizations applied successfully!")),console.log(re.gray(`💾 Configuration saved at: ${le}`))}catch(c){console.error(re.red("❌ Failed to apply patches:")),console.error(re.red(c instanceof Error?c.message:String(c))),c instanceof Error&&c.message.includes("patch:")&&(console.log(re.yellow("⚠️ Some patches failed to apply, but the file was updated.")),console.log(re.yellow(" This may happen if Claude Code was updated.")),console.log(re.gray(" Run tweakcc interactively to review and update your customizations.")))}process.exit(0)}catch(i){console.error(re.red("❌ Unexpected error:")),console.error(re.red(i instanceof Error?i.message:String(i))),process.exit(1)}}const n=await Ye();n?rn(t(hr,{startupCheckInfo:n})):(console.error(`\x1B[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
|
|
28
28
|
|
|
29
29
|
Searched at the following locations:
|
|
30
30
|
${Me.map(i=>"- "+i).join(`
|
|
@@ -44,4 +44,4 @@ Notes:
|
|
|
44
44
|
|
|
45
45
|
- Don't specify the path to your Claude Code executable's directory. It needs to be the path
|
|
46
46
|
to the folder that contains **cli.js**.
|
|
47
|
-
\x1B[0m`),process.exit(1))};
|
|
47
|
+
\x1B[0m`),process.exit(1))};gr();
|