tako-cli 0.2.10 → 0.2.11
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 +73 -73
- package/install.ps1 +5 -2
- package/install.sh +77 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var $S=Object.create;var{getPrototypeOf:SS,defineProperty:R$,getOwnPropertyNames:y1,getOwnPropertyDescriptor:OS}=Object,j1=Object.prototype.hasOwnProperty;function _1($){return this[$]}var HS,ES,w$=($,S,H)=>{var E=$!=null&&typeof $==="object";if(E){var R=S?HS??=new WeakMap:ES??=new WeakMap,I=R.get($);if(I)return I}H=$!=null?$S(SS($)):{};let O=S||!$||!$.__esModule?R$(H,"default",{value:$,enumerable:!0}):H;for(let Y of y1($))if(!j1.call(O,Y))R$(O,Y,{get:_1.bind($,Y),enumerable:!0});if(E)R.set($,O);return O},RS=($)=>{var S=(m1??=new WeakMap).get($),H;if(S)return S;if(S=R$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var E of y1($))if(!j1.call(S,E))R$(S,E,{get:_1.bind($,E),enumerable:!(H=OS($,E))||H.enumerable})}return m1.set($,S),S},m1,P1=($,S)=>()=>(S||$((S={exports:{}}).exports,S),S.exports);var IS=($)=>$;function YS($,S){this[$]=IS.bind(null,S)}var GS=($,S)=>{for(var H in S)R$($,H,{get:S[H],enumerable:!0,configurable:!0,set:YS.bind(S,H)})};var bS=($,S)=>()=>($&&(S=$($=0)),S);var j=import.meta.require;var O1=P1((WH,S0)=>{var S1={to($,S){if(!S)return`\x1B[${$+1}G`;return`\x1B[${S+1};${$+1}H`},move($,S){let H="";if($<0)H+=`\x1B[${-$}D`;else if($>0)H+=`\x1B[${$}C`;if(S<0)H+=`\x1B[${-S}A`;else if(S>0)H+=`\x1B[${S}B`;return H},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},CS={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},mS={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let S="";for(let H=0;H<$;H++)S+=this.line+(H<$-1?S1.up():"");if($)S+=S1.left;return S}};S0.exports={cursor:S1,scroll:CS,erase:mS,beep:"\x07"}});var E1=P1((JH,H1)=>{var A$=process||{},O0=A$.argv||[],h$=A$.env||{},yS=!(!!h$.NO_COLOR||O0.includes("--no-color"))&&(!!h$.FORCE_COLOR||O0.includes("--color")||A$.platform==="win32"||(A$.stdout||{}).isTTY&&h$.TERM!=="dumb"||!!h$.CI),jS=($,S,H=$)=>(E)=>{let R=""+E,I=R.indexOf(S,$.length);return~I?$+_S(R,S,H,I)+S:$+R+S},_S=($,S,H,E)=>{let R="",I=0;do R+=$.substring(I,E)+H,I=E+S.length,E=$.indexOf(S,I);while(~E);return R+$.substring(I)},H0=($=yS)=>{let S=$?jS:()=>String;return{isColorSupported:$,reset:S("\x1B[0m","\x1B[0m"),bold:S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:S("\x1B[3m","\x1B[23m"),underline:S("\x1B[4m","\x1B[24m"),inverse:S("\x1B[7m","\x1B[27m"),hidden:S("\x1B[8m","\x1B[28m"),strikethrough:S("\x1B[9m","\x1B[29m"),black:S("\x1B[30m","\x1B[39m"),red:S("\x1B[31m","\x1B[39m"),green:S("\x1B[32m","\x1B[39m"),yellow:S("\x1B[33m","\x1B[39m"),blue:S("\x1B[34m","\x1B[39m"),magenta:S("\x1B[35m","\x1B[39m"),cyan:S("\x1B[36m","\x1B[39m"),white:S("\x1B[37m","\x1B[39m"),gray:S("\x1B[90m","\x1B[39m"),bgBlack:S("\x1B[40m","\x1B[49m"),bgRed:S("\x1B[41m","\x1B[49m"),bgGreen:S("\x1B[42m","\x1B[49m"),bgYellow:S("\x1B[43m","\x1B[49m"),bgBlue:S("\x1B[44m","\x1B[49m"),bgMagenta:S("\x1B[45m","\x1B[49m"),bgCyan:S("\x1B[46m","\x1B[49m"),bgWhite:S("\x1B[47m","\x1B[49m"),blackBright:S("\x1B[90m","\x1B[39m"),redBright:S("\x1B[91m","\x1B[39m"),greenBright:S("\x1B[92m","\x1B[39m"),yellowBright:S("\x1B[93m","\x1B[39m"),blueBright:S("\x1B[94m","\x1B[39m"),magentaBright:S("\x1B[95m","\x1B[39m"),cyanBright:S("\x1B[96m","\x1B[39m"),whiteBright:S("\x1B[97m","\x1B[39m"),bgBlackBright:S("\x1B[100m","\x1B[49m"),bgRedBright:S("\x1B[101m","\x1B[49m"),bgGreenBright:S("\x1B[102m","\x1B[49m"),bgYellowBright:S("\x1B[103m","\x1B[49m"),bgBlueBright:S("\x1B[104m","\x1B[49m"),bgMagentaBright:S("\x1B[105m","\x1B[49m"),bgCyanBright:S("\x1B[106m","\x1B[49m"),bgWhiteBright:S("\x1B[107m","\x1B[49m")}};H1.exports=H0();H1.exports.createColors=H0});var B0={};GS(B0,{t:()=>M,setLocale:()=>v1,getLocale:()=>N1,detectLocale:()=>a,clearLocaleOverride:()=>w2});function a(){if(m$)return m$;let $=process.env.LANG||process.env.LANGUAGE||process.env.LC_ALL||"";if($.toLowerCase().includes("zh")||$.toLowerCase().includes("chinese"))return"zh";try{if(Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase().startsWith("zh"))return"zh"}catch{}return"zh"}function v1($){m$=$}function w2(){m$=null}function M($,S){let H=a(),E=$.split("."),R=L2;for(let O of E)if(R=R?.[O],!R)return $;let I=R[H]||R.en||$;if(S)for(let[O,Y]of Object.entries(S))I=I.replace(`{${O}}`,String(Y));return I}function N1(){return a()}var m$=null,L2;var V=bS(()=>{L2={launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},directoryNotFound:{en:"Directory not found: {path}",zh:"\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}"},apiKeyNotConfigured:{en:"API Key not configured",zh:"API Key \u672A\u914D\u7F6E"},error:{en:"Error: {message}",zh:"\u9519\u8BEF\uFF1A{message}"}},menu:{selectAction:{en:"Select an action:",zh:"\u8BF7\u9009\u62E9\u64CD\u4F5C\uFF1A"},launchClient:{en:"Launch {client}",zh:"\u542F\u52A8 {client}"},advanced:{en:"Advanced",zh:"\u9AD8\u7EA7"},advancedHint:{en:"Usage stats, configuration, etc.",zh:"\u7528\u91CF\u7EDF\u8BA1\u3001\u914D\u7F6E\u7B49"},exit:{en:"Exit",zh:"\u9000\u51FA"},advancedOptions:{en:"Advanced Options:",zh:"\u9AD8\u7EA7\u9009\u9879\uFF1A"},viewStats:{en:"View Usage Statistics",zh:"\u67E5\u770B\u7528\u91CF\u7EDF\u8BA1"},configApiKey:{en:"Configure API Key",zh:"\u914D\u7F6E API Key"},back:{en:"Back",zh:"\u8FD4\u56DE"},changeLanguage:{en:"Change Language",zh:"\u5207\u6362\u8BED\u8A00"},currentLanguage:{en:"Current Language: {lang}",zh:"\u5F53\u524D\u8BED\u8A00\uFF1A{lang}"},languageChanged:{en:"Language changed to {lang}",zh:"\u8BED\u8A00\u5DF2\u5207\u6362\u4E3A {lang}"}},language:{en:{en:"English",zh:"\u82F1\u8BED"},zh:{en:"Chinese",zh:"\u4E2D\u6587"}},banner:{welcome:{en:"Welcome!",zh:"\u6B22\u8FCE\u4F7F\u7528\uFF01"}},stats:{title:{en:"\uD83D\uDCCA Usage Statistics",zh:"\uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"},totalRequests:{en:"Total Requests: {count} times",zh:"\u603B\u8C03\u7528\u6B21\u6570\uFF1A{count} \u6B21"},totalCost:{en:"Total Cost: {cost}",zh:"\u603B\u6D88\u8D39\uFF1A{cost}"},todayCost:{en:"Today's Cost: {cost}",zh:"\u4ECA\u65E5\u6D88\u8D39\uFF1A{cost}"},modelDistribution:{en:"Model Usage Distribution (Today):",zh:"\u6A21\u578B\u4F7F\u7528\u5206\u5E03\uFF08\u4ECA\u65E5\uFF09\uFF1A"},times:{en:"times",zh:"\u6B21"},refreshHint:{en:"{countdown}s until refresh | Press any key to return",zh:"{countdown}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE"},fetching:{en:"Fetching usage statistics...",zh:"\u83B7\u53D6\u7528\u91CF\u7EDF\u8BA1..."},fetchFailed:{en:"Failed to fetch: {error}",zh:"\u83B7\u53D6\u5931\u8D25\uFF1A{error}"}},prompts:{enterApiKey:{en:"Please enter your API Key:",zh:"\u8BF7\u8F93\u5165\u60A8\u7684 API Key\uFF1A"},apiKeyPlaceholder:{en:"cr_xxxxxxxx",zh:"cr_xxxxxxxx"},validating:{en:"Validating API Key...",zh:"\u6B63\u5728\u9A8C\u8BC1 API Key..."},keyInvalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},keyValidationFailed:{en:"Validation failed: {error}",zh:"\u9A8C\u8BC1\u5931\u8D25\uFF1A{error}"},keyConfigured:{en:"API Key configured successfully!",zh:"API Key \u914D\u7F6E\u6210\u529F\uFF01"}},cli:{version:{en:"Tako CLI v{version}",zh:"Tako CLI v{version}"},usage:{en:"Usage: tako [options] [command]",zh:"\u7528\u6CD5\uFF1Atako [\u9009\u9879] [\u547D\u4EE4]"},options:{en:"Options:",zh:"\u9009\u9879\uFF1A"},optionVersion:{en:" -v, --version Display version number",zh:" -v, --version \u663E\u793A\u7248\u672C\u53F7"},optionHelp:{en:" -h, --help Display help information",zh:" -h, --help \u663E\u793A\u5E2E\u52A9\u4FE1\u606F"},shortcuts:{en:"Shortcuts:",zh:"\u5FEB\u6377\u547D\u4EE4\uFF1A"},shortcutClaude:{en:" --claude Launch Claude Code directly",zh:" --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},shortcutCodex:{en:" --codex Launch Codex directly",zh:" --codex \u76F4\u63A5\u542F\u52A8 Codex"},examples:{en:"Examples:",zh:"\u793A\u4F8B\uFF1A"},exampleInteractive:{en:" tako Interactive tool selection",zh:" tako \u4EA4\u4E92\u5F0F\u9009\u62E9\u5DE5\u5177"},exampleClaude:{en:" tako --claude Launch Claude Code directly",zh:" tako --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},exampleCodex:{en:" tako --codex Launch Codex directly",zh:" tako --codex \u76F4\u63A5\u542F\u52A8 Codex"},clientNotFound:{en:"{client} client not found",zh:"{client} \u5BA2\u6237\u7AEF\u672A\u627E\u5230"},cliError:{en:"Tako CLI encountered an error:",zh:"Tako CLI \u53D1\u751F\u9519\u8BEF\uFF1A"},launchFailed:{en:"Launch failed",zh:"\u542F\u52A8\u5931\u8D25"}},auth:{invalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},validationFailed:{en:"Validation failed",zh:"\u9A8C\u8BC1\u5931\u8D25"},networkError:{en:"Network request failed",zh:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}},updater:{migrating:{en:"Detected old installation, migrating...",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\u65B9\u5F0F\uFF0C\u6B63\u5728\u8FC1\u79FB..."},installingLocally:{en:"Installing to local directory...",zh:"\u6B63\u5728\u5B89\u88C5\u5230\u672C\u5730\u76EE\u5F55..."},migrationFailed:{en:"Local installation failed, skipping migration",zh:"\u672C\u5730\u5B89\u88C5\u5931\u8D25\uFF0C\u8DF3\u8FC7\u8FC1\u79FB"},installComplete:{en:"Local installation complete",zh:"\u672C\u5730\u5B89\u88C5\u5B8C\u6210"},migrationComplete:{en:"Detected old installation, migration complete. Please restart Tako CLI",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\uFF0C\u5DF2\u5B8C\u6210\u8FC1\u79FB\uFF0C\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI"},newVersionAvailable:{en:"New version v{version} available (current v{current})",zh:"\u53D1\u73B0\u65B0\u7248\u672C v{version}\uFF08\u5F53\u524D v{current}\uFF09"},pleaseRestart:{en:"Please restart Tako CLI to use the new version",zh:"\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"}},region:{usingChinaMirror:{en:"Detected China mainland network, using domestic mirror",zh:"\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"},usingGlobalMirror:{en:"Using global mirror",zh:"\u4F7F\u7528\u56FD\u9645\u6E90"}},telemetry:{toggle:{en:"Toggle Telemetry",zh:"\u5207\u6362\u9065\u6D4B"},enabled:{en:"Telemetry is enabled",zh:"\u9065\u6D4B\u5DF2\u5F00\u542F"},disabled:{en:"Telemetry is disabled",zh:"\u9065\u6D4B\u5DF2\u5173\u95ED"},description:{en:"Anonymous usage data helps us improve Tako CLI",zh:"\u533F\u540D\u4F7F\u7528\u6570\u636E\u5E2E\u52A9\u6211\u4EEC\u6539\u8FDB Tako CLI"}},time:{justNow:{en:"just now",zh:"\u521A\u521A"},minutesAgo:{en:"{n}m ago",zh:"{n}\u5206\u949F\u524D"},hoursAgo:{en:"{n}h ago",zh:"{n}\u5C0F\u65F6\u524D"},yesterday:{en:"yesterday",zh:"\u6628\u5929"},daysAgo:{en:"{n}d ago",zh:"{n}\u5929\u524D"},weeksAgo:{en:"{n}w ago",zh:"{n}\u5468\u524D"},monthsAgo:{en:"{n}mo ago",zh:"{n}\u6708\u524D"}},recentProjects:{title:{en:"Recent Projects",zh:"\u6700\u8FD1\u9879\u76EE"},launchInCurrent:{en:"Launch in current directory",zh:"\u5728\u5F53\u524D\u76EE\u5F55\u542F\u52A8"}}}});import{join as z$}from"path";import{homedir as MS}from"os";import{join as S$}from"path";var _=S$(MS(),".tako"),F1=S$(_,"config.json"),l$=S$(_,"tools"),P=S$(_,"cli"),D=S$(_,"bun"),A=S$(D,"bin",process.platform==="win32"?"bun.exe":"bun"),TS=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",c=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",hO=process.env.TAKO_DEV==="true"||TS.includes("localhost"),k1={apiKey:"",apiId:"",installedClients:{}};async function g1(){let $=await import("fs/promises");try{await $.mkdir(_,{recursive:!0}),await $.mkdir(l$,{recursive:!0})}catch{}}async function X(){await g1();try{let $=Bun.file(F1);if(await $.exists()){let S=await $.json();return{...k1,...S}}}catch{}return{...k1}}async function o$($){await g1(),await Bun.write(F1,JSON.stringify($,null,2))}async function L$($){let H={...await X(),...$};return await o$(H),H}async function u1(){return!!(await X()).apiKey}async function Q$(){return(await X()).apiKey}async function c1(){return(await X()).apiId}function i$($,S){if(!$.startsWith(_))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${S} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function I$($){let S=z$(l$,$);return i$(S,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),S}async function d1($){let S=I$($.id),H=z$(S,"node_modules",$.package,"package.json");try{let E=Bun.file(H);if(!await E.exists())return null;let I=(await E.json()).bin;if(!I)return null;let O=null;if(typeof I==="string")O=I;else if(typeof I==="object"&&I[$.command])O=I[$.command];if(!O)return null;let Y=z$(S,"node_modules",$.package,O);return i$(Y,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),Y}catch{return null}}function l1($){let S=I$($.id),H=z$(S,"node_modules",".bin",$.command);return i$(H,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),H}var p$=new Map;function Z$($){p$.set($.id,$)}function o1(){return Array.from(p$.values())}function D$($){return p$.get($)}var xS={id:"claude-code",name:"Claude Code",package:"@anthropic-ai/claude-code",command:"claude",runtime:"bun",continueArg:"--continue",getEnvVars($){return{ANTHROPIC_BASE_URL:`${c}/api`,ANTHROPIC_AUTH_TOKEN:$}}};Z$(xS);import{homedir as BS}from"os";import{join as t$}from"path";/*!
|
|
3
|
+
var SS=Object.create;var{getPrototypeOf:OS,defineProperty:R$,getOwnPropertyNames:y1,getOwnPropertyDescriptor:HS}=Object,j1=Object.prototype.hasOwnProperty;function _1($){return this[$]}var ES,RS,L$=($,S,H)=>{var E=$!=null&&typeof $==="object";if(E){var R=S?ES??=new WeakMap:RS??=new WeakMap,I=R.get($);if(I)return I}H=$!=null?SS(OS($)):{};let O=S||!$||!$.__esModule?R$(H,"default",{value:$,enumerable:!0}):H;for(let Y of y1($))if(!j1.call(O,Y))R$(O,Y,{get:_1.bind($,Y),enumerable:!0});if(E)R.set($,O);return O},IS=($)=>{var S=(m1??=new WeakMap).get($),H;if(S)return S;if(S=R$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var E of y1($))if(!j1.call(S,E))R$(S,E,{get:_1.bind($,E),enumerable:!(H=HS($,E))||H.enumerable})}return m1.set($,S),S},m1,P1=($,S)=>()=>(S||$((S={exports:{}}).exports,S),S.exports);var YS=($)=>$;function GS($,S){this[$]=YS.bind(null,S)}var xS=($,S)=>{for(var H in S)R$($,H,{get:S[H],enumerable:!0,configurable:!0,set:GS.bind(S,H)})};var bS=($,S)=>()=>($&&(S=$($=0)),S);var f=import.meta.require;var H1=P1((UH,S0)=>{var O1={to($,S){if(!S)return`\x1B[${$+1}G`;return`\x1B[${S+1};${$+1}H`},move($,S){let H="";if($<0)H+=`\x1B[${-$}D`;else if($>0)H+=`\x1B[${$}C`;if(S<0)H+=`\x1B[${-S}A`;else if(S>0)H+=`\x1B[${S}B`;return H},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},mS={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},yS={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let S="";for(let H=0;H<$;H++)S+=this.line+(H<$-1?O1.up():"");if($)S+=O1.left;return S}};S0.exports={cursor:O1,scroll:mS,erase:yS,beep:"\x07"}});var R1=P1((hH,E1)=>{var A$=process||{},O0=A$.argv||[],h$=A$.env||{},jS=!(!!h$.NO_COLOR||O0.includes("--no-color"))&&(!!h$.FORCE_COLOR||O0.includes("--color")||A$.platform==="win32"||(A$.stdout||{}).isTTY&&h$.TERM!=="dumb"||!!h$.CI),_S=($,S,H=$)=>(E)=>{let R=""+E,I=R.indexOf(S,$.length);return~I?$+PS(R,S,H,I)+S:$+R+S},PS=($,S,H,E)=>{let R="",I=0;do R+=$.substring(I,E)+H,I=E+S.length,E=$.indexOf(S,I);while(~E);return R+$.substring(I)},H0=($=jS)=>{let S=$?_S:()=>String;return{isColorSupported:$,reset:S("\x1B[0m","\x1B[0m"),bold:S("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:S("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:S("\x1B[3m","\x1B[23m"),underline:S("\x1B[4m","\x1B[24m"),inverse:S("\x1B[7m","\x1B[27m"),hidden:S("\x1B[8m","\x1B[28m"),strikethrough:S("\x1B[9m","\x1B[29m"),black:S("\x1B[30m","\x1B[39m"),red:S("\x1B[31m","\x1B[39m"),green:S("\x1B[32m","\x1B[39m"),yellow:S("\x1B[33m","\x1B[39m"),blue:S("\x1B[34m","\x1B[39m"),magenta:S("\x1B[35m","\x1B[39m"),cyan:S("\x1B[36m","\x1B[39m"),white:S("\x1B[37m","\x1B[39m"),gray:S("\x1B[90m","\x1B[39m"),bgBlack:S("\x1B[40m","\x1B[49m"),bgRed:S("\x1B[41m","\x1B[49m"),bgGreen:S("\x1B[42m","\x1B[49m"),bgYellow:S("\x1B[43m","\x1B[49m"),bgBlue:S("\x1B[44m","\x1B[49m"),bgMagenta:S("\x1B[45m","\x1B[49m"),bgCyan:S("\x1B[46m","\x1B[49m"),bgWhite:S("\x1B[47m","\x1B[49m"),blackBright:S("\x1B[90m","\x1B[39m"),redBright:S("\x1B[91m","\x1B[39m"),greenBright:S("\x1B[92m","\x1B[39m"),yellowBright:S("\x1B[93m","\x1B[39m"),blueBright:S("\x1B[94m","\x1B[39m"),magentaBright:S("\x1B[95m","\x1B[39m"),cyanBright:S("\x1B[96m","\x1B[39m"),whiteBright:S("\x1B[97m","\x1B[39m"),bgBlackBright:S("\x1B[100m","\x1B[49m"),bgRedBright:S("\x1B[101m","\x1B[49m"),bgGreenBright:S("\x1B[102m","\x1B[49m"),bgYellowBright:S("\x1B[103m","\x1B[49m"),bgBlueBright:S("\x1B[104m","\x1B[49m"),bgMagentaBright:S("\x1B[105m","\x1B[49m"),bgCyanBright:S("\x1B[106m","\x1B[49m"),bgWhiteBright:S("\x1B[107m","\x1B[49m")}};E1.exports=H0();E1.exports.createColors=H0});var V0={};xS(V0,{t:()=>b,setLocale:()=>N1,getLocale:()=>L1,detectLocale:()=>a,clearLocaleOverride:()=>w2});function a(){if(m$)return m$;let $=process.env.LANG||process.env.LANGUAGE||process.env.LC_ALL||"";if($.toLowerCase().includes("zh")||$.toLowerCase().includes("chinese"))return"zh";try{if(Intl.DateTimeFormat().resolvedOptions().locale.toLowerCase().startsWith("zh"))return"zh"}catch{}return"zh"}function N1($){m$=$}function w2(){m$=null}function b($,S){let H=a(),E=$.split("."),R=Q2;for(let O of E)if(R=R?.[O],!R)return $;let I=R[H]||R.en||$;if(S)for(let[O,Y]of Object.entries(S))I=I.replace(`{${O}}`,String(Y));return I}function L1(){return a()}var m$=null,Q2;var B=bS(()=>{Q2={launcher:{starting:{en:"Starting {client}...",zh:"\u6B63\u5728\u542F\u52A8 {client}..."},directoryNotFound:{en:"Directory not found: {path}",zh:"\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}"},apiKeyNotConfigured:{en:"API Key not configured",zh:"API Key \u672A\u914D\u7F6E"},error:{en:"Error: {message}",zh:"\u9519\u8BEF\uFF1A{message}"}},menu:{selectAction:{en:"Select an action:",zh:"\u8BF7\u9009\u62E9\u64CD\u4F5C\uFF1A"},launchClient:{en:"Launch {client}",zh:"\u542F\u52A8 {client}"},advanced:{en:"Advanced",zh:"\u9AD8\u7EA7"},advancedHint:{en:"Usage stats, configuration, etc.",zh:"\u7528\u91CF\u7EDF\u8BA1\u3001\u914D\u7F6E\u7B49"},exit:{en:"Exit",zh:"\u9000\u51FA"},advancedOptions:{en:"Advanced Options:",zh:"\u9AD8\u7EA7\u9009\u9879\uFF1A"},viewStats:{en:"View Usage Statistics",zh:"\u67E5\u770B\u7528\u91CF\u7EDF\u8BA1"},configApiKey:{en:"Configure API Key",zh:"\u914D\u7F6E API Key"},back:{en:"Back",zh:"\u8FD4\u56DE"},changeLanguage:{en:"Change Language",zh:"\u5207\u6362\u8BED\u8A00"},currentLanguage:{en:"Current Language: {lang}",zh:"\u5F53\u524D\u8BED\u8A00\uFF1A{lang}"},languageChanged:{en:"Language changed to {lang}",zh:"\u8BED\u8A00\u5DF2\u5207\u6362\u4E3A {lang}"}},language:{en:{en:"English",zh:"\u82F1\u8BED"},zh:{en:"Chinese",zh:"\u4E2D\u6587"}},banner:{welcome:{en:"Welcome!",zh:"\u6B22\u8FCE\u4F7F\u7528\uFF01"}},stats:{title:{en:"\uD83D\uDCCA Usage Statistics",zh:"\uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"},totalRequests:{en:"Total Requests: {count} times",zh:"\u603B\u8C03\u7528\u6B21\u6570\uFF1A{count} \u6B21"},totalCost:{en:"Total Cost: {cost}",zh:"\u603B\u6D88\u8D39\uFF1A{cost}"},todayCost:{en:"Today's Cost: {cost}",zh:"\u4ECA\u65E5\u6D88\u8D39\uFF1A{cost}"},modelDistribution:{en:"Model Usage Distribution (Today):",zh:"\u6A21\u578B\u4F7F\u7528\u5206\u5E03\uFF08\u4ECA\u65E5\uFF09\uFF1A"},times:{en:"times",zh:"\u6B21"},refreshHint:{en:"{countdown}s until refresh | Press any key to return",zh:"{countdown}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE"},fetching:{en:"Fetching usage statistics...",zh:"\u83B7\u53D6\u7528\u91CF\u7EDF\u8BA1..."},fetchFailed:{en:"Failed to fetch: {error}",zh:"\u83B7\u53D6\u5931\u8D25\uFF1A{error}"}},prompts:{enterApiKey:{en:"Please enter your API Key:",zh:"\u8BF7\u8F93\u5165\u60A8\u7684 API Key\uFF1A"},apiKeyPlaceholder:{en:"cr_xxxxxxxx",zh:"cr_xxxxxxxx"},validating:{en:"Validating API Key...",zh:"\u6B63\u5728\u9A8C\u8BC1 API Key..."},keyInvalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},keyValidationFailed:{en:"Validation failed: {error}",zh:"\u9A8C\u8BC1\u5931\u8D25\uFF1A{error}"},keyConfigured:{en:"API Key configured successfully!",zh:"API Key \u914D\u7F6E\u6210\u529F\uFF01"}},cli:{version:{en:"Tako CLI v{version}",zh:"Tako CLI v{version}"},usage:{en:"Usage: tako [options] [command]",zh:"\u7528\u6CD5\uFF1Atako [\u9009\u9879] [\u547D\u4EE4]"},options:{en:"Options:",zh:"\u9009\u9879\uFF1A"},optionVersion:{en:" -v, --version Display version number",zh:" -v, --version \u663E\u793A\u7248\u672C\u53F7"},optionHelp:{en:" -h, --help Display help information",zh:" -h, --help \u663E\u793A\u5E2E\u52A9\u4FE1\u606F"},shortcuts:{en:"Shortcuts:",zh:"\u5FEB\u6377\u547D\u4EE4\uFF1A"},shortcutClaude:{en:" --claude Launch Claude Code directly",zh:" --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},shortcutCodex:{en:" --codex Launch Codex directly",zh:" --codex \u76F4\u63A5\u542F\u52A8 Codex"},examples:{en:"Examples:",zh:"\u793A\u4F8B\uFF1A"},exampleInteractive:{en:" tako Interactive tool selection",zh:" tako \u4EA4\u4E92\u5F0F\u9009\u62E9\u5DE5\u5177"},exampleClaude:{en:" tako --claude Launch Claude Code directly",zh:" tako --claude \u76F4\u63A5\u542F\u52A8 Claude Code"},exampleCodex:{en:" tako --codex Launch Codex directly",zh:" tako --codex \u76F4\u63A5\u542F\u52A8 Codex"},clientNotFound:{en:"{client} client not found",zh:"{client} \u5BA2\u6237\u7AEF\u672A\u627E\u5230"},cliError:{en:"Tako CLI encountered an error:",zh:"Tako CLI \u53D1\u751F\u9519\u8BEF\uFF1A"},launchFailed:{en:"Launch failed",zh:"\u542F\u52A8\u5931\u8D25"}},auth:{invalidFormat:{en:"Invalid format, must start with cr_",zh:"\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"},validationFailed:{en:"Validation failed",zh:"\u9A8C\u8BC1\u5931\u8D25"},networkError:{en:"Network request failed",zh:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}},updater:{migrating:{en:"Detected old installation, migrating...",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\u65B9\u5F0F\uFF0C\u6B63\u5728\u8FC1\u79FB..."},installingLocally:{en:"Installing to local directory...",zh:"\u6B63\u5728\u5B89\u88C5\u5230\u672C\u5730\u76EE\u5F55..."},migrationFailed:{en:"Local installation failed, skipping migration",zh:"\u672C\u5730\u5B89\u88C5\u5931\u8D25\uFF0C\u8DF3\u8FC7\u8FC1\u79FB"},installComplete:{en:"Local installation complete",zh:"\u672C\u5730\u5B89\u88C5\u5B8C\u6210"},migrationComplete:{en:"Detected old installation, migration complete. Please restart Tako CLI",zh:"\u68C0\u6D4B\u5230\u65E7\u7248\u5B89\u88C5\uFF0C\u5DF2\u5B8C\u6210\u8FC1\u79FB\uFF0C\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI"},newVersionAvailable:{en:"New version v{version} available (current v{current})",zh:"\u53D1\u73B0\u65B0\u7248\u672C v{version}\uFF08\u5F53\u524D v{current}\uFF09"},pleaseRestart:{en:"Please restart Tako CLI to use the new version",zh:"\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"}},region:{usingChinaMirror:{en:"Detected China mainland network, using domestic mirror",zh:"\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"},usingGlobalMirror:{en:"Using global mirror",zh:"\u4F7F\u7528\u56FD\u9645\u6E90"}},telemetry:{toggle:{en:"Toggle Telemetry",zh:"\u5207\u6362\u9065\u6D4B"},enabled:{en:"Telemetry is enabled",zh:"\u9065\u6D4B\u5DF2\u5F00\u542F"},disabled:{en:"Telemetry is disabled",zh:"\u9065\u6D4B\u5DF2\u5173\u95ED"},description:{en:"Anonymous usage data helps us improve Tako CLI",zh:"\u533F\u540D\u4F7F\u7528\u6570\u636E\u5E2E\u52A9\u6211\u4EEC\u6539\u8FDB Tako CLI"}},time:{justNow:{en:"just now",zh:"\u521A\u521A"},minutesAgo:{en:"{n}m ago",zh:"{n}\u5206\u949F\u524D"},hoursAgo:{en:"{n}h ago",zh:"{n}\u5C0F\u65F6\u524D"},yesterday:{en:"yesterday",zh:"\u6628\u5929"},daysAgo:{en:"{n}d ago",zh:"{n}\u5929\u524D"},weeksAgo:{en:"{n}w ago",zh:"{n}\u5468\u524D"},monthsAgo:{en:"{n}mo ago",zh:"{n}\u6708\u524D"}},recentProjects:{title:{en:"Recent Projects",zh:"\u6700\u8FD1\u9879\u76EE"},launchInCurrent:{en:"Launch in current directory",zh:"\u5728\u5F53\u524D\u76EE\u5F55\u542F\u52A8"}}}});import{join as Z$}from"path";import{homedir as qS}from"os";import{join as $$}from"path";var P=$$(qS(),".tako"),F1=$$(P,"config.json"),o$=$$(P,"tools"),k=$$(P,"cli"),p=$$(P,"bun"),A=$$(p,"bin",process.platform==="win32"?"bun.exe":"bun"),TS=process.env.TAKO_SERVER||"https://claude-proxy.shiroha.tech",c=process.env.PROXY_BASE_URL||"https://claude-proxy.shiroha.tech",BO=process.env.TAKO_DEV==="true"||TS.includes("localhost"),k1={apiKey:"",apiId:"",installedClients:{}};async function g1(){let $=await import("fs/promises");try{await $.mkdir(P,{recursive:!0}),await $.mkdir(o$,{recursive:!0})}catch{}}async function X(){await g1();try{let $=Bun.file(F1);if(await $.exists()){let S=await $.json();return{...k1,...S}}}catch{}return{...k1}}async function p$($){await g1(),await Bun.write(F1,JSON.stringify($,null,2))}async function w$($){let H={...await X(),...$};return await p$(H),H}async function u1(){return!!(await X()).apiKey}async function Q$(){return(await X()).apiKey}async function c1(){return(await X()).apiId}function i$($,S){if(!$.startsWith(P))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${S} \u8DEF\u5F84 "${$}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function I$($){let S=Z$(o$,$);return i$(S,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),S}async function d1($){let S=I$($.id),H=Z$(S,"node_modules",$.package,"package.json");try{let E=Bun.file(H);if(!await E.exists())return null;let I=(await E.json()).bin;if(!I)return null;let O=null;if(typeof I==="string")O=I;else if(typeof I==="object"&&I[$.command])O=I[$.command];if(!O)return null;let Y=Z$(S,"node_modules",$.package,O);return i$(Y,"\u5BA2\u6237\u7AEF\u5165\u53E3\u6587\u4EF6"),Y}catch{return null}}function l1($){let S=I$($.id),H=Z$(S,"node_modules",".bin",$.command);return i$(H,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),H}var D$=new Map;function J$($){D$.set($.id,$)}function o1(){return Array.from(D$.values())}function a$($){return D$.get($)}var vS={id:"claude-code",name:"Claude Code",package:"@anthropic-ai/claude-code",command:"claude",runtime:"bun",continueArg:"--continue",getEnvVars($){return{ANTHROPIC_BASE_URL:`${c}/api`,ANTHROPIC_AUTH_TOKEN:$}}};J$(vS);import{homedir as BS}from"os";import{join as $1}from"path";/*!
|
|
4
4
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*
|
|
@@ -26,9 +26,9 @@ var $S=Object.create;var{getPrototypeOf:SS,defineProperty:R$,getOwnPropertyNames
|
|
|
26
26
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
27
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
-
*/function
|
|
29
|
+
*/function MS($,S){let H=$.slice(0,S).split(/\r\n|\n|\r/g);return[H.length,H.pop().length+1]}function NS($,S,H){let E=$.split(/\r\n|\n|\r/g),R="",I=(Math.log10(S+1)|0)+1;for(let O=S-1;O<=S+1;O++){let Y=E[O-1];if(!Y)continue;if(R+=O.toString().padEnd(I," "),R+=": ",R+=Y,R+=`
|
|
30
30
|
`,O===S)R+=" ".repeat(I+H+2),R+=`^
|
|
31
|
-
`}return R}class
|
|
31
|
+
`}return R}class M extends Error{line;column;codeblock;constructor($,S){let[H,E]=MS(S.toml,S.ptr),R=NS(S.toml,H,E);super(`Invalid TOML document: ${$}
|
|
32
32
|
|
|
33
33
|
${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
34
34
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -56,14 +56,14 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
56
56
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
57
57
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
58
58
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
59
|
-
*/function
|
|
60
|
-
`,S);if($[E-1]==="\r")E--;return E<=H?E:-1}function
|
|
59
|
+
*/function LS($,S){let H=0;while($[S-++H]==="\\");return--H&&H%2}function z$($,S=0,H=$.length){let E=$.indexOf(`
|
|
60
|
+
`,S);if($[E-1]==="\r")E--;return E<=H?E:-1}function S$($,S){for(let H=S;H<$.length;H++){let E=$[H];if(E===`
|
|
61
61
|
`)return H;if(E==="\r"&&$[H+1]===`
|
|
62
|
-
`)return H+1;if(E<" "&&E!=="\t"||E==="\x7F")throw new
|
|
62
|
+
`)return H+1;if(E<" "&&E!=="\t"||E==="\x7F")throw new M("control characters are not allowed in comments",{toml:$,ptr:S})}return $.length}function V($,S,H,E){let R;while(!0){while((R=$[S])===" "||R==="\t"||!H&&(R===`
|
|
63
63
|
`||R==="\r"&&$[S+1]===`
|
|
64
|
-
`))S++;if(E||R!=="#")break;S=
|
|
64
|
+
`))S++;if(E||R!=="#")break;S=S$($,S)}return S}function p1($,S,H,E,R=!1){if(!E)return S=z$($,S),S<0?$.length:S;for(let I=S;I<$.length;I++){let O=$[I];if(O==="#")I=z$($,I);else if(O===H)return I+1;else if(O===E||R&&(O===`
|
|
65
65
|
`||O==="\r"&&$[I+1]===`
|
|
66
|
-
`))return I}throw new
|
|
66
|
+
`))return I}throw new M("cannot find end of structure",{toml:$,ptr:S})}function W$($,S){let H=$[S],E=H===$[S+1]&&$[S+1]===$[S+2]?$.slice(S,S+3):H;S+=E.length-1;do S=$.indexOf(E,++S);while(S>-1&&H!=="'"&&LS($,S));if(S>-1){if(S+=E.length,E.length>1){if($[S]===H)S++;if($[S]===H)S++}}return S}/*!
|
|
67
67
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*
|
|
@@ -115,13 +115,13 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
115
115
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
116
116
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
117
117
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
118
|
-
*/var
|
|
118
|
+
*/var QS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,ZS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,JS=/^[+-]?0[0-9_]/,zS=/^[0-9a-f]{2,8}$/i,i1={b:"\b",t:"\t",n:`
|
|
119
119
|
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function X$($,S=0,H=$.length){let E=$[S]==="'",R=$[S++]===$[S]&&$[S]===$[S+1];if(R){if(H-=2,$[S+=2]==="\r")S++;if($[S]===`
|
|
120
|
-
`)S++}let I=0,O,Y="",
|
|
120
|
+
`)S++}let I=0,O,Y="",x=S;while(S<H-1){let G=$[S++];if(G===`
|
|
121
121
|
`||G==="\r"&&$[S]===`
|
|
122
|
-
`){if(!R)throw new
|
|
123
|
-
`||G===" "||G==="\t"||G==="\r")){if(S=
|
|
124
|
-
`&&$[S]!=="\r")throw new
|
|
122
|
+
`){if(!R)throw new M("newlines are not allowed in strings",{toml:$,ptr:S-1})}else if(G<" "&&G!=="\t"||G==="\x7F")throw new M("control characters are not allowed in strings",{toml:$,ptr:S-1});if(O){if(O=!1,G==="x"||G==="u"||G==="U"){let q=$.slice(S,S+=G==="x"?2:G==="u"?4:8);if(!zS.test(q))throw new M("invalid unicode escape",{toml:$,ptr:I});try{Y+=String.fromCodePoint(parseInt(q,16))}catch{throw new M("invalid unicode escape",{toml:$,ptr:I})}}else if(R&&(G===`
|
|
123
|
+
`||G===" "||G==="\t"||G==="\r")){if(S=V($,S-1,!0),$[S]!==`
|
|
124
|
+
`&&$[S]!=="\r")throw new M("invalid escape: only line-ending whitespace may be escaped",{toml:$,ptr:I});S=V($,S)}else if(G in i1)Y+=i1[G];else throw new M("unrecognized escape sequence",{toml:$,ptr:I});x=S}else if(!E&&G==="\\")I=S-1,O=!0,Y+=$.slice(x,I)}return Y+$.slice(x,H-1)}function D1($,S,H,E){if($==="true")return!0;if($==="false")return!1;if($==="-inf")return-1/0;if($==="inf"||$==="+inf")return 1/0;if($==="nan"||$==="+nan"||$==="-nan")return NaN;if($==="-0")return E?0n:0;let R=QS.test($);if(R||ZS.test($)){if(JS.test($))throw new M("leading zeroes are not allowed",{toml:S,ptr:H});$=$.replace(/_/g,"");let O=+$;if(isNaN(O))throw new M("invalid number",{toml:S,ptr:H});if(R){if((R=!Number.isSafeInteger(O))&&!E)throw new M("integer value cannot be represented losslessly",{toml:S,ptr:H});if(R||E===!0)O=BigInt($)}return O}let I=new i($);if(!I.isValid())throw new M("invalid value",{toml:S,ptr:H});return I}/*!
|
|
125
125
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
126
126
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
127
127
|
*
|
|
@@ -147,8 +147,8 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
147
147
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
148
148
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
149
149
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
150
|
-
*/function WS($,S,H){let E=$.slice(S,H),R=E.indexOf("#");if(R>-1)
|
|
151
|
-
`&&$[O]!=="\r")throw new
|
|
150
|
+
*/function WS($,S,H){let E=$.slice(S,H),R=E.indexOf("#");if(R>-1)S$($,R),E=E.slice(0,R);return[E.trimEnd(),R]}function Y$($,S,H,E,R){if(E===0)throw new M("document contains excessively nested structures. aborting.",{toml:$,ptr:S});let I=$[S];if(I==="["||I==="{"){let[x,G]=I==="["?r1($,S,E,R):a1($,S,E,R);if(H){if(G=V($,G),$[G]===",")G++;else if($[G]!==H)throw new M("expected comma or end of structure",{toml:$,ptr:G})}return[x,G]}let O;if(I==='"'||I==="'"){O=W$($,S);let x=X$($,S,O);if(H){if(O=V($,O),$[O]&&$[O]!==","&&$[O]!==H&&$[O]!==`
|
|
151
|
+
`&&$[O]!=="\r")throw new M("unexpected character encountered",{toml:$,ptr:O});O+=+($[O]===",")}return[x,O]}O=p1($,S,",",H);let Y=WS($,S,O-+($[O-1]===","));if(!Y[0])throw new M("incomplete key-value declaration: no value specified",{toml:$,ptr:S});if(H&&Y[1]>-1)O=V($,S+Y[1]),O+=+($[O]===",");return[D1(Y[0],$,S,R),O]}/*!
|
|
152
152
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
153
153
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
154
154
|
*
|
|
@@ -174,9 +174,9 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
174
174
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
175
175
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
176
176
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
177
|
-
*/var
|
|
178
|
-
`&&O!=="\r"){let Y,
|
|
179
|
-
`&&I!=="\r"){let O=Y$($,S-1,"]",H-1,E);R.push(O[0]),S=O[1]}if(!I)throw new
|
|
177
|
+
*/var XS=/^[a-zA-Z0-9-_]+[ \t]*$/;function U$($,S,H="="){let E=S-1,R=[],I=$.indexOf(H,S);if(I<0)throw new M("incomplete key-value: cannot find end of key",{toml:$,ptr:S});do{let O=$[S=++E];if(O!==" "&&O!=="\t")if(O==='"'||O==="'"){if(O===$[S+1]&&O===$[S+2])throw new M("multiline strings are not allowed in keys",{toml:$,ptr:S});let Y=W$($,S);if(Y<0)throw new M("unfinished string encountered",{toml:$,ptr:S});E=$.indexOf(".",Y);let x=$.slice(Y,E<0||E>I?I:E),G=z$(x);if(G>-1)throw new M("newlines are not allowed in keys",{toml:$,ptr:S+E+G});if(x.trimStart())throw new M("found extra tokens after the string part",{toml:$,ptr:Y});if(I<Y){if(I=$.indexOf(H,Y),I<0)throw new M("incomplete key-value: cannot find end of key",{toml:$,ptr:S})}R.push(X$($,S,Y))}else{E=$.indexOf(".",S);let Y=$.slice(S,E<0||E>I?I:E);if(!XS.test(Y))throw new M("only letter, numbers, dashes and underscores are allowed in keys",{toml:$,ptr:S});R.push(Y.trimEnd())}}while(E+1&&E<I);return[R,V($,I+1,!0,!0)]}function a1($,S,H,E){let R={},I=new Set,O;S++;while((O=$[S++])!=="}"&&O)if(O===",")throw new M("expected value, found comma",{toml:$,ptr:S-1});else if(O==="#")S=S$($,S);else if(O!==" "&&O!=="\t"&&O!==`
|
|
178
|
+
`&&O!=="\r"){let Y,x=R,G=!1,[q,v]=U$($,S-1);for(let y=0;y<q.length;y++){if(y)x=G?x[Y]:x[Y]={};if(Y=q[y],(G=Object.hasOwn(x,Y))&&(typeof x[Y]!=="object"||I.has(x[Y])))throw new M("trying to redefine an already defined value",{toml:$,ptr:S});if(!G&&Y==="__proto__")Object.defineProperty(x,Y,{enumerable:!0,configurable:!0,writable:!0})}if(G)throw new M("trying to redefine an already defined value",{toml:$,ptr:S});let[w,K]=Y$($,v,"}",H-1,E);I.add(w),x[Y]=w,S=K}if(!O)throw new M("unfinished table encountered",{toml:$,ptr:S});return[R,S]}function r1($,S,H,E){let R=[],I;S++;while((I=$[S++])!=="]"&&I)if(I===",")throw new M("expected value, found comma",{toml:$,ptr:S-1});else if(I==="#")S=S$($,S);else if(I!==" "&&I!=="\t"&&I!==`
|
|
179
|
+
`&&I!=="\r"){let O=Y$($,S-1,"]",H-1,E);R.push(O[0]),S=O[1]}if(!I)throw new M("unfinished array encountered",{toml:$,ptr:S});return[R,S]}/*!
|
|
180
180
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
181
181
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
182
182
|
*
|
|
@@ -202,8 +202,8 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
202
202
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
203
203
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
204
204
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
205
|
-
*/function n1($,S,H,E){let R=S,I=H,O,Y=!1,
|
|
206
|
-
`&&$[Y]!=="\r")throw new
|
|
205
|
+
*/function n1($,S,H,E){let R=S,I=H,O,Y=!1,x;for(let G=0;G<$.length;G++){if(G){if(R=Y?R[O]:R[O]={},I=(x=I[O]).c,E===0&&(x.t===1||x.t===2))return null;if(x.t===2){let q=R.length-1;R=R[q],I=I[q].c}}if(O=$[G],(Y=Object.hasOwn(R,O))&&I[O]?.t===0&&I[O]?.d)return null;if(!Y){if(O==="__proto__")Object.defineProperty(R,O,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(I,O,{enumerable:!0,configurable:!0,writable:!0});I[O]={t:G<$.length-1&&E===2?3:E,d:!1,i:0,c:{}}}}if(x=I[O],x.t!==E&&!(E===1&&x.t===3))return null;if(E===2){if(!x.d)x.d=!0,R[O]=[];R[O].push(R={}),x.c[x.i++]=x={t:1,d:!1,i:0,c:{}}}if(x.d)return null;if(x.d=!0,E===1)R=Y?R[O]:R[O]={};else if(E===0&&Y)return null;return[O,R,x.c]}function r$($,{maxDepth:S=1000,integersAsBigInt:H}={}){let E={},R={},I=E,O=R;for(let Y=V($,0);Y<$.length;){if($[Y]==="["){let x=$[++Y]==="[",G=U$($,Y+=+x,"]");if(x){if($[G[1]-1]!=="]")throw new M("expected end of table declaration",{toml:$,ptr:G[1]-1});G[1]++}let q=n1(G[0],E,R,x?2:1);if(!q)throw new M("trying to redefine an already defined table or value",{toml:$,ptr:Y});O=q[2],I=q[1],Y=G[1]}else{let x=U$($,Y),G=n1(x[0],I,O,0);if(!G)throw new M("trying to redefine an already defined table or value",{toml:$,ptr:Y});let q=Y$($,x[1],void 0,S,H);G[1][G[0]]=q[0],Y=q[1]}if(Y=V($,Y,!0),$[Y]&&$[Y]!==`
|
|
206
|
+
`&&$[Y]!=="\r")throw new M("each key-value declaration must be followed by an end-of-line",{toml:$,ptr:Y});Y=V($,Y)}return E}/*!
|
|
207
207
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
208
208
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
209
209
|
*
|
|
@@ -229,14 +229,14 @@ ${R}`,S);this.line=H,this.column=E,this.codeblock=R}}/*!
|
|
|
229
229
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
230
230
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
231
231
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
232
|
-
*/var s1=/^[a-z0-9-_]+$/i;function G$($){let S=typeof $;if(S==="object"){if(Array.isArray($))return"array";if($ instanceof Date)return"date"}return S}function
|
|
232
|
+
*/var s1=/^[a-z0-9-_]+$/i;function G$($){let S=typeof $;if(S==="object"){if(Array.isArray($))return"array";if($ instanceof Date)return"date"}return S}function US($){for(let S=0;S<$.length;S++)if(G$($[S])!=="object")return!1;return $.length!=0}function n$($){return JSON.stringify($).replace(/\x7f/g,"\\u007f")}function s$($,S,H,E){if(H===0)throw Error("Could not stringify the object: maximum object depth exceeded");if(S==="number"){if(isNaN($))return"nan";if($===1/0)return"inf";if($===-1/0)return"-inf";if(E&&Number.isInteger($))return $.toFixed(1);return $.toString()}if(S==="bigint"||S==="boolean")return $.toString();if(S==="string")return n$($);if(S==="date"){if(isNaN($.getTime()))throw TypeError("cannot serialize invalid date");return $.toISOString()}if(S==="object")return hS($,H,E);if(S==="array")return AS($,H,E)}function hS($,S,H){let E=Object.keys($);if(E.length===0)return"{}";let R="{ ";for(let I=0;I<E.length;I++){let O=E[I];if(I)R+=", ";R+=s1.test(O)?O:n$(O),R+=" = ",R+=s$($[O],G$($[O]),S-1,H)}return R+" }"}function AS($,S,H){if($.length===0)return"[]";let E="[ ";for(let R=0;R<$.length;R++){if(R)E+=", ";if($[R]===null||$[R]===void 0)throw TypeError("arrays cannot contain null or undefined values");E+=s$($[R],G$($[R]),S-1,H)}return E+" ]"}function VS($,S,H,E){if(H===0)throw Error("Could not stringify the object: maximum object depth exceeded");let R="";for(let I=0;I<$.length;I++)R+=`${R&&`
|
|
233
233
|
`}[[${S}]]
|
|
234
|
-
`,R+=
|
|
235
|
-
`)+
|
|
236
|
-
`)+
|
|
234
|
+
`,R+=e$(0,$[I],S,H,E);return R}function e$($,S,H,E,R){if(E===0)throw Error("Could not stringify the object: maximum object depth exceeded");let I="",O="",Y=Object.keys(S);for(let x=0;x<Y.length;x++){let G=Y[x];if(S[G]!==null&&S[G]!==void 0){let q=G$(S[G]);if(q==="symbol"||q==="function")throw TypeError(`cannot serialize values of type '${q}'`);let v=s1.test(G)?G:n$(G);if(q==="array"&&US(S[G]))O+=(O&&`
|
|
235
|
+
`)+VS(S[G],H?`${H}.${v}`:v,E-1,R);else if(q==="object"){let w=H?`${H}.${v}`:v;O+=(O&&`
|
|
236
|
+
`)+e$(w,S[G],w,E-1,R)}else I+=v,I+=" = ",I+=s$(S[G],q,E,R),I+=`
|
|
237
237
|
`}}if($&&(I||!O))I=I?`[${$}]
|
|
238
238
|
${I}`:`[${$}]`;return I&&O?`${I}
|
|
239
|
-
${O}`:I||O}function
|
|
239
|
+
${O}`:I||O}function t$($,{maxDepth:S=1000,numbersAsFloat:H=!1}={}){if(G$($)!=="object")throw TypeError("stringify can only be called with an object");let E=e$(0,$,"",S,H);if(E[E.length-1]!==`
|
|
240
240
|
`)return E+`
|
|
241
241
|
`;return E}/*!
|
|
242
242
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -264,67 +264,67 @@ ${O}`:I||O}function e$($,{maxDepth:S=1000,numbersAsFloat:H=!1}={}){if(G$($)!=="o
|
|
|
264
264
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
265
265
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
266
266
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
267
|
-
*/var
|
|
267
|
+
*/var S1=$1(BS(),".codex"),e1=$1(S1,"config.toml"),t1=$1(S1,"auth.json"),CS={model_provider:"crs",model:"gpt-5.3-codex",model_reasoning_effort:"high",disable_response_storage:!0,model_providers:{crs:{name:"crs",base_url:`${c}/openai`,wire_api:"responses",requires_openai_auth:!1,env_key:"CRS_OAI_KEY"}}};function $0($,S){let H={...$};for(let[E,R]of Object.entries(S))if(R&&typeof R==="object"&&!Array.isArray(R)&&H[E]&&typeof H[E]==="object"&&!Array.isArray(H[E]))H[E]=$0(H[E],R);else H[E]=R;return H}async function KS($){let S=await import("fs/promises");try{await S.mkdir(S1,{recursive:!0})}catch{}let H={};try{H=r$(await S.readFile(e1,"utf-8"))}catch{}let E=$0(H,CS);await Bun.write(e1,t$(E));try{await S.access(t1)}catch{await Bun.write(t1,`{
|
|
268
268
|
"OPENAI_API_KEY": null
|
|
269
269
|
}
|
|
270
|
-
`)}}var KS={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:fS};Z$(KS);var h=w$(O1(),1),V$=w$(E1(),1);import{stdin as q0,stdout as v0}from"process";import*as p from"readline";import E0 from"readline";import{WriteStream as PS}from"tty";function kS({onlyFirst:$=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,$?void 0:"g")}var FS=kS();function N0($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(FS,"")}function w0($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var L0={exports:{}};(function($){var S={};$.exports=S,S.eastAsianWidth=function(E){var R=E.charCodeAt(0),I=E.length==2?E.charCodeAt(1):0,O=R;return 55296<=R&&R<=56319&&56320<=I&&I<=57343&&(R&=1023,I&=1023,O=R<<10|I,O+=65536),O==12288||65281<=O&&O<=65376||65504<=O&&O<=65510?"F":O==8361||65377<=O&&O<=65470||65474<=O&&O<=65479||65482<=O&&O<=65487||65490<=O&&O<=65495||65498<=O&&O<=65500||65512<=O&&O<=65518?"H":4352<=O&&O<=4447||4515<=O&&O<=4519||4602<=O&&O<=4607||9001<=O&&O<=9002||11904<=O&&O<=11929||11931<=O&&O<=12019||12032<=O&&O<=12245||12272<=O&&O<=12283||12289<=O&&O<=12350||12353<=O&&O<=12438||12441<=O&&O<=12543||12549<=O&&O<=12589||12593<=O&&O<=12686||12688<=O&&O<=12730||12736<=O&&O<=12771||12784<=O&&O<=12830||12832<=O&&O<=12871||12880<=O&&O<=13054||13056<=O&&O<=19903||19968<=O&&O<=42124||42128<=O&&O<=42182||43360<=O&&O<=43388||44032<=O&&O<=55203||55216<=O&&O<=55238||55243<=O&&O<=55291||63744<=O&&O<=64255||65040<=O&&O<=65049||65072<=O&&O<=65106||65108<=O&&O<=65126||65128<=O&&O<=65131||110592<=O&&O<=110593||127488<=O&&O<=127490||127504<=O&&O<=127546||127552<=O&&O<=127560||127568<=O&&O<=127569||131072<=O&&O<=194367||177984<=O&&O<=196605||196608<=O&&O<=262141?"W":32<=O&&O<=126||162<=O&&O<=163||165<=O&&O<=166||O==172||O==175||10214<=O&&O<=10221||10629<=O&&O<=10630?"Na":O==161||O==164||167<=O&&O<=168||O==170||173<=O&&O<=174||176<=O&&O<=180||182<=O&&O<=186||188<=O&&O<=191||O==198||O==208||215<=O&&O<=216||222<=O&&O<=225||O==230||232<=O&&O<=234||236<=O&&O<=237||O==240||242<=O&&O<=243||247<=O&&O<=250||O==252||O==254||O==257||O==273||O==275||O==283||294<=O&&O<=295||O==299||305<=O&&O<=307||O==312||319<=O&&O<=322||O==324||328<=O&&O<=331||O==333||338<=O&&O<=339||358<=O&&O<=359||O==363||O==462||O==464||O==466||O==468||O==470||O==472||O==474||O==476||O==593||O==609||O==708||O==711||713<=O&&O<=715||O==717||O==720||728<=O&&O<=731||O==733||O==735||768<=O&&O<=879||913<=O&&O<=929||931<=O&&O<=937||945<=O&&O<=961||963<=O&&O<=969||O==1025||1040<=O&&O<=1103||O==1105||O==8208||8211<=O&&O<=8214||8216<=O&&O<=8217||8220<=O&&O<=8221||8224<=O&&O<=8226||8228<=O&&O<=8231||O==8240||8242<=O&&O<=8243||O==8245||O==8251||O==8254||O==8308||O==8319||8321<=O&&O<=8324||O==8364||O==8451||O==8453||O==8457||O==8467||O==8470||8481<=O&&O<=8482||O==8486||O==8491||8531<=O&&O<=8532||8539<=O&&O<=8542||8544<=O&&O<=8555||8560<=O&&O<=8569||O==8585||8592<=O&&O<=8601||8632<=O&&O<=8633||O==8658||O==8660||O==8679||O==8704||8706<=O&&O<=8707||8711<=O&&O<=8712||O==8715||O==8719||O==8721||O==8725||O==8730||8733<=O&&O<=8736||O==8739||O==8741||8743<=O&&O<=8748||O==8750||8756<=O&&O<=8759||8764<=O&&O<=8765||O==8776||O==8780||O==8786||8800<=O&&O<=8801||8804<=O&&O<=8807||8810<=O&&O<=8811||8814<=O&&O<=8815||8834<=O&&O<=8835||8838<=O&&O<=8839||O==8853||O==8857||O==8869||O==8895||O==8978||9312<=O&&O<=9449||9451<=O&&O<=9547||9552<=O&&O<=9587||9600<=O&&O<=9615||9618<=O&&O<=9621||9632<=O&&O<=9633||9635<=O&&O<=9641||9650<=O&&O<=9651||9654<=O&&O<=9655||9660<=O&&O<=9661||9664<=O&&O<=9665||9670<=O&&O<=9672||O==9675||9678<=O&&O<=9681||9698<=O&&O<=9701||O==9711||9733<=O&&O<=9734||O==9737||9742<=O&&O<=9743||9748<=O&&O<=9749||O==9756||O==9758||O==9792||O==9794||9824<=O&&O<=9825||9827<=O&&O<=9829||9831<=O&&O<=9834||9836<=O&&O<=9837||O==9839||9886<=O&&O<=9887||9918<=O&&O<=9919||9924<=O&&O<=9933||9935<=O&&O<=9953||O==9955||9960<=O&&O<=9983||O==10045||O==10071||10102<=O&&O<=10111||11093<=O&&O<=11097||12872<=O&&O<=12879||57344<=O&&O<=63743||65024<=O&&O<=65039||O==65533||127232<=O&&O<=127242||127248<=O&&O<=127277||127280<=O&&O<=127337||127344<=O&&O<=127386||917760<=O&&O<=917999||983040<=O&&O<=1048573||1048576<=O&&O<=1114109?"A":"N"},S.characterLength=function(E){var R=this.eastAsianWidth(E);return R=="F"||R=="W"||R=="A"?2:1};function H(E){return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}S.length=function(E){for(var R=H(E),I=0,O=0;O<R.length;O++)I=I+this.characterLength(R[O]);return I},S.slice=function(E,R,I){textLen=S.length(E),R=R||0,I=I||1,R<0&&(R=textLen+R),I<0&&(I=textLen+I);for(var O="",Y=0,b=H(E),G=0;G<b.length;G++){var T=b[G],q=S.length(T);if(Y>=R-(q==2?1:0))if(Y+q<=I)O+=T;else break;Y+=q}return O}})(L0);var gS=L0.exports,uS=w0(gS),cS=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},dS=w0(cS);function b$($,S={}){if(typeof $!="string"||$.length===0||(S={ambiguousIsNarrow:!0,...S},$=N0($),$.length===0))return 0;$=$.replace(dS()," ");let H=S.ambiguousIsNarrow?1:2,E=0;for(let R of $){let I=R.codePointAt(0);if(I<=31||I>=127&&I<=159||I>=768&&I<=879)continue;switch(uS.eastAsianWidth(R)){case"F":case"W":E+=2;break;case"A":E+=H;break;default:E+=1}}return E}var R1=10,R0=($=0)=>(S)=>`\x1B[${S+$}m`,I0=($=0)=>(S)=>`\x1B[${38+$};5;${S}m`,Y0=($=0)=>(S,H,E)=>`\x1B[${38+$};2;${S};${H};${E}m`,z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(z.modifier);var lS=Object.keys(z.color),oS=Object.keys(z.bgColor);[...lS,...oS];function iS(){let $=new Map;for(let[S,H]of Object.entries(z)){for(let[E,R]of Object.entries(H))z[E]={open:`\x1B[${R[0]}m`,close:`\x1B[${R[1]}m`},H[E]=z[E],$.set(R[0],R[1]);Object.defineProperty(z,S,{value:H,enumerable:!1})}return Object.defineProperty(z,"codes",{value:$,enumerable:!1}),z.color.close="\x1B[39m",z.bgColor.close="\x1B[49m",z.color.ansi=R0(),z.color.ansi256=I0(),z.color.ansi16m=Y0(),z.bgColor.ansi=R0(R1),z.bgColor.ansi256=I0(R1),z.bgColor.ansi16m=Y0(R1),Object.defineProperties(z,{rgbToAnsi256:{value:(S,H,E)=>S===H&&H===E?S<8?16:S>248?231:Math.round((S-8)/247*24)+232:16+36*Math.round(S/255*5)+6*Math.round(H/255*5)+Math.round(E/255*5),enumerable:!1},hexToRgb:{value:(S)=>{let H=/[a-f\d]{6}|[a-f\d]{3}/i.exec(S.toString(16));if(!H)return[0,0,0];let[E]=H;E.length===3&&(E=[...E].map((I)=>I+I).join(""));let R=Number.parseInt(E,16);return[R>>16&255,R>>8&255,R&255]},enumerable:!1},hexToAnsi256:{value:(S)=>z.rgbToAnsi256(...z.hexToRgb(S)),enumerable:!1},ansi256ToAnsi:{value:(S)=>{if(S<8)return 30+S;if(S<16)return 90+(S-8);let H,E,R;if(S>=232)H=((S-232)*10+8)/255,E=H,R=H;else{S-=16;let Y=S%36;H=Math.floor(S/36)/5,E=Math.floor(Y/6)/5,R=Y%6/5}let I=Math.max(H,E,R)*2;if(I===0)return 30;let O=30+(Math.round(R)<<2|Math.round(E)<<1|Math.round(H));return I===2&&(O+=60),O},enumerable:!1},rgbToAnsi:{value:(S,H,E)=>z.ansi256ToAnsi(z.rgbToAnsi256(S,H,E)),enumerable:!1},hexToAnsi:{value:(S)=>z.ansi256ToAnsi(z.hexToAnsi256(S)),enumerable:!1}}),z}var pS=iS(),f$=new Set(["\x1B","\x9B"]),DS=39,Y1="\x07",Q0="[",aS="]",z0="m",G1=`${aS}8;;`,G0=($)=>`${f$.values().next().value}${Q0}${$}${z0}`,b0=($)=>`${f$.values().next().value}${G1}${$}${Y1}`,rS=($)=>$.split(" ").map((S)=>b$(S)),I1=($,S,H)=>{let E=[...S],R=!1,I=!1,O=b$(N0($[$.length-1]));for(let[Y,b]of E.entries()){let G=b$(b);if(O+G<=H?$[$.length-1]+=b:($.push(b),O=0),f$.has(b)&&(R=!0,I=E.slice(Y+1).join("").startsWith(G1)),R){I?b===Y1&&(R=!1,I=!1):b===z0&&(R=!1);continue}O+=G,O===H&&Y<E.length-1&&($.push(""),O=0)}!O&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},nS=($)=>{let S=$.split(" "),H=S.length;for(;H>0&&!(b$(S[H-1])>0);)H--;return H===S.length?$:S.slice(0,H).join(" ")+S.slice(H).join("")},sS=($,S,H={})=>{if(H.trim!==!1&&$.trim()==="")return"";let E="",R,I,O=rS($),Y=[""];for(let[G,T]of $.split(" ").entries()){H.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let q=b$(Y[Y.length-1]);if(G!==0&&(q>=S&&(H.wordWrap===!1||H.trim===!1)&&(Y.push(""),q=0),(q>0||H.trim===!1)&&(Y[Y.length-1]+=" ",q++)),H.hard&&O[G]>S){let Q=S-q,u=1+Math.floor((O[G]-Q-1)/S);Math.floor((O[G]-1)/S)<u&&Y.push(""),I1(Y,T,S);continue}if(q+O[G]>S&&q>0&&O[G]>0){if(H.wordWrap===!1&&q<S){I1(Y,T,S);continue}Y.push("")}if(q+O[G]>S&&H.wordWrap===!1){I1(Y,T,S);continue}Y[Y.length-1]+=T}H.trim!==!1&&(Y=Y.map((G)=>nS(G)));let b=[...Y.join(`
|
|
271
|
-
`)];for(let[G,
|
|
272
|
-
`?(I&&(E+=
|
|
273
|
-
`&&(R&&
|
|
270
|
+
`)}}var fS={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",continueArg:"--continue",getEnvVars($){return{CRS_OAI_KEY:$}},setupConfigFiles:KS};J$(fS);var h=L$(H1(),1),B$=L$(R1(),1);import{stdin as v0,stdout as M0}from"process";import*as D from"readline";import E0 from"readline";import{WriteStream as kS}from"tty";function FS({onlyFirst:$=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,$?void 0:"g")}var gS=FS();function N0($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(gS,"")}function L0($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var w0={exports:{}};(function($){var S={};$.exports=S,S.eastAsianWidth=function(E){var R=E.charCodeAt(0),I=E.length==2?E.charCodeAt(1):0,O=R;return 55296<=R&&R<=56319&&56320<=I&&I<=57343&&(R&=1023,I&=1023,O=R<<10|I,O+=65536),O==12288||65281<=O&&O<=65376||65504<=O&&O<=65510?"F":O==8361||65377<=O&&O<=65470||65474<=O&&O<=65479||65482<=O&&O<=65487||65490<=O&&O<=65495||65498<=O&&O<=65500||65512<=O&&O<=65518?"H":4352<=O&&O<=4447||4515<=O&&O<=4519||4602<=O&&O<=4607||9001<=O&&O<=9002||11904<=O&&O<=11929||11931<=O&&O<=12019||12032<=O&&O<=12245||12272<=O&&O<=12283||12289<=O&&O<=12350||12353<=O&&O<=12438||12441<=O&&O<=12543||12549<=O&&O<=12589||12593<=O&&O<=12686||12688<=O&&O<=12730||12736<=O&&O<=12771||12784<=O&&O<=12830||12832<=O&&O<=12871||12880<=O&&O<=13054||13056<=O&&O<=19903||19968<=O&&O<=42124||42128<=O&&O<=42182||43360<=O&&O<=43388||44032<=O&&O<=55203||55216<=O&&O<=55238||55243<=O&&O<=55291||63744<=O&&O<=64255||65040<=O&&O<=65049||65072<=O&&O<=65106||65108<=O&&O<=65126||65128<=O&&O<=65131||110592<=O&&O<=110593||127488<=O&&O<=127490||127504<=O&&O<=127546||127552<=O&&O<=127560||127568<=O&&O<=127569||131072<=O&&O<=194367||177984<=O&&O<=196605||196608<=O&&O<=262141?"W":32<=O&&O<=126||162<=O&&O<=163||165<=O&&O<=166||O==172||O==175||10214<=O&&O<=10221||10629<=O&&O<=10630?"Na":O==161||O==164||167<=O&&O<=168||O==170||173<=O&&O<=174||176<=O&&O<=180||182<=O&&O<=186||188<=O&&O<=191||O==198||O==208||215<=O&&O<=216||222<=O&&O<=225||O==230||232<=O&&O<=234||236<=O&&O<=237||O==240||242<=O&&O<=243||247<=O&&O<=250||O==252||O==254||O==257||O==273||O==275||O==283||294<=O&&O<=295||O==299||305<=O&&O<=307||O==312||319<=O&&O<=322||O==324||328<=O&&O<=331||O==333||338<=O&&O<=339||358<=O&&O<=359||O==363||O==462||O==464||O==466||O==468||O==470||O==472||O==474||O==476||O==593||O==609||O==708||O==711||713<=O&&O<=715||O==717||O==720||728<=O&&O<=731||O==733||O==735||768<=O&&O<=879||913<=O&&O<=929||931<=O&&O<=937||945<=O&&O<=961||963<=O&&O<=969||O==1025||1040<=O&&O<=1103||O==1105||O==8208||8211<=O&&O<=8214||8216<=O&&O<=8217||8220<=O&&O<=8221||8224<=O&&O<=8226||8228<=O&&O<=8231||O==8240||8242<=O&&O<=8243||O==8245||O==8251||O==8254||O==8308||O==8319||8321<=O&&O<=8324||O==8364||O==8451||O==8453||O==8457||O==8467||O==8470||8481<=O&&O<=8482||O==8486||O==8491||8531<=O&&O<=8532||8539<=O&&O<=8542||8544<=O&&O<=8555||8560<=O&&O<=8569||O==8585||8592<=O&&O<=8601||8632<=O&&O<=8633||O==8658||O==8660||O==8679||O==8704||8706<=O&&O<=8707||8711<=O&&O<=8712||O==8715||O==8719||O==8721||O==8725||O==8730||8733<=O&&O<=8736||O==8739||O==8741||8743<=O&&O<=8748||O==8750||8756<=O&&O<=8759||8764<=O&&O<=8765||O==8776||O==8780||O==8786||8800<=O&&O<=8801||8804<=O&&O<=8807||8810<=O&&O<=8811||8814<=O&&O<=8815||8834<=O&&O<=8835||8838<=O&&O<=8839||O==8853||O==8857||O==8869||O==8895||O==8978||9312<=O&&O<=9449||9451<=O&&O<=9547||9552<=O&&O<=9587||9600<=O&&O<=9615||9618<=O&&O<=9621||9632<=O&&O<=9633||9635<=O&&O<=9641||9650<=O&&O<=9651||9654<=O&&O<=9655||9660<=O&&O<=9661||9664<=O&&O<=9665||9670<=O&&O<=9672||O==9675||9678<=O&&O<=9681||9698<=O&&O<=9701||O==9711||9733<=O&&O<=9734||O==9737||9742<=O&&O<=9743||9748<=O&&O<=9749||O==9756||O==9758||O==9792||O==9794||9824<=O&&O<=9825||9827<=O&&O<=9829||9831<=O&&O<=9834||9836<=O&&O<=9837||O==9839||9886<=O&&O<=9887||9918<=O&&O<=9919||9924<=O&&O<=9933||9935<=O&&O<=9953||O==9955||9960<=O&&O<=9983||O==10045||O==10071||10102<=O&&O<=10111||11093<=O&&O<=11097||12872<=O&&O<=12879||57344<=O&&O<=63743||65024<=O&&O<=65039||O==65533||127232<=O&&O<=127242||127248<=O&&O<=127277||127280<=O&&O<=127337||127344<=O&&O<=127386||917760<=O&&O<=917999||983040<=O&&O<=1048573||1048576<=O&&O<=1114109?"A":"N"},S.characterLength=function(E){var R=this.eastAsianWidth(E);return R=="F"||R=="W"||R=="A"?2:1};function H(E){return E.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}S.length=function(E){for(var R=H(E),I=0,O=0;O<R.length;O++)I=I+this.characterLength(R[O]);return I},S.slice=function(E,R,I){textLen=S.length(E),R=R||0,I=I||1,R<0&&(R=textLen+R),I<0&&(I=textLen+I);for(var O="",Y=0,x=H(E),G=0;G<x.length;G++){var q=x[G],v=S.length(q);if(Y>=R-(v==2?1:0))if(Y+v<=I)O+=q;else break;Y+=v}return O}})(w0);var uS=w0.exports,cS=L0(uS),dS=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},lS=L0(dS);function x$($,S={}){if(typeof $!="string"||$.length===0||(S={ambiguousIsNarrow:!0,...S},$=N0($),$.length===0))return 0;$=$.replace(lS()," ");let H=S.ambiguousIsNarrow?1:2,E=0;for(let R of $){let I=R.codePointAt(0);if(I<=31||I>=127&&I<=159||I>=768&&I<=879)continue;switch(cS.eastAsianWidth(R)){case"F":case"W":E+=2;break;case"A":E+=H;break;default:E+=1}}return E}var I1=10,R0=($=0)=>(S)=>`\x1B[${S+$}m`,I0=($=0)=>(S)=>`\x1B[${38+$};5;${S}m`,Y0=($=0)=>(S,H,E)=>`\x1B[${38+$};2;${S};${H};${E}m`,Z={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(Z.modifier);var oS=Object.keys(Z.color),pS=Object.keys(Z.bgColor);[...oS,...pS];function iS(){let $=new Map;for(let[S,H]of Object.entries(Z)){for(let[E,R]of Object.entries(H))Z[E]={open:`\x1B[${R[0]}m`,close:`\x1B[${R[1]}m`},H[E]=Z[E],$.set(R[0],R[1]);Object.defineProperty(Z,S,{value:H,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:$,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=R0(),Z.color.ansi256=I0(),Z.color.ansi16m=Y0(),Z.bgColor.ansi=R0(I1),Z.bgColor.ansi256=I0(I1),Z.bgColor.ansi16m=Y0(I1),Object.defineProperties(Z,{rgbToAnsi256:{value:(S,H,E)=>S===H&&H===E?S<8?16:S>248?231:Math.round((S-8)/247*24)+232:16+36*Math.round(S/255*5)+6*Math.round(H/255*5)+Math.round(E/255*5),enumerable:!1},hexToRgb:{value:(S)=>{let H=/[a-f\d]{6}|[a-f\d]{3}/i.exec(S.toString(16));if(!H)return[0,0,0];let[E]=H;E.length===3&&(E=[...E].map((I)=>I+I).join(""));let R=Number.parseInt(E,16);return[R>>16&255,R>>8&255,R&255]},enumerable:!1},hexToAnsi256:{value:(S)=>Z.rgbToAnsi256(...Z.hexToRgb(S)),enumerable:!1},ansi256ToAnsi:{value:(S)=>{if(S<8)return 30+S;if(S<16)return 90+(S-8);let H,E,R;if(S>=232)H=((S-232)*10+8)/255,E=H,R=H;else{S-=16;let Y=S%36;H=Math.floor(S/36)/5,E=Math.floor(Y/6)/5,R=Y%6/5}let I=Math.max(H,E,R)*2;if(I===0)return 30;let O=30+(Math.round(R)<<2|Math.round(E)<<1|Math.round(H));return I===2&&(O+=60),O},enumerable:!1},rgbToAnsi:{value:(S,H,E)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(S,H,E)),enumerable:!1},hexToAnsi:{value:(S)=>Z.ansi256ToAnsi(Z.hexToAnsi256(S)),enumerable:!1}}),Z}var DS=iS(),C$=new Set(["\x1B","\x9B"]),aS=39,G1="\x07",Q0="[",rS="]",Z0="m",x1=`${rS}8;;`,G0=($)=>`${C$.values().next().value}${Q0}${$}${Z0}`,x0=($)=>`${C$.values().next().value}${x1}${$}${G1}`,nS=($)=>$.split(" ").map((S)=>x$(S)),Y1=($,S,H)=>{let E=[...S],R=!1,I=!1,O=x$(N0($[$.length-1]));for(let[Y,x]of E.entries()){let G=x$(x);if(O+G<=H?$[$.length-1]+=x:($.push(x),O=0),C$.has(x)&&(R=!0,I=E.slice(Y+1).join("").startsWith(x1)),R){I?x===G1&&(R=!1,I=!1):x===Z0&&(R=!1);continue}O+=G,O===H&&Y<E.length-1&&($.push(""),O=0)}!O&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},sS=($)=>{let S=$.split(" "),H=S.length;for(;H>0&&!(x$(S[H-1])>0);)H--;return H===S.length?$:S.slice(0,H).join(" ")+S.slice(H).join("")},eS=($,S,H={})=>{if(H.trim!==!1&&$.trim()==="")return"";let E="",R,I,O=nS($),Y=[""];for(let[G,q]of $.split(" ").entries()){H.trim!==!1&&(Y[Y.length-1]=Y[Y.length-1].trimStart());let v=x$(Y[Y.length-1]);if(G!==0&&(v>=S&&(H.wordWrap===!1||H.trim===!1)&&(Y.push(""),v=0),(v>0||H.trim===!1)&&(Y[Y.length-1]+=" ",v++)),H.hard&&O[G]>S){let w=S-v,K=1+Math.floor((O[G]-w-1)/S);Math.floor((O[G]-1)/S)<K&&Y.push(""),Y1(Y,q,S);continue}if(v+O[G]>S&&v>0&&O[G]>0){if(H.wordWrap===!1&&v<S){Y1(Y,q,S);continue}Y.push("")}if(v+O[G]>S&&H.wordWrap===!1){Y1(Y,q,S);continue}Y[Y.length-1]+=q}H.trim!==!1&&(Y=Y.map((G)=>sS(G)));let x=[...Y.join(`
|
|
271
|
+
`)];for(let[G,q]of x.entries()){if(E+=q,C$.has(q)){let{groups:w}=new RegExp(`(?:\\${Q0}(?<code>\\d+)m|\\${x1}(?<uri>.*)${G1})`).exec(x.slice(G).join(""))||{groups:{}};if(w.code!==void 0){let K=Number.parseFloat(w.code);R=K===aS?void 0:K}else w.uri!==void 0&&(I=w.uri.length===0?void 0:w.uri)}let v=DS.codes.get(Number(R));x[G+1]===`
|
|
272
|
+
`?(I&&(E+=x0("")),R&&v&&(E+=G0(v))):q===`
|
|
273
|
+
`&&(R&&v&&(E+=G0(R)),I&&(E+=x0(I)))}return E};function b0($,S,H){return String($).normalize().replace(/\r\n/g,`
|
|
274
274
|
`).split(`
|
|
275
|
-
`).map((E)=>
|
|
276
|
-
`)}var
|
|
275
|
+
`).map((E)=>eS(E,S,H)).join(`
|
|
276
|
+
`)}var tS=Object.defineProperty,$2=($,S,H)=>(S in $)?tS($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,m=($,S,H)=>($2($,typeof S!="symbol"?S+"":S,H),H);function S2($,S){if($===S)return;let H=$.split(`
|
|
277
277
|
`),E=S.split(`
|
|
278
|
-
`),R=[];for(let I=0;I<Math.max(H.length,E.length);I++)H[I]!==E[I]&&R.push(I);return R}var
|
|
279
|
-
`),
|
|
280
|
-
`).length-1;this.output.write(h.cursor.move(-999,$*-1))}render(){let $=
|
|
278
|
+
`),R=[];for(let I=0;I<Math.max(H.length,E.length);I++)H[I]!==E[I]&&R.push(I);return R}var J0=Symbol("clack:cancel");function d($){return $===J0}function V$($,S){$.isTTY&&$.setRawMode(S)}var q0=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),O2=new Set(["up","down","left","right","space","enter"]);class b1{constructor({render:$,input:S=v0,output:H=M0,...E},R=!0){m(this,"input"),m(this,"output"),m(this,"rl"),m(this,"opts"),m(this,"_track",!1),m(this,"_render"),m(this,"_cursor",0),m(this,"state","initial"),m(this,"value"),m(this,"error",""),m(this,"subscribers",new Map),m(this,"_prevFrame",""),this.opts=E,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=$.bind(this),this._track=R,this.input=S,this.output=H}prompt(){let $=new kS(0);return $._write=(S,H,E)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),E()},this.input.pipe($),this.rl=E0.createInterface({input:this.input,output:$,tabSize:2,prompt:"",escapeCodeTimeout:50}),E0.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),V$(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((S,H)=>{this.once("submit",()=>{this.output.write(h.cursor.show),this.output.off("resize",this.render),V$(this.input,!1),S(this.value)}),this.once("cancel",()=>{this.output.write(h.cursor.show),this.output.off("resize",this.render),V$(this.input,!1),S(J0)})})}on($,S){let H=this.subscribers.get($)??[];H.push({cb:S}),this.subscribers.set($,H)}once($,S){let H=this.subscribers.get($)??[];H.push({cb:S,once:!0}),this.subscribers.set($,H)}emit($,...S){let H=this.subscribers.get($)??[],E=[];for(let R of H)R.cb(...S),R.once&&E.push(()=>H.splice(H.indexOf(R),1));for(let R of E)R()}unsubscribe(){this.subscribers.clear()}onKeypress($,S){if(this.state==="error"&&(this.state="active"),S?.name&&!this._track&&q0.has(S.name)&&this.emit("cursor",q0.get(S.name)),S?.name&&O2.has(S.name)&&this.emit("cursor",S.name),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),S?.name==="return"){if(this.opts.validate){let H=this.opts.validate(this.value);H&&(this.error=H,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}$==="\x03"&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
279
|
+
`),V$(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=b0(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
280
|
+
`).length-1;this.output.write(h.cursor.move(-999,$*-1))}render(){let $=b0(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(h.cursor.hide);else{let S=S2(this._prevFrame,$);if(this.restoreCursor(),S&&S?.length===1){let H=S[0];this.output.write(h.cursor.move(0,H)),this.output.write(h.erase.lines(1));let E=$.split(`
|
|
281
281
|
`);this.output.write(E[H]),this._prevFrame=$,this.output.write(h.cursor.move(0,E.length-H-1));return}else if(S&&S?.length>1){let H=S[0];this.output.write(h.cursor.move(0,H)),this.output.write(h.erase.down());let E=$.split(`
|
|
282
282
|
`).slice(H);this.output.write(E.join(`
|
|
283
|
-
`)),this._prevFrame=$;return}this.output.write(h.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}var
|
|
283
|
+
`)),this._prevFrame=$;return}this.output.write(h.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}var H2=Object.defineProperty,E2=($,S,H)=>(S in $)?H2($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,T0=($,S,H)=>(E2($,typeof S!="symbol"?S+"":S,H),H),z0=class extends b1{constructor($){super($,!1),T0(this,"options"),T0(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:S})=>S===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(S)=>{switch(S){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var R2=Object.defineProperty,I2=($,S,H)=>(S in $)?R2($,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):$[S]=H,Y2=($,S,H)=>(I2($,typeof S!="symbol"?S+"":S,H),H);class q1 extends b1{constructor($){super($),Y2(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${B$.default.inverse(B$.default.hidden("_"))}`;else{let S=this.value.slice(0,this.cursor),H=this.value.slice(this.cursor);this.valueWithCursor=`${S}${B$.default.inverse(H[0])}${H.slice(1)}`}})}get cursor(){return this._cursor}}var G2=globalThis.process.platform.startsWith("win");function W0({input:$=v0,output:S=M0,overwrite:H=!0,hideCursor:E=!0}={}){let R=D.createInterface({input:$,output:S,prompt:"",tabSize:1});D.emitKeypressEvents($,R),$.isTTY&&$.setRawMode(!0);let I=(O,{name:Y})=>{if(String(O)==="\x03"){E&&S.write(h.cursor.show),process.exit(0);return}if(!H)return;D.moveCursor(S,Y==="return"?0:-1,Y==="return"?-1:0,()=>{D.clearLine(S,1,()=>{$.once("keypress",I)})})};return E&&S.write(h.cursor.hide),$.once("keypress",I),()=>{$.off("keypress",I),E&&S.write(h.cursor.show),$.isTTY&&!G2&&$.setRawMode(!1),R.terminal=!1,R.close()}}var T=L$(R1(),1),O$=L$(H1(),1);import j from"process";function x2(){return j.platform!=="win32"?j.env.TERM!=="linux":Boolean(j.env.CI)||Boolean(j.env.WT_SESSION)||Boolean(j.env.TERMINUS_SUBLIME)||j.env.ConEmuTask==="{cmd::Cmder}"||j.env.TERM_PROGRAM==="Terminus-Sublime"||j.env.TERM_PROGRAM==="vscode"||j.env.TERM==="xterm-256color"||j.env.TERM==="alacritty"||j.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var T1=x2(),z=($,S)=>T1?$:S,b2=z("\u25C6","*"),X0=z("\u25A0","x"),U0=z("\u25B2","x"),v1=z("\u25C7","o"),FH=z("\u250C","T"),U=z("\u2502","|"),K$=z("\u2514","\u2014"),q2=z("\u25CF",">"),T2=z("\u25CB"," "),gH=z("\u25FB","[\u2022]"),uH=z("\u25FC","[+]"),cH=z("\u25FB","[ ]"),dH=z("\u25AA","\u2022"),lH=z("\u2500","-"),oH=z("\u256E","+"),pH=z("\u251C","+"),iH=z("\u256F","+"),v2=z("\u25CF","\u2022"),M2=z("\u25C6","*"),N2=z("\u25B2","!"),L2=z("\u25A0","x"),h0=($)=>{switch($){case"initial":case"active":return T.default.cyan(b2);case"cancel":return T.default.red(X0);case"error":return T.default.yellow(U0);case"submit":return T.default.green(v1)}},A0=($)=>new q1({validate:$.validate,placeholder:$.placeholder,defaultValue:$.defaultValue,initialValue:$.initialValue,render(){let S=`${T.default.gray(U)}
|
|
284
284
|
${h0(this.state)} ${$.message}
|
|
285
|
-
`,H=$.placeholder?
|
|
286
|
-
${
|
|
287
|
-
${
|
|
288
|
-
`;case"submit":return`${S}${
|
|
289
|
-
`+
|
|
290
|
-
${
|
|
291
|
-
`}}}).prompt();var
|
|
285
|
+
`,H=$.placeholder?T.default.inverse($.placeholder[0])+T.default.dim($.placeholder.slice(1)):T.default.inverse(T.default.hidden("_")),E=this.value?this.valueWithCursor:H;switch(this.state){case"error":return`${S.trim()}
|
|
286
|
+
${T.default.yellow(U)} ${E}
|
|
287
|
+
${T.default.yellow(K$)} ${T.default.yellow(this.error)}
|
|
288
|
+
`;case"submit":return`${S}${T.default.gray(U)} ${T.default.dim(this.value||$.placeholder)}`;case"cancel":return`${S}${T.default.gray(U)} ${T.default.strikethrough(T.default.dim(this.value??""))}${this.value?.trim()?`
|
|
289
|
+
`+T.default.gray(U):""}`;default:return`${S}${T.default.cyan(U)} ${E}
|
|
290
|
+
${T.default.cyan(K$)}
|
|
291
|
+
`}}}).prompt();var b$=($)=>{let S=(E,R)=>{let I=E.label??String(E.value);return R==="active"?`${T.default.green(q2)} ${I} ${E.hint?T.default.dim(`(${E.hint})`):""}`:R==="selected"?`${T.default.dim(I)}`:R==="cancelled"?`${T.default.strikethrough(T.default.dim(I))}`:`${T.default.dim(T2)} ${T.default.dim(I)}`},H=0;return new z0({options:$.options,initialValue:$.initialValue,render(){let E=`${T.default.gray(U)}
|
|
292
292
|
${h0(this.state)} ${$.message}
|
|
293
|
-
`;switch(this.state){case"submit":return`${E}${
|
|
294
|
-
${
|
|
295
|
-
${
|
|
296
|
-
${
|
|
297
|
-
`}}}}).prompt()};var
|
|
298
|
-
${
|
|
293
|
+
`;switch(this.state){case"submit":return`${E}${T.default.gray(U)} ${S(this.options[this.cursor],"selected")}`;case"cancel":return`${E}${T.default.gray(U)} ${S(this.options[this.cursor],"cancelled")}
|
|
294
|
+
${T.default.gray(U)}`;default:{let R=$.maxItems===void 0?1/0:Math.max($.maxItems,5);this.cursor>=H+R-3?H=Math.max(Math.min(this.cursor-R+3,this.options.length-R),0):this.cursor<H+2&&(H=Math.max(this.cursor-2,0));let I=R<this.options.length&&H>0,O=R<this.options.length&&H+R<this.options.length;return`${E}${T.default.cyan(U)} ${this.options.slice(H,H+R).map((Y,x,G)=>x===0&&I?T.default.dim("..."):x===G.length-1&&O?T.default.dim("..."):S(Y,x+H===this.cursor?"active":"inactive")).join(`
|
|
295
|
+
${T.default.cyan(U)} `)}
|
|
296
|
+
${T.default.cyan(K$)}
|
|
297
|
+
`}}}}).prompt()};var M1=($="")=>{process.stdout.write(`${T.default.gray(U)}
|
|
298
|
+
${T.default.gray(K$)} ${$}
|
|
299
299
|
|
|
300
|
-
`)},N={message:($="",{symbol:S=
|
|
301
|
-
`);H.push(`${S} ${E}`,...R.map((I)=>`${
|
|
300
|
+
`)},N={message:($="",{symbol:S=T.default.gray(U)}={})=>{let H=[`${T.default.gray(U)}`];if($){let[E,...R]=$.split(`
|
|
301
|
+
`);H.push(`${S} ${E}`,...R.map((I)=>`${T.default.gray(U)} ${I}`))}process.stdout.write(`${H.join(`
|
|
302
302
|
`)}
|
|
303
|
-
`)},info:($)=>{N.message($,{symbol:
|
|
304
|
-
`);let
|
|
305
|
-
`),H()},b=(T="")=>{I=T??I},G=(T)=>{let q=T>1?"Something went wrong":"Canceled";R&&Y(q,T)};return process.on("uncaughtExceptionMonitor",()=>G(2)),process.on("unhandledRejection",()=>G(2)),process.on("SIGINT",()=>G(1)),process.on("SIGTERM",()=>G(1)),process.on("exit",G),{start:O,stop:Y,message:b}};import{join as Q1}from"path";V();var y$=null,w1={cn:{npm:"https://registry.npmmirror.com",bun:"https://bun.sh/install",bunMirror:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bun:"https://bun.sh/install",bunMirror:null}};async function r(){if(y$)return y$;let $=[Q2,z2,Z2];for(let S of $)try{let H=await Promise.race([S(),new Promise((E,R)=>setTimeout(()=>R(Error("timeout")),3000))]);if(H)return y$=H,H}catch{}return y$="cn","cn"}async function Q2(){try{let $=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function z2(){try{let $=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country==="CN"?"cn":"global"}catch{return null}}async function Z2(){try{let $=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function W2(){let $=await r();return w1[$]}async function n(){return(await W2()).npm}async function V0(){if(await r()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${w1.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function f0(){let $=await r(),S=w1[$];if($==="cn")N.info(M("region.usingChinaMirror")),N.message(` npm: ${S.npm}`);else N.info(M("region.usingGlobalMirror"))}var J2=class{constructor($){this.baseUrl=$.baseUrl,this.headers={"Content-Type":"application/json",...$.defaultHeaders},this.maxRetries=$.maxRetries??3,this.initialRetryDelay=$.initialRetryDelay??500}async resolveHeaders(){let $={};for(let[S,H]of Object.entries(this.headers)){let E=await H;E!==null&&($[S]=E)}return $}addHeader($,S){this.headers[$]=S}async post($,S,H,E){try{let R=await fetch($,{method:"POST",headers:await this.resolveHeaders(),body:S?JSON.stringify(S??{}):void 0,keepalive:!0,...H});if(R.status===401)return null;if(R.status!==200&&R.status!==202)throw Error(`HTTP error! status: ${R.status}`);let I=await R.text();return I?JSON.parse(I):null}catch(R){if(E<this.maxRetries){let I=this.initialRetryDelay*2**E;return await new Promise((O)=>setTimeout(O,I)),this.post($,S,H,E+1)}return console.error("Max retries reached:",R),null}}async fetch($,S,H={}){let E=`${this.baseUrl}${$}`;return this.post(E,S,H,0)}},K0=class{constructor($){this.options=$,this.queue=[];let S={"openpanel-client-id":$.clientId};$.clientSecret&&(S["openpanel-client-secret"]=$.clientSecret),S["openpanel-sdk-name"]=$.sdk||"node",S["openpanel-sdk-version"]=$.sdkVersion||"1.0.4",this.api=new J2({baseUrl:$.apiUrl||"https://api.openpanel.dev",defaultHeaders:S})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send($){return this.options.disabled||this.options.filter&&!this.options.filter($)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push($),Promise.resolve()):this.api.fetch("/track",$)}setGlobalProperties($){this.global={...this.global,...$}}async track($,S){return this.log("track event",$,S),this.send({type:"track",payload:{name:$,profileId:S?.profileId??this.profileId,properties:{...this.global??{},...S??{}}}})}async identify($){if(this.log("identify user",$),$.profileId&&(this.profileId=$.profileId,this.flush()),Object.keys($).length>1)return this.send({type:"identify",payload:{...$,properties:{...this.global,...$.properties}}})}async alias($){}async increment($){return this.send({type:"increment",payload:$})}async decrement($){return this.send({type:"decrement",payload:$})}async revenue($,S){let H=S?.deviceId;return delete S?.deviceId,this.track("revenue",{...S??{},...H?{__deviceId:H}:{},__revenue:$})}async fetchDeviceId(){return(await this.api.fetch("/track/device-id",void 0,{method:"GET",keepalive:!1}))?.deviceId??""}clear(){this.profileId=void 0}flush(){this.queue.forEach(($)=>{this.send({...$,payload:{...$.payload,profileId:$.payload.profileId??this.profileId}})}),this.queue=[]}log(...$){this.options.debug&&console.log("[OpenPanel.dev]",...$)}};var X2="f8ec91ab-20e5-4c17-bece-f5f2fe647a71",U2="sec_3038f0cb74f91312f374",h2="https://op.shiroha.tech/api",T$=null;function L1(){if(!T$)T$=new K0({clientId:X2,clientSecret:U2,apiUrl:h2});return T$}async function C0(){if(T$)try{T$=null}catch{}}V();V();var A2="0.2.10";function m0(){return{cli_version:A2,platform:process.platform,arch:process.arch,locale:a(),node_version:process.version}}function y0($){return Bun.hash($).toString(16).slice(0,8)}var B2="0.2.10",j0=!1,x$=null;async function _0(){if(x$!==null)return x$;try{return x$=(await X()).telemetryEnabled!==!1,x$}catch{return x$=!1,!1}}async function V2(){try{return(await X()).apiId||"anonymous"}catch{return"anonymous"}}async function j$(){if(j0)return;try{if(!await _0())return;let $=await X();if(!$.apiId)return;let S=L1(),H=await r();await S.identify({profileId:$.apiId,properties:{region:H,locale:a(),first_seen_version:B2,platform:process.platform,arch:process.arch}}),j0=!0}catch{}}function J($,S){f2($,S).catch(()=>{})}async function f2($,S){try{if(!await _0())return;let H=L1(),E=await V2();await H.track($,{profileId:E,properties:{...m0(),...S}})}catch{}}async function q$(){await C0()}var s=null;function K2($){return $.startsWith(D)}async function C2(){try{if(!await Bun.file(A).exists())return null;let S=Bun.spawn([A,"--version"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode!==0)return null;return(await new Response(S.stdout).text()).trim()}catch{return null}}async function k0(){return await C2()!==null}async function m2(){if(process.platform==="win32")return!0;try{let S=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode===0)return!0}catch{}N.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let $=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let S of $)try{let H=Bun.spawn(["bash","-c",`sudo ${S} 2>/dev/null || ${S}`],{stdout:"pipe",stderr:"pipe"});if(await H.exited,H.exitCode===0)return!0}catch{}return!1}async function y2(){let $=k();if(!await m2())return N.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await f0(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(D,{recursive:!0});let H;if(process.platform==="win32"){let R=await r()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",I=`$env:BUN_INSTALL="${D}"; ${R}irm bun.sh/install.ps1 | iex`;H=await Bun.spawn(["powershell","-Command",I],{stdout:"inherit",stderr:"inherit"}).exited}else{let E=await V0(),R=`BUN_INSTALL="${D}" ${E}`;H=await Bun.spawn(["bash","-c",R],{stdout:"inherit",stderr:"inherit"}).exited}if(H!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return s=A,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),N.info(`\u5B89\u88C5\u4F4D\u7F6E: ${D}`),!0}catch(S){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function j2(){if(await k0())return s=A,!0;return N.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),N.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await y2()}async function z1(){if(s){if(!K2(s))s=A;return s}if(await k0())return s=A,A;return A}async function F0($){try{let S=await n(),H=await fetch(`${S}/${$}/latest`);if(!H.ok)return null;return(await H.json()).version}catch{return null}}async function _2($){return(await X()).installedClients[$.id]?.version||null}async function g0($){let S=I$($.id),H=Q1(S,"package.json");try{return await Bun.file(H).exists()}catch{return!1}}async function u0($){let S=await _2($);if(!S)return!0;let H=await F0($.package);if(!H)return!1;return S!==H}async function P0($,S=!1){let H=k(),E=I$($.id);try{if(!await j2())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let R=await g0($),I=S||await u0($);if(R&&!I)return{success:!0};let O=R?"\u66F4\u65B0":"\u5B89\u88C5";H.start(`\u6B63\u5728${O} ${$.name}...`);let Y=await import("fs/promises");await Y.mkdir(E,{recursive:!0});let b=Q1(E,"package.json");if(!await Bun.file(b).exists())await Bun.write(b,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let T=await z1(),q=await n();if(R){let $$=Q1(E,"bun.lock");try{await Y.unlink($$)}catch{}}let Q=Bun.spawn([T,"add",`${$.package}@latest`],{cwd:E,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:q}});if(await Q.exited!==0){let $$=await new Response(Q.stderr).text();return H.stop(`${O} ${$.name} \u5931\u8D25`),{success:!1,error:$$}}let C=await F0($.package),C1=(await X()).installedClients[$.id]?.version;if(C){let $$=await X();if($$.installedClients[$.id]={version:C,installedAt:new Date().toISOString()},await L$($$),R&&C1)J("client_updated",{client_id:$.id,from_version:C1,to_version:C});else J("client_installed",{client_id:$.id,client_version:C})}return H.stop(`${$.name} ${O}\u5B8C\u6210`),{success:!0}}catch(R){return H.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:R instanceof Error?R.message:"\u672A\u77E5\u9519\u8BEF"}}}async function _$($){if(!await g0($))return await P0($);if(await u0($))return await P0($,!0);return{success:!0}}import{homedir as P2}from"os";var k2=50,Z1=3;async function v$($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function P$($,S){let H=await X(),E=H.recentProjects||[],R=new Date().toISOString(),I=E.findIndex((Y)=>Y.path===$);if(I>=0){let Y=E[I],b=Y.clientUsage||{},G=b[S]||{count:0,lastAt:R};E[I]={...Y,launchCount:Y.launchCount+1,lastLaunchedAt:R,lastClientId:S,clientUsage:{...b,[S]:{count:G.count+1,lastAt:R}}}}else E.push({path:$,launchCount:1,lastLaunchedAt:R,lastClientId:S,clientUsage:{[S]:{count:1,lastAt:R}}});let O=E.sort((Y,b)=>new Date(b.lastLaunchedAt).getTime()-new Date(Y.lastLaunchedAt).getTime()).slice(0,k2);H.recentProjects=O,await o$(H)}function F2($,S){let H=$.clientUsage?.[S];if(H)return new Date(H.lastAt).getTime();if($.lastClientId===S)return new Date($.lastLaunchedAt).getTime();return 0}async function c0($,S=Z1,H=!0){let R=(await X()).recentProjects||[],I=process.cwd(),Y=R.filter((G)=>{if(H&&G.path===I)return!1;return G.clientUsage?.[$]||G.lastClientId===$}).map((G)=>({...G,lastUsedTime:F2(G,$)})).sort((G,T)=>T.lastUsedTime-G.lastUsedTime),b=[];for(let{lastUsedTime:G,...T}of Y){if(b.length>=S)break;if(await v$(T.path))b.push(T)}return b}async function d0(){let S=(await X()).recentProjects||[],H=process.cwd();return S.find((R)=>R.path===H)?.lastClientId||null}function l0($,S=25){let H=P2(),E=$.startsWith(H)?"~"+$.slice(H.length):$;if(E.length>S){let I=E.split("/").pop()||"";if(I.length>S-4)E="..."+I.slice(-S+3);else E=`.../${I}`}return E}function o0($){let{t:S}=(V(),RS(B0)),H=Date.now(),E=new Date($).getTime(),R=H-E,I=Math.floor(R/60000),O=Math.floor(R/3600000),Y=Math.floor(R/86400000),b=Math.floor(Y/7),G=Math.floor(Y/30);if(I<1)return S("time.justNow");if(I<60)return S("time.minutesAgo",{n:I});if(O<24)return S("time.hoursAgo",{n:O});if(Y===1)return S("time.yesterday");if(Y<7)return S("time.daysAgo",{n:Y});if(Y<30)return S("time.weeksAgo",{n:b});return S("time.monthsAgo",{n:G})}V();async function i0($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await v$(S.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${S.projectPath}`}}let E=await _$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(R);let I=await d1($);if(!I)I=l1($);if(!await Bun.file(I).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${I}`};await P$(H,$.id);let Y=$.getEnvVars(R),b={...process.env,...Y};N.info(`\u542F\u52A8 ${$.name}...`);let G;if($.runtime==="native")G=[I];else G=[await z1(),I];if(S?.args&&S.args.length>0)G=[...G,...S.args];return await Bun.spawn(G,{env:b,stdio:["inherit","inherit","inherit"],cwd:H}).exited,{success:!0}}catch(H){return{success:!1,error:H instanceof Error?H.message:"\u542F\u52A8\u5931\u8D25"}}}async function E$($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await v$(S.projectPath))return{success:!1,error:M("launcher.directoryNotFound",{path:S.projectPath})}}let E=await _$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:M("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(R);await P$(H,$.id);let O=(await X()).installedClients[$.id]?.version;return J("client_launched",{client_id:$.id,client_version:O,project_hash:y0(H),is_recent_project:!!S?.projectPath}),N.info(M("launcher.starting",{client:$.name})),await i0($,S)}catch(H){return{success:!1,error:H instanceof Error?H.message:"Launch failed"}}}V();import{join as F}from"path";var W1="tako-cli",e="0.2.10";function g2($,S){let H=$.split(".").map(Number),E=S.split(".").map(Number);for(let R=0;R<3;R++){let I=H[R]||0,O=E[R]||0;if(I>O)return 1;if(I<O)return-1}return 0}async function u2(){try{let $=await n(),S=await fetch(`${$}/${W1}/latest`,{signal:AbortSignal.timeout(5000)});if(!S.ok)return null;return(await S.json()).version||null}catch{return null}}async function c2(){let $=await u2();if(!$)return{hasUpdate:!1,currentVersion:e};return{hasUpdate:g2($,e)>0,latestVersion:$,currentVersion:e}}async function p0(){let $=await import("fs/promises"),S=F(_,"bin"),H=F(S,"tako"),E=F(P,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(S,{recursive:!0}),process.platform==="win32"){let I=`@echo off\r
|
|
303
|
+
`)},info:($)=>{N.message($,{symbol:T.default.blue(v2)})},success:($)=>{N.message($,{symbol:T.default.green(M2)})},step:($)=>{N.message($,{symbol:T.default.green(v1)})},warn:($)=>{N.message($,{symbol:T.default.yellow(N2)})},warning:($)=>{N.warn($)},error:($)=>{N.message($,{symbol:T.default.red(L2)})}},F=()=>{let $=T1?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],S=T1?80:120,H,E,R=!1,I="",O=(q="")=>{R=!0,H=W0(),I=q.replace(/\.+$/,""),process.stdout.write(`${T.default.gray(U)}
|
|
304
|
+
`);let v=0,w=0;E=setInterval(()=>{let K=T.default.magenta($[v]),y=".".repeat(Math.floor(w)).slice(0,3);process.stdout.write(O$.cursor.move(-999,0)),process.stdout.write(O$.erase.down(1)),process.stdout.write(`${K} ${I}${y}`),v=v+1<$.length?v+1:0,w=w<$.length?w+0.125:0},S)},Y=(q="",v=0)=>{I=q??I,R=!1,clearInterval(E);let w=v===0?T.default.green(v1):v===1?T.default.red(X0):T.default.red(U0);process.stdout.write(O$.cursor.move(-999,0)),process.stdout.write(O$.erase.down(1)),process.stdout.write(`${w} ${I}
|
|
305
|
+
`),H()},x=(q="")=>{I=q??I},G=(q)=>{let v=q>1?"Something went wrong":"Canceled";R&&Y(v,q)};return process.on("uncaughtExceptionMonitor",()=>G(2)),process.on("unhandledRejection",()=>G(2)),process.on("SIGINT",()=>G(1)),process.on("SIGTERM",()=>G(1)),process.on("exit",G),{start:O,stop:Y,message:x}};import{join as Q1}from"path";B();var y$=null,j$={cn:{npm:"https://registry.npmmirror.com",bunBinary:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bunBinary:null}};async function H$(){if(y$)return y$;let $=[Z2,J2,z2];for(let S of $)try{let H=await Promise.race([S(),new Promise((E,R)=>setTimeout(()=>R(Error("timeout")),3000))]);if(H)return y$=H,H}catch{}return y$="cn","cn"}async function Z2(){try{let $=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function J2(){try{let $=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country==="CN"?"cn":"global"}catch{return null}}async function z2(){try{let $=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!$.ok)return null;return(await $.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function W2(){let $=await H$();return j$[$]}async function r(){return(await W2()).npm}function B0(){return"curl -fsSL https://bun.sh/install | bash"}async function X2(){let $=j$.cn.bunBinary,S=await fetch(`${$}/`,{signal:AbortSignal.timeout(1e4)});if(!S.ok)throw Error(`Failed to fetch bun versions: ${S.status}`);let E=(await S.json()).map((R)=>R.name.replace(/\/$/,"")).filter((R)=>/^bun-v\d+\.\d+\.\d+$/.test(R)).sort((R,I)=>{let O=R.replace("bun-v","").split(".").map(Number),Y=I.replace("bun-v","").split(".").map(Number);for(let x=0;x<3;x++)if(O[x]!==Y[x])return Y[x]-O[x];return 0});if(E.length===0)throw Error("No bun versions found on mirror");return E[0]}async function C0(){let $=j$.cn.bunBinary,S=await X2(),E={darwin:"darwin",win32:"windows",linux:"linux"}[process.platform]||"linux",R=process.arch==="arm64"?"aarch64":"x64",I=`bun-${E}-${R}`;return`${$}/${S}/${I}.zip`}async function K0(){let $=await H$(),S=j$[$];if($==="cn")N.info(b("region.usingChinaMirror")),N.message(` npm: ${S.npm}`);else N.info(b("region.usingGlobalMirror"))}var U2=class{constructor($){this.baseUrl=$.baseUrl,this.headers={"Content-Type":"application/json",...$.defaultHeaders},this.maxRetries=$.maxRetries??3,this.initialRetryDelay=$.initialRetryDelay??500}async resolveHeaders(){let $={};for(let[S,H]of Object.entries(this.headers)){let E=await H;E!==null&&($[S]=E)}return $}addHeader($,S){this.headers[$]=S}async post($,S,H,E){try{let R=await fetch($,{method:"POST",headers:await this.resolveHeaders(),body:S?JSON.stringify(S??{}):void 0,keepalive:!0,...H});if(R.status===401)return null;if(R.status!==200&&R.status!==202)throw Error(`HTTP error! status: ${R.status}`);let I=await R.text();return I?JSON.parse(I):null}catch(R){if(E<this.maxRetries){let I=this.initialRetryDelay*2**E;return await new Promise((O)=>setTimeout(O,I)),this.post($,S,H,E+1)}return console.error("Max retries reached:",R),null}}async fetch($,S,H={}){let E=`${this.baseUrl}${$}`;return this.post(E,S,H,0)}},f0=class{constructor($){this.options=$,this.queue=[];let S={"openpanel-client-id":$.clientId};$.clientSecret&&(S["openpanel-client-secret"]=$.clientSecret),S["openpanel-sdk-name"]=$.sdk||"node",S["openpanel-sdk-version"]=$.sdkVersion||"1.0.4",this.api=new U2({baseUrl:$.apiUrl||"https://api.openpanel.dev",defaultHeaders:S})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send($){return this.options.disabled||this.options.filter&&!this.options.filter($)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push($),Promise.resolve()):this.api.fetch("/track",$)}setGlobalProperties($){this.global={...this.global,...$}}async track($,S){return this.log("track event",$,S),this.send({type:"track",payload:{name:$,profileId:S?.profileId??this.profileId,properties:{...this.global??{},...S??{}}}})}async identify($){if(this.log("identify user",$),$.profileId&&(this.profileId=$.profileId,this.flush()),Object.keys($).length>1)return this.send({type:"identify",payload:{...$,properties:{...this.global,...$.properties}}})}async alias($){}async increment($){return this.send({type:"increment",payload:$})}async decrement($){return this.send({type:"decrement",payload:$})}async revenue($,S){let H=S?.deviceId;return delete S?.deviceId,this.track("revenue",{...S??{},...H?{__deviceId:H}:{},__revenue:$})}async fetchDeviceId(){return(await this.api.fetch("/track/device-id",void 0,{method:"GET",keepalive:!1}))?.deviceId??""}clear(){this.profileId=void 0}flush(){this.queue.forEach(($)=>{this.send({...$,payload:{...$.payload,profileId:$.payload.profileId??this.profileId}})}),this.queue=[]}log(...$){this.options.debug&&console.log("[OpenPanel.dev]",...$)}};var h2="f8ec91ab-20e5-4c17-bece-f5f2fe647a71",A2="sec_3038f0cb74f91312f374",V2="https://op.shiroha.tech/api",q$=null;function w1(){if(!q$)q$=new f0({clientId:h2,clientSecret:A2,apiUrl:V2});return q$}async function m0(){if(q$)try{q$=null}catch{}}B();B();var B2="0.2.11";function y0(){return{cli_version:B2,platform:process.platform,arch:process.arch,locale:a(),node_version:process.version}}function j0($){return Bun.hash($).toString(16).slice(0,8)}var C2="0.2.11",_0=!1,T$=null;async function P0(){if(T$!==null)return T$;try{return T$=(await X()).telemetryEnabled!==!1,T$}catch{return T$=!1,!1}}async function K2(){try{return(await X()).apiId||"anonymous"}catch{return"anonymous"}}async function _$(){if(_0)return;try{if(!await P0())return;let $=await X();if(!$.apiId)return;let S=w1(),H=await H$();await S.identify({profileId:$.apiId,properties:{region:H,locale:a(),first_seen_version:C2,platform:process.platform,arch:process.arch}}),_0=!0}catch{}}function W($,S){f2($,S).catch(()=>{})}async function f2($,S){try{if(!await P0())return;let H=w1(),E=await K2();await H.track($,{profileId:E,properties:{...y0(),...S}})}catch{}}async function v$(){await m0()}var n=null;function m2($){return $.startsWith(p)}async function y2(){try{if(!await Bun.file(A).exists())return null;let S=Bun.spawn([A,"--version"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode!==0)return null;return(await new Response(S.stdout).text()).trim()}catch{return null}}async function F0(){return await y2()!==null}async function j2(){if(process.platform==="win32")return!0;try{let S=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await S.exited,S.exitCode===0)return!0}catch{}N.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let $=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let S of $)try{let H=Bun.spawn(["bash","-c",`sudo ${S} 2>/dev/null || ${S}`],{stdout:"pipe",stderr:"pipe"});if(await H.exited,H.exitCode===0)return!0}catch{}return!1}async function _2($){let S=await import("fs/promises"),{join:H}=await import("path"),E=process.platform==="win32",R=E?"bun.exe":"bun",I=await C0();N.info(`\u4ECE npmmirror \u4E0B\u8F7D: ${I}`);let O=await fetch(I);if(!O.ok)throw Error(`\u4E0B\u8F7D\u5931\u8D25: ${O.status}`);let Y=H($,"bun-download.zip");await Bun.write(Y,O);let x=H($,"bin");if(await S.mkdir(x,{recursive:!0}),E){let q=`Expand-Archive -Path "${Y}" -DestinationPath "${$}" -Force`,v=Bun.spawn(["powershell","-Command",q],{stdout:"pipe",stderr:"pipe"});if(await v.exited,v.exitCode!==0)throw Error("\u89E3\u538B\u5931\u8D25")}else{let q=Bun.spawn(["unzip","-oq",Y,"-d",$],{stdout:"pipe",stderr:"pipe"});if(await q.exited,q.exitCode!==0)throw Error("\u89E3\u538B\u5931\u8D25")}let G=await S.readdir($);for(let q of G){let v=H($,q);if((await S.stat(v)).isDirectory()&&q.startsWith("bun-")){let K=H(v,R);try{if(await S.access(K),await S.rename(K,H(x,R)),!E)await S.chmod(H(x,R),493);await S.rm(v,{recursive:!0,force:!0});break}catch{}}}return await S.rm(Y,{force:!0}),!0}async function P2(){let $=F();if(!await j2())return N.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await K0(),$.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{if(await(await import("fs/promises")).mkdir(p,{recursive:!0}),await H$()==="cn")await _2(p);else if(process.platform==="win32"){let E=`$env:BUN_INSTALL="${p}"; irm bun.sh/install.ps1 | iex`;if(await Bun.spawn(["powershell","-Command",E],{stdout:"inherit",stderr:"inherit"}).exited!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}else{let E=`BUN_INSTALL="${p}" ${B0()}`;if(await Bun.spawn(["bash","-c",E],{stdout:"inherit",stderr:"inherit"}).exited!==0)return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}return n=A,$.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),N.info(`\u5B89\u88C5\u4F4D\u7F6E: ${p}`),!0}catch(S){return $.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function k2(){if(await F0())return n=A,!0;return N.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),N.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await P2()}async function Z1(){if(n){if(!m2(n))n=A;return n}if(await F0())return n=A,A;return A}async function g0($){try{let S=await r(),H=await fetch(`${S}/${$}/latest`);if(!H.ok)return null;return(await H.json()).version}catch{return null}}async function F2($){return(await X()).installedClients[$.id]?.version||null}async function u0($){let S=I$($.id),H=Q1(S,"package.json");try{return await Bun.file(H).exists()}catch{return!1}}async function c0($){let S=await F2($);if(!S)return!0;let H=await g0($.package);if(!H)return!1;return S!==H}async function k0($,S=!1){let H=F(),E=I$($.id);try{if(!await k2())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let R=await u0($),I=S||await c0($);if(R&&!I)return{success:!0};let O=R?"\u66F4\u65B0":"\u5B89\u88C5";H.start(`\u6B63\u5728${O} ${$.name}...`);let Y=await import("fs/promises");await Y.mkdir(E,{recursive:!0});let x=Q1(E,"package.json");if(!await Bun.file(x).exists())await Bun.write(x,JSON.stringify({name:`tako-${$.id}`,private:!0,dependencies:{}},null,2));let q=await Z1(),v=await r();if(R){let t=Q1(E,"bun.lock");try{await Y.unlink(t)}catch{}}let w=Bun.spawn([q,"add",`${$.package}@latest`],{cwd:E,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:v}});if(await w.exited!==0){let t=await new Response(w.stderr).text();return H.stop(`${O} ${$.name} \u5931\u8D25`),{success:!1,error:t}}let y=await g0($.package),f1=(await X()).installedClients[$.id]?.version;if(y){let t=await X();if(t.installedClients[$.id]={version:y,installedAt:new Date().toISOString()},await w$(t),R&&f1)W("client_updated",{client_id:$.id,from_version:f1,to_version:y});else W("client_installed",{client_id:$.id,client_version:y})}return H.stop(`${$.name} ${O}\u5B8C\u6210`),{success:!0}}catch(R){return H.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:R instanceof Error?R.message:"\u672A\u77E5\u9519\u8BEF"}}}async function P$($){if(!await u0($))return await k0($);if(await c0($))return await k0($,!0);return{success:!0}}import{homedir as g2}from"os";var u2=50,J1=3;async function M$($){try{return(await(await import("fs/promises")).stat($)).isDirectory()}catch{return!1}}async function k$($,S){let H=await X(),E=H.recentProjects||[],R=new Date().toISOString(),I=E.findIndex((Y)=>Y.path===$);if(I>=0){let Y=E[I],x=Y.clientUsage||{},G=x[S]||{count:0,lastAt:R};E[I]={...Y,launchCount:Y.launchCount+1,lastLaunchedAt:R,lastClientId:S,clientUsage:{...x,[S]:{count:G.count+1,lastAt:R}}}}else E.push({path:$,launchCount:1,lastLaunchedAt:R,lastClientId:S,clientUsage:{[S]:{count:1,lastAt:R}}});let O=E.sort((Y,x)=>new Date(x.lastLaunchedAt).getTime()-new Date(Y.lastLaunchedAt).getTime()).slice(0,u2);H.recentProjects=O,await p$(H)}function c2($,S){let H=$.clientUsage?.[S];if(H)return new Date(H.lastAt).getTime();if($.lastClientId===S)return new Date($.lastLaunchedAt).getTime();return 0}async function d0($,S=J1,H=!0){let R=(await X()).recentProjects||[],I=process.cwd(),Y=R.filter((G)=>{if(H&&G.path===I)return!1;return G.clientUsage?.[$]||G.lastClientId===$}).map((G)=>({...G,lastUsedTime:c2(G,$)})).sort((G,q)=>q.lastUsedTime-G.lastUsedTime),x=[];for(let{lastUsedTime:G,...q}of Y){if(x.length>=S)break;if(await M$(q.path))x.push(q)}return x}async function l0(){let S=(await X()).recentProjects||[],H=process.cwd();return S.find((R)=>R.path===H)?.lastClientId||null}function o0($,S=25){let H=g2(),E=$.startsWith(H)?"~"+$.slice(H.length):$;if(E.length>S){let I=E.split("/").pop()||"";if(I.length>S-4)E="..."+I.slice(-S+3);else E=`.../${I}`}return E}function p0($){let{t:S}=(B(),IS(V0)),H=Date.now(),E=new Date($).getTime(),R=H-E,I=Math.floor(R/60000),O=Math.floor(R/3600000),Y=Math.floor(R/86400000),x=Math.floor(Y/7),G=Math.floor(Y/30);if(I<1)return S("time.justNow");if(I<60)return S("time.minutesAgo",{n:I});if(O<24)return S("time.hoursAgo",{n:O});if(Y===1)return S("time.yesterday");if(Y<7)return S("time.daysAgo",{n:Y});if(Y<30)return S("time.weeksAgo",{n:x});return S("time.monthsAgo",{n:G})}B();async function i0($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await M$(S.projectPath))return{success:!1,error:`\u76EE\u5F55\u4E0D\u5B58\u5728: ${S.projectPath}`}}let E=await P$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if($.setupConfigFiles)await $.setupConfigFiles(R);let I=await d1($);if(!I)I=l1($);if(!await Bun.file(I).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${I}`};await k$(H,$.id);let Y=$.getEnvVars(R),x={...process.env,...Y};N.info(`\u542F\u52A8 ${$.name}...`);let G;if($.runtime==="native")G=[I];else G=[await Z1(),I];if(S?.args&&S.args.length>0)G=[...G,...S.args];return await Bun.spawn(G,{env:x,stdio:["inherit","inherit","inherit"],cwd:H}).exited,{success:!0}}catch(H){return{success:!1,error:H instanceof Error?H.message:"\u542F\u52A8\u5931\u8D25"}}}async function E$($,S){try{let H=S?.projectPath||process.cwd();if(S?.projectPath){if(!await M$(S.projectPath))return{success:!1,error:b("launcher.directoryNotFound",{path:S.projectPath})}}let E=await P$($);if(!E.success)return E;let R=await Q$();if(!R)return{success:!1,error:b("launcher.apiKeyNotConfigured")};if($.setupConfigFiles)await $.setupConfigFiles(R);await k$(H,$.id);let O=(await X()).installedClients[$.id]?.version;return W("client_launched",{client_id:$.id,client_version:O,project_hash:j0(H),is_recent_project:!!S?.projectPath}),N.info(b("launcher.starting",{client:$.name})),await i0($,S)}catch(H){return{success:!1,error:H instanceof Error?H.message:"Launch failed"}}}B();import{join as g}from"path";var z1="tako-cli",s="0.2.11";function d2($,S){let H=$.split(".").map(Number),E=S.split(".").map(Number);for(let R=0;R<3;R++){let I=H[R]||0,O=E[R]||0;if(I>O)return 1;if(I<O)return-1}return 0}async function l2(){try{let $=await r(),S=await fetch(`${$}/${z1}/latest`,{signal:AbortSignal.timeout(5000)});if(!S.ok)return null;return(await S.json()).version||null}catch{return null}}async function o2(){let $=await l2();if(!$)return{hasUpdate:!1,currentVersion:s};return{hasUpdate:d2($,s)>0,latestVersion:$,currentVersion:s}}async function D0(){let $=await import("fs/promises"),S=g(P,"bin"),H=g(S,"tako"),E=g(k,"node_modules/tako-cli/dist/index.js");if(await $.mkdir(S,{recursive:!0}),process.platform==="win32"){let I=`@echo off\r
|
|
306
306
|
"${A}" "${E}" %*\r
|
|
307
|
-
`;await $.writeFile(
|
|
307
|
+
`;await $.writeFile(g(S,"tako.cmd"),I)}else{let I=`#!/bin/bash
|
|
308
308
|
exec "${A}" "${E}" "$@"
|
|
309
|
-
`;await $.writeFile(H,I,{mode:493})}}async function
|
|
310
|
-
`)}async function A1(){let S=
|
|
311
|
-
`).length;process.stdout.write(`\x1B[${Y}A\x1B[0J`)}R=n2(H.data,E),console.log(R)};I();let O=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((Y)=>{let b=!0,G=()=>{if(!b)return;b=!1,q(),Y()},T=setInterval(async()=>{if(!b)return;if(E--,E<=0){E=10;let Q=await N$();if(Q.success)H=Q}I()},1000),q=()=>{if(clearInterval(T),process.stdin.removeListener("data",G),process.stdin.isTTY)process.stdin.setRawMode(O??!1);process.stdin.pause()};process.stdin.on("data",G)})}function s2(){let S="\u2500".repeat(50);console.log(),console.log(` \u250C${S}\u2510`);let H=`\uD83D\uDC19 ${M("cli.version",{version:e})}`,E=J1(H),R=Math.floor((50-E)/2),I=50-R-E;console.log(` \u2502${" ".repeat(R)}${H}${" ".repeat(I)}\u2502`);let O=M("banner.welcome"),Y=`\x1B[90m${O}\x1B[0m`,b=J1(O),G=Math.floor((50-b)/2),T=50-G-b;console.log(` \u2502${" ".repeat(G)}${Y}${" ".repeat(T)}\u2502`),console.log(` \u2514${S}\u2518`),console.log()}async function r0($){switch($.type){case"launch":{J("menu_action",{action:"launch",client_id:$.client.id});let S=await E$($.client);if(!S.success)N.error(S.error||M("cli.launchFailed"));return!0}case"launch-in-project":{J("menu_action",{action:"launch",client_id:$.client.id});let S=$.client.continueArg?[$.client.continueArg]:[],H=await E$($.client,{projectPath:$.projectPath,args:S});if(!H.success)N.error(H.error||M("cli.launchFailed"));return!0}case"advanced":{J("menu_action",{action:"advanced"});let S=await U1();if(S)return await r0(S);return!0}case"stats":return J("menu_action",{action:"stats"}),await A1(),!0;case"config":return J("menu_action",{action:"config"}),await F$(!0),!0;case"language":return J("menu_action",{action:"language"}),await e2(),!0;case"exit":return J("menu_action",{action:"exit"}),!1}}async function e2(){let $=N1(),S=M(`language.${$}`),H=await M$({message:M("menu.changeLanguage")+` (${M("menu.currentLanguage",{lang:S})})`,options:[{value:"en",label:M("language.en")},{value:"zh",label:M("language.zh")}]});if(d(H))return;v1(H);let E=M(`language.${H}`);N.success(M("menu.languageChanged",{lang:E}))}async function n0(){if(s2(),!await u1()){if(!await F$()){q1("\u518D\u89C1\uFF01");return}}while(!0){let S=await X1();if(S===null)break;if(!await r0(S))break}q1("\u518D\u89C1\uFF01")}V();import{homedir as $O}from"os";var Z={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"};var L={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",reset:"\x1B[0m"};var w={directory:{icon:Z.brightYellow,text:Z.brightGreen},git:{icon:Z.brightBlue,text:Z.brightBlue,clean:Z.brightGreen,dirty:Z.brightYellow,conflict:Z.brightRed},model:{icon:Z.brightCyan,text:Z.brightCyan},version:{icon:Z.brightWhite,text:Z.brightBlack},outputStyle:{icon:Z.brightMagenta,text:Z.brightMagenta},context:{icon:Z.brightMagenta,low:Z.brightGreen,medium:Z.brightYellow,high:Z.brightRed},todayUsage:{icon:Z.brightGreen,text:Z.brightGreen},separator:Z.brightBlack},l={directory:{nerd:"\uF07B",plain:"\uD83D\uDCC1"},git:{nerd:"\uE725",plain:"\uD83C\uDF3F"},model:{nerd:"\uF11B",plain:"\uD83E\uDD16"},version:{nerd:"\uF412",plain:"\uD83D\uDCBE"},outputStyle:{nerd:"\uF12F5",plain:"\uD83C\uDFAF"},context:{nerd:"\uF0E7",plain:"\u26A1"},todayUsage:{nerd:"\uF155",plain:"\uD83D\uDCB0"},gitClean:"\u2713",gitDirty:"\u25CF",gitConflict:"\u26A0",gitAhead:"\u2191",gitBehind:"\u2193"};function t2(){return!1}function f($){let S=l[$];if(typeof S==="string")return S;return t2()?S.nerd:S.plain}class g${id="directory";render($){let S=this.formatPath($.workspace.current_dir),H=f("directory");return`${w.directory.icon}${H}${L.reset} ${w.directory.text}${S}${L.reset}`}formatPath($){let S=$O();if($===S)return"~";if($.startsWith(S+"/"))return"~"+$.slice(S.length);return $}}class u${id="git";async render($){let S=$.workspace.current_dir;if(!await this.isGitRepository(S))return null;let E=await this.getBranch(S);if(!E)return null;let{status:R,statusColor:I}=await this.getStatus(S),{ahead:O,behind:Y}=await this.getAheadBehind(S),b=f("git"),G=`${w.git.icon}${b}${L.reset} ${w.git.text}${E}${L.reset}`;if(G+=` ${I}${R}${L.reset}`,O>0)G+=` ${w.git.clean}${l.gitAhead}${O}${L.reset}`;if(Y>0)G+=` ${w.git.dirty}${l.gitBehind}${Y}${L.reset}`;return G}async isGitRepository($){try{return await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:$,stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async getBranch($){try{let S=Bun.spawn(["git","branch","--show-current"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited===0&&H.trim())return H.trim();let R=Bun.spawn(["git","rev-parse","--short","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),I=await new Response(R.stdout).text();if(await R.exited===0&&I.trim())return`detached:${I.trim()}`;return null}catch{return null}}async getStatus($){try{let S=Bun.spawn(["git","status","--porcelain"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited!==0)return{status:l.gitClean,statusColor:w.git.clean};let R=H.trim();if(!R)return{status:l.gitClean,statusColor:w.git.clean};if(R.includes("UU")||R.includes("AA")||R.includes("DD"))return{status:l.gitConflict,statusColor:w.git.conflict};return{status:l.gitDirty,statusColor:w.git.dirty}}catch{return{status:l.gitClean,statusColor:w.git.clean}}}async getAheadBehind($){try{let S=Bun.spawn(["git","rev-list","--count","@{u}..HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text(),R=await S.exited===0?parseInt(H.trim(),10)||0:0,I=Bun.spawn(["git","rev-list","--count","HEAD..@{u}"],{cwd:$,stdout:"pipe",stderr:"pipe"}),O=await new Response(I.stdout).text(),b=await I.exited===0?parseInt(O.trim(),10)||0:0;return{ahead:R,behind:b}}catch{return{ahead:0,behind:0}}}}var SO={"claude-opus-4-5-20251101":"Opus 4.5","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-20250514":"Sonnet 4.5","claude-sonnet-4-5":"Sonnet 4.5","claude-sonnet-4-20250514":"Sonnet 4","claude-sonnet-4":"Sonnet 4","claude-sonnet-3-5-20241022":"Sonnet 3.5","claude-3-5-sonnet-20241022":"Sonnet 3.5","claude-3-5-sonnet":"Sonnet 3.5","claude-haiku-3-5-20241022":"Haiku 3.5","claude-3-5-haiku-20241022":"Haiku 3.5","claude-3-5-haiku":"Haiku 3.5"};class c${id="model";render($){let S=$.model.id,H=SO[S]||this.simplifyModelName($.model.display_name),E=f("model");return`${w.model.icon}${E}${L.reset} ${w.model.text}${H}${L.reset}`}simplifyModelName($){let S=$.replace(/^Claude\s+/i,"");return S=S.replace(/-\d{8}$/,""),S}}import{homedir as OO}from"os";import{join as y}from"path";var{Glob:HO}=globalThis.Bun;var s0=process.platform==="win32";class d${id="version";async render($){let S=await this.getClaudeCodeVersion();if(!S)return null;let H=f("version");return`${w.version.icon}${H}${L.reset} ${w.version.text}v${S}${L.reset}`}async getClaudeCodeVersion(){let $=OO(),S=[];if(s0)S.push(y($,"AppData","Roaming","npm","node_modules","@anthropic-ai","claude-code","package.json"),y($,"AppData","Local","npm-cache","_npx","**","node_modules","@anthropic-ai","claude-code","package.json"),y($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"));else S.push(y($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"),y($,".npm-global","lib","node_modules","@anthropic-ai","claude-code","package.json"),"/usr/local/lib/node_modules/@anthropic-ai/claude-code/package.json","/usr/lib/node_modules/@anthropic-ai/claude-code/package.json");for(let E of S){let R=await this.readVersionFromPackage(E);if(R)return R}let H=[];if(s0)H.push({base:y($,"AppData","Roaming","nvm"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"});else H.push({base:y($,".local","share","fnm","node-versions"),pattern:"*/installation/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".nvm","versions","node"),pattern:"*/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:y($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"},{base:y($,".local","share","pnpm","global"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"});for(let{base:E,pattern:R}of H)try{let I=new HO(R);for await(let O of I.scan({cwd:E,absolute:!0})){let Y=await this.readVersionFromPackage(O);if(Y)return Y}}catch{continue}return null}async readVersionFromPackage($){try{let S=Bun.file($);if(!await S.exists())return null;return(await S.json()).version||null}catch{return null}}}var EO={"claude-opus-4-5-20251101":200000,"claude-opus-4-5":200000,"claude-sonnet-4-5-20250514":200000,"claude-sonnet-4-5":200000,"claude-sonnet-4-20250514":200000,"claude-sonnet-4":200000,"claude-sonnet-3-5-20241022":200000,"claude-3-5-sonnet-20241022":200000,"claude-3-5-sonnet":200000,"claude-haiku-3-5-20241022":200000,"claude-3-5-haiku-20241022":200000,"claude-3-5-haiku":200000},RO=200000;class g{id="context";static cache=null;static CACHE_TTL=5000;async render($){let S=await this.getTokensWithCache($.transcript_path),H=this.getContextLimit($.model.id),R=Math.round((S??0)/H*100),I=Math.max(0,100-R),O=f("context"),Y=this.getRemainingColor(I),b=this.renderProgressBar(I);return`${w.context.icon}${O}${L.reset} ${Y}Context Remaining: ${I}%${L.reset} ${b}`}renderProgressBar($){let H=Math.round($/100*10),E=10-H,R="=".repeat(H),I="-".repeat(E),O=this.getRemainingColor($);return`${Z.brightBlack}[${L.reset}${O}${R}${L.reset}${Z.brightBlack}${I}]${L.reset}`}getRemainingColor($){if($<=20)return w.context.high;if($<=50)return w.context.medium;return w.context.low}async getTokensWithCache($){let S=Date.now();if(g.cache&&g.cache.path===$&&S-g.cache.timestamp<g.CACHE_TTL)return g.cache.tokens;let H=await this.parseTranscriptTokens($);return g.cache={path:$,tokens:H,timestamp:S},H}async parseTranscriptTokens($){try{let S=Bun.file($);if(!await S.exists())return null;let H=await S.text();if(!H.trim())return null;let E=H.split(`
|
|
312
|
-
`).filter((R)=>R.trim());for(let R=E.length-1;R>=0;R--)try{let I=JSON.parse(E[R]);if(I.type==="assistant"&&I.message?.usage){let O=I.message.usage;return(O.input_tokens||0)+(O.output_tokens||0)+(O.cache_creation_input_tokens||0)+(O.cache_read_input_tokens||0)}}catch{continue}return null}catch{return null}}getContextLimit($){return
|
|
313
|
-
`)}renderLine($,S){let H=[];for(let E of S){let R=$.get(E);if(R)H.push(R)}return H.join(this.separator)}}import{join as
|
|
314
|
-
${
|
|
309
|
+
`;await $.writeFile(H,I,{mode:493})}}async function p2($){let S=F();S.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${$}...`);try{let H=await r(),E=await import("fs/promises");await E.mkdir(k,{recursive:!0});let R=g(k,"package.json");try{await E.access(R)}catch{await E.writeFile(R,JSON.stringify({name:"tako-local",private:!0},null,2))}let I=Bun.spawn([A,"update",z1,"--latest"],{cwd:k,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:H}});if(await I.exited,I.exitCode===0)return await D0(),W("cli_updated",{from_version:s,to_version:$}),S.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${$}`),!0;else{let O=await new Response(I.stderr).text();return S.stop(`\u66F4\u65B0\u5931\u8D25: ${O||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(H){return S.stop(`\u66F4\u65B0\u5931\u8D25: ${H instanceof Error?H.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function i2(){let $=await import("fs/promises"),S=g(k,"bun.lock");try{await $.unlink(S)}catch{}}async function D2(){let $=await import("fs/promises");try{let S=await r();await $.mkdir(k,{recursive:!0});let H=g(k,"package.json");try{await $.access(H)}catch{await $.writeFile(H,JSON.stringify({name:"tako-local",private:!0},null,2))}await i2();let E=Bun.spawn([A,"add",`${z1}@latest`],{cwd:k,stdout:"pipe",stderr:"pipe",env:{...process.env,BUN_CONFIG_REGISTRY:S}});return await E.exited,E.exitCode===0}catch{return!1}}async function a2(){let $=await import("fs/promises"),S=g(P,"bin"),H=g(S,"tako"),E=g(k,"node_modules/tako-cli/dist/index.js");try{let R=await $.readFile(H,"utf-8");if(R.includes("bun run tako-cli")||R.includes("run tako-cli")){N.info(b("updater.migrating"));let I=!1;try{await $.access(E),I=!0}catch{I=!1}if(!I){let O=F();if(O.start(b("updater.installingLocally")),!await D2())return O.stop(b("updater.migrationFailed")),!1;O.stop(b("updater.installComplete"))}return await D0(),!0}}catch{}return!1}async function F$(){try{if(await a2())N.info(b("updater.migrationComplete")),process.exit(0);let S=await o2();if(S.hasUpdate&&S.latestVersion){if(N.warn(b("updater.newVersionAvailable",{version:S.latestVersion,current:s})),await p2(S.latestVersion))N.info(b("updater.pleaseRestart")),process.exit(0)}}catch{}}B();function r2($){let S=$.codePointAt(0);if(!S)return!1;return S>=19968&&S<=40959||S>=13312&&S<=19903||S>=131072&&S<=191471||S>=63744&&S<=64255||S>=194560&&S<=195103||S>=44032&&S<=55215||S>=12352&&S<=12447||S>=12448&&S<=12543||S>=65280&&S<=65519||S>=126976&&S<=131071||S>=9728&&S<=10175||S===11088}function n2($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function W1($){let S=n2($),H=0;for(let E of S)H+=r2(E)?2:1;return H}B();async function a0(){let $=o1(),S=await l0(),H=process.cwd(),E=[],R=[...$].sort((I,O)=>{if(I.id===S)return-1;if(O.id===S)return 1;return 0});for(let I of R){let O=await d0(I.id,J1,!0);E.push({value:{type:"launch",client:I},label:I.name,hint:b("recentProjects.launchInCurrent")});for(let Y of O)E.push({value:{type:"launch-in-project",client:I,projectPath:Y.path},label:` \u2514\u2500 ${o0(Y.path,35)}`,hint:p0(Y.lastLaunchedAt)})}return E.push({value:{type:"advanced"},label:b("menu.advanced"),hint:b("menu.advancedHint")},{value:{type:"exit"},label:b("menu.exit")}),E}async function X1(){let $=await a0(),S=await b$({message:b("menu.selectAction"),options:$});if(d(S))return null;return S}async function U1(){let $=await b$({message:b("menu.advancedOptions"),options:[{value:{type:"stats"},label:b("menu.viewStats")},{value:{type:"config"},label:b("menu.configApiKey")},{value:{type:"language"},label:b("menu.changeLanguage")},{value:null,label:b("menu.back")}]});if(d($)||$===null)return null;return $}B();function s2($){return $.startsWith("cr_")&&$.length>10}async function e2($){try{let H=await(await fetch(`${c}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:$})})).json();if(H.success&&H.data?.id)return{valid:!0,apiId:H.data.id};return{valid:!1,error:H.error||b("auth.validationFailed")}}catch(S){return{valid:!1,error:S instanceof Error?S.message:b("auth.networkError")}}}async function r0($){if(!s2($))return W("api_key_validated",{success:!1,error_type:"invalid_format"}),{success:!1,error:b("auth.invalidFormat")};let S=await e2($);if(!S.valid)return W("api_key_validated",{success:!1,error_type:"api_validation_failed"}),{success:!1,error:S.error};return await w$({apiKey:$,apiId:S.apiId}),W("api_key_validated",{success:!0}),_$(),{success:!0}}B();async function g$($=!1){if(!$)N.warn("API Key not detected"),console.log();let S=await A0({message:b("prompts.enterApiKey"),placeholder:b("prompts.apiKeyPlaceholder"),validate(R){if(!R)return b("prompts.enterApiKey");if(!R.startsWith("cr_"))return b("prompts.keyInvalidFormat");if(R.length<10)return b("prompts.keyInvalidFormat")}});if(d(S))return!1;let H=F();H.start(b("prompts.validating"));let E=await r0(S);if(E.success)return H.stop(b("prompts.keyConfigured")),!0;else return H.stop(b("prompts.keyValidationFailed",{error:E.error||""})),!1}async function N$(){try{let $=await c1();if(!$)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let H=await(await fetch(`${c}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$})})).json(),R=await(await fetch(`${c}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:$,period:"daily"})})).json();if(!H.success)return{success:!1,error:H.error||H.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let I=(R.data||[]).map((O)=>({model:O.model,requests:O.requests,cost:O.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:H.data?.usage?.total?.requests||0,totalCost:H.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(H.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:I}}}catch($){return{success:!1,error:$ instanceof Error?$.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function h1($){return $.toLocaleString("en-US")}B();function t2($,S){let H=[];if(H.push(""),H.push(` ${b("stats.title")}`),H.push(""),H.push(` ${b("stats.totalRequests",{count:h1($.totalRequests)})}`),H.push(` ${b("stats.totalCost",{cost:$.totalCost})}`),H.push(` ${b("stats.todayCost",{cost:$.todayCost})}`),$.modelStats.length>0)H.push(""),H.push(` ${b("stats.modelDistribution")}`),$.modelStats.forEach((E,R)=>{let I=R===$.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",O=E.model.length>25?E.model.slice(0,22)+"...":E.model;H.push(` ${I} ${O.padEnd(25)} ${h1(E.requests).padStart(6)} ${b("stats.times")} ${E.cost.padStart(8)}`)});return H.push(""),H.push(` \x1B[90m${b("stats.refreshHint",{countdown:S})}\x1B[0m`),H.join(`
|
|
310
|
+
`)}async function A1(){let S=F();S.start(b("stats.fetching"));let H=await N$();if(!H.success){S.stop(b("stats.fetchFailed",{error:H.error||""}));return}S.stop("");let E=10,R="",I=()=>{if(R){let Y=R.split(`
|
|
311
|
+
`).length;process.stdout.write(`\x1B[${Y}A\x1B[0J`)}R=t2(H.data,E),console.log(R)};I();let O=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((Y)=>{let x=!0,G=()=>{if(!x)return;x=!1,v(),Y()},q=setInterval(async()=>{if(!x)return;if(E--,E<=0){E=10;let w=await N$();if(w.success)H=w}I()},1000),v=()=>{if(clearInterval(q),process.stdin.removeListener("data",G),process.stdin.isTTY)process.stdin.setRawMode(O??!1);process.stdin.pause()};process.stdin.on("data",G)})}function $O(){let S="\u2500".repeat(50);console.log(),console.log(` \u250C${S}\u2510`);let H=`\uD83D\uDC19 ${b("cli.version",{version:s})}`,E=W1(H),R=Math.floor((50-E)/2),I=50-R-E;console.log(` \u2502${" ".repeat(R)}${H}${" ".repeat(I)}\u2502`);let O=b("banner.welcome"),Y=`\x1B[90m${O}\x1B[0m`,x=W1(O),G=Math.floor((50-x)/2),q=50-G-x;console.log(` \u2502${" ".repeat(G)}${Y}${" ".repeat(q)}\u2502`),console.log(` \u2514${S}\u2518`),console.log()}async function n0($){switch($.type){case"launch":{W("menu_action",{action:"launch",client_id:$.client.id});let S=await E$($.client);if(!S.success)N.error(S.error||b("cli.launchFailed"));return!0}case"launch-in-project":{W("menu_action",{action:"launch",client_id:$.client.id});let S=$.client.continueArg?[$.client.continueArg]:[],H=await E$($.client,{projectPath:$.projectPath,args:S});if(!H.success)N.error(H.error||b("cli.launchFailed"));return!0}case"advanced":{W("menu_action",{action:"advanced"});let S=await U1();if(S)return await n0(S);return!0}case"stats":return W("menu_action",{action:"stats"}),await A1(),!0;case"config":return W("menu_action",{action:"config"}),await g$(!0),!0;case"language":return W("menu_action",{action:"language"}),await SO(),!0;case"exit":return W("menu_action",{action:"exit"}),!1}}async function SO(){let $=L1(),S=b(`language.${$}`),H=await b$({message:b("menu.changeLanguage")+` (${b("menu.currentLanguage",{lang:S})})`,options:[{value:"en",label:b("language.en")},{value:"zh",label:b("language.zh")}]});if(d(H))return;N1(H);let E=b(`language.${H}`);N.success(b("menu.languageChanged",{lang:E}))}async function s0(){if($O(),!await u1()){if(!await g$()){M1("\u518D\u89C1\uFF01");return}}while(!0){let S=await X1();if(S===null)break;if(!await n0(S))break}M1("\u518D\u89C1\uFF01")}B();import{homedir as HO}from"os";var J={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"};var Q={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",reset:"\x1B[0m"};var L={directory:{icon:J.brightYellow,text:J.brightGreen},git:{icon:J.brightBlue,text:J.brightBlue,clean:J.brightGreen,dirty:J.brightYellow,conflict:J.brightRed},model:{icon:J.brightCyan,text:J.brightCyan},version:{icon:J.brightWhite,text:J.brightBlack},outputStyle:{icon:J.brightMagenta,text:J.brightMagenta},context:{icon:J.brightMagenta,low:J.brightGreen,medium:J.brightYellow,high:J.brightRed},todayUsage:{icon:J.brightGreen,text:J.brightGreen},separator:J.brightBlack},l={directory:{nerd:"\uF07B",plain:"\uD83D\uDCC1"},git:{nerd:"\uE725",plain:"\uD83C\uDF3F"},model:{nerd:"\uF11B",plain:"\uD83E\uDD16"},version:{nerd:"\uF412",plain:"\uD83D\uDCBE"},outputStyle:{nerd:"\uF12F5",plain:"\uD83C\uDFAF"},context:{nerd:"\uF0E7",plain:"\u26A1"},todayUsage:{nerd:"\uF155",plain:"\uD83D\uDCB0"},gitClean:"\u2713",gitDirty:"\u25CF",gitConflict:"\u26A0",gitAhead:"\u2191",gitBehind:"\u2193"};function OO(){return!1}function C($){let S=l[$];if(typeof S==="string")return S;return OO()?S.nerd:S.plain}class u${id="directory";render($){let S=this.formatPath($.workspace.current_dir),H=C("directory");return`${L.directory.icon}${H}${Q.reset} ${L.directory.text}${S}${Q.reset}`}formatPath($){let S=HO();if($===S)return"~";if($.startsWith(S+"/"))return"~"+$.slice(S.length);return $}}class c${id="git";async render($){let S=$.workspace.current_dir;if(!await this.isGitRepository(S))return null;let E=await this.getBranch(S);if(!E)return null;let{status:R,statusColor:I}=await this.getStatus(S),{ahead:O,behind:Y}=await this.getAheadBehind(S),x=C("git"),G=`${L.git.icon}${x}${Q.reset} ${L.git.text}${E}${Q.reset}`;if(G+=` ${I}${R}${Q.reset}`,O>0)G+=` ${L.git.clean}${l.gitAhead}${O}${Q.reset}`;if(Y>0)G+=` ${L.git.dirty}${l.gitBehind}${Y}${Q.reset}`;return G}async isGitRepository($){try{return await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:$,stdout:"pipe",stderr:"pipe"}).exited===0}catch{return!1}}async getBranch($){try{let S=Bun.spawn(["git","branch","--show-current"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited===0&&H.trim())return H.trim();let R=Bun.spawn(["git","rev-parse","--short","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),I=await new Response(R.stdout).text();if(await R.exited===0&&I.trim())return`detached:${I.trim()}`;return null}catch{return null}}async getStatus($){try{let S=Bun.spawn(["git","status","--porcelain"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text();if(await S.exited!==0)return{status:l.gitClean,statusColor:L.git.clean};let R=H.trim();if(!R)return{status:l.gitClean,statusColor:L.git.clean};if(R.includes("UU")||R.includes("AA")||R.includes("DD"))return{status:l.gitConflict,statusColor:L.git.conflict};return{status:l.gitDirty,statusColor:L.git.dirty}}catch{return{status:l.gitClean,statusColor:L.git.clean}}}async getAheadBehind($){try{let S=Bun.spawn(["git","rev-list","--count","@{u}..HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),H=await new Response(S.stdout).text(),R=await S.exited===0?parseInt(H.trim(),10)||0:0,I=Bun.spawn(["git","rev-list","--count","HEAD..@{u}"],{cwd:$,stdout:"pipe",stderr:"pipe"}),O=await new Response(I.stdout).text(),x=await I.exited===0?parseInt(O.trim(),10)||0:0;return{ahead:R,behind:x}}catch{return{ahead:0,behind:0}}}}var EO={"claude-opus-4-5-20251101":"Opus 4.5","claude-opus-4-5":"Opus 4.5","claude-sonnet-4-5-20250514":"Sonnet 4.5","claude-sonnet-4-5":"Sonnet 4.5","claude-sonnet-4-20250514":"Sonnet 4","claude-sonnet-4":"Sonnet 4","claude-sonnet-3-5-20241022":"Sonnet 3.5","claude-3-5-sonnet-20241022":"Sonnet 3.5","claude-3-5-sonnet":"Sonnet 3.5","claude-haiku-3-5-20241022":"Haiku 3.5","claude-3-5-haiku-20241022":"Haiku 3.5","claude-3-5-haiku":"Haiku 3.5"};class d${id="model";render($){let S=$.model.id,H=EO[S]||this.simplifyModelName($.model.display_name),E=C("model");return`${L.model.icon}${E}${Q.reset} ${L.model.text}${H}${Q.reset}`}simplifyModelName($){let S=$.replace(/^Claude\s+/i,"");return S=S.replace(/-\d{8}$/,""),S}}import{homedir as RO}from"os";import{join as _}from"path";var{Glob:IO}=globalThis.Bun;var e0=process.platform==="win32";class l${id="version";async render($){let S=await this.getClaudeCodeVersion();if(!S)return null;let H=C("version");return`${L.version.icon}${H}${Q.reset} ${L.version.text}v${S}${Q.reset}`}async getClaudeCodeVersion(){let $=RO(),S=[];if(e0)S.push(_($,"AppData","Roaming","npm","node_modules","@anthropic-ai","claude-code","package.json"),_($,"AppData","Local","npm-cache","_npx","**","node_modules","@anthropic-ai","claude-code","package.json"),_($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"));else S.push(_($,".bun","install","global","node_modules","@anthropic-ai","claude-code","package.json"),_($,".npm-global","lib","node_modules","@anthropic-ai","claude-code","package.json"),"/usr/local/lib/node_modules/@anthropic-ai/claude-code/package.json","/usr/lib/node_modules/@anthropic-ai/claude-code/package.json");for(let E of S){let R=await this.readVersionFromPackage(E);if(R)return R}let H=[];if(e0)H.push({base:_($,"AppData","Roaming","nvm"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"},{base:_($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"});else H.push({base:_($,".local","share","fnm","node-versions"),pattern:"*/installation/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:_($,".nvm","versions","node"),pattern:"*/lib/node_modules/@anthropic-ai/claude-code/package.json"},{base:_($,".volta","tools","image","packages","@anthropic-ai","claude-code"),pattern:"*/package.json"},{base:_($,".local","share","pnpm","global"),pattern:"*/node_modules/@anthropic-ai/claude-code/package.json"});for(let{base:E,pattern:R}of H)try{let I=new IO(R);for await(let O of I.scan({cwd:E,absolute:!0})){let Y=await this.readVersionFromPackage(O);if(Y)return Y}}catch{continue}return null}async readVersionFromPackage($){try{let S=Bun.file($);if(!await S.exists())return null;return(await S.json()).version||null}catch{return null}}}var YO={"claude-opus-4-5-20251101":200000,"claude-opus-4-5":200000,"claude-sonnet-4-5-20250514":200000,"claude-sonnet-4-5":200000,"claude-sonnet-4-20250514":200000,"claude-sonnet-4":200000,"claude-sonnet-3-5-20241022":200000,"claude-3-5-sonnet-20241022":200000,"claude-3-5-sonnet":200000,"claude-haiku-3-5-20241022":200000,"claude-3-5-haiku-20241022":200000,"claude-3-5-haiku":200000},GO=200000;class u{id="context";static cache=null;static CACHE_TTL=5000;async render($){let S=await this.getTokensWithCache($.transcript_path),H=this.getContextLimit($.model.id),R=Math.round((S??0)/H*100),I=Math.max(0,100-R),O=C("context"),Y=this.getRemainingColor(I),x=this.renderProgressBar(I);return`${L.context.icon}${O}${Q.reset} ${Y}Context Remaining: ${I}%${Q.reset} ${x}`}renderProgressBar($){let H=Math.round($/100*10),E=10-H,R="=".repeat(H),I="-".repeat(E),O=this.getRemainingColor($);return`${J.brightBlack}[${Q.reset}${O}${R}${Q.reset}${J.brightBlack}${I}]${Q.reset}`}getRemainingColor($){if($<=20)return L.context.high;if($<=50)return L.context.medium;return L.context.low}async getTokensWithCache($){let S=Date.now();if(u.cache&&u.cache.path===$&&S-u.cache.timestamp<u.CACHE_TTL)return u.cache.tokens;let H=await this.parseTranscriptTokens($);return u.cache={path:$,tokens:H,timestamp:S},H}async parseTranscriptTokens($){try{let S=Bun.file($);if(!await S.exists())return null;let H=await S.text();if(!H.trim())return null;let E=H.split(`
|
|
312
|
+
`).filter((R)=>R.trim());for(let R=E.length-1;R>=0;R--)try{let I=JSON.parse(E[R]);if(I.type==="assistant"&&I.message?.usage){let O=I.message.usage;return(O.input_tokens||0)+(O.output_tokens||0)+(O.cache_creation_input_tokens||0)+(O.cache_read_input_tokens||0)}}catch{continue}return null}catch{return null}}getContextLimit($){return YO[$]||GO}}class o{id="today-usage";static cache=null;static CACHE_TTL=30000;async render($){if(o.cache&&Date.now()-o.cache.timestamp<o.CACHE_TTL)return o.cache.data;try{let S=await N$();if(!S.success||!S.data)return null;let H=S.data.todayCost,E=C("todayUsage"),R=`${L.todayUsage.icon}${E}${Q.reset} ${L.todayUsage.text}Today: ${H}${Q.reset}`;return o.cache={data:R,timestamp:Date.now()},R}catch{return null}}}class V1{separator=`${L.separator} \u2502 ${Q.reset}`;render($){let S=["directory","git","model","version","today-usage"],H=["context"],E=this.renderLine($,S),R=this.renderLine($,H);return[E,R].filter((I)=>I.length>0).join(`
|
|
313
|
+
`)}renderLine($,S){let H=[];for(let E of S){let R=$.get(E);if(R)H.push(R)}return H.join(this.separator)}}import{join as e,dirname as xO}from"path";import{homedir as B1}from"os";import{mkdir as bO}from"fs/promises";var t0=e(B1(),".tako"),qO=e(t0,"cli"),TO=e(t0,"bin",process.platform==="win32"?"tako.cmd":"tako");function vO(){if(process.platform==="win32")return e(process.env.APPDATA||e(B1(),"AppData","Roaming"),"claude","settings.json");return e(B1(),".claude","settings.json")}var MO=process.platform==="win32",NO="0.1.48";function LO($,S){let H=$.split(".").map(Number),E=S.split(".").map(Number),R=Math.max(H.length,E.length);for(let I=0;I<R;I++){let O=H[I]||0,Y=E[I]||0;if(O!==Y)return O-Y}return 0}async function wO(){let $=e(qO,"node_modules","tako-cli","package.json");try{let S=Bun.file($);if(!await S.exists())return null;return(await S.json()).version||null}catch{return null}}async function QO(){let $=await wO();if(!$)return!1;return LO($,NO)>=0}function ZO(){return TO}function JO($){if(MO)return $.replace(/\\/g,"/");return $}async function C1(){if(!await QO())return;let S=vO(),H={};try{let O=Bun.file(S);if(await O.exists())H=await O.json()}catch{}let R={type:"command",command:`"${JO(ZO())}" statusline`,padding:0},I=typeof H.statusLine==="object"&&H.statusLine!==null?H.statusLine.command:null;if(typeof I==="string"&&I.includes("tako statusline"))return;H.statusLine=R,await bO(xO(S),{recursive:!0}),await Bun.write(S,JSON.stringify(H,null,2))}var zO=[new u$,new c$,new d$,new l$,new u,new o];async function WO($){let S=await Promise.all(zO.map(async(R)=>{try{let I=await R.render($);return{id:R.id,content:I}}catch{return{id:R.id,content:null}}})),H=new Map;for(let{id:R,content:I}of S)H.set(R,I);return new V1().render(H)}async function $S(){try{let $=await Bun.stdin.json(),S=await WO($);console.log(S)}catch($){process.exit(0)}}var K1="0.2.11";function XO(){console.log(`
|
|
314
|
+
${b("cli.version",{version:K1})}
|
|
315
315
|
|
|
316
|
-
${
|
|
316
|
+
${b("cli.usage")}
|
|
317
317
|
|
|
318
|
-
${
|
|
319
|
-
${
|
|
320
|
-
${
|
|
318
|
+
${b("cli.options")}
|
|
319
|
+
${b("cli.optionVersion")}
|
|
320
|
+
${b("cli.optionHelp")}
|
|
321
321
|
|
|
322
|
-
${
|
|
323
|
-
${
|
|
324
|
-
${
|
|
322
|
+
${b("cli.shortcuts")}
|
|
323
|
+
${b("cli.shortcutClaude")}
|
|
324
|
+
${b("cli.shortcutCodex")}
|
|
325
325
|
|
|
326
|
-
${
|
|
327
|
-
${
|
|
328
|
-
${
|
|
329
|
-
${
|
|
330
|
-
`)}async function
|
|
326
|
+
${b("cli.examples")}
|
|
327
|
+
${b("cli.exampleInteractive")}
|
|
328
|
+
${b("cli.exampleClaude")}
|
|
329
|
+
${b("cli.exampleCodex")}
|
|
330
|
+
`)}async function UO(){let $=process.argv.slice(2);if($[0]==="statusline"){await $S();return}if($.includes("-v")||$.includes("--version")){console.log(`Tako CLI v${K1}`);return}if($.includes("-h")||$.includes("--help")){XO();return}let S=K1==="dev";if(_$(),W("cli_started"),$.includes("--claude")){let H=a$("claude-code");if(!H)console.error(b("cli.clientNotFound",{client:"Claude Code"})),process.exit(1);if(!S)await F$();let E=await E$(H);if(!E.success)console.error(E.error),process.exit(1);return}if($.includes("--codex")){let H=a$("codex");if(!H)console.error(b("cli.clientNotFound",{client:"Codex"})),process.exit(1);if(!S)await F$();let E=await E$(H);if(!E.success)console.error(E.error),process.exit(1);return}if(!S)await F$();C1().catch(()=>{}),await s0()}process.on("beforeExit",async()=>{await v$()});process.on("SIGINT",async()=>{await v$(),process.exit(0)});process.on("SIGTERM",async()=>{await v$(),process.exit(0)});UO().catch(async($)=>{console.error(b("cli.cliError"),$),await v$(),process.exit(1)});
|
package/install.ps1
CHANGED
|
@@ -172,10 +172,12 @@ function Install-Tako {
|
|
|
172
172
|
# Disable Bun color output to avoid ANSI code pollution
|
|
173
173
|
$env:NO_COLOR = "1"
|
|
174
174
|
|
|
175
|
-
# Install tako-cli
|
|
175
|
+
# Install tako-cli using BUN_CONFIG_REGISTRY (bun add doesn't support --registry)
|
|
176
|
+
$env:BUN_CONFIG_REGISTRY = $registry
|
|
176
177
|
$prevErrorAction = $ErrorActionPreference
|
|
177
178
|
$ErrorActionPreference = "Continue"
|
|
178
|
-
|
|
179
|
+
Write-Info "Using npm registry: $registry"
|
|
180
|
+
& $bun add "tako-cli@latest" 2>&1 | ForEach-Object { Write-Host $_ }
|
|
179
181
|
$ErrorActionPreference = $prevErrorAction
|
|
180
182
|
|
|
181
183
|
if ($LASTEXITCODE -ne 0) {
|
|
@@ -184,6 +186,7 @@ function Install-Tako {
|
|
|
184
186
|
} finally {
|
|
185
187
|
Pop-Location
|
|
186
188
|
Remove-Item Env:NO_COLOR -ErrorAction SilentlyContinue
|
|
189
|
+
Remove-Item Env:BUN_CONFIG_REGISTRY -ErrorAction SilentlyContinue
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
$takoEntry = "$TAKO_CLI_DIR\node_modules\tako-cli\dist\index.js"
|
package/install.sh
CHANGED
|
@@ -43,12 +43,20 @@ detect_region() {
|
|
|
43
43
|
country=$(curl -s --connect-timeout 2 "https://ipinfo.io/country" 2>/dev/null || echo "")
|
|
44
44
|
fi
|
|
45
45
|
|
|
46
|
+
if [ -z "$country" ]; then
|
|
47
|
+
country=$(curl -s --connect-timeout 2 "https://api.ip.sb/geoip" 2>/dev/null | grep -o '"country_code":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "")
|
|
48
|
+
fi
|
|
49
|
+
|
|
46
50
|
if [ "$country" = "CN" ]; then
|
|
47
51
|
REGION="cn"
|
|
48
52
|
info "检测到中国大陆网络,使用国内镜像"
|
|
49
|
-
|
|
53
|
+
elif [ -n "$country" ]; then
|
|
50
54
|
REGION="global"
|
|
51
55
|
info "使用国际源"
|
|
56
|
+
else
|
|
57
|
+
# 所有检测都失败,默认使用国内镜像(保守策略,与 TS 代码一致)
|
|
58
|
+
REGION="cn"
|
|
59
|
+
info "网络检测超时,默认使用国内镜像"
|
|
52
60
|
fi
|
|
53
61
|
}
|
|
54
62
|
|
|
@@ -88,6 +96,68 @@ install_dependencies() {
|
|
|
88
96
|
fi
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
# 从 npmmirror 直接下载安装 Bun(国内专用,不依赖 bun.sh 和 GitHub)
|
|
100
|
+
install_bun_from_npmmirror() {
|
|
101
|
+
local mirror="https://registry.npmmirror.com/-/binary/bun"
|
|
102
|
+
|
|
103
|
+
# 检测平台和架构
|
|
104
|
+
local os arch target
|
|
105
|
+
os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
106
|
+
arch=$(uname -m)
|
|
107
|
+
|
|
108
|
+
case "$os" in
|
|
109
|
+
linux) os="linux" ;;
|
|
110
|
+
darwin) os="darwin" ;;
|
|
111
|
+
*) error "不支持的操作系统: $os" ;;
|
|
112
|
+
esac
|
|
113
|
+
|
|
114
|
+
case "$arch" in
|
|
115
|
+
x86_64|amd64) arch="x64" ;;
|
|
116
|
+
aarch64|arm64) arch="aarch64" ;;
|
|
117
|
+
*) error "不支持的架构: $arch" ;;
|
|
118
|
+
esac
|
|
119
|
+
|
|
120
|
+
# Alpine Linux 使用 musl 版本
|
|
121
|
+
target="bun-${os}-${arch}"
|
|
122
|
+
if [ "$os" = "linux" ] && [ -f /etc/alpine-release ]; then
|
|
123
|
+
target="${target}-musl"
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# 获取最新版本号
|
|
127
|
+
info "正在获取最新版本..."
|
|
128
|
+
local latest_version
|
|
129
|
+
latest_version=$(curl -s --connect-timeout 5 "$mirror/" 2>/dev/null \
|
|
130
|
+
| grep -o '"name":"bun-v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/"' \
|
|
131
|
+
| sed 's/"name":"bun-v//;s/\/"//' \
|
|
132
|
+
| sort -t. -k1,1rn -k2,2rn -k3,3rn \
|
|
133
|
+
| head -1)
|
|
134
|
+
|
|
135
|
+
if [ -z "$latest_version" ]; then
|
|
136
|
+
error "无法获取 Bun 最新版本号"
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# 补回前缀
|
|
140
|
+
latest_version="bun-v${latest_version}"
|
|
141
|
+
|
|
142
|
+
local download_url="${mirror}/${latest_version}/${target}.zip"
|
|
143
|
+
local zip_file="/tmp/bun-install-$$.zip"
|
|
144
|
+
|
|
145
|
+
info "下载 Bun (${latest_version}) from npmmirror..."
|
|
146
|
+
curl --fail --location --progress-bar --output "$zip_file" "$download_url" || \
|
|
147
|
+
error "下载失败: $download_url"
|
|
148
|
+
|
|
149
|
+
# 解压到目标目录
|
|
150
|
+
local bin_dir="$TAKO_BUN_DIR/bin"
|
|
151
|
+
mkdir -p "$bin_dir"
|
|
152
|
+
|
|
153
|
+
unzip -oq "$zip_file" -d /tmp/bun-install-$$ || error "解压失败"
|
|
154
|
+
mv "/tmp/bun-install-$$/${target}/bun" "$bin_dir/bun"
|
|
155
|
+
chmod +x "$bin_dir/bun"
|
|
156
|
+
|
|
157
|
+
# 清理临时文件
|
|
158
|
+
rm -rf "$zip_file" "/tmp/bun-install-$$"
|
|
159
|
+
}
|
|
160
|
+
|
|
91
161
|
# 安装 Tako 专属 Bun
|
|
92
162
|
install_bun() {
|
|
93
163
|
# 检查是否已安装
|
|
@@ -101,20 +171,15 @@ install_bun() {
|
|
|
101
171
|
|
|
102
172
|
mkdir -p "$TAKO_BUN_DIR"
|
|
103
173
|
|
|
104
|
-
# 设置环境变量确保 bun 安装到正确位置
|
|
105
|
-
export BUN_INSTALL="$TAKO_BUN_DIR"
|
|
106
|
-
|
|
107
|
-
# 国内用户使用镜像
|
|
108
174
|
if [ "$REGION" = "cn" ]; then
|
|
109
|
-
|
|
175
|
+
# 国内用户:直接从 npmmirror 下载二进制,完全不经过 bun.sh/GitHub
|
|
176
|
+
install_bun_from_npmmirror
|
|
177
|
+
else
|
|
178
|
+
# 海外用户:使用官方安装脚本
|
|
179
|
+
export BUN_INSTALL="$TAKO_BUN_DIR"
|
|
180
|
+
curl -fsSL https://bun.sh/install | bash
|
|
110
181
|
fi
|
|
111
182
|
|
|
112
|
-
# 执行 bun 安装脚本
|
|
113
|
-
curl -fsSL https://bun.sh/install | bash
|
|
114
|
-
|
|
115
|
-
# 清理环境变量
|
|
116
|
-
unset BUN_INSTALL_MIRROR
|
|
117
|
-
|
|
118
183
|
if [ ! -x "$TAKO_BUN_DIR/bin/bun" ]; then
|
|
119
184
|
error "Bun 安装失败,请检查网络连接"
|
|
120
185
|
fi
|