hwjcode-personal 1.1.127 → 1.1.129

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### **飞书原生 · Worktree 并行 · 自更新的 AI 编程 Agent**
6
6
 
7
- *基于 Easy Code 深度定制的增强 fork,专为飞书团队协作而生*
7
+ _基于 Easy Code 深度定制的增强 fork,专为飞书团队协作而生_
8
8
 
9
9
  <br>
10
10
 
@@ -30,14 +30,14 @@
30
30
  ```
31
31
  你在飞书群:帮我重构这个模块
32
32
 
33
- 飞书 Bot → 创建独立 Worktree → Agent 在隔离环境中工作 提交代码
33
+ 飞书 Bot → 绑定项目目录 → Agent 执行任务(需要并行时创建独立 Worktree)→ 提交代码
34
34
  ```
35
35
 
36
36
  - **私聊**:直接对话,像用 CLI 一样
37
37
  - **项目群**:「拉个群 + 项目路径」一键创建绑定工作目录的专属群
38
38
  - **批量建群**:一次性拆分任务到多个群并行开发,每个群自带独立 worktree + TASK.md 任务文档
39
39
  - **实时流式**:Agent 的思考过程和工具调用通过飞书卡片实时回传
40
- - **自然语言指令**:「提交代码」「查看修改」「放弃修改」直接触发 git 操作
40
+ - **工作区命令**:使用显式 `/worktree ...` 管理隔离工作区;普通 Git 需求由 Agent 按当前分支处理
41
41
 
42
42
  ### 2. 🌳 Git Worktree 并行隔离
43
43
 
@@ -45,7 +45,7 @@
45
45
 
46
46
  ```
47
47
  ai-exam/ ← 仓库根目录
48
- ├── .easycode/worktrees/
48
+ ├── .hwjcode/worktrees/
49
49
  │ ├── ui-team/ ← UI 组的隔离工作区(独立分支)
50
50
  │ ├── api-team/ ← API 组的隔离工作区(独立分支)
51
51
  │ └── test-team/ ← 测试组的隔离工作区(独立分支)
@@ -53,8 +53,8 @@ ai-exam/ ← 仓库根目录
53
53
  └── packages/
54
54
  ```
55
55
 
56
- - 每个飞书群聊绑定独立 worktree,文件操作完全隔离
57
- - `/worktree status` 查看改动 · `/worktree commit` 提交 · `/worktree discard` 丢弃
56
+ - 单个项目群默认直接绑定项目目录;批量并行群或明确要求隔离时才创建独立 worktree
57
+ - `/worktree status` 查看改动 · `/worktree commit` 提交存档 · `/worktree done` 提交并清理 · `/worktree discard` 丢弃
58
58
  - worktree 正确建在 git root(而非子目录),包含完整仓库快照
59
59
  - TASK.md 持久化任务文档(handoff 设计哲学:文档是最可靠的上下文)
60
60
 
@@ -121,34 +121,36 @@ hwjcode --feishu
121
121
 
122
122
  ### 项目群创建
123
123
 
124
- | 操作 | 效果 |
125
- |:---|:---|
126
- | `拉个群 D:\my-app` | 创建群 + 绑定工作目录 + 自动检测 git 创建 worktree |
127
- | `拉个群 D:\my-app --agent claude-code` | 群消息自动派发给本机 Claude Code 执行 |
128
- | 批量建群(Agent 自动) | 一次性创建多个群,每个群独立 worktree + TASK.md |
124
+ | 操作 | 效果 |
125
+ | :------------------------------------- | :----------------------------------------------- |
126
+ | `拉个群 D:\my-app` | 创建群 + 绑定项目工作目录(默认不创建 worktree |
127
+ | `拉个群 D:\my-app --agent claude-code` | 群消息自动派发给本机 Claude Code 执行 |
128
+ | 创建项目群时明确要求「并行」或「隔离」 | Git 仓库中为该群创建独立 worktree |
129
+ | 批量建群(Agent 自动) | 一次性创建多个群,每个群独立 worktree + TASK.md |
129
130
 
130
131
  ### 飞书命令
131
132
 
132
- | 命令 | 说明 |
133
- |:---|:---|
134
- | `/help` | 查看帮助 |
135
- | `/status` | 查看 CLI 版本、积分、模型、上下文大小 |
136
- | `/model <name>` | 切换 AI 模型 |
137
- | `/bind <路径>` | 绑定/切换群的工作目录 |
138
- | `/worktree status` | 查看当前 worktree 的 git 改动 |
139
- | `/worktree commit [msg]` | 提交修改并清理 worktree |
140
- | `/worktree discard` | 丢弃所有修改 |
141
- | `/worktree create [name]` | 创建新 worktree |
142
- | `/sessions` | 查看本机 Agent 会话(Claude Code / Codex) |
143
- | `/update` | 自更新到最新版 |
144
-
145
- ### 自然语言触发
146
-
147
- | 你说的话 | 触发的操作 |
148
- |:---|:---|
149
- | 「提交代码」 | `/worktree commit` |
150
- | 「查看修改」 | `/worktree status` |
151
- | 「放弃修改」 | `/worktree discard` |
133
+ | 命令 | 说明 |
134
+ | :------------------------ | :----------------------------------------- |
135
+ | `/help` | 查看帮助 |
136
+ | `/status` | 查看 CLI 版本、积分、模型、上下文大小 |
137
+ | `/model <name>` | 切换 AI 模型 |
138
+ | `/bind <路径>` | 绑定/切换群的工作目录 |
139
+ | `/worktree status` | 查看当前工作目录的 Git 改动 |
140
+ | `/worktree commit [msg]` | 提交隔离 worktree 的修改,保留工作区 |
141
+ | `/worktree done [msg]` | 提交并清理隔离 worktree,群切回项目目录 |
142
+ | `/worktree push` | 推送隔离 worktree 分支到远程 |
143
+ | `/worktree discard` | 丢弃隔离 worktree 的修改并清理工作区 |
144
+ | `/worktree create [name]` | 创建新 worktree |
145
+ | `/sessions` | 查看本机 Agent 会话(Claude Code / Codex) |
146
+ | `/update` | 自更新到最新版 |
147
+
148
+ ### 自然语言快捷操作
149
+
150
+ Worktree 操作必须使用显式 `/worktree`(或 `/wt`)命令;普通的「提交」「推送」等 Git 请求会保留给 Agent 在当前工作目录处理。
151
+
152
+ | 你说的话 | 触发的操作 |
153
+ | :----------------- | :----------------------------------- |
152
154
  | 「更新一下你自己」 | 直接自更新到最新版(不经过模型工具) |
153
155
 
154
156
  ### Agent 派发(ACP)
@@ -170,18 +172,19 @@ hwjcode --feishu
170
172
  ### 工作流
171
173
 
172
174
  ```
173
- 建群 自动创建 worktree(独立分支)
175
+ 建群(默认项目目录)→ 需要隔离时 `/worktree create <name>`(独立分支)
174
176
 
175
177
  Agent 在隔离环境工作(文件互不干扰)
176
178
 
177
179
  /worktree status ← 查看改了什么
178
- /worktree commit ← 提交到分支 + 清理
180
+ /worktree commit ← 提交到分支,保留工作区
181
+ /worktree done ← 提交到分支 + 清理
179
182
  /worktree discard ← 不满意?丢弃重来
180
183
  ```
181
184
 
182
185
  ### TASK.md 任务文档
183
186
 
184
- 批量建群时,每个群的 worktree 根目录会自动生成 `TASK.md`:
187
+ 创建项目群时附带任务描述,会在该群工作目录(项目目录或 worktree 根目录)生成 `TASK.md`:
185
188
 
186
189
  ```markdown
187
190
  # 任务规划
@@ -195,6 +198,7 @@ Agent 在隔离环境工作(文件互不干扰)
195
198
  ```
196
199
 
197
200
  Agent 首次收到消息时会被引导去读 `TASK.md`。这个文件:
201
+
198
202
  - ✅ **持久** — 不会因 session 重建或 /compact 丢失
199
203
  - ✅ **可见** — 终端 `cat TASK.md` 随时查看
200
204
  - ✅ **可编辑** — 改了文件,Agent 下次读就是新内容
@@ -215,8 +219,7 @@ Agent 首次收到消息时会被引导去读 `TASK.md`。这个文件:
215
219
  - **Skills 系统**:可复用的技能包,支持本地和远程仓库
216
220
  - **Cron 定时任务**:支持定时执行任务
217
221
 
218
- 详见原项目文档。
219
- ---
222
+ ## 详见原项目文档。
220
223
 
221
224
  ## 🛠️ 开发
222
225
 
@@ -230,37 +233,34 @@ npm run dev
230
233
 
231
234
  ### 常用命令
232
235
 
233
- | 命令 | 说明 |
234
- |:---|:---|
235
- | `npm run build` | 构建所有包 |
236
- | `npm run dev` | 开发模式运行 |
237
- | `npm run test` | 运行测试 |
238
- | `npm run lint` | 代码风格检查 |
239
- | `npm run typecheck` | TypeScript 类型检查 |
240
- | `npm run release:version patch` | 版本号 bump |
236
+ | 命令 | 说明 |
237
+ | :------------------ | :-------------------------------------- |
238
+ | `npm run build` | 构建所有包 |
239
+ | `npm run dev` | 开发模式运行 |
240
+ | `npm run test` | 运行测试 |
241
+ | `npm run lint` | 代码风格检查 |
242
+ | `npm run typecheck` | TypeScript 类型检查 |
243
+ | 个人版发布 | 合并 PR `master` 后自动打 tag 并发布 |
241
244
 
242
245
  ### 发布流程
243
246
 
244
- ```bash
245
- npm run release:version patch # bump 版本
246
- git add -A && git commit # 提交
247
- git tag v1.1.xx && git push # 打 tag 推送
248
- npm publish --access public # 发布到 npm
249
- ```
247
+ 个人版:将功能 PR 合并到 `master`。自动版本工作流会按最新 `vX.Y.Z` tag 递增 patch,随后发布 `hwjcode-personal@latest`;无需手动打 tag 或执行 `npm publish`。
248
+
249
+ 商业版:将商业版变更合并到 `commercial/1.1` 后,自动版本工作流会按最新 `commercial-vX.Y.Z` tag 选择下一个未被 npm 占用的 patch,随后发布 `hwjcode@stable`(同时兼容更新 `latest`);无需手动打 tag 或执行 `npm publish`。只有需要受控的手动发布时,才在 GitHub Actions 运行 **Release Commercial**,输入版本号与确认词 `RELEASE_COMMERCIAL`。
250
250
 
251
251
  ---
252
252
 
253
253
  ## 📋 与原项目的差异
254
254
 
255
- | 功能 | 原 Easy Code | hwjcode fork |
256
- |:---|:---|:---|
257
- | 飞书集成 | ❌ | ✅ 网关模式 + 群聊 + 卡片 + 流式 |
258
- | Worktree 隔离 | ❌ | ✅ 并行开发 + 群聊隔离 |
259
- | 自更新 | ❌ | ✅ npm + 外挂脚本 + SIGHUP 修复 |
260
- | 批量建群 | ❌ | ✅ + TASK.md 持久化任务文档 |
261
- | Agent 派发 | 基础 ACP | ✅ 增强(群默认绑定 + /sessions + resume) |
262
- | 包名 | `easycode-ai` | `hwjcode` |
263
- | 命令名 | `easycode` | `hwjcode` |
255
+ | 功能 | 原 Easy Code | hwjcode fork |
256
+ | :------------ | :------------ | :----------------------------------------- |
257
+ | 飞书集成 | ❌ | ✅ 网关模式 + 群聊 + 卡片 + 流式 |
258
+ | Worktree 隔离 | ❌ | ✅ 并行开发 + 群聊隔离 |
259
+ | 自更新 | ❌ | ✅ npm + 外挂脚本 + SIGHUP 修复 |
260
+ | 批量建群 | ❌ | ✅ + TASK.md 持久化任务文档 |
261
+ | Agent 派发 | 基础 ACP | ✅ 增强(群默认绑定 + /sessions + resume) |
262
+ | 包名 | `easycode-ai` | `hwjcode` |
263
+ | 命令名 | `easycode` | `hwjcode` |
264
264
 
265
265
  ---
266
266
 
package/bundle/hwjcode.js CHANGED
@@ -2186,7 +2186,7 @@ ${e.format(r)}`.trim())}};sbr.exports=gst});var yst=He((WMi,ubr)=>{"use strict";
2186
2186
  ${s}`;break;case"retry":UGr(s)&&(r[i]=s);break;case"id":zGr(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(e){e.retry&&UGr(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&zGr(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};_Gr.exports={EventSourceStream:Lot}});var agr=He((GUi,rgr)=>{"use strict";var{pipeline:f0n}=Ct("node:stream"),{fetching:G0n}=Ese(),{makeRequest:g0n}=WU(),{webidl:b2}=Rp(),{EventSourceStream:v0n}=PGr(),{parseMIMEType:y0n}=lZ(),{createFastMessageEvent:Z0n}=xWe(),{isNetworkError:jGr}=wse(),{kEnumerableProperty:iS}=hs(),{environmentSettingsObject:qGr}=z1(),KGr=!1,$Gr=3e3,Xse=0,egr=1,kse=2,N0n="anonymous",W0n="use-credentials",QU=class a extends EventTarget{#e={open:null,error:null,message:null};#t;#r=!1;#a=Xse;#i=null;#n=null;#c;#o;constructor(e,r={}){super(),b2.util.markAsUncloneable(this);let n="EventSource constructor";b2.argumentLengthCheck(arguments,1,n),KGr||(KGr=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=b2.converters.USVString(e),r=b2.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#c=r.node.dispatcher||r.dispatcher,this.#o={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=qGr,s;try{s=new URL(e,i.settingsObject.baseUrl),this.#o.origin=s.origin}catch(d){throw new DOMException(d,"SyntaxError")}this.#t=s.href;let t=N0n;r.withCredentials===!0&&(t=W0n,this.#r=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:t==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=qGr.settingsObject,o.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],o.cache="no-store",o.initiator="other",o.urlList=[new URL(this.#t)],this.#i=g0n(o),this.#s()}get readyState(){return this.#a}get url(){return this.#t}get withCredentials(){return this.#r}#s(){if(this.#a===kse)return;this.#a=Xse;let e={request:this.#i,dispatcher:this.#c},r=n=>{if(!jGr(n))return this.#I()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(jGr(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#I();return}let i=n.headersList.get("content-type",!0),s=i!==null?y0n(i):"failure",t=s!=="failure"&&s.essence==="text/event-stream";if(n.status!==200||t===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#a=egr,this.dispatchEvent(new Event("open")),this.#o.origin=n.urlList[n.urlList.length-1].origin;let o=new v0n({eventSourceSettings:this.#o,push:d=>{this.dispatchEvent(Z0n(d.type,d.options))}});f0n(n.body.stream,o,d=>{d?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=G0n(e)}#I(){this.#a!==kse&&(this.#a=Xse,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#a===Xse&&(this.#o.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#o.lastEventId,!0),this.#s())},this.#o.reconnectionTime)?.unref())}close(){b2.brandCheck(this,a),this.#a!==kse&&(this.#a=kse,this.#n.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=b2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=b2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=b2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},tgr={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Xse,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:egr,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:kse,writable:!1}};Object.defineProperties(QU,tgr);Object.defineProperties(QU.prototype,tgr);Object.defineProperties(QU.prototype,{close:iS,onerror:iS,onmessage:iS,onopen:iS,readyState:iS,url:iS,withCredentials:iS});b2.converters.EventSourceInitDict=b2.dictionaryConverter([{key:"withCredentials",converter:b2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:b2.converters.any},{key:"node",converter:b2.dictionaryConverter([{key:"reconnectionTime",converter:b2.converters["unsigned long"],defaultValue:()=>$Gr},{key:"dispatcher",converter:b2.converters.any}]),defaultValue:()=>({})}]);rgr.exports={EventSource:QU,defaultReconnectionTime:$Gr}});var OWe=He((gUi,Wn)=>{"use strict";var F0n=vV(),igr=Hie(),w0n=H6(),R0n=D0r(),A0n=z0r(),E0n=S6(),x0n=Nit(),C0n=git(),Y0n=Ymr(),V0n=Lmr(),Q0n=Tmr(),sgr=zi(),DWe=hs(),{InvalidArgumentError:TWe}=sgr,HU=Npr(),H0n=W6(),X0n=lst(),{MockCallHistory:k0n,MockCallHistoryLog:S0n}=dst(),L0n=vst(),J0n=pst(),B0n=Zbr(),T0n=Mit(),D0n=SNe(),{getGlobalDispatcher:ogr,setGlobalDispatcher:O0n}=$Ne(),M0n=GU(),U0n=Ast();Object.assign(igr.prototype,HU);Wn.exports.Dispatcher=igr;Wn.exports.Client=F0n;Wn.exports.Pool=w0n;Wn.exports.BalancedPool=R0n;Wn.exports.RoundRobinPool=A0n;Wn.exports.Agent=E0n;Wn.exports.ProxyAgent=x0n;Wn.exports.Socks5ProxyAgent=C0n;Wn.exports.EnvHttpProxyAgent=Y0n;Wn.exports.RetryAgent=V0n;Wn.exports.H2CClient=Q0n;Wn.exports.RetryHandler=D0n;Wn.exports.DecoratorHandler=M0n;Wn.exports.RedirectHandler=U0n;Wn.exports.interceptors={redirect:Vbr(),responseError:Hbr(),retry:kbr(),dump:Lbr(),dns:Dbr(),cache:yfr(),decompress:wfr(),deduplicate:Cfr()};Wn.exports.cacheStores={MemoryCacheStore:Dst()};var z0n=Qfr();Wn.exports.cacheStores.SqliteCacheStore=z0n;Wn.exports.buildConnector=H0n;Wn.exports.errors=sgr;Wn.exports.util={parseHeaders:DWe.parseHeaders,headerNameToString:DWe.headerNameToString};function Sse(a){return(e,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new TWe("invalid url");if(r!=null&&typeof r!="object")throw new TWe("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new TWe("invalid opts.path");let t=r.path;r.path.startsWith("/")||(t=`/${t}`),e=new URL(DWe.parseOrigin(e).origin+t)}else r||(r=typeof e=="object"?e:{}),e=DWe.parseURL(e);let{agent:i,dispatcher:s=ogr()}=r;if(i)throw new TWe("unsupported opts.agent. Did you mean opts.client?");return a.call(s,{...r,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}Wn.exports.setGlobalDispatcher=O0n;Wn.exports.getGlobalDispatcher=ogr;var _0n=Ese().fetch,ngr=typeof __filename<"u"?__filename:void 0;function lgr(a,e){if(!a||typeof a!="object")return;let r=typeof a.stack=="string"?a.stack:"",n=e.replace(/\\/g,"/");if(r&&(r.includes(e)||r.includes(n)))return;let i={};if(Error.captureStackTrace(i,lgr),!i.stack)return;let s=i.stack.split(`
2187
2187
  `).slice(1).join(`
2188
2188
  `);a.stack=r?`${r}
2189
- ${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return _0n(e,r).catch(n=>{throw ngr?lgr(n,ngr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=q6().Headers;Wn.exports.Response=wse().Response;Wn.exports.Request=WU().Request;Wn.exports.FormData=dNe().FormData;var{setGlobalOrigin:P0n,getGlobalOrigin:j0n}=nnt();Wn.exports.setGlobalOrigin=P0n;Wn.exports.getGlobalOrigin=j0n;var{CacheStorage:q0n}=O2r(),{kConstruct:K0n}=Zc();Wn.exports.caches=new q0n(K0n);var{deleteCookie:$0n,getCookies:emn,getSetCookies:tmn,setCookie:rmn,parseCookie:amn}=rGr();Wn.exports.deleteCookie=$0n;Wn.exports.getCookies=emn;Wn.exports.getSetCookies=tmn;Wn.exports.setCookie=rmn;Wn.exports.parseCookie=amn;var{parseMIMEType:nmn,serializeAMimeType:imn}=lZ();Wn.exports.parseMIMEType=nmn;Wn.exports.serializeAMimeType=imn;var{CloseEvent:smn,ErrorEvent:omn,MessageEvent:lmn}=xWe(),{WebSocket:cmn,ping:umn}=HGr();Wn.exports.WebSocket=cmn;Wn.exports.CloseEvent=smn;Wn.exports.ErrorEvent=omn;Wn.exports.MessageEvent=lmn;Wn.exports.ping=umn;Wn.exports.WebSocketStream=DGr().WebSocketStream;Wn.exports.WebSocketError=Qot().WebSocketError;Wn.exports.request=Sse(HU.request);Wn.exports.stream=Sse(HU.stream);Wn.exports.pipeline=Sse(HU.pipeline);Wn.exports.connect=Sse(HU.connect);Wn.exports.upgrade=Sse(HU.upgrade);Wn.exports.MockClient=X0n;Wn.exports.MockCallHistory=k0n;Wn.exports.MockCallHistoryLog=S0n;Wn.exports.MockPool=J0n;Wn.exports.MockAgent=L0n;Wn.exports.SnapshotAgent=B0n;Wn.exports.mockErrors=T0n;var{EventSource:dmn}=agr();Wn.exports.EventSource=dmn;function Imn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=Imn});function cW(a){let e=a??"1.1.127"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${MWe}/VSCode/${i} (${r}; ${n})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${MWe}/Desktop/${i} (${r}; ${n})`}return`${MWe}/CLI/${e} (${r}; ${n})`}var MWe,sS=_e(()=>{"use strict";MWe="HwjCode"});import*as rv from"node:path";import*as Li from"node:fs";import*as cgr from"node:os";import*as ugr from"node:zlib";import{spawn as UWe,spawnSync as hmn}from"node:child_process";function hgr(a){if(Li.existsSync(a)){for(let e of Li.readdirSync(a)){let r=rv.join(a,e);Li.statSync(r).isDirectory()?hgr(r):Li.unlinkSync(r)}Li.rmdirSync(a)}}var dgr,Igr,bI,mgr=_e(()=>{"use strict";dgr=Qt(OWe(),1),Igr=Qt(sKe(),1);sS();nm();bI=class{static get lspDir(){return rv.join(cgr.homedir(),Qo,"lsp")}static findOnPath(e){let r=process.platform==="win32"?"where.exe":"which",i=(hmn(r,[e],{shell:!1,encoding:"utf8",windowsHide:!0}).stdout||"").toString().trim();if(!i)return null;for(let s of i.split(/\r?\n/).map(t=>t.trim()).filter(Boolean))if(Li.existsSync(s))return s;return null}static async cleanBinaryCache(e){let r=rv.join(this.lspDir,e);Li.existsSync(r)&&(console.log(`[LSP] Cleaning corrupted binary cache for ${e} at ${r}`),hgr(r),console.log("[LSP] Cache cleaned successfully"))}static async ensureBinary(e,r,n){let i=n?.maxRetries??1,s=null;for(let t=0;t<=i;t++)try{let o=rv.join(this.lspDir,e);return Li.existsSync(o)||Li.mkdirSync(o,{recursive:!0}),await r(o)}catch(o){s=o,t<i&&(console.log(`[LSP] Attempt ${t+1} failed: ${s.message}`),console.log(`[LSP] Cleaning cache and retrying (${i-t} retries left)...`),await this.cleanBinaryCache(e))}throw s||new Error(`Failed to ensure binary for ${e}`)}static async npmInstaller(e,r){return async n=>{let i=rv.join(n,"node_modules",".bin",r+(process.platform==="win32"?".cmd":""));return Li.existsSync(i)||(console.log(`[LSP] Installing ${e.join(", ")} via npm...`),Li.existsSync(rv.join(n,"package.json"))||Li.writeFileSync(rv.join(n,"package.json"),JSON.stringify({name:`deepv-lsp-${r}`,version:"1.0.0",private:!0})),await new Promise((s,t)=>{let o=process.platform==="win32",d=["install",...e,"--no-save"];(o?UWe("cmd.exe",["/c","npm",...d],{cwd:n,shell:!1,stdio:"inherit"}):UWe("npm",d,{cwd:n,shell:!1,stdio:"inherit"})).on("close",u=>{u===0?s():t(new Error(`npm install failed with code ${u}`))})})),i}}static async goInstaller(e,r,n="latest"){return async i=>{let s=process.platform,t=rv.join(i,r+(s==="win32"?".exe":""));if(Li.existsSync(t))return t;let o=this.findOnPath("go");if(!o)throw new Error(`[LSP] Go toolchain not found in PATH (required to install ${r}). Please install Go from https://go.dev/dl/ and ensure "go" is available in your PATH, or configure a preinstalled gopls via PATH/DEEPV_GOPLS_PATH.`);if(console.log(`[LSP] Installing ${r} via go install (${e}@${n})...`),await new Promise((d,I)=>{let u=UWe(o,["install",`${e}@${n}`],{cwd:i,shell:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,GOBIN:i}}),h="";u.stdout?.on("data",c=>{process.stdout.write(c)}),u.stderr?.on("data",c=>{let m=c.toString();h+=m,h.length>16384&&(h=h.slice(h.length-16384)),process.stderr.write(c)}),u.on("close",c=>{if(c===0)d();else{let m=h.trim();I(new Error(`[LSP] go install failed with code ${c}`+(m?`
2189
+ ${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return _0n(e,r).catch(n=>{throw ngr?lgr(n,ngr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=q6().Headers;Wn.exports.Response=wse().Response;Wn.exports.Request=WU().Request;Wn.exports.FormData=dNe().FormData;var{setGlobalOrigin:P0n,getGlobalOrigin:j0n}=nnt();Wn.exports.setGlobalOrigin=P0n;Wn.exports.getGlobalOrigin=j0n;var{CacheStorage:q0n}=O2r(),{kConstruct:K0n}=Zc();Wn.exports.caches=new q0n(K0n);var{deleteCookie:$0n,getCookies:emn,getSetCookies:tmn,setCookie:rmn,parseCookie:amn}=rGr();Wn.exports.deleteCookie=$0n;Wn.exports.getCookies=emn;Wn.exports.getSetCookies=tmn;Wn.exports.setCookie=rmn;Wn.exports.parseCookie=amn;var{parseMIMEType:nmn,serializeAMimeType:imn}=lZ();Wn.exports.parseMIMEType=nmn;Wn.exports.serializeAMimeType=imn;var{CloseEvent:smn,ErrorEvent:omn,MessageEvent:lmn}=xWe(),{WebSocket:cmn,ping:umn}=HGr();Wn.exports.WebSocket=cmn;Wn.exports.CloseEvent=smn;Wn.exports.ErrorEvent=omn;Wn.exports.MessageEvent=lmn;Wn.exports.ping=umn;Wn.exports.WebSocketStream=DGr().WebSocketStream;Wn.exports.WebSocketError=Qot().WebSocketError;Wn.exports.request=Sse(HU.request);Wn.exports.stream=Sse(HU.stream);Wn.exports.pipeline=Sse(HU.pipeline);Wn.exports.connect=Sse(HU.connect);Wn.exports.upgrade=Sse(HU.upgrade);Wn.exports.MockClient=X0n;Wn.exports.MockCallHistory=k0n;Wn.exports.MockCallHistoryLog=S0n;Wn.exports.MockPool=J0n;Wn.exports.MockAgent=L0n;Wn.exports.SnapshotAgent=B0n;Wn.exports.mockErrors=T0n;var{EventSource:dmn}=agr();Wn.exports.EventSource=dmn;function Imn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=Imn});function cW(a){let e=a??"1.1.129"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${MWe}/VSCode/${i} (${r}; ${n})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${MWe}/Desktop/${i} (${r}; ${n})`}return`${MWe}/CLI/${e} (${r}; ${n})`}var MWe,sS=_e(()=>{"use strict";MWe="HwjCode"});import*as rv from"node:path";import*as Li from"node:fs";import*as cgr from"node:os";import*as ugr from"node:zlib";import{spawn as UWe,spawnSync as hmn}from"node:child_process";function hgr(a){if(Li.existsSync(a)){for(let e of Li.readdirSync(a)){let r=rv.join(a,e);Li.statSync(r).isDirectory()?hgr(r):Li.unlinkSync(r)}Li.rmdirSync(a)}}var dgr,Igr,bI,mgr=_e(()=>{"use strict";dgr=Qt(OWe(),1),Igr=Qt(sKe(),1);sS();nm();bI=class{static get lspDir(){return rv.join(cgr.homedir(),Qo,"lsp")}static findOnPath(e){let r=process.platform==="win32"?"where.exe":"which",i=(hmn(r,[e],{shell:!1,encoding:"utf8",windowsHide:!0}).stdout||"").toString().trim();if(!i)return null;for(let s of i.split(/\r?\n/).map(t=>t.trim()).filter(Boolean))if(Li.existsSync(s))return s;return null}static async cleanBinaryCache(e){let r=rv.join(this.lspDir,e);Li.existsSync(r)&&(console.log(`[LSP] Cleaning corrupted binary cache for ${e} at ${r}`),hgr(r),console.log("[LSP] Cache cleaned successfully"))}static async ensureBinary(e,r,n){let i=n?.maxRetries??1,s=null;for(let t=0;t<=i;t++)try{let o=rv.join(this.lspDir,e);return Li.existsSync(o)||Li.mkdirSync(o,{recursive:!0}),await r(o)}catch(o){s=o,t<i&&(console.log(`[LSP] Attempt ${t+1} failed: ${s.message}`),console.log(`[LSP] Cleaning cache and retrying (${i-t} retries left)...`),await this.cleanBinaryCache(e))}throw s||new Error(`Failed to ensure binary for ${e}`)}static async npmInstaller(e,r){return async n=>{let i=rv.join(n,"node_modules",".bin",r+(process.platform==="win32"?".cmd":""));return Li.existsSync(i)||(console.log(`[LSP] Installing ${e.join(", ")} via npm...`),Li.existsSync(rv.join(n,"package.json"))||Li.writeFileSync(rv.join(n,"package.json"),JSON.stringify({name:`deepv-lsp-${r}`,version:"1.0.0",private:!0})),await new Promise((s,t)=>{let o=process.platform==="win32",d=["install",...e,"--no-save"];(o?UWe("cmd.exe",["/c","npm",...d],{cwd:n,shell:!1,stdio:"inherit"}):UWe("npm",d,{cwd:n,shell:!1,stdio:"inherit"})).on("close",u=>{u===0?s():t(new Error(`npm install failed with code ${u}`))})})),i}}static async goInstaller(e,r,n="latest"){return async i=>{let s=process.platform,t=rv.join(i,r+(s==="win32"?".exe":""));if(Li.existsSync(t))return t;let o=this.findOnPath("go");if(!o)throw new Error(`[LSP] Go toolchain not found in PATH (required to install ${r}). Please install Go from https://go.dev/dl/ and ensure "go" is available in your PATH, or configure a preinstalled gopls via PATH/DEEPV_GOPLS_PATH.`);if(console.log(`[LSP] Installing ${r} via go install (${e}@${n})...`),await new Promise((d,I)=>{let u=UWe(o,["install",`${e}@${n}`],{cwd:i,shell:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,GOBIN:i}}),h="";u.stdout?.on("data",c=>{process.stdout.write(c)}),u.stderr?.on("data",c=>{let m=c.toString();h+=m,h.length>16384&&(h=h.slice(h.length-16384)),process.stderr.write(c)}),u.on("close",c=>{if(c===0)d();else{let m=h.trim();I(new Error(`[LSP] go install failed with code ${c}`+(m?`
2190
2190
  ${m}`:"")))}}),u.on("error",c=>{I(new Error(`[LSP] Failed to spawn go (${o}): ${c.message}. Please ensure Go is installed and available in PATH.`))})}),!Li.existsSync(t))throw new Error(`[LSP] ${r} installation completed but binary not found at ${t}. This usually means Go did not honor GOBIN or the install failed silently.`);return t}}static async githubInstaller(e,r,n){return async i=>{let s=process.platform,t=process.arch,o=n(s,t),d=r+(s==="win32"?".exe":""),I=rv.join(i,d);if(Li.existsSync(I))return I;console.log(`[LSP] Downloading ${r} from GitHub ${e}/${r}...`);let u=process.env.GITHUB_TOKEN||process.env.GITHUB_PAT,h={"User-Agent":cW()};u&&(h.Authorization=`Bearer ${u}`);let c=`https://api.github.com/repos/${e}/${r}/releases/latest`,Z=await(await(0,dgr.request)(c,{headers:h})).body.json(),v=Z.assets.find(A=>typeof o=="string"?A.name===o:o.test(A.name));if(!v){let A=`${s}-${t}`,p=[];r==="rust-analyzer"&&(A==="win32-x64"?p.push(/rust-analyzer.*x86_64.*windows.*\.zip/i,/rust-analyzer.*x64.*windows.*\.zip/i,/rust-analyzer.*msvc.*\.zip/i):A==="win32-arm64"?p.push(/rust-analyzer.*aarch64.*windows.*\.zip/i):A==="darwin-x64"?p.push(/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,/rust-analyzer.*x86_64.*macos.*\.gz/i):A==="darwin-arm64"?p.push(/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,/rust-analyzer.*aarch64.*macos.*\.gz/i):A==="linux-x64"?p.push(/rust-analyzer.*x86_64.*linux.*\.gz/i,/rust-analyzer.*x86_64.*gnu.*\.gz/i):A==="linux-arm64"&&p.push(/rust-analyzer.*aarch64.*linux.*\.gz/i,/rust-analyzer.*aarch64.*gnu.*\.gz/i)),p.length>0&&(v=Z.assets.find(y=>p.some(W=>W.test(y.name))))}if(!v){let A=Z.assets.map(p=>p.name).join(", ");throw new Error(`Could not find a suitable binary for ${s}-${t} in ${e}/${r} releases. Available: ${A}`)}console.log(`[LSP] Downloading: ${v.name}`),console.log(`[LSP] File size: ${(v.size/1024/1024).toFixed(1)}MB`);let N=rv.join(i,v.name),g=Date.now(),E=0;if(await new Promise((A,p)=>{let y=process.platform==="win32"?"curl.exe":"curl",W=UWe(y,["-L","--fail","-o",N,v.browser_download_url]),R="",f=setInterval(()=>{if(Li.existsSync(N)){let b=Li.statSync(N).size,G=(b/(v.size||1)*100).toFixed(1),F=(b/1024/1024).toFixed(1),C=(v.size/1024/1024).toFixed(1);console.log(`[LSP] \u2B07\uFE0F ${v.name}: ${F}MB / ${C}MB (${G}%)`),E=b,g=Date.now()}},2e3);W.stderr.on("data",b=>{R+=b.toString()}),W.on("close",b=>{clearInterval(f),b===0?A():(Li.existsSync(N)&&Li.unlinkSync(N),p(new Error(`[LSP] curl failed with code ${b}: ${R}`)))}),W.on("error",b=>{clearInterval(f),Li.existsSync(N)&&Li.unlinkSync(N),p(new Error(`[LSP] Failed to spawn curl: ${b.message}. curl may not be installed or available in PATH. Please install curl and add it to your system PATH.`))})}),!Li.existsSync(N))throw new Error(`[LSP] Downloaded file not found at ${N}. curl may have failed silently.`);let w=Li.statSync(N).size;if(w===0)throw Li.unlinkSync(N),new Error(`[LSP] Downloaded file is empty (0 bytes) for ${v.name}. The download URL may be invalid or temporarily unavailable. Please retry.`);if(console.log(`[LSP] Downloaded ${w} bytes (expected: ${v.size} bytes)`),v.name.endsWith(".gz")){console.log(`[LSP] Decompressing ${v.name}...`);let A=Li.readFileSync(N);try{let p=ugr.gunzipSync(A);if(p.length===0)throw new Error("Decompressed data is empty");Li.writeFileSync(I,p)}catch(p){Li.unlinkSync(N);let y=p instanceof Error?p.message:String(p);throw new Error(`[LSP] Failed to decompress ${v.name}: ${y}. The file may be corrupted. Please retry.`)}Li.unlinkSync(N)}else if(v.name.endsWith(".zip")){console.log(`[LSP] Extracting ${v.name}...`);let A=Li.readFileSync(N);if(A.length<4)throw Li.unlinkSync(N),new Error(`[LSP] ZIP file is too small (${A.length} bytes) for ${v.name}. The download is corrupted. Please retry or check your network connection.`);if(A[0]!==80||A[1]!==75||A[2]!==3||A[3]!==4)throw Li.unlinkSync(N),new Error(`[LSP] ZIP file header is corrupted for ${v.name}. The download may have been interrupted. Please retry.`);let p;try{p=await Igr.default.loadAsync(A)}catch(b){Li.unlinkSync(N);let G=b instanceof Error?b.message:String(b);throw new Error(`[LSP] Failed to parse ZIP file ${v.name}: ${G}. The file may be corrupted. Please retry the download.`)}let y=d.toLowerCase(),R=Object.values(p.files).filter(b=>!b.dir).filter(b=>rv.posix.basename(b.name).toLowerCase()===y).sort((b,G)=>b.name.length-G.name.length)[0];if(!R)throw new Error(`Zip archive did not contain expected executable "${d}" for ${e}/${r}.`);let f=await R.async("nodebuffer");Li.writeFileSync(I,f),Li.unlinkSync(N)}else Li.renameSync(N,I);if(s!=="win32"&&Li.chmodSync(I,493),console.log(`[LSP] Binary installed at: ${I}`),console.log(`[LSP] Binary exists: ${Li.existsSync(I)}`),Li.existsSync(I)){let A=Li.statSync(I);console.log(`[LSP] Binary stats: size=${A.size}, mode=${(A.mode&parseInt("777",8)).toString(8)}`)}return I}}}});import*as F0 from"node:path";import*as fZ from"node:fs";import{spawn as QV}from"node:child_process";function XU(a,e,r){let i=process.platform==="win32"&&a.toLowerCase().endsWith(".cmd"),s={cwd:r.cwd,shell:!1,stdio:["pipe","pipe","pipe"]};if(i&&fZ.existsSync(a)){let o=fZ.readFileSync(a,"utf8").match(/%dp0%([^"]*\.m?js)/i);if(o){let d=F0.dirname(a),I=o[1].replace(/\\/g,F0.sep);I.startsWith(F0.sep)&&(I="."+I);let u=F0.resolve(d,I);if(fZ.existsSync(u))return QV(process.execPath,[u,...e],s)}return QV("cmd.exe",["/c",a,...e],s)}return QV(a,e,s)}var Lse,mmn,pmn,bmn,fmn,Gmn,gmn,vmn,ymn,Zmn,pgr,bgr=_e(()=>{"use strict";mgr();Lse=(a,e)=>async r=>{let n=F0.normalize(F0.dirname(F0.resolve(r))),i=F0.normalize(F0.resolve(e)),s=(t,o)=>{let d=t.toLowerCase(),I=o.toLowerCase();return d.startsWith(I)||d===I};for(;s(n,i);){for(let o of a)if(fZ.existsSync(F0.join(n,o)))return n;let t=F0.normalize(F0.dirname(n));if(t===n)break;n=t}return i},mmn=a=>({id:"typescript-language-server",displayName:"TypeScript/JavaScript Language Server",extensions:[".ts",".tsx",".js",".jsx"],root:Lse(["package.json","tsconfig.json","jsconfig.json"],a),async spawn(e){let r=await bI.ensureBinary("typescript-language-server",await bI.npmInstaller(["typescript-language-server","typescript"],"typescript-language-server")),n=F0.join(F0.dirname(r),"..","..","typescript","lib","tsserver.js"),i=["--stdio"];return fZ.existsSync(n)&&i.push("--tsserver-path",n),{process:XU(r,i,{cwd:e})}}}),pmn=a=>({id:"pyright",displayName:"Python Language Server",extensions:[".py"],root:Lse(["pyproject.toml","setup.py","requirements.txt","package.json"],a),async spawn(e){let r=await bI.ensureBinary("pyright",await bI.npmInstaller(["pyright"],"pyright-langserver"));return{process:XU(r,["--stdio"],{cwd:e})}}}),bmn=a=>({id:"rust-analyzer",displayName:"Rust Language Server",extensions:[".rs"],root:Lse(["Cargo.toml"],a),async spawn(e){let r=process.platform,n=process.arch;console.log(`[LSP] Detecting platform for rust-analyzer: platform=${r}, arch=${n}`);let i=await bI.githubInstaller("rust-lang","rust-analyzer",(o,d)=>{let I={"win32-x64":/rust-analyzer.*x86_64.*windows.*\.zip/i,"win32-arm64":/rust-analyzer.*aarch64.*windows.*\.zip/i,"darwin-x64":/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,"darwin-arm64":/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,"linux-x64":/rust-analyzer.*x86_64.*linux.*\.gz/i,"linux-arm64":/rust-analyzer.*aarch64.*linux.*\.gz/i},u=`${o}-${d}`,h=I[u]||/rust-analyzer-.*/;return console.log(`[LSP] Asset matcher for ${u}: ${h instanceof RegExp?h.source:h}`),h}),s=await bI.ensureBinary("rust-analyzer",i,{maxRetries:1});if(console.log(`[LSP] RustAnalyzer binary path: ${s}`),console.log(`[LSP] RustAnalyzer binary exists: ${fZ.existsSync(s)}`),fZ.existsSync(s)){let o=fZ.statSync(s);console.log(`[LSP] RustAnalyzer binary stats: size=${o.size}, isFile=${o.isFile()}, mode=${(o.mode&parseInt("777",8)).toString(8)}`)}console.log(`[LSP] RustAnalyzer spawning with cwd=${e}, args=[], shell=undefined`);let t=QV(s,[],{cwd:e});return console.log(`[LSP] RustAnalyzer spawn returned: pid=${t.pid}`),t.on("error",o=>{console.error("[LSP] RustAnalyzer process error:",{code:o.code,errno:o.errno,syscall:o.syscall,path:o.path,message:o.message})}),t.on("exit",(o,d)=>{console.log(`[LSP] RustAnalyzer process exited: code=${o}, signal=${d}`)}),{process:t}}}),fmn=a=>({id:"gopls",displayName:"Go Language Server",extensions:[".go"],root:Lse(["go.mod","go.sum"],a),async spawn(e){let r=process.env.DEEPV_GOPLS_PATH;if(r&&fZ.existsSync(r))return{process:QV(r,[],{cwd:e})};let n=bI.findOnPath("gopls");if(n)return{process:QV(n,[],{cwd:e})};let i=await bI.ensureBinary("gopls",await bI.goInstaller("golang.org/x/tools/gopls","gopls"),{maxRetries:1});return{process:QV(i,[],{cwd:e})}}}),Gmn=a=>({id:"clangd",displayName:"C/C++ Language Server",extensions:[".c",".cpp",".h",".hpp",".cc"],root:Lse(["compile_commands.json","CMakeLists.txt",".git"],a),async spawn(e){let r=await bI.githubInstaller("clangd","clangd",(i,s)=>{let t=i==="win32"?"windows":i==="darwin"?"mac":"linux";return new RegExp(`clangd-${t}-.*\\.zip`)}),n=await bI.ensureBinary("clangd",r,{maxRetries:1});return{process:QV(n,[],{cwd:e})}}}),gmn=a=>({id:"vscode-langservers-extracted",displayName:"HTML/CSS/JSON/ESLint Language Server",extensions:[".html",".css",".json",".jsonc"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("vscode-langservers-extracted",await bI.npmInstaller(["vscode-langservers-extracted"],"vscode-html-language-server"));return{process:XU(r,["--stdio"],{cwd:e})}}}),vmn=a=>({id:"sql-language-server",displayName:"SQL Language Server",extensions:[".sql"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("sql-language-server",await bI.npmInstaller(["sql-language-server"],"sql-language-server"));return{process:XU(r,["up","--method","stdio"],{cwd:e})}}}),ymn=a=>({id:"dockerfile-language-server-nodejs",displayName:"Dockerfile Language Server",extensions:["Dockerfile",".dockerfile"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("dockerfile-language-server-nodejs",await bI.npmInstaller(["dockerfile-language-server-nodejs"],"docker-langserver"));return{process:XU(r,["--stdio"],{cwd:e})}}}),Zmn=a=>({id:"yaml-language-server",displayName:"YAML Language Server",extensions:[".yaml",".yml"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("yaml-language-server",await bI.npmInstaller(["yaml-language-server"],"yaml-language-server"));return{process:XU(r,["--stdio"],{cwd:e})}}}),pgr=a=>[mmn(a),pmn(a),bmn(a),fmn(a),Gmn(a),gmn(a),vmn(a),ymn(a),Zmn(a)]});import*as tE from"node:path";import*as _We from"node:fs";import{pathToFileURL as Nmn}from"node:url";var zWe,fgr=_e(()=>{"use strict";Zdr();bgr();zWe=class{clients=new Map;servers;projectRoot;openedFiles=new Set;fileVersions=new Map;fileContents=new Map;freshClients=new Set;constructor(e){this.projectRoot=e,this.servers=pgr(e)}async getClientsForFile(e){let r=tE.extname(e).toLowerCase(),n=this.servers.filter(s=>s.extensions.includes(r)),i=[];for(let s of n){let t=await s.root(e),o=`${s.id}:${t}`;if(this.clients.has(o))i.push(this.clients.get(o));else try{console.log(`[LSP] Starting ${s.id} for root ${t}`);let{process:d}=await s.spawn(t);console.log(`[LSP] Process spawned: pid=${d.pid}, stdio=${JSON.stringify(d.stdio)}`);let I=await vdr({serverID:s.id,server:{process:d},root:t});this.clients.set(o,I),this.freshClients.add(I.serverID),i.push(I)}catch(d){let I=d instanceof Error?{message:d.message,stack:d.stack,code:d.code,errno:d.errno,syscall:d.syscall,path:d.path}:String(d);console.error(`[LSP] Failed to start ${s.id}:`,I);let u=d;(u.errno===-4094||u.code==="UNKNOWN")&&console.error(`[LSP] Binary file may be corrupted (errno=${u.errno}). Suggest deleting ${s.id} cache and reinitializing.`)}}return i}async syncDocument(e,r){let n=this.getUri(r),i=`${e.serverID}:${n}`,s=_We.readFileSync(r,"utf8");if(!this.openedFiles.has(i))this.fileVersions.set(i,1),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didOpen",{textDocument:{uri:n,languageId:this.getLanguageId(r),version:1,text:s}}),this.openedFiles.add(i),await new Promise(t=>setTimeout(t,3e3));else{if(this.fileContents.get(i)===s)return;let o=(this.fileVersions.get(i)||1)+1;this.fileVersions.set(i,o),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didChange",{textDocument:{uri:n,version:o},contentChanges:[{text:s}]})}}getLanguageId(e){switch(tE.extname(e).toLowerCase()){case".ts":case".tsx":return"typescript";case".js":case".jsx":return"javascript";case".go":return"go";case".py":return"python";case".rs":return"rust";default:return"plaintext"}}getUri(e){return Nmn(tE.resolve(e)).href.replace(/^file:\/\/\/([A-Z])[:%3A]+\//i,(n,i)=>`file:///${i.toLowerCase()}%3A/`)}async shutdown(){for(let e of this.clients.values())await ydr(e);this.clients.clear(),this.openedFiles.clear()}async run(e,r,n){let i=process.env.DEEPV_LSP_DEBUG==="1"||process.env.DEEPV_LSP_DEBUG==="true",s=Number(process.env.DEEPV_LSP_REQUEST_TIMEOUT_MS),t=n?.timeoutMs??(Number.isFinite(s)&&s>0?s:15e3),o=n?.operationName??"request",d=tE.normalize(e),I=await this.getClientsForFile(d),u=await Promise.all(I.map(async c=>{await this.syncDocument(c,d),this.freshClients.has(c.serverID)&&this.freshClients.delete(c.serverID);try{return await Promise.race([r(c),new Promise((Z,v)=>{let N=setTimeout(()=>{clearTimeout(N),v(new Error(`[LSP][${c.serverID}] ${o} timed out after ${t}ms`))},t)})])}catch(m){if(i)console.error(`[LSP][${c.serverID}] Request failed:`,m);else{let Z=m instanceof Error?m.message:String(m);Z.includes("timed out after")?console.warn(Z):console.error(`[LSP][${c.serverID}] Request failed:`,Z)}return null}})),h=[];for(let c of u)c!==null&&h.push(c);return h}async getHover(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/hover",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/hover"})}async getDefinition(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/definition",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/definition"})}async getReferences(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n},context:{includeDeclaration:!0}},t=await i.connection.sendRequest("textDocument/references",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No references found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/references",s)),t},{operationName:"textDocument/references"})}async getImplementation(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n}},t=await i.connection.sendRequest("textDocument/implementation",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No implementation found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/implementation",s)),t},{operationName:"textDocument/implementation"})}async getDocumentSymbols(e){return this.run(e,r=>r.connection.sendRequest("textDocument/documentSymbol",{textDocument:{uri:this.getUri(e)}}),{operationName:"textDocument/documentSymbol"})}async getWorkspaceSymbols(e){if(this.clients.size===0){console.log("[LSP] No active clients for workspace symbols, probing project...");let n=_We.readdirSync(this.projectRoot,{recursive:!0}),i=[{ext:".ts",id:"typescript-language-server"},{ext:".py",id:"pyright"},{ext:".go",id:"gopls"},{ext:".rs",id:"rust-analyzer"},{ext:".js",id:"typescript-language-server"}];for(let s of i){let t=n.find(o=>o.endsWith(s.ext)&&!o.includes("node_modules")&&!o.includes("dist"));if(t){console.log(`[LSP] Detected ${s.ext} project, activating ${s.id}...`);let o=tE.join(this.projectRoot,t),d=await this.getClientsForFile(o);for(let I of d)await this.syncDocument(I,o);console.log(`[LSP] Waiting 5s for ${s.id} indexing...`),await new Promise(I=>setTimeout(I,5e3));break}}}let r=[];console.log(`[LSP] Searching workspace symbols for "${e}" across ${this.clients.size} clients...`);for(let n of this.clients.values())try{let i=await n.connection.sendRequest("workspace/symbol",{query:e});(!i||i.length===0)&&(console.log(`[LSP][${n.serverID}] No symbols yet, retrying in 3s...`),await new Promise(s=>setTimeout(s,3e3)),i=await n.connection.sendRequest("workspace/symbol",{query:e})),console.log(`[LSP][${n.serverID}] Found ${i?.length||0} symbols`),i&&r.push(i)}catch(i){console.error(`[LSP][${n.serverID}] Workspace symbols failed:`,i)}return r}async getDiagnostics(e){return[]}}});function Ggr(a){return Jot||(Jot=new zWe(a)),Jot}var Jot,ggr=_e(()=>{"use strict";fgr();Jot=null});import*as kU from"node:path";import{fileURLToPath as Wmn}from"node:url";var Db,Bot=_e(()=>{"use strict";Es();ggr();Gi();mc();Db=class a extends ka{config;static Name="lsp";constructor(e){super(a.Name,"LSP Tool","Perform Language Server Protocol operations like Go to Definition, Find References, Hover, etc. Useful for code navigation and understanding.",Ga.LightBulb,{properties:{operation:{type:Pt.STRING,enum:["goToDefinition","findReferences","hover","documentSymbol","workspaceSymbol","goToImplementation"],description:"The LSP operation to perform."},filePath:{type:Pt.STRING,description:"The absolute path to the file. Required for file-specific operations."},line:{type:Pt.NUMBER,description:"The 1-based line number. Required for position-specific operations."},character:{type:Pt.NUMBER,description:"The 1-based character offset. Required for position-specific operations."},query:{type:Pt.STRING,description:"Search query. Required for workspaceSymbol."}},required:["operation"],type:Pt.OBJECT}),this.config=e}validateToolParams(e){let r=ai.validate(this.schema.parameters,e,a.Name);return r||(e.operation!=="workspaceSymbol"&&(!e.filePath||!kU.isAbsolute(e.filePath))?"filePath must be an absolute path for this operation.":["goToDefinition","findReferences","hover","goToImplementation"].includes(e.operation)&&(!e.line||!e.character||e.line<1||e.character<1)?"line and character must be 1-based (>= 1) for this operation.":e.operation==="workspaceSymbol"&&!e.query?"query is required for workspaceSymbol.":null)}async execute(e){let r=Ggr(this.config.getTargetDir()),n=null,i=e.filePath?kU.resolve(e.filePath):void 0;try{switch(e.operation){case"goToDefinition":n=await r.getDefinition(i,e.line-1,e.character-1);break;case"findReferences":n=await r.getReferences(i,e.line-1,e.character-1);break;case"hover":n=await r.getHover(i,e.line-1,e.character-1);break;case"documentSymbol":n=await r.getDocumentSymbols(i);break;case"workspaceSymbol":n=await r.getWorkspaceSymbols(e.query||"");break;case"goToImplementation":n=await r.getImplementation(i,e.line-1,e.character-1);break;default:throw new Error(`Unknown operation: ${e.operation}`)}let s=n;Array.isArray(n)&&(e.operation==="hover"?s=n.find(d=>d&&d.contents)||null:e.operation==="goToDefinition"?(s=n.flat().filter(Boolean),s.length===0?s=null:s.length===1&&(s=s[0])):(s=n.flat().filter(Boolean),s.length===0&&Array.isArray(n)&&(s=[])));let t=this.formatLspResult(s,e.operation,this.config.getTargetDir());return{llmContent:`Operation ${e.operation} result:
2191
2191
  ${t}`,returnDisplay:t}}catch(s){let t=s instanceof Error?s.message:String(s);return{llmContent:`Error executing LSP operation ${e.operation}: ${t}`,returnDisplay:`Error: ${t}`}}}formatLspResult(e,r,n){if(!e)return"No result found.";let i=(s,t)=>{let o=s;s.startsWith("file://")&&(o=Wmn(s));let d=kU.relative(n,o),I=t.start.line+1,u=t.start.character+1,h=t.end.line+1,c=t.end.character+1;return I===h?`${d}:${I}:${u}-${c}`:`${d}:${I}:${u} - ${h}:${c}`};if(Array.isArray(e)){if(e.length===0)return"No results.";let s=e[0];return s.uri||s.targetUri?e.map(t=>{let o=t.uri||t.targetUri,d=t.range||t.targetSelectionRange;return`\u2022 ${i(o,d)}`}).join(`
2192
2192
  `):s.name&&s.kind!==void 0?e.map(t=>{let d={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String"}[t.kind]||`Kind(${t.kind})`,I="";if(t.location)I=i(t.location.uri,t.location.range);else if(t.range){let u=t.range;I=`${u.start.line+1}:${u.start.character+1}`}return`\u2022 [${d}] ${t.name} (${I})`}).join(`
@@ -3526,7 +3526,7 @@ ${N}`,returnDisplay:`Described image: ${Tl(E)}${g?" (truncated)":""}`}}catch(m){
3526
3526
  The spawned session starts with NO context from this conversation \u2014 the 'task' instruction MUST be fully self-contained: goal, relevant file paths, constraints, and acceptance criteria.
3527
3527
  The host enforces a concurrency cap on how many spawned sessions run AT ONCE; it is not a lifetime quota. Sessions that have finished their task free up a slot, so you can keep spawning in batches over time. If the call fails because the cap is currently full, the error reports the exact limit \u2014 wait for a running session to finish, then spawn again.
3528
3528
  Best suited for tasks that can be completed independently and whose file changes do not overlap with your current work or with other spawned sessions.
3529
- This tool returns immediately once the session is started (reporting its branch and worktree path); it does NOT wait for the task to finish. The user reviews and merges the spawned session's result there \u2014 do not spawn work whose outcome you need before continuing this conversation.`,Ga.Tasks,{type:Pt.OBJECT,properties:{task:{type:Pt.STRING,description:"Self-contained task instruction for the spawned session. It cannot see this conversation, so include everything needed to act: the goal, relevant file paths, constraints, and how to verify the result."},name:{type:Pt.STRING,description:'Optional short kebab-case name (lowercase letters/digits with hyphens, e.g. "fix-login-redirect") used for the worktree branch and the session title.'},base:{type:Pt.STRING,enum:["fresh","head"],description:"What the isolated branch is based on: 'fresh' (default) bases the worktree on the repository's clean base state; 'head' bases it on the current HEAD commit so the spawned session builds on the latest committed work."}},required:["task"]},!0,!1,!1,!1),this.config=e}validateToolParams(e){let r=ai.validate(this.schema.parameters,e,a.Name);if(r)return r;if(!e.task||e.task.trim().length===0)return"The 'task' parameter cannot be empty: provide a fully self-contained task instruction.";if(e.name!==void 0){if(!DZn.test(e.name))return`The 'name' parameter must be kebab-case: lowercase letters/digits separated by single hyphens (e.g. "fix-login-redirect").`;if(e.name.length>_Wr)return`The 'name' parameter must be at most ${_Wr} characters.`}return e.base!==void 0&&e.base!=="fresh"&&e.base!=="head"?"The 'base' parameter must be either 'fresh' or 'head'.":null}getDescription(e){let r=e.name?`[${e.name}] `:"",n=e.task??"",i=n.length>100?`${n.substring(0,97)}...`:n;return`Spawn parallel worktree session: ${r}${i}`}async shouldConfirmExecute(e,r){return this.config.getApprovalMode()===ya.AUTO_EDIT||this.validateToolParams(e)?!1:{type:"info",title:"Confirm parallel worktree session",prompt:`${e.name?`[${e.name}] `:""}${e.task}`,onConfirm:async s=>{s===Ya.ProceedAlways&&this.config.setApprovalMode(ya.AUTO_EDIT)}}}async execute(e,r){let n=this.validateToolParams(e);if(n)return{llmContent:`Error: Invalid parameters provided. Reason: ${n}`,returnDisplay:n};let i="Error: spawn_parallel_task is only available when this session is hosted by HwjCode Desktop, which intercepts the call and creates the worktree session. The current host does not support it \u2014 no session was spawned. Complete the task in this conversation instead.";return{llmContent:i,returnDisplay:i}}}});import OZn from"path";var $we,PWr=_e(()=>{"use strict";Es();Gi();Roe();$we=class extends ka{constructor(){super("use_skill","Use Skill",`Execute a skill and MUST follow its scripts if provided
3529
+ This tool returns immediately once the session is started (reporting its branch and worktree path); it does NOT wait for the task to finish. The user reviews and merges the spawned session's result there \u2014 do not spawn work whose outcome you need before continuing this conversation.`,Ga.Tasks,{type:Pt.OBJECT,properties:{task:{type:Pt.STRING,description:"Self-contained task instruction for the spawned session. It cannot see this conversation, so include everything needed to act: the goal, relevant file paths, constraints, and how to verify the result."},name:{type:Pt.STRING,description:'Optional short kebab-case name (lowercase letters/digits with hyphens, e.g. "fix-login-redirect") used for the worktree branch and the session title.'},base:{type:Pt.STRING,enum:["fresh","head"],description:"What the isolated branch is based on: 'fresh' (default) bases the worktree on the repository's clean base state; 'head' bases it on the current HEAD commit so the spawned session builds on the latest committed work."}},required:["task"]},!0,!1,!1,!1),this.config=e}validateToolParams(e){let r=ai.validate(this.schema.parameters,e,a.Name);if(r)return r;if(!e.task||e.task.trim().length===0)return"The 'task' parameter cannot be empty: provide a fully self-contained task instruction.";if(e.name!==void 0){if(!DZn.test(e.name))return`The 'name' parameter must be kebab-case: lowercase letters/digits separated by single hyphens (e.g. "fix-login-redirect").`;if(e.name.length>_Wr)return`The 'name' parameter must be at most ${_Wr} characters.`}return e.base!==void 0&&e.base!=="fresh"&&e.base!=="head"?"The 'base' parameter must be either 'fresh' or 'head'.":null}getDescription(e){let r=e.name?`[${e.name}] `:"",n=e.task??"",i=n.length>100?`${n.substring(0,97)}...`:n;return`Spawn parallel worktree session: ${r}${i}`}async shouldConfirmExecute(e,r){return this.config.getApprovalMode()===ya.AUTO_EDIT||this.validateToolParams(e)?!1:{type:"info",title:"Confirm parallel worktree session",prompt:`${e.name?`[${e.name}] `:""}${e.task}`,onConfirm:async s=>{s===Ya.ProceedAlways&&this.config.setApprovalMode(ya.AUTO_EDIT)}}}async execute(e,r){let n=this.validateToolParams(e);if(n)return{llmContent:`Error: Invalid parameters provided. Reason: ${n}`,returnDisplay:n};let i="Error: spawn_parallel_task is only available when this session is hosted by HwjCode Desktop, which intercepts the call and creates the worktree session. The current host does not support it \u2014 no session was spawned. Complete the task in this conversation instead.";return{llmContent:i,returnDisplay:i}}}});import OZn from"path";var $we,PWr=_e(()=>{"use strict";Es();Gi();Roe();$we=class extends ka{config;constructor(e){super("use_skill","Use Skill",`Execute a skill and MUST follow its scripts if provided
3530
3530
 
3531
3531
  <skills_instructions>
3532
3532
  When users ask you to perform tasks, check if any available skills can help.
@@ -3549,7 +3549,7 @@ Important:
3549
3549
  - Skills with \u{1F4DC} or <has_scripts>true</has_scripts> MUST use their scripts
3550
3550
  - Do not guess script syntax - always use_skill first to see exact commands
3551
3551
  - For knowledge-only skills (no scripts), follow the guidance provided
3552
- </skills_instructions>`,Ga.LightBulb,{type:Pt.OBJECT,properties:{skillName:{type:Pt.STRING,description:'The skill name to activate (no arguments). E.g., "pdf", "test-pdf", "xlsx"'}},required:["skillName"]},!1,!1)}validateToolParams(e){return!e.skillName||typeof e.skillName!="string"?"skillName is required and must be a string":e.skillName.trim().length===0?"skillName cannot be empty":null}getDescription(e){return`Loading skill: ${e.skillName}`}toolLocations(e){return[]}async shouldConfirmExecute(e,r){return!1}async execute(e,r){let n=this.validateToolParams(e);if(n)return{llmContent:`\u274C Invalid parameters: ${n}`,returnDisplay:`Invalid parameters: ${n}`};try{let i=new Sh;await i.initialize();let s=new Lh(i),t=new Cp(i,s),o=new mW(t,i),d=await t.loadEnabledSkills(yi.RESOURCES);process.env.DEBUG_SKILLS&&(console.log(`[use_skill] Loaded ${d.length} skills from SkillLoader:`),d.forEach(A=>{console.log(` - ${A.name} (id: ${A.id}, isCustom: ${A.isCustom}, location: ${A.location?.type||"N/A"})`)}));let I=e.skillName.toLowerCase().trim(),u=d.filter(A=>{let p=(A.name||"").toLowerCase().trim(),y=(A.id||"").toLowerCase();return!!(p===I||y.endsWith(`:${I}`)||y===I||p.includes(I))});if(u.length===0){let A=d.map(W=>`${W.name} (id: ${W.id})`).join(", "),p=d.map(W=>W.name).sort().join(", "),y=d.map(W=>W.id).sort().join(", ");return{llmContent:`\u274C Skill "${e.skillName}" not found.
3552
+ </skills_instructions>`,Ga.LightBulb,{type:Pt.OBJECT,properties:{skillName:{type:Pt.STRING,description:'The skill name to activate (no arguments). E.g., "pdf", "test-pdf", "xlsx"'}},required:["skillName"]},!1,!1),this.config=e}validateToolParams(e){return!e.skillName||typeof e.skillName!="string"?"skillName is required and must be a string":e.skillName.trim().length===0?"skillName cannot be empty":null}getDescription(e){return`Loading skill: ${e.skillName}`}toolLocations(e){return[]}async shouldConfirmExecute(e,r){return!1}async execute(e,r){let n=this.validateToolParams(e);if(n)return{llmContent:`\u274C Invalid parameters: ${n}`,returnDisplay:`Invalid parameters: ${n}`};try{let i=new Sh;await i.initialize();let s=new Lh(i),t=new Cp(i,s,void 0,this.config?.getProjectRoot()),o=new mW(t,i),d=await t.loadEnabledSkills(yi.RESOURCES);process.env.DEBUG_SKILLS&&(console.log(`[use_skill] Loaded ${d.length} skills from SkillLoader:`),d.forEach(A=>{console.log(` - ${A.name} (id: ${A.id}, isCustom: ${A.isCustom}, location: ${A.location?.type||"N/A"})`)}));let I=e.skillName.toLowerCase().trim(),u=d.filter(A=>{let p=(A.name||"").toLowerCase().trim(),y=(A.id||"").toLowerCase();return!!(p===I||y.endsWith(`:${I}`)||y===I||p.includes(I))});if(u.length===0){let A=d.map(W=>`${W.name} (id: ${W.id})`).join(", "),p=d.map(W=>W.name).sort().join(", "),y=d.map(W=>W.id).sort().join(", ");return{llmContent:`\u274C Skill "${e.skillName}" not found.
3553
3553
 
3554
3554
  \u{1F4CA} Debug Information:
3555
3555
  - Your search: "${e.skillName}"
@@ -4040,11 +4040,11 @@ ${g}
4040
4040
 
4041
4041
  Dangerous commands cannot be auto-executed in YOLO mode. Please run this command in interactive mode for confirmation.`);console.error(`
4042
4042
  ${"=".repeat(80)}`),console.error("\u{1F6AB} DANGEROUS COMMAND EXECUTION PREVENTED"),console.error(`${"=".repeat(80)}`),console.error(`Rule: ${N}`),console.error(`Warning: ${g}`),console.error(`${"=".repeat(80)}
4043
- `);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let v=VX(e.name,e.callId,h);return{callId:e.callId,responseParts:v,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var q4r=_e(()=>{"use strict";aGe();gte();s$();});import{randomUUID as X4n}from"crypto";function RW(){return Qle||(Qle=X4n()),Qle}function K4r(a){Qle=a}function $4r(){Qle=void 0}var Qle,eAr,kht=_e(()=>{"use strict";eAr=RW()});import*as Tc from"fs";import*as AW from"path";import*as TS from"os";function k4n(a){EW.configure(a)}function S4n(a){EW.setUserInfo(a)}function L4n(a){EW.setCliVersion(a)}async function J4n(){return await EW.getUserHeaders()}function B4n(){return EW.getStatus()}var Hle,Dc,EW,Xle=_e(()=>{"use strict";lut();kht();sS();nm();Hle=259200,Dc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return cW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.127",this.config={proxyServerUrl:out()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Hle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Tc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Tc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Tc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=AW.dirname(this.userInfoFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Tc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Tc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=AW.dirname(this.jwtTokenFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Tc.existsSync(this.usageStatsFilePath)){let e=Tc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=AW.dirname(this.usageStatsFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Hle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Hle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Hle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Hle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":RW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":RW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Tc.existsSync(this.userInfoFilePath)&&Tc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},EW=Dc.getInstance()});function T4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function kle(a={}){let e=(a.baseUrl??EW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new xW("Proxy server URL is not configured");if(T4n(e))return[];let r=`${e}/web-api/models`,n=await EW.getUserHeaders(),i=a.timeoutMs??D4n,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new xW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new xW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&jDe(c))throw new c_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new xW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new xW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new xW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new xW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var D4n,xW,c_,tAr=_e(()=>{"use strict";Xle();yu();D4n=15e3,xW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},c_=class extends xW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Sht,rAr=_e(()=>{"use strict";Sht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as C5 from"node:fs";import*as d9 from"node:path";import*as aAr from"node:os";function Lht(){return d9.join(aAr.homedir(),Qo,"trusted-project-hooks.json")}function NRe(){try{let a=Lht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function nAr(a){let e=Lht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function u_(a){let e=d9.resolve(a),{trustedPaths:r}=NRe();return r.includes(e)}function Jht(a){let e=d9.resolve(a),r=NRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),nAr(r))}function Bht(a){let e=d9.resolve(a),r=NRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&nAr({trustedPaths:n})}function O4n(){return NRe().trustedPaths}var iAr=_e(()=>{"use strict";nm();});function sAr(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(by(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function oAr(a){if(a==null)return"";if(typeof a=="string")return Tht(a)??a;if(by(a))return a.error.message||"";if(cb(a)||a instanceof Error)return Tht(a.message)??a.message;try{return String(a)}catch{return""}}function Tht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function DS(a){let e=sAr(a),r=oAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var lAr=_e(()=>{"use strict";SH();});function dAr(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return M4n.includes(n)}function U4n(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function IAr(a){let e=U4n(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function WRe(a){return a1(a)}function Sle(a,e={}){if(!WRe(a))return null;let r=e.locale??"zh",n=IAr(a),i=dAr(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${uAr}`:`Sign in at ${cAr} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${uAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${cAr} \u5145\u503C\u3002`;return`${s}${t}`}var cAr,uAr,M4n,hAr=_e(()=>{"use strict";SH();cAr="https://hwjcode.bot/",uAr="https://applink.feishu.cn/T981u6WkPNNZ",M4n=["cmcm.com","orionstar.com"]});function FRe(a){let e=fw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function z4n(a,e=!1){let r=FRe(a);console.log(`
4043
+ `);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let v=VX(e.name,e.callId,h);return{callId:e.callId,responseParts:v,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var q4r=_e(()=>{"use strict";aGe();gte();s$();});import{randomUUID as X4n}from"crypto";function RW(){return Qle||(Qle=X4n()),Qle}function K4r(a){Qle=a}function $4r(){Qle=void 0}var Qle,eAr,kht=_e(()=>{"use strict";eAr=RW()});import*as Tc from"fs";import*as AW from"path";import*as TS from"os";function k4n(a){EW.configure(a)}function S4n(a){EW.setUserInfo(a)}function L4n(a){EW.setCliVersion(a)}async function J4n(){return await EW.getUserHeaders()}function B4n(){return EW.getStatus()}var Hle,Dc,EW,Xle=_e(()=>{"use strict";lut();kht();sS();nm();Hle=259200,Dc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return cW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=AW.join(TS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=AW.join(TS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=AW.join(TS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.129",this.config={proxyServerUrl:out()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Hle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Tc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Tc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Tc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=AW.dirname(this.userInfoFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Tc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Tc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=AW.dirname(this.jwtTokenFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Tc.existsSync(this.usageStatsFilePath)){let e=Tc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=AW.dirname(this.usageStatsFilePath);Tc.existsSync(e)||Tc.mkdirSync(e,{recursive:!0,mode:448}),Tc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Hle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Hle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Hle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Hle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":RW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":RW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Tc.existsSync(this.userInfoFilePath)&&Tc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Tc.existsSync(this.jwtTokenFilePath)&&Tc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},EW=Dc.getInstance()});function T4n(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function kle(a={}){let e=(a.baseUrl??EW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new xW("Proxy server URL is not configured");if(T4n(e))return[];let r=`${e}/web-api/models`,n=await EW.getUserHeaders(),i=a.timeoutMs??D4n,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new xW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new xW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&jDe(c))throw new c_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new xW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new xW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new xW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new xW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var D4n,xW,c_,tAr=_e(()=>{"use strict";Xle();yu();D4n=15e3,xW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},c_=class extends xW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Sht,rAr=_e(()=>{"use strict";Sht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as C5 from"node:fs";import*as d9 from"node:path";import*as aAr from"node:os";function Lht(){return d9.join(aAr.homedir(),Qo,"trusted-project-hooks.json")}function NRe(){try{let a=Lht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function nAr(a){let e=Lht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function u_(a){let e=d9.resolve(a),{trustedPaths:r}=NRe();return r.includes(e)}function Jht(a){let e=d9.resolve(a),r=NRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),nAr(r))}function Bht(a){let e=d9.resolve(a),r=NRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&nAr({trustedPaths:n})}function O4n(){return NRe().trustedPaths}var iAr=_e(()=>{"use strict";nm();});function sAr(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(by(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function oAr(a){if(a==null)return"";if(typeof a=="string")return Tht(a)??a;if(by(a))return a.error.message||"";if(cb(a)||a instanceof Error)return Tht(a.message)??a.message;try{return String(a)}catch{return""}}function Tht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function DS(a){let e=sAr(a),r=oAr(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var lAr=_e(()=>{"use strict";SH();});function dAr(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return M4n.includes(n)}function U4n(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function IAr(a){let e=U4n(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function WRe(a){return a1(a)}function Sle(a,e={}){if(!WRe(a))return null;let r=e.locale??"zh",n=IAr(a),i=dAr(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${uAr}`:`Sign in at ${cAr} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${uAr})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${cAr} \u5145\u503C\u3002`;return`${s}${t}`}var cAr,uAr,M4n,hAr=_e(()=>{"use strict";SH();cAr="https://hwjcode.bot/",uAr="https://applink.feishu.cn/T981u6WkPNNZ",M4n=["cmcm.com","orionstar.com"]});function FRe(a){let e=fw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function z4n(a,e=!1){let r=FRe(a);console.log(`
4044
4044
  \u{1F50D} Model Diagnostics: ${a}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
4045
4045
  \u26A0\uFE0F Warnings:`),r.warnings.forEach(n=>console.log(` \u2022 ${n}`))),e&&r.recommendations.length>0&&(console.log(`
4046
4046
  \u{1F4A1} Recommendations:`),r.recommendations.forEach(n=>console.log(` \u2022 ${n}`))),e&&(console.log(`
4047
- \u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function _4n(a){let e=FRe(a);return e.isSmallModel||e.needsSpecialHandling}function P4n(a){let e=FRe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var mAr=_e(()=>{"use strict";bte();});import*as HZ from"fs";import*as wRe from"path";var j4n,Lle,pAr=_e(()=>{"use strict";Nd();j4n="healthy-use-reminder.json",Lle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=_f(e);this.stateFilePath=wRe.join(r,j4n)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=wRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Dht,Oht,q4n,K4n,$4n,bAr=_e(()=>{"use strict";Dht="--- Content from referenced files ---",Oht="--- End of content ---",q4n=2e3,K4n=2e3,$4n=20});function GAr(...a){return eAn(...a)}function gAr(...a){return tAn(...a)}function fAr(a,e){return a in e}function Mht(){let a={get(i,s){if(s==="write")return GAr;if(fAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return gAr;if(fAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var eAn,tAn,vAr=_e(()=>{"use strict";eAn=process.stdout.write.bind(process.stdout),tAn=process.stderr.write.bind(process.stderr)});import{readFile as rAn}from"node:fs/promises";import{fileURLToPath as aAn}from"node:url";import Uht from"node:path";function nAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Uht.dirname(aAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Jle||(Jle=(async()=>"1.1.127")(),Jle)}function iAn(){Jle=void 0}var Jle,zht=_e(()=>{"use strict";});function sAn(a="latest"){let e=a?.trim().toLowerCase();return yAr.includes(e)?e:ZAr}var yAr,ZAr,NAr=_e(()=>{"use strict";yAr=["stable","latest"],ZAr="stable"});import{EventEmitter as oAn}from"node:events";var Ble,_ht,Pht,WAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Ble||(Ble={}));_ht=class{emitter=new oAn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Pht=new _ht});function RRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function lAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function jht(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??RRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?RRe(r.content):[],i=lAn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...RRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...RRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var FAr=_e(()=>{"use strict";});var OS,wAr,Tle,RAr=_e(()=>{"use strict";OS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},wAr="latest",Tle=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw OS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw OS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===wAr){let s=await this.listSessions();if(s.length===0)throw OS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new OS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function cAn(a,e,r){return new ARe(a,e,r)}var ARe,ERe,xRe,AAr=_e(()=>{"use strict";cte();sS();ARe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":cW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new ERe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new xRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},ERe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},xRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function uAn(a){return Dle.getInstance(a)}function dAn(a){let e=Dle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Dle,EAr=_e(()=>{"use strict";Xle();Dle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Dc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Dc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as CRe from"fs";import*as A2 from"path";function IAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ole,qht,xAr=_e(()=>{"use strict";Ole=IAn(),qht=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(A2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"auth","login","templates",e))),Ole&&r.push(A2.join(Ole,e)),Ole){let s=Ole;for(let t=0;t<10;t++)r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled",e)),r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e)),s=A2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"dist","bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(CRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Ole||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=CRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
4047
+ \u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function _4n(a){let e=FRe(a);return e.isSmallModel||e.needsSpecialHandling}function P4n(a){let e=FRe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var mAr=_e(()=>{"use strict";bte();});import*as HZ from"fs";import*as wRe from"path";var j4n,Lle,pAr=_e(()=>{"use strict";Nd();j4n="healthy-use-reminder.json",Lle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=_f(e);this.stateFilePath=wRe.join(r,j4n)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=wRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var Dht,Oht,q4n,K4n,$4n,bAr=_e(()=>{"use strict";Dht="--- Content from referenced files ---",Oht="--- End of content ---",q4n=2e3,K4n=2e3,$4n=20});function GAr(...a){return eAn(...a)}function gAr(...a){return tAn(...a)}function fAr(a,e){return a in e}function Mht(){let a={get(i,s){if(s==="write")return GAr;if(fAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return gAr;if(fAr(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var eAn,tAn,vAr=_e(()=>{"use strict";eAn=process.stdout.write.bind(process.stdout),tAn=process.stderr.write.bind(process.stderr)});import{readFile as rAn}from"node:fs/promises";import{fileURLToPath as aAn}from"node:url";import Uht from"node:path";function nAn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return Uht.dirname(aAn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Jle||(Jle=(async()=>"1.1.129")(),Jle)}function iAn(){Jle=void 0}var Jle,zht=_e(()=>{"use strict";});function sAn(a="latest"){let e=a?.trim().toLowerCase();return yAr.includes(e)?e:ZAr}var yAr,ZAr,NAr=_e(()=>{"use strict";yAr=["stable","latest"],ZAr="stable"});import{EventEmitter as oAn}from"node:events";var Ble,_ht,Pht,WAr=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(Ble||(Ble={}));_ht=class{emitter=new oAn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Pht=new _ht});function RRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function lAn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function jht(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??RRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?RRe(r.content):[],i=lAn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...RRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...RRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var FAr=_e(()=>{"use strict";});var OS,wAr,Tle,RAr=_e(()=>{"use strict";OS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},wAr="latest",Tle=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw OS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw OS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===wAr){let s=await this.listSessions();if(s.length===0)throw OS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new OS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function cAn(a,e,r){return new ARe(a,e,r)}var ARe,ERe,xRe,AAr=_e(()=>{"use strict";cte();sS();ARe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":cW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new ERe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new xRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},ERe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},xRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function uAn(a){return Dle.getInstance(a)}function dAn(a){let e=Dle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Dle,EAr=_e(()=>{"use strict";Xle();Dle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Dc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Dc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as CRe from"fs";import*as A2 from"path";function IAn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ole,qht,xAr=_e(()=>{"use strict";Ole=IAn(),qht=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(A2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(A2.join(this.customBasePath,"auth","login","templates",e))),Ole&&r.push(A2.join(Ole,e)),Ole){let s=Ole;for(let t=0;t<10;t++)r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled",e)),r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e)),s=A2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(A2.join(s,"bundle","login","templates",e)),r.push(A2.join(s,"dist","bundled","auth","login","templates",e)),r.push(A2.join(s,"bundled","auth","login","templates",e)),r.push(A2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(CRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Ole||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=CRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
4048
4048
  <!DOCTYPE html>
4049
4049
  <html>
4050
4050
  <head>
@@ -5347,7 +5347,7 @@ ${we("model.command.available.models")}${d}\uFF1A
5347
5347
  ${m}`;if(a.ui&&a.ui.addItem){let v={type:"error",text:Z};a.ui.addItem(v,Date.now())}return}if(r.setValue("User","preferredModel",I),n){let m=n.getGeminiClient();if(m){if(a.ui&&a.ui.addItem){let N={type:"info",text:kt("model.command.switching",{model:I})||`Switching to model ${I}, please wait...`};a.ui.addItem(N,Date.now())}await m.waitForChatInitialized();let Z=a.session.lastTokenUsage?.input_tokens,v=await m.switchModel(I,new AbortController().signal,Z);if(console.log("[modelCommand] switchResult:",{success:v.success,hasCompressionInfo:!!v.compressionInfo,hasCompressionSkipReason:!!v.compressionSkipReason,hasError:!!v.error}),!v.success){let N=`Failed to switch to model ${I}. ${v.error||"Context compression may have failed."}`;if(a.ui&&a.ui.addItem){let g={type:"error",text:N};a.ui.addItem(g,Date.now())}return}if(v.compressionInfo){let N="\u{1F4E6} Context compressed";if(a.ui&&a.ui.addItem){let g={type:"info",text:N};a.ui.addItem(g,Date.now())}}else if(v.compressionSkipReason){let N=`\u2713 ${v.compressionSkipReason}`;if(a.ui&&a.ui.addItem){let g={type:"info",text:N};a.ui.addItem(g,Date.now())}}else console.log("[modelCommand] No compression info or skip reason found in switch result")}else n.setModel(I);Ua.emit("model-changed",I)}let h=sl(I,n),c=kt("model.command.set.success",{model:h});if(I!=="auto"&&t.length>0){let m=t.find(Z=>Z.name===I);m&&m.creditsPerRequest&&(c+=`
5348
5348
  ${kt("model.command.credit.cost",{credits:m.creditsPerRequest})}`,m.highVolumeCredits&&m.highVolumeThreshold&&(c+=`
5349
5349
  \u{1F4B0} ${kt("model.command.long.context.short",{credits:m.highVolumeCredits,threshold:m.highVolumeThreshold.toLocaleString()})}`))}else I==="auto"&&(c+=`
5350
- ${we("model.command.auto.mode")}`);if(a.ui&&a.ui.addItem){let m={type:"info",text:c};a.ui.addItem(m,Date.now())}}catch(s){console.error("[ModelCommand] Operation failed:",s)}})().catch(s=>{console.error("[ModelCommand] Async operation failed:",s)})}}});function cYr(a){if(a.models.length<2||a.models.length>3)throw new Error(`debate requires 2-3 models, got ${a.models.length}`);if(a.rounds<1||a.rounds>2)throw new Error(`debate rounds must be 1 or 2, got ${a.rounds}`);return PI={topic:a.topic,models:[...a.models],rounds:a.rounds,language:a.language,cursor:{round:0,modelIdx:0},status:"running",originalModel:a.originalModel},PI}function B_(){return PI?(PI.cursor.modelIdx+=1,PI.cursor.modelIdx>=PI.models.length&&(PI.cursor.modelIdx=0,PI.cursor.round+=1),PI.cursor.round>=PI.rounds&&(PI.status="done"),PI):null}function Ed(){return PI}function A9(){PI&&PI.status==="running"&&(PI.status="paused")}function uYr(){return PI&&PI.status==="paused"?(PI.status="running",PI):null}function L5(){PI=null}function K4e(a){return a?a.cursor.round===a.rounds-1&&a.cursor.modelIdx===a.models.length-1:!1}var PI,T_=_e(()=>{"use strict";PI=null});var fYr=He(aAe=>{"use strict";var DVn=Symbol.for("react.transitional.element"),OVn=Symbol.for("react.fragment");function bYr(a,e,r){var n=null;if(r!==void 0&&(n=""+r),e.key!==void 0&&(n=""+e.key),"key"in e){r={};for(var i in e)i!=="key"&&(r[i]=e[i])}else r=e;return e=r.ref,{$$typeof:DVn,type:a,key:n,ref:e!==void 0?e:null,props:r}}aAe.Fragment=OVn;aAe.jsx=bYr;aAe.jsxs=bYr});var Fr=He((T0s,GYr)=>{"use strict";GYr.exports=fYr()});var Ud,FYr,wYr=_e(()=>{"use strict";qb();Ud={type:"dark",Background:"#0b0e14",Foreground:"#bfbdb6",LightBlue:"#59C2FF",AccentBlue:"#39BAE6",AccentPurple:"#D2A6FF",AccentCyan:"#95E6CB",AccentGreen:"#AAD94C",AccentYellow:"#FFB454",AccentOrange:"#FF8C00",AccentRed:"#F26D78",DiffAdded:"#293022",DiffRemoved:"#3D1215",Comment:"#646A71",Gray:"#3D4149",InfoColor:"#B8A77E",GradientColors:["#FFB454","#F26D78"]},FYr=new ql("Ayu","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Ud.Background,color:Ud.Foreground},"hljs-keyword":{color:Ud.AccentYellow},"hljs-literal":{color:Ud.AccentPurple},"hljs-symbol":{color:Ud.AccentCyan},"hljs-name":{color:Ud.LightBlue},"hljs-link":{color:Ud.AccentBlue},"hljs-function .hljs-keyword":{color:Ud.AccentYellow},"hljs-subst":{color:Ud.Foreground},"hljs-string":{color:Ud.AccentGreen},"hljs-title":{color:Ud.AccentYellow},"hljs-type":{color:Ud.AccentBlue},"hljs-attribute":{color:Ud.AccentYellow},"hljs-bullet":{color:Ud.AccentYellow},"hljs-addition":{color:Ud.AccentGreen},"hljs-variable":{color:Ud.Foreground},"hljs-template-tag":{color:Ud.AccentYellow},"hljs-template-variable":{color:Ud.AccentYellow},"hljs-comment":{color:Ud.Comment,fontStyle:"italic"},"hljs-quote":{color:Ud.AccentCyan,fontStyle:"italic"},"hljs-deletion":{color:Ud.AccentRed},"hljs-meta":{color:Ud.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Ud)});var Cl,RYr,AYr=_e(()=>{"use strict";qb();Cl={type:"light",Background:"#f8f9fa",Foreground:"#5c6166",LightBlue:"#55b4d4",AccentBlue:"#399ee6",AccentPurple:"#a37acc",AccentCyan:"#4cbf99",AccentGreen:"#86b300",AccentYellow:"#f2ae49",AccentOrange:"#FF8C00",AccentRed:"#f07171",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#ABADB1",Gray:"#a6aaaf",InfoColor:"#8B7355",GradientColors:["#399ee6","#86b300"]},RYr=new ql("Ayu Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Cl.Background,color:Cl.Foreground},"hljs-comment":{color:Cl.Comment,fontStyle:"italic"},"hljs-quote":{color:Cl.AccentCyan,fontStyle:"italic"},"hljs-string":{color:Cl.AccentGreen},"hljs-constant":{color:Cl.AccentCyan},"hljs-number":{color:Cl.AccentPurple},"hljs-keyword":{color:Cl.AccentYellow},"hljs-selector-tag":{color:Cl.AccentYellow},"hljs-attribute":{color:Cl.AccentYellow},"hljs-variable":{color:Cl.Foreground},"hljs-variable.language":{color:Cl.LightBlue,fontStyle:"italic"},"hljs-title":{color:Cl.AccentBlue},"hljs-section":{color:Cl.AccentGreen,fontWeight:"bold"},"hljs-type":{color:Cl.LightBlue},"hljs-class .hljs-title":{color:Cl.AccentBlue},"hljs-tag":{color:Cl.LightBlue},"hljs-name":{color:Cl.AccentBlue},"hljs-builtin-name":{color:Cl.AccentYellow},"hljs-meta":{color:Cl.AccentYellow},"hljs-symbol":{color:Cl.AccentRed},"hljs-bullet":{color:Cl.AccentYellow},"hljs-regexp":{color:Cl.AccentCyan},"hljs-link":{color:Cl.LightBlue},"hljs-deletion":{color:Cl.AccentRed},"hljs-addition":{color:Cl.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-literal":{color:Cl.AccentCyan},"hljs-built_in":{color:Cl.AccentRed},"hljs-doctag":{color:Cl.AccentRed},"hljs-template-variable":{color:Cl.AccentCyan},"hljs-selector-id":{color:Cl.AccentRed}},Cl)});var Do,EYr,xYr=_e(()=>{"use strict";qb();Do={type:"dark",Background:"#282c34",Foreground:"#abb2bf",LightBlue:"#61aeee",AccentBlue:"#61aeee",AccentPurple:"#c678dd",AccentCyan:"#56b6c2",AccentGreen:"#98c379",AccentYellow:"#e6c07b",AccentOrange:"#FF8C00",AccentRed:"#e06c75",DiffAdded:"#39544E",DiffRemoved:"#562B2F",Comment:"#5c6370",Gray:"#5c6370",InfoColor:"#B8A77E",GradientColors:["#61aeee","#98c379"]},EYr=new ql("Atom One","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Do.Foreground,background:Do.Background},"hljs-comment":{color:Do.Comment,fontStyle:"italic"},"hljs-quote":{color:Do.Comment,fontStyle:"italic"},"hljs-doctag":{color:Do.AccentPurple},"hljs-keyword":{color:Do.AccentPurple},"hljs-formula":{color:Do.AccentPurple},"hljs-section":{color:Do.AccentRed},"hljs-name":{color:Do.AccentRed},"hljs-selector-tag":{color:Do.AccentRed},"hljs-deletion":{color:Do.AccentRed},"hljs-subst":{color:Do.AccentRed},"hljs-literal":{color:Do.AccentCyan},"hljs-string":{color:Do.AccentGreen},"hljs-regexp":{color:Do.AccentGreen},"hljs-addition":{color:Do.AccentGreen},"hljs-attribute":{color:Do.AccentGreen},"hljs-meta-string":{color:Do.AccentGreen},"hljs-built_in":{color:Do.AccentYellow},"hljs-class .hljs-title":{color:Do.AccentYellow},"hljs-attr":{color:Do.AccentYellow},"hljs-variable":{color:Do.AccentYellow},"hljs-template-variable":{color:Do.AccentYellow},"hljs-type":{color:Do.AccentYellow},"hljs-selector-class":{color:Do.AccentYellow},"hljs-selector-attr":{color:Do.AccentYellow},"hljs-selector-pseudo":{color:Do.AccentYellow},"hljs-number":{color:Do.AccentYellow},"hljs-symbol":{color:Do.AccentBlue},"hljs-bullet":{color:Do.AccentBlue},"hljs-link":{color:Do.AccentBlue,textDecoration:"underline"},"hljs-meta":{color:Do.AccentBlue},"hljs-selector-id":{color:Do.AccentBlue},"hljs-title":{color:Do.AccentBlue},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Do)});var $u,CYr,YYr=_e(()=>{"use strict";qb();$u={type:"dark",Background:"#282a36",Foreground:"#f8f8f2",LightBlue:"#8be9fd",AccentBlue:"#8be9fd",AccentPurple:"#ff79c6",AccentCyan:"#8be9fd",AccentGreen:"#50fa7b",AccentYellow:"#f1fa8c",AccentOrange:"#FF8C00",AccentRed:"#ff5555",DiffAdded:"#11431d",DiffRemoved:"#6e1818",Comment:"#6272a4",Gray:"#6272a4",InfoColor:"#B8A77E",GradientColors:["#ff79c6","#8be9fd"]},CYr=new ql("Dracula","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:$u.Background,color:$u.Foreground},"hljs-keyword":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-selector-tag":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-literal":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-section":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-link":{color:$u.AccentBlue},"hljs-function .hljs-keyword":{color:$u.AccentPurple},"hljs-subst":{color:$u.Foreground},"hljs-string":{color:$u.AccentYellow},"hljs-title":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-name":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-type":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-attribute":{color:$u.AccentYellow},"hljs-symbol":{color:$u.AccentYellow},"hljs-bullet":{color:$u.AccentYellow},"hljs-addition":{color:$u.AccentGreen},"hljs-variable":{color:$u.AccentYellow},"hljs-template-tag":{color:$u.AccentYellow},"hljs-template-variable":{color:$u.AccentYellow},"hljs-comment":{color:$u.Comment},"hljs-quote":{color:$u.Comment},"hljs-deletion":{color:$u.AccentRed},"hljs-meta":{color:$u.Comment},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},$u)});var Yl,VYr,QYr=_e(()=>{"use strict";qb();Yl={type:"dark",Background:"#24292e",Foreground:"#d1d5da",LightBlue:"#79B8FF",AccentBlue:"#79B8FF",AccentPurple:"#B392F0",AccentCyan:"#9ECBFF",AccentGreen:"#85E89D",AccentYellow:"#FFAB70",AccentOrange:"#FF8C00",AccentRed:"#F97583",DiffAdded:"#3C4636",DiffRemoved:"#502125",Comment:"#6A737D",Gray:"#6A737D",InfoColor:"#B8A77E",GradientColors:["#79B8FF","#85E89D"]},VYr=new ql("GitHub","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Yl.Foreground,background:Yl.Background},"hljs-comment":{color:Yl.Comment,fontStyle:"italic"},"hljs-quote":{color:Yl.Comment,fontStyle:"italic"},"hljs-keyword":{color:Yl.AccentRed,fontWeight:"bold"},"hljs-selector-tag":{color:Yl.AccentRed,fontWeight:"bold"},"hljs-subst":{color:Yl.Foreground},"hljs-number":{color:Yl.LightBlue},"hljs-literal":{color:Yl.LightBlue},"hljs-variable":{color:Yl.AccentYellow},"hljs-template-variable":{color:Yl.AccentYellow},"hljs-tag .hljs-attr":{color:Yl.AccentYellow},"hljs-string":{color:Yl.AccentCyan},"hljs-doctag":{color:Yl.AccentCyan},"hljs-title":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-section":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Yl.AccentGreen,fontWeight:"bold"},"hljs-class .hljs-title":{color:Yl.AccentGreen,fontWeight:"bold"},"hljs-tag":{color:Yl.AccentGreen},"hljs-name":{color:Yl.AccentGreen},"hljs-attribute":{color:Yl.LightBlue},"hljs-regexp":{color:Yl.AccentCyan},"hljs-link":{color:Yl.AccentCyan},"hljs-symbol":{color:Yl.AccentPurple},"hljs-bullet":{color:Yl.AccentPurple},"hljs-built_in":{color:Yl.LightBlue},"hljs-builtin-name":{color:Yl.LightBlue},"hljs-meta":{color:Yl.LightBlue,fontWeight:"bold"},"hljs-deletion":{background:"#86181D",color:Yl.AccentRed},"hljs-addition":{background:"#144620",color:Yl.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Yl)});var nc,HYr,XYr=_e(()=>{"use strict";qb();nc={type:"light",Background:"#f8f8f8",Foreground:"#24292E",LightBlue:"#0086b3",AccentBlue:"#458",AccentPurple:"#900",AccentCyan:"#009926",AccentGreen:"#008080",AccentYellow:"#990073",AccentOrange:"#FF8C00",AccentRed:"#d14",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#998",Gray:"#999",InfoColor:"#8B7355",GradientColors:["#458","#008080"]},HYr=new ql("GitHub Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:nc.Foreground,background:nc.Background},"hljs-comment":{color:nc.Comment,fontStyle:"italic"},"hljs-quote":{color:nc.Comment,fontStyle:"italic"},"hljs-keyword":{color:nc.Foreground,fontWeight:"bold"},"hljs-selector-tag":{color:nc.Foreground,fontWeight:"bold"},"hljs-subst":{color:nc.Foreground,fontWeight:"normal"},"hljs-number":{color:nc.AccentGreen},"hljs-literal":{color:nc.AccentGreen},"hljs-variable":{color:nc.AccentGreen},"hljs-template-variable":{color:nc.AccentGreen},"hljs-tag .hljs-attr":{color:nc.AccentGreen},"hljs-string":{color:nc.AccentRed},"hljs-doctag":{color:nc.AccentRed},"hljs-title":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-section":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-type":{color:nc.AccentBlue,fontWeight:"bold"},"hljs-class .hljs-title":{color:nc.AccentBlue,fontWeight:"bold"},"hljs-tag":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-name":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-attribute":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-regexp":{color:nc.AccentCyan},"hljs-link":{color:nc.AccentCyan},"hljs-symbol":{color:nc.AccentYellow},"hljs-bullet":{color:nc.AccentYellow},"hljs-built_in":{color:nc.LightBlue},"hljs-builtin-name":{color:nc.LightBlue},"hljs-meta":{color:nc.Gray,fontWeight:"bold"},"hljs-deletion":{background:"#fdd"},"hljs-addition":{background:"#dfd"},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},nc)});var Vl,kYr,SYr=_e(()=>{"use strict";qb();Vl={type:"light",Background:"white",Foreground:"#444",LightBlue:"#066",AccentBlue:"#008",AccentPurple:"#606",AccentCyan:"#066",AccentGreen:"#080",AccentYellow:"#660",AccentOrange:"#FF8C00",AccentRed:"#800",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#5f6368",Gray:xl.Gray,InfoColor:"#8B7355",GradientColors:["#066","#606"]},kYr=new ql("Google Code","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Vl.Background,color:Vl.Foreground},"hljs-comment":{color:Vl.AccentRed},"hljs-quote":{color:Vl.AccentRed},"hljs-keyword":{color:Vl.AccentBlue},"hljs-selector-tag":{color:Vl.AccentBlue},"hljs-section":{color:Vl.AccentBlue},"hljs-title":{color:Vl.AccentPurple},"hljs-name":{color:Vl.AccentBlue},"hljs-variable":{color:Vl.AccentYellow},"hljs-template-variable":{color:Vl.AccentYellow},"hljs-string":{color:Vl.AccentGreen},"hljs-selector-attr":{color:Vl.AccentGreen},"hljs-selector-pseudo":{color:Vl.AccentGreen},"hljs-regexp":{color:Vl.AccentGreen},"hljs-literal":{color:Vl.AccentCyan},"hljs-symbol":{color:Vl.AccentCyan},"hljs-bullet":{color:Vl.AccentCyan},"hljs-meta":{color:Vl.AccentCyan},"hljs-number":{color:Vl.AccentCyan},"hljs-link":{color:Vl.AccentCyan},"hljs-doctag":{color:Vl.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Vl.AccentPurple},"hljs-attr":{color:Vl.AccentPurple},"hljs-built_in":{color:Vl.AccentPurple},"hljs-builtin-name":{color:Vl.AccentPurple},"hljs-params":{color:Vl.AccentPurple},"hljs-attribute":{color:Vl.Foreground},"hljs-subst":{color:Vl.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-selector-id":{color:Vl.AccentYellow},"hljs-selector-class":{color:Vl.AccentYellow},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Vl)});var ns,Y0,LYr,JYr=_e(()=>{"use strict";qb();ns={type:"dark",Background:"#2d2b57",Foreground:"#e3dfff",LightBlue:"#847ace",AccentBlue:"#a599e9",AccentPurple:"#ac65ff",AccentCyan:"#a1feff",AccentGreen:"#A5FF90",AccentYellow:"#fad000",AccentOrange:"#FF8C00",AccentRed:"#ff628c",DiffAdded:"#383E45",DiffRemoved:"#572244",Comment:"#B362FF",Gray:"#726c86",InfoColor:"#B8A77E",GradientColors:["#4d21fc","#847ace","#ff628c"]},Y0={AccentYellowAlt:"#f8d000",AccentOrange:"#fb9e00",AccentPink:"#fa658d",AccentLightPurple:"#c991ff",AccentDarkPurple:"#6943ff",AccentTeal:"#2ee2fa"},LYr=new ql("Shades Of Purple","dark",{hljs:{display:"block",overflowX:"auto",background:ns.Background,color:ns.Foreground},"hljs-title":{color:ns.AccentYellow,fontWeight:"normal"},"hljs-name":{color:ns.AccentCyan,fontWeight:"normal"},"hljs-tag":{color:ns.Foreground},"hljs-attr":{color:Y0.AccentYellowAlt,fontStyle:"italic"},"hljs-built_in":{color:Y0.AccentOrange},"hljs-selector-tag":{color:Y0.AccentOrange,fontWeight:"normal"},"hljs-section":{color:Y0.AccentOrange},"hljs-keyword":{color:Y0.AccentOrange,fontWeight:"normal"},"hljs-subst":{color:ns.Foreground},"hljs-string":{color:ns.AccentGreen},"hljs-attribute":{color:ns.AccentGreen},"hljs-symbol":{color:ns.AccentGreen},"hljs-bullet":{color:ns.AccentGreen},"hljs-addition":{color:ns.AccentGreen},"hljs-code":{color:ns.AccentGreen},"hljs-regexp":{color:ns.AccentGreen},"hljs-selector-class":{color:ns.AccentGreen},"hljs-selector-attr":{color:ns.AccentGreen},"hljs-selector-pseudo":{color:ns.AccentGreen},"hljs-template-tag":{color:ns.AccentGreen},"hljs-quote":{color:ns.AccentGreen},"hljs-deletion":{color:ns.AccentRed},"hljs-meta":{color:Y0.AccentOrange},"hljs-meta-string":{color:Y0.AccentOrange},"hljs-comment":{color:ns.AccentPurple},"hljs-literal":{color:Y0.AccentPink,fontWeight:"normal"},"hljs-number":{color:Y0.AccentPink},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-diff":{color:ns.Foreground},"hljs-meta.hljs-diff":{color:ns.AccentBlue},"hljs-ln":{color:ns.Gray},"hljs-type":{color:ns.AccentYellow,fontWeight:"normal"},"hljs-variable":{color:ns.AccentYellow},"hljs-template-variable":{color:ns.AccentGreen},"hljs-function .hljs-keyword":{color:Y0.AccentOrange},"hljs-link":{color:ns.LightBlue},"hljs-doctag":{fontWeight:"bold"},"hljs-params":{color:Y0.AccentLightPurple,fontStyle:"italic"},"hljs-class":{color:ns.AccentCyan,fontWeight:"bold"},"hljs-function":{color:ns.AccentCyan},"hljs-property":{color:ns.AccentBlue},"hljs-operator":{color:Y0.AccentDarkPurple},"hljs-punctuation":{color:ns.Gray},"hljs-selector-id":{color:ns.AccentYellow,fontWeight:"bold"},"hljs-char":{color:ns.AccentGreen},"hljs-escape":{color:Y0.AccentPink,fontWeight:"bold"},"hljs-meta-keyword":{color:Y0.AccentOrange,fontWeight:"bold"},"hljs-builtin-name":{color:Y0.AccentTeal},"hljs-module":{color:ns.AccentCyan},"hljs-namespace":{color:ns.LightBlue},"hljs-important":{color:ns.AccentRed,fontWeight:"bold"},"hljs-formula":{color:ns.AccentCyan,fontStyle:"italic"},"hljs-decorator":{color:Y0.AccentTeal,fontWeight:"bold"},"hljs-symbol.ruby":{color:Y0.AccentPink},"hljs-keyword.sql":{color:Y0.AccentOrange,textTransform:"uppercase"},"hljs-section.markdown":{color:ns.AccentYellow,fontWeight:"bold"},"hljs-attr.json":{color:ns.AccentCyan},"hljs-tag .hljs-name":{color:ns.AccentRed},"hljs-tag .hljs-attr":{color:Y0.AccentYellowAlt},"hljs.hljs-line-numbers":{borderRight:`1px solid ${ns.Gray}`},"hljs.hljs-line-numbers .hljs-ln-numbers":{color:ns.Gray,paddingRight:"1em"},"hljs.hljs-line-numbers .hljs-ln-code":{paddingLeft:"1em"},"hljs::selection":{background:ns.AccentBlue+"40"},"hljs ::-moz-selection":{background:ns.AccentBlue+"40"},"hljs .hljs-highlight":{background:ns.AccentPurple+"20",display:"block",width:"100%"}},ns)});var ol,BYr,TYr=_e(()=>{"use strict";qb();ol={type:"light",Background:"#fff",Foreground:"#444",LightBlue:"#0E0EFF",AccentBlue:"#1c00cf",AccentPurple:"#aa0d91",AccentCyan:"#3F6E74",AccentGreen:"#007400",AccentYellow:"#836C28",AccentOrange:"#FF8C00",AccentRed:"#c41a16",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#007400",Gray:"#c0c0c0",InfoColor:"#8B7355",GradientColors:["#1c00cf","#007400"]},BYr=new ql("Xcode","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:ol.Background,color:ol.Foreground},"xml .hljs-meta":{color:ol.Gray},"hljs-comment":{color:ol.Comment},"hljs-quote":{color:ol.Comment},"hljs-tag":{color:ol.AccentPurple},"hljs-attribute":{color:ol.AccentPurple},"hljs-keyword":{color:ol.AccentPurple},"hljs-selector-tag":{color:ol.AccentPurple},"hljs-literal":{color:ol.AccentPurple},"hljs-name":{color:ol.AccentPurple},"hljs-variable":{color:ol.AccentCyan},"hljs-template-variable":{color:ol.AccentCyan},"hljs-code":{color:ol.AccentRed},"hljs-string":{color:ol.AccentRed},"hljs-meta-string":{color:ol.AccentRed},"hljs-regexp":{color:ol.LightBlue},"hljs-link":{color:ol.LightBlue},"hljs-title":{color:ol.AccentBlue},"hljs-symbol":{color:ol.AccentBlue},"hljs-bullet":{color:ol.AccentBlue},"hljs-number":{color:ol.AccentBlue},"hljs-section":{color:ol.AccentYellow},"hljs-meta":{color:ol.AccentYellow},"hljs-class .hljs-title":{color:ol.AccentPurple},"hljs-type":{color:ol.AccentPurple},"hljs-built_in":{color:ol.AccentPurple},"hljs-builtin-name":{color:ol.AccentPurple},"hljs-params":{color:ol.AccentPurple},"hljs-attr":{color:ol.AccentYellow},"hljs-subst":{color:ol.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-selector-id":{color:ol.AccentYellow},"hljs-selector-class":{color:ol.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},ol)});var jVn,DYr,OYr=_e(()=>{"use strict";qb();jVn={type:"dark",Background:"black",Foreground:"white",LightBlue:"bluebright",AccentBlue:"blue",AccentPurple:"magenta",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"yellow",AccentOrange:"yellow",AccentRed:"red",DiffAdded:"#003300",DiffRemoved:"#4D0000",Comment:"gray",Gray:"gray",InfoColor:"yellow",GradientColors:["cyan","green"]},DYr=new ql("ANSI","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"black",color:"white"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"yellow"},"hljs-meta-string":{color:"yellow"},"hljs-regexp":{color:"red"},"hljs-template-tag":{color:"red"},"hljs-subst":{color:"white"},"hljs-function":{color:"white"},"hljs-title":{color:"white"},"hljs-params":{color:"white"},"hljs-formula":{color:"white"},"hljs-comment":{color:"green"},"hljs-quote":{color:"green"},"hljs-doctag":{color:"green"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"magenta"},"hljs-template-variable":{color:"magenta"},"hljs-attr":{color:"bluebright"},"hljs-attribute":{color:"bluebright"},"hljs-builtin-name":{color:"bluebright"},"hljs-section":{color:"yellow"},"hljs-emphasis":{},"hljs-strong":{},"hljs-bullet":{color:"yellow"},"hljs-selector-tag":{color:"yellow"},"hljs-selector-id":{color:"yellow"},"hljs-selector-class":{color:"yellow"},"hljs-selector-attr":{color:"yellow"},"hljs-selector-pseudo":{color:"yellow"}},jVn)});var qVn,MYr,UYr=_e(()=>{"use strict";qb();qVn={type:"light",Background:"white",Foreground:"#444",LightBlue:"blue",AccentBlue:"blue",AccentPurple:"purple",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"orange",AccentOrange:"yellow",AccentRed:"red",DiffAdded:"#E5F2E5",DiffRemoved:"#FFE5E5",Comment:"gray",Gray:"gray",InfoColor:"yellow",GradientColors:["blue","green"]},MYr=new ql("ANSI Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"white",color:"black"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"red"},"hljs-meta-string":{color:"red"},"hljs-regexp":{color:"magenta"},"hljs-template-tag":{color:"magenta"},"hljs-subst":{color:"black"},"hljs-function":{color:"black"},"hljs-title":{color:"black"},"hljs-params":{color:"black"},"hljs-formula":{color:"black"},"hljs-comment":{color:"gray"},"hljs-quote":{color:"gray"},"hljs-doctag":{color:"gray"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"purple"},"hljs-template-variable":{color:"purple"},"hljs-attr":{color:"blue"},"hljs-attribute":{color:"blue"},"hljs-builtin-name":{color:"blue"},"hljs-section":{color:"orange"},"hljs-bullet":{color:"orange"},"hljs-selector-tag":{color:"orange"},"hljs-selector-id":{color:"orange"},"hljs-selector-class":{color:"orange"},"hljs-selector-attr":{color:"orange"},"hljs-selector-pseudo":{color:"orange"}},qVn)});var KVn,zYr,_Yr=_e(()=>{"use strict";qb();KVn={type:"ansi",Background:"",Foreground:"",LightBlue:"",AccentBlue:"",AccentPurple:"",AccentCyan:"",AccentGreen:"",AccentYellow:"",AccentOrange:"",AccentRed:"",DiffAdded:"",DiffRemoved:"",Comment:"",Gray:"",InfoColor:""},zYr=new ql("NoColor","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em"},"hljs-keyword":{},"hljs-literal":{},"hljs-symbol":{},"hljs-name":{},"hljs-link":{textDecoration:"underline"},"hljs-built_in":{},"hljs-type":{},"hljs-number":{},"hljs-class":{},"hljs-string":{},"hljs-meta-string":{},"hljs-regexp":{},"hljs-template-tag":{},"hljs-subst":{},"hljs-function":{},"hljs-title":{},"hljs-params":{},"hljs-formula":{},"hljs-comment":{fontStyle:"italic"},"hljs-quote":{fontStyle:"italic"},"hljs-doctag":{},"hljs-meta":{},"hljs-meta-keyword":{},"hljs-tag":{},"hljs-variable":{},"hljs-template-variable":{},"hljs-attr":{},"hljs-attribute":{},"hljs-builtin-name":{},"hljs-section":{},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{},"hljs-selector-tag":{},"hljs-selector-id":{},"hljs-selector-class":{},"hljs-selector-attr":{},"hljs-selector-pseudo":{},"hljs-addition":{display:"inline-block",width:"100%"},"hljs-deletion":{display:"inline-block",width:"100%"}},KVn)});import $Vn from"node:process";var B5,Mmt,Ao,C9=_e(()=>{"use strict";wYr();AYr();xYr();YYr();QYr();XYr();SYr();xmt();Cmt();JYr();TYr();qb();OYr();UYr();_Yr();B5=eL,Mmt=class{availableThemes;activeTheme;customThemes=new Map;constructor(){this.availableThemes=[FYr,RYr,EYr,CYr,X_,eL,VYr,HYr,kYr,LYr,BYr,DYr,MYr],this.activeTheme=B5}loadCustomThemes(e){if(this.customThemes.clear(),!!e){for(let[r,n]of Object.entries(e)){let i=JCr(n);if(i.isValid){i.warning&&console.warn(`Theme "${r}": ${i.warning}`);let s={...B5.colors,...n,name:n.name||r,type:"custom"};try{let t=LCr(s);this.customThemes.set(r,t)}catch(t){console.warn(`Failed to load custom theme "${r}":`,t)}}else console.warn(`Invalid custom theme "${r}": ${i.error}`)}this.activeTheme&&this.activeTheme.type==="custom"&&this.customThemes.has(this.activeTheme.name)&&(this.activeTheme=this.customThemes.get(this.activeTheme.name))}}setActiveTheme(e){let r=this.findThemeByName(e);return r?(this.activeTheme=r,!0):!1}getActiveTheme(){return $Vn.env.NO_COLOR?zYr:((!this.activeTheme||!this.findThemeByName(this.activeTheme.name))&&(this.activeTheme=B5),this.activeTheme)}getCustomThemeNames(){return Array.from(this.customThemes.keys())}isCustomTheme(e){return this.customThemes.has(e)}getAvailableThemes(){let e=this.availableThemes.map(s=>({name:s.name,type:s.type,isCustom:!1})),r=Array.from(this.customThemes.values()).map(s=>({name:s.name,type:s.type,isCustom:!0}));return[...e,...r].sort((s,t)=>{let o=I=>{switch(I){case"dark":return 1;case"light":return 2;case"ansi":return 3;case"custom":return 4;default:return 5}},d=o(s.type)-o(t.type);return d!==0?d:s.name.localeCompare(t.name)})}getTheme(e){return this.findThemeByName(e)}findThemeByName(e){if(!e)return B5;let r=this.availableThemes.find(n=>n.name===e);return r||this.customThemes.get(e)}},Ao=new Mmt});var Ue,za=_e(()=>{"use strict";C9();Ue={get type(){return Ao.getActiveTheme().colors.type},get Foreground(){return Ao.getActiveTheme().colors.Foreground},get Background(){return Ao.getActiveTheme().colors.Background},get LightBlue(){return Ao.getActiveTheme().colors.LightBlue},get AccentBlue(){return Ao.getActiveTheme().colors.AccentBlue},get AccentPurple(){return Ao.getActiveTheme().colors.AccentPurple},get AccentCyan(){return Ao.getActiveTheme().colors.AccentCyan},get AccentGreen(){return Ao.getActiveTheme().colors.AccentGreen},get AccentYellow(){return Ao.getActiveTheme().colors.AccentYellow},get AccentOrange(){return Ao.getActiveTheme().colors.AccentOrange},get AccentRed(){return Ao.getActiveTheme().colors.AccentRed},get DiffAdded(){return Ao.getActiveTheme().colors.DiffAdded},get DiffRemoved(){return Ao.getActiveTheme().colors.DiffRemoved},get Comment(){return Ao.getActiveTheme().colors.Comment},get Gray(){return Ao.getActiveTheme().colors.Gray},get InfoColor(){return Ao.getActiveTheme().colors.InfoColor},get GradientColors(){return Ao.getActiveTheme().colors.GradientColors}}});var IVr={};Xs(IVr,{buildSwitchMessage:()=>sAe,detectNLTrigger:()=>_mt,getNoiseWords:()=>d9n,getToolToggleRules:()=>u9n});function zmt(a){let e=a.replace(/^custom:/,""),r=e.indexOf(":");if(r<0)return a;let n=e.slice(r+1),i=n.lastIndexOf("@");return i>0?n.slice(0,i):n}function lVr(a){let e=a;e=e.replace(/[。,!?.,!?;;::、~~\s]+$/g,"");for(let r of uVr)e=e.replace(r,"");return e.trim()}function l9n(a){let e=["\u81EA\u5B9A\u4E49\u7684","\u81EA\u5B9A\u4E49"];for(let r of e)if(a.includes(r))return{customOnly:!0,cleaned:a.replace(r,"").trim()};return{customOnly:!1,cleaned:a}}function cVr(a,e){let r=a.toLowerCase();for(let n of e)if(r.startsWith(n.toLowerCase()))return n;for(let n of e)if(r.indexOf(n.toLowerCase())>0)return n;return null}function c9n(a,e,r,n){let i=a.toLowerCase(),s=n?e.filter(d=>d.isCustom):e,t=d=>({modelName:d.name,modelDisplayName:d.displayName||d.name,isCustom:d.isCustom||!1});for(let d of s)if(d.name.toLowerCase()===i)return t(d);if(!n){for(let d of e.filter(I=>I.isCustom))if(zmt(d.name).toLowerCase()===i)return t(d)}for(let d of s)if(d.displayName?.toLowerCase()===i)return t(d);let o=i.split(/\s+/).filter(d=>d.length>0);for(let d of s){let I=d.name.toLowerCase(),u=(d.displayName||"").toLowerCase(),h=`${I} ${u}`;if(o.every(c=>h.includes(c)))return t(d)}if(!n)for(let d of e.filter(I=>I.isCustom)){let I=zmt(d.name).toLowerCase(),u=(d.displayName||"").toLowerCase(),h=`${I} ${u}`;if(o.every(c=>h.includes(c)))return t(d)}if(r){let d=r[i];if(d)for(let I of s){let u=I.name.toLowerCase(),h=I.isCustom?zmt(I.name).toLowerCase():u;if(u.startsWith(d)||h.startsWith(d))return t(I)}}if(!n){for(let d of s)if(d.name.toLowerCase().startsWith(i))return t(d)}return null}function _mt(a,e){if(!a)return null;let r=a.trim();if(r.length<2||r.startsWith("/")||r.startsWith("?"))return null;for(let n of dVr)switch(n.type){case"modelSwitch":{if(!e?.favorites?.length)continue;let i="",s="";for(let u of n.keywords){if(r.startsWith(u)){i=u,s=r.slice(u.length).trim();break}let h=r.indexOf(u);if(h>0&&h+u.length<r.length){i=u,s=r.slice(h+u.length).trim();break}}if(!i||!s)continue;let{customOnly:t,cleaned:o}=l9n(s),d=lVr(o);if(!d)continue;let I=c9n(d,e.favorites,n.vendorAliases,t);return I?{type:"modelSwitch",matchedKeyword:i,modelName:I.modelName,modelDisplayName:I.modelDisplayName,isCustom:I.isCustom}:null}case"command":{let i=cVr(r,n.keywords);if(i)return{type:"command",matchedKeyword:i,slashCommand:n.slashCommand};let s=lVr(r);if(s!==r){let t=cVr(s,n.keywords);if(t)return{type:"command",matchedKeyword:t,slashCommand:n.slashCommand}}break}case"toolToggle":{if(n.enableKeywords.includes(r))return{type:"toolToggle",matchedKeyword:r,slashCommand:n.enableSlashCommand};if(n.disableKeywords.includes(r))return{type:"toolToggle",matchedKeyword:r,slashCommand:n.disableSlashCommand};break}}return null}function sAe(a,e){return`\u{1F504} \u5DF2\u5207\u6362\u6A21\u578B\u4E3A\uFF1A${a}`}function u9n(){return dVr.filter(a=>a.type==="toolToggle")}function d9n(){return[...uVr]}var uVr,dVr,Pmt=_e(()=>{"use strict";uVr=["\u6A21\u578B","\u7684","\u4E00\u4E0B","\u5E2E\u6211","\u7ED9\u6211","\u5E2E\u5FD9","\u73B0\u5728","\u7136\u540E","\u90A3\u4E2A","\u8FD9\u4E2A","\u8BF7","\u9EBB\u70E6","\u6362","\u5207\u6362","\u5207\u6362\u81F3","\u6362\u4E3A","\u6362\u5230"];dVr=[{type:"modelSwitch",priority:1,keywords:["\u5207\u6362\u6A21\u578B","\u5207\u6362\u4E3A","\u5207\u6362\u5230","\u5207\u6362\u81F3","\u5207\u6362","\u5207\u5230","\u6362\u6210","\u6362\u4E3A","\u6362\u5230","\u6362\u6210\u6A21\u578B","\u7528\u6A21\u578B","\u4F7F\u7528\u6A21\u578B","\u7528","\u6362","\u5207"],vendorAliases:{\u667A\u8C31:"glm",zhipu:"glm",chatglm:"glm",\u6DF1\u5EA6\u6C42\u7D22:"deepseek",ds:"deepseek",\u53CC\u5B50\u661F:"gemini",\u8C37\u6B4C:"gemini",\u5C0F\u7C73:"mimo",xiaomi:"mimo"}},{type:"command",priority:2,keywords:["\u66F4\u65B0\u4E00\u4E0B\u4F60\u81EA\u5DF1","\u66F4\u65B0\u81EA\u5DF1","\u5347\u7EA7\u4E00\u4E0B\u4F60\u81EA\u5DF1","\u5347\u7EA7\u81EA\u5DF1","update yourself","self-update","self update"],slashCommand:"/update"},{type:"command",priority:2,keywords:["\u65B0\u5BF9\u8BDD","\u5F00\u4E2A\u65B0\u5BF9\u8BDD","\u6362\u4E2A\u8BDD\u9898","\u6E05\u7A7A\u5BF9\u8BDD","\u5F00\u59CB\u65B0\u5BF9\u8BDD","\u91CD\u65B0\u5F00\u59CB","\u65B0\u5EFA\u5BF9\u8BDD","\u5F00\u65B0\u5BF9\u8BDD"],slashCommand:"/new"},{type:"command",priority:3,keywords:["\u538B\u7F29\u4E0A\u4E0B\u6587","\u538B\u7F29\u5BF9\u8BDD","\u538B\u7F29\u4E00\u4E0B","\u7F29\u5C0F\u4E0A\u4E0B\u6587","\u7CBE\u7B80\u5BF9\u8BDD","\u603B\u7ED3\u5BF9\u8BDD","\u538B\u7F29\u4E0B\u4E0A\u4E0B\u6587"],slashCommand:"/compress"},{type:"command",priority:4,keywords:["\u6574\u7406\u77E5\u8BC6\u5E93","\u66F4\u65B0\u77E5\u8BC6\u5E93","\u77E5\u8BC6\u5E93\u96C6\u53D6","\u6444\u53D6\u6587\u6863\u5230\u77E5\u8BC6\u5E93","\u77E5\u8BC6\u5E93\u66F4\u65B0","\u77E5\u8BC6\u5E93\u6444\u53D6"],slashCommand:"/wiki ingest ."},{type:"command",priority:5,keywords:["\u63D0\u4EA4\u4EE3\u7801","\u63D0\u4EA4\u4FEE\u6539","\u4FDD\u5B58\u4EE3\u7801","\u4FDD\u5B58\u4FEE\u6539","\u4EE3\u7801\u63D0\u4EA4","\u4FEE\u6539\u63D0\u4EA4","\u63D0\u4EA4\u4E00\u4E0B","commit\u4EE3\u7801","commit\u4FEE\u6539"],slashCommand:"/worktree commit"},{type:"command",priority:5,keywords:["\u5B8C\u6210\u4EFB\u52A1","\u4EFB\u52A1\u5B8C\u6210","\u6536\u5DE5","\u5DE5\u4F5C\u5B8C\u6210","\u63D0\u4EA4\u5E76\u6E05\u7406","\u6E05\u7406\u5DE5\u4F5C\u533A","\u7ED3\u675F\u4EFB\u52A1","\u5B8C\u6210worktree","worktree\u5B8C\u6210"],slashCommand:"/worktree done"},{type:"command",priority:5,keywords:["\u63A8\u9001\u4EE3\u7801","\u63A8\u9001\u4FEE\u6539","\u4EE3\u7801\u63A8\u9001","push\u4EE3\u7801","\u540C\u6B65\u4EE3\u7801","\u540C\u6B65\u4FEE\u6539","\u63A8\u9001\u5206\u652F","push\u5206\u652F","\u63A8\u9001\u5230\u8FDC\u7A0B","\u540C\u6B65\u5230\u8FDC\u7A0B"],slashCommand:"/worktree push"},{type:"command",priority:6,keywords:["\u67E5\u770B\u4FEE\u6539","\u770B\u770B\u4FEE\u6539","\u6539\u4E86\u54EA\u4E9B","\u770B\u770B\u6539\u52A8","\u67E5\u770B\u6539\u52A8","\u67E5\u770B\u53D8\u66F4","\u4EE3\u7801\u72B6\u6001","\u67E5\u770B\u72B6\u6001","git status","git diff"],slashCommand:"/worktree status"},{type:"command",priority:7,keywords:["\u653E\u5F03\u4FEE\u6539","\u653E\u5F03\u6539\u52A8","\u64A4\u9500\u4FEE\u6539","\u64A4\u9500\u6539\u52A8","\u4E22\u5F03\u4FEE\u6539","\u4E22\u5F03\u6539\u52A8","\u56DE\u9000\u4FEE\u6539","\u56DE\u9000\u6539\u52A8","\u653E\u5F03worktree","\u4E22\u5F03worktree","\u64A4\u9500worktree"],slashCommand:"/worktree discard"},{type:"toolToggle",priority:12,keywords:["\u5F00\u542F\u97F3\u9891","\u6253\u5F00\u97F3\u9891","\u542F\u7528\u97F3\u9891","\u5173\u95ED\u97F3\u9891","\u505C\u7528\u97F3\u9891","\u7981\u7528\u97F3\u9891"],toolName:"audio_reader",enableKeywords:["\u5F00\u542F\u97F3\u9891","\u6253\u5F00\u97F3\u9891","\u542F\u7528\u97F3\u9891"],disableKeywords:["\u5173\u95ED\u97F3\u9891","\u505C\u7528\u97F3\u9891","\u7981\u7528\u97F3\u9891"],enableSlashCommand:"/tool enable audio_reader",disableSlashCommand:"/tool disable audio_reader"},{type:"toolToggle",priority:13,keywords:["\u5F00\u542F\u641C\u7D22","\u6253\u5F00\u641C\u7D22","\u542F\u7528\u641C\u7D22","\u5F00\u542F\u7F51\u9875\u641C\u7D22","\u6253\u5F00\u7F51\u9875\u641C\u7D22","\u5173\u95ED\u641C\u7D22","\u505C\u7528\u641C\u7D22","\u7981\u7528\u641C\u7D22","\u5173\u95ED\u7F51\u9875\u641C\u7D22","\u505C\u7528\u7F51\u9875\u641C\u7D22"],toolName:"google_web_search",enableKeywords:["\u5F00\u542F\u641C\u7D22","\u6253\u5F00\u641C\u7D22","\u542F\u7528\u641C\u7D22","\u5F00\u542F\u7F51\u9875\u641C\u7D22","\u6253\u5F00\u7F51\u9875\u641C\u7D22"],disableKeywords:["\u5173\u95ED\u641C\u7D22","\u505C\u7528\u641C\u7D22","\u7981\u7528\u641C\u7D22","\u5173\u95ED\u7F51\u9875\u641C\u7D22","\u505C\u7528\u7F51\u9875\u641C\u7D22"],enableSlashCommand:"/tool enable google_web_search",disableSlashCommand:"/tool disable google_web_search"},{type:"toolToggle",priority:14,keywords:["\u5F00\u542F\u98DE\u4E66","\u6253\u5F00\u98DE\u4E66","\u542F\u7528\u98DE\u4E66","\u5F00\u542Flark","\u6253\u5F00lark","\u5173\u95ED\u98DE\u4E66","\u505C\u7528\u98DE\u4E66","\u7981\u7528\u98DE\u4E66","\u5173\u95EDlark","\u505C\u7528lark"],toolName:"lark_cli",enableKeywords:["\u5F00\u542F\u98DE\u4E66","\u6253\u5F00\u98DE\u4E66","\u542F\u7528\u98DE\u4E66","\u5F00\u542Flark","\u6253\u5F00lark"],disableKeywords:["\u5173\u95ED\u98DE\u4E66","\u505C\u7528\u98DE\u4E66","\u7981\u7528\u98DE\u4E66","\u5173\u95EDlark","\u505C\u7528lark"],enableSlashCommand:"/tool enable lark_cli",disableSlashCommand:"/tool disable lark_cli"},{type:"toolToggle",priority:16,keywords:["\u5F00\u542F\u5DE5\u4F5C\u6D41","\u6253\u5F00\u5DE5\u4F5C\u6D41","\u542F\u7528\u5DE5\u4F5C\u6D41","\u5173\u95ED\u5DE5\u4F5C\u6D41","\u505C\u7528\u5DE5\u4F5C\u6D41","\u7981\u7528\u5DE5\u4F5C\u6D41"],toolName:"workflow",enableKeywords:["\u5F00\u542F\u5DE5\u4F5C\u6D41","\u6253\u5F00\u5DE5\u4F5C\u6D41","\u542F\u7528\u5DE5\u4F5C\u6D41"],disableKeywords:["\u5173\u95ED\u5DE5\u4F5C\u6D41","\u505C\u7528\u5DE5\u4F5C\u6D41","\u7981\u7528\u5DE5\u4F5C\u6D41"],enableSlashCommand:"/tool enable workflow",disableSlashCommand:"/tool disable workflow"},{type:"toolToggle",priority:17,keywords:["\u5F00\u542F\u59D4\u6258","\u6253\u5F00\u59D4\u6258","\u542F\u7528\u59D4\u6258","\u5F00\u542Fdelegate","\u6253\u5F00delegate","\u5173\u95ED\u59D4\u6258","\u505C\u7528\u59D4\u6258","\u7981\u7528\u59D4\u6258","\u5173\u95EDdelegate","\u505C\u7528delegate"],toolName:"delegate_to_agent",enableKeywords:["\u5F00\u542F\u59D4\u6258","\u6253\u5F00\u59D4\u6258","\u542F\u7528\u59D4\u6258","\u5F00\u542Fdelegate","\u6253\u5F00delegate"],disableKeywords:["\u5173\u95ED\u59D4\u6258","\u505C\u7528\u59D4\u6258","\u7981\u7528\u59D4\u6258","\u5173\u95EDdelegate","\u505C\u7528delegate"],enableSlashCommand:"/tool enable delegate_to_agent",disableSlashCommand:"/tool disable delegate_to_agent"},{type:"toolToggle",priority:18,keywords:["\u5F00\u542F\u59D4\u6258\u67E5\u8BE2","\u6253\u5F00\u59D4\u6258\u67E5\u8BE2","\u542F\u7528\u59D4\u6258\u67E5\u8BE2","\u5173\u95ED\u59D4\u6258\u67E5\u8BE2","\u505C\u7528\u59D4\u6258\u67E5\u8BE2","\u7981\u7528\u59D4\u6258\u67E5\u8BE2"],toolName:"check_delegate_status",enableKeywords:["\u5F00\u542F\u59D4\u6258\u67E5\u8BE2","\u6253\u5F00\u59D4\u6258\u67E5\u8BE2","\u542F\u7528\u59D4\u6258\u67E5\u8BE2"],disableKeywords:["\u5173\u95ED\u59D4\u6258\u67E5\u8BE2","\u505C\u7528\u59D4\u6258\u67E5\u8BE2","\u7981\u7528\u59D4\u6258\u67E5\u8BE2"],enableSlashCommand:"/tool enable check_delegate_status",disableSlashCommand:"/tool disable check_delegate_status"}]});import*as XE from"fs";import*as oAe from"path";function fVr(a){return oAe.join(a,I9n,h9n)}function m9n(a){let e=oAe.dirname(a);XE.existsSync(e)||XE.mkdirSync(e,{recursive:!0})}function mVr(a){return`${a.rounds}|${a.models.join(",")}|${a.topic}`}function wce(a){let e=fVr(a);try{if(!XE.existsSync(e))return[];let r=XE.readFileSync(e,"utf-8"),n=JSON.parse((0,pVr.default)(r));if(!n||!Array.isArray(n.presets))return[];let i=n.presets.filter(p9n);return i.sort((s,t)=>new Date(t.savedAt).getTime()-new Date(s.savedAt).getTime()),i.slice(0,bVr)}catch(r){return console.warn(`[debateStorage] Failed to load presets from ${e}: ${r instanceof Error?r.message:String(r)}`),[]}}function p9n(a){if(!a||typeof a!="object")return!1;let e=a;return typeof e.topic=="string"&&e.topic.length>0&&Array.isArray(e.models)&&e.models.length>=2&&e.models.length<=4&&e.models.every(r=>typeof r=="string"&&r.length>0)&&typeof e.rounds=="number"&&e.rounds>=1&&typeof e.savedAt=="string"}function GVr(a,e){let r=fVr(a);try{let n=wce(a),i=mVr(e),s=n.filter(d=>mVr(d)!==i),o=[{topic:e.topic,models:[...e.models],rounds:e.rounds,savedAt:new Date().toISOString()},...s].slice(0,bVr);m9n(r),XE.writeFileSync(r,JSON.stringify({presets:o},null,2),"utf-8")}catch(n){console.warn(`[debateStorage] Failed to save preset to ${r}: ${n instanceof Error?n.message:String(n)}`)}}var pVr,I9n,h9n,bVr,jmt=_e(()=>{"use strict";pVr=Qt(S4e(),1);Uh();I9n=C2,h9n="debate-history.json",bVr=3});var qmt,yVr=_e(()=>{"use strict";qmt="[99;5u"});var lAe,f9n,G9n,Rce,Ace,ZVr,Kmt=_e(async()=>{"use strict";await wa();lAe=Qt(qr(),1);f9n="\x1B[?1004h",G9n="\x1B[?1004l",Rce="\x1B[I",Ace="\x1B[O",ZVr=()=>{let{stdin:a}=UF(),{stdout:e}=FK(),[r,n]=(0,lAe.useState)(!0);return(0,lAe.useEffect)(()=>{let i=s=>{let t=s.toString(),o=t.lastIndexOf(Rce),d=t.lastIndexOf(Ace);o>d?n(!0):d>o&&n(!1)};return e?.write(f9n),a?.on("data",i),()=>{e?.write(G9n),a?.removeListener("data",i)}},[a,e]),r}});import dAe from"node:readline";import{PassThrough as w9n}from"node:stream";function wVr(){let a=(0,$b.useContext)(FVr);if(!a)throw new Error("useKeypressContext must be used within a KeypressProvider");return a}function RVr({children:a,config:e,onBackgroundModeRequested:r}){let{stdin:n,setRawMode:i}=UF(),s=(0,$b.useRef)(new Set).current,t=(0,$b.useRef)(!1),o=(0,$b.useRef)(""),d=(0,$b.useRef)(null),I=(0,$b.useRef)([]),u=(0,$b.useRef)(null),h=(0,$b.useCallback)(m=>{s.add(m)},[s]),c=(0,$b.useCallback)(m=>{s.delete(m)},[s]);return(0,$b.useEffect)(()=>{let m=()=>{d.current&&(clearTimeout(d.current),d.current=null)},Z=()=>{u.current&&(clearTimeout(u.current),u.current=null)},v=()=>{if(I.current.length>0){let H=I.current.map(S=>S.sequence).join("");I.current=[],G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:H})}},N=H=>{if(!!(H.ctrl||H.meta)){if(I.current.length>0)if(Z(),I.current.length>=$mt)v();else{for(let T of I.current)G(T);I.current=[]}return!1}return I.current.push(H),Z(),u.current=setTimeout(()=>{if(I.current.length>=$mt)v();else{for(let T of I.current)G(T);I.current=[]}},x9n),!0},g=n.isRaw;g===!1&&i(!0);let E=new w9n,w=!0;(parseInt(process.versions.node.split(".")[0],10)<=20||process.env.PASTE_WORKAROUND==="1"||process.env.PASTE_WORKAROUND==="true")&&(w=!0);let p=!1,y="",W="",R=null,f=!1,b=H=>{let S=new RegExp(`^${mv}\\[Z`),T=H.match(S);if(T)return{key:{name:"tab",ctrl:!1,meta:!1,shift:!0,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length};let L=new RegExp(`^${mv}\\[1;(\\d+)Z`);if(T=H.match(L),T){let x=parseInt(T[1],10);x>=128&&(x-=128);let Y=x-1,B=(Y&2)===2;return{key:{name:"tab",ctrl:(Y&4)===4,meta:B,shift:!0,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let k=new RegExp(`^${mv}\\[1;(\\d+)([ABCDHFPQSR])`);if(T=H.match(k),T){let x=parseInt(T[1],10);x>=128&&(x-=128);let Y=x-1,B=(Y&1)===1,M=(Y&2)===2,O=(Y&4)===4,J=T[2],U={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",P:"f1",Q:"f2",R:"f3",S:"f4"}[J]||"";return U?{key:{name:U,ctrl:O,meta:M,shift:B,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}:null}let Q=new RegExp(`^${mv}\\[(\\d+)(;(\\d+))?([u~])`);if(T=H.match(Q),T){let x=parseInt(T[1],10),Y=T[3]?parseInt(T[3],10):1;Y>=128&&(Y-=128);let B=Y-1,M=(B&1)===1,O=(B&2)===2,J=(B&4)===4;if(T[4]==="~"){let _=null;switch(x){case 1:_="home";break;case 2:_="insert";break;case 3:_="delete";break;case 4:_="end";break;case 5:_="pageup";break;case 6:_="pagedown";break;default:break}if(_)return{key:{name:_,ctrl:J,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let z={27:"escape",9:"tab",127:"backspace",13:"return",57414:"return"}[x];if(z)return{key:{name:z,ctrl:J,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length};if(J&&x>=97&&x<=122)return{key:{name:String.fromCharCode(x),ctrl:!0,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let V=new RegExp(`^${mv}\\[([ABCDHF])`);if(T=H.match(V),T){let x=T[1];return{key:{name:{A:"up",B:"down",C:"right",D:"left",H:"home",F:"end"}[x],ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}return null},G=H=>{for(let S of s)S(H)},F=(H,S)=>{if(S.name==="paste-start"){p=!0;return}if(S.name==="paste-end"){p=!1,G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:y}),y="";return}if(p){y+=S.sequence;return}if(!(!S.paste&&!S.name&&S.sequence.length>1&&N(S))){if(S.sequence===A9n||S.sequence===E9n||t.current){t.current=!0,o.current+=S.sequence,m(),d.current=setTimeout(()=>{t.current=!1;let T=o.current;o.current="",T&&G({...S,name:"",paste:!0,sequence:T})},R9n);return}if(S.name==="return"&&f){R&&(clearTimeout(R),R=null),f=!1,G({...S,shift:!0,sequence:"\r"});return}if(S.sequence==="\\"&&!S.name){f=!0,R=setTimeout(()=>{f=!1,R=null,G(S)},5);return}if(f&&S.name!=="return"&&(R&&(clearTimeout(R),R=null),f=!1,G({name:"",sequence:"\\",ctrl:!1,meta:!1,shift:!1,paste:!1})),["up","down","left","right"].includes(S.name)){G(S);return}if(S.ctrl&&S.name==="b"){console.log("[KeypressContext] \u{1F3AF} Ctrl+B detected!",{ctrl:S.ctrl,name:S.name}),r&&(console.log("[KeypressContext] Calling onBackgroundModeRequested(true)"),r(!0));let T=globalThis.__backgroundModeCallback;T?(console.log("[KeypressContext] Calling global __backgroundModeCallback(true)"),T(!0)):console.log("[KeypressContext] \u26A0\uFE0F No callback found!");return}if(S.ctrl&&S.name==="c"||S.sequence===`${mv}${qmt}`){W="",S.sequence===`${mv}${qmt}`?G({name:"c",ctrl:!0,meta:!1,shift:!1,paste:!1,sequence:S.sequence,kittyProtocol:!0}):G(S);return}if(W||S.sequence.startsWith(`${mv}[`)&&!S.sequence.startsWith(NVr)&&!S.sequence.startsWith(WVr)&&!S.sequence.startsWith(Rce)&&!S.sequence.startsWith(Ace)){W+=S.sequence;let T=!1;for(;W;){let L=b(W);if(!L){let k=W.indexOf(`${mv}[`,1);if(k>0){W=W.slice(k);continue}break}W=W.slice(L.length),G(L.key),T=!0}if(T)return;if(e?.getDebugMode()){let L=Array.from(W).map(k=>k.charCodeAt(0));console.warn("Kitty sequence buffer has char codes:",L)}if(W.length>32)W="";else return}S.name==="return"&&S.sequence===`${mv}\r`&&(S.meta=!0),!(S.sequence===Rce||S.sequence===Ace)&&G({...S,paste:p})}},C=H=>{let S=Buffer.isBuffer(H)?H:Buffer.from(H),T=Buffer.from(NVr),L=Buffer.from(WVr),k=Buffer.from(Rce),Q=Buffer.from(Ace),V=S,x=V.indexOf(k);for(;x!==-1;){let D=V.subarray(0,x),U=V.subarray(x+k.length);V=Buffer.concat([D,U]),x=V.indexOf(k)}let Y=V.indexOf(Q);for(;Y!==-1;){let D=V.subarray(0,Y),U=V.subarray(Y+Q.length);V=Buffer.concat([D,U]),Y=V.indexOf(Q)}if(V.length===0)return;let B=V.toString("utf8"),M=V.includes(T)||V.includes(L);if(!p&&!M&&V.length>=C9n&&!B.includes(mv)&&/^[\t\r\n\x20-\x7E\u0080-\uFFFF]+$/.test(B)){G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:B});return}let J=0;for(;J<V.length;){let D=V.indexOf(T,J),U=V.indexOf(L,J),z=D!==-1&&(U===-1||D<U),_=U!==-1&&(D===-1||U<D),P=-1,j=0;if(z?P=D:_&&(P=U),j=L.length,P===-1){E.write(V.slice(J));return}let ee=V.slice(J,P);ee.length>0&&E.write(ee);let K=re=>({name:re,ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:""});z?F(void 0,K("paste-start")):_&&F(void 0,K("paste-end")),J=P+j}},X;return w?(X=dAe.createInterface({input:E,escapeCodeTimeout:0}),dAe.emitKeypressEvents(E,X),E.on("keypress",F),n.on("data",C)):(X=dAe.createInterface({input:n,escapeCodeTimeout:0}),dAe.emitKeypressEvents(n,X),n.on("keypress",F)),()=>{w?(E.removeListener("keypress",F),n.removeListener("data",C)):n.removeListener("keypress",F),X.close(),g===!1&&i(!1),R&&(clearTimeout(R),R=null),p&&(G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:y}),y=""),d.current&&(clearTimeout(d.current),d.current=null),t.current&&o.current&&(G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:o.current}),t.current=!1,o.current=""),Z(),I.current.length>0&&I.current.length>=$mt?v():I.current=[]}},[n,i,e,s]),(0,AVr.jsx)(FVr.Provider,{value:{subscribe:h,unsubscribe:c,onBackgroundModeRequested:r},children:a})}var $b,AVr,mv,NVr,WVr,R9n,A9n,E9n,$mt,x9n,C9n,FVr,ept=_e(async()=>{"use strict";await wa();$b=Qt(qr(),1);yVr();await Kmt();AVr=Qt(Fr(),1);mv="\x1B",NVr=`${mv}[200~`,WVr=`${mv}[201~`,R9n=100,A9n="'",E9n='"',$mt=5,x9n=5,C9n=32,FVr=(0,$b.createContext)(void 0)});function Vp(a,{isActive:e}){let{subscribe:r,unsubscribe:n}=wVr();(0,EVr.useEffect)(()=>{if(e)return r(a),()=>{n(a)}},[e,a,r,n])}var EVr,kE=_e(async()=>{"use strict";EVr=Qt(qr(),1);await ept();});function Y9n(a,e=15){return $S(a)<=e?a:a.split(/\r?\n/).slice(0,e).join(`
5350
+ ${we("model.command.auto.mode")}`);if(a.ui&&a.ui.addItem){let m={type:"info",text:c};a.ui.addItem(m,Date.now())}}catch(s){console.error("[ModelCommand] Operation failed:",s)}})().catch(s=>{console.error("[ModelCommand] Async operation failed:",s)})}}});function cYr(a){if(a.models.length<2||a.models.length>3)throw new Error(`debate requires 2-3 models, got ${a.models.length}`);if(a.rounds<1||a.rounds>2)throw new Error(`debate rounds must be 1 or 2, got ${a.rounds}`);return PI={topic:a.topic,models:[...a.models],rounds:a.rounds,language:a.language,cursor:{round:0,modelIdx:0},status:"running",originalModel:a.originalModel},PI}function B_(){return PI?(PI.cursor.modelIdx+=1,PI.cursor.modelIdx>=PI.models.length&&(PI.cursor.modelIdx=0,PI.cursor.round+=1),PI.cursor.round>=PI.rounds&&(PI.status="done"),PI):null}function Ed(){return PI}function A9(){PI&&PI.status==="running"&&(PI.status="paused")}function uYr(){return PI&&PI.status==="paused"?(PI.status="running",PI):null}function L5(){PI=null}function K4e(a){return a?a.cursor.round===a.rounds-1&&a.cursor.modelIdx===a.models.length-1:!1}var PI,T_=_e(()=>{"use strict";PI=null});var fYr=He(aAe=>{"use strict";var DVn=Symbol.for("react.transitional.element"),OVn=Symbol.for("react.fragment");function bYr(a,e,r){var n=null;if(r!==void 0&&(n=""+r),e.key!==void 0&&(n=""+e.key),"key"in e){r={};for(var i in e)i!=="key"&&(r[i]=e[i])}else r=e;return e=r.ref,{$$typeof:DVn,type:a,key:n,ref:e!==void 0?e:null,props:r}}aAe.Fragment=OVn;aAe.jsx=bYr;aAe.jsxs=bYr});var Fr=He((T0s,GYr)=>{"use strict";GYr.exports=fYr()});var Ud,FYr,wYr=_e(()=>{"use strict";qb();Ud={type:"dark",Background:"#0b0e14",Foreground:"#bfbdb6",LightBlue:"#59C2FF",AccentBlue:"#39BAE6",AccentPurple:"#D2A6FF",AccentCyan:"#95E6CB",AccentGreen:"#AAD94C",AccentYellow:"#FFB454",AccentOrange:"#FF8C00",AccentRed:"#F26D78",DiffAdded:"#293022",DiffRemoved:"#3D1215",Comment:"#646A71",Gray:"#3D4149",InfoColor:"#B8A77E",GradientColors:["#FFB454","#F26D78"]},FYr=new ql("Ayu","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Ud.Background,color:Ud.Foreground},"hljs-keyword":{color:Ud.AccentYellow},"hljs-literal":{color:Ud.AccentPurple},"hljs-symbol":{color:Ud.AccentCyan},"hljs-name":{color:Ud.LightBlue},"hljs-link":{color:Ud.AccentBlue},"hljs-function .hljs-keyword":{color:Ud.AccentYellow},"hljs-subst":{color:Ud.Foreground},"hljs-string":{color:Ud.AccentGreen},"hljs-title":{color:Ud.AccentYellow},"hljs-type":{color:Ud.AccentBlue},"hljs-attribute":{color:Ud.AccentYellow},"hljs-bullet":{color:Ud.AccentYellow},"hljs-addition":{color:Ud.AccentGreen},"hljs-variable":{color:Ud.Foreground},"hljs-template-tag":{color:Ud.AccentYellow},"hljs-template-variable":{color:Ud.AccentYellow},"hljs-comment":{color:Ud.Comment,fontStyle:"italic"},"hljs-quote":{color:Ud.AccentCyan,fontStyle:"italic"},"hljs-deletion":{color:Ud.AccentRed},"hljs-meta":{color:Ud.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Ud)});var Cl,RYr,AYr=_e(()=>{"use strict";qb();Cl={type:"light",Background:"#f8f9fa",Foreground:"#5c6166",LightBlue:"#55b4d4",AccentBlue:"#399ee6",AccentPurple:"#a37acc",AccentCyan:"#4cbf99",AccentGreen:"#86b300",AccentYellow:"#f2ae49",AccentOrange:"#FF8C00",AccentRed:"#f07171",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#ABADB1",Gray:"#a6aaaf",InfoColor:"#8B7355",GradientColors:["#399ee6","#86b300"]},RYr=new ql("Ayu Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Cl.Background,color:Cl.Foreground},"hljs-comment":{color:Cl.Comment,fontStyle:"italic"},"hljs-quote":{color:Cl.AccentCyan,fontStyle:"italic"},"hljs-string":{color:Cl.AccentGreen},"hljs-constant":{color:Cl.AccentCyan},"hljs-number":{color:Cl.AccentPurple},"hljs-keyword":{color:Cl.AccentYellow},"hljs-selector-tag":{color:Cl.AccentYellow},"hljs-attribute":{color:Cl.AccentYellow},"hljs-variable":{color:Cl.Foreground},"hljs-variable.language":{color:Cl.LightBlue,fontStyle:"italic"},"hljs-title":{color:Cl.AccentBlue},"hljs-section":{color:Cl.AccentGreen,fontWeight:"bold"},"hljs-type":{color:Cl.LightBlue},"hljs-class .hljs-title":{color:Cl.AccentBlue},"hljs-tag":{color:Cl.LightBlue},"hljs-name":{color:Cl.AccentBlue},"hljs-builtin-name":{color:Cl.AccentYellow},"hljs-meta":{color:Cl.AccentYellow},"hljs-symbol":{color:Cl.AccentRed},"hljs-bullet":{color:Cl.AccentYellow},"hljs-regexp":{color:Cl.AccentCyan},"hljs-link":{color:Cl.LightBlue},"hljs-deletion":{color:Cl.AccentRed},"hljs-addition":{color:Cl.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-literal":{color:Cl.AccentCyan},"hljs-built_in":{color:Cl.AccentRed},"hljs-doctag":{color:Cl.AccentRed},"hljs-template-variable":{color:Cl.AccentCyan},"hljs-selector-id":{color:Cl.AccentRed}},Cl)});var Do,EYr,xYr=_e(()=>{"use strict";qb();Do={type:"dark",Background:"#282c34",Foreground:"#abb2bf",LightBlue:"#61aeee",AccentBlue:"#61aeee",AccentPurple:"#c678dd",AccentCyan:"#56b6c2",AccentGreen:"#98c379",AccentYellow:"#e6c07b",AccentOrange:"#FF8C00",AccentRed:"#e06c75",DiffAdded:"#39544E",DiffRemoved:"#562B2F",Comment:"#5c6370",Gray:"#5c6370",InfoColor:"#B8A77E",GradientColors:["#61aeee","#98c379"]},EYr=new ql("Atom One","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Do.Foreground,background:Do.Background},"hljs-comment":{color:Do.Comment,fontStyle:"italic"},"hljs-quote":{color:Do.Comment,fontStyle:"italic"},"hljs-doctag":{color:Do.AccentPurple},"hljs-keyword":{color:Do.AccentPurple},"hljs-formula":{color:Do.AccentPurple},"hljs-section":{color:Do.AccentRed},"hljs-name":{color:Do.AccentRed},"hljs-selector-tag":{color:Do.AccentRed},"hljs-deletion":{color:Do.AccentRed},"hljs-subst":{color:Do.AccentRed},"hljs-literal":{color:Do.AccentCyan},"hljs-string":{color:Do.AccentGreen},"hljs-regexp":{color:Do.AccentGreen},"hljs-addition":{color:Do.AccentGreen},"hljs-attribute":{color:Do.AccentGreen},"hljs-meta-string":{color:Do.AccentGreen},"hljs-built_in":{color:Do.AccentYellow},"hljs-class .hljs-title":{color:Do.AccentYellow},"hljs-attr":{color:Do.AccentYellow},"hljs-variable":{color:Do.AccentYellow},"hljs-template-variable":{color:Do.AccentYellow},"hljs-type":{color:Do.AccentYellow},"hljs-selector-class":{color:Do.AccentYellow},"hljs-selector-attr":{color:Do.AccentYellow},"hljs-selector-pseudo":{color:Do.AccentYellow},"hljs-number":{color:Do.AccentYellow},"hljs-symbol":{color:Do.AccentBlue},"hljs-bullet":{color:Do.AccentBlue},"hljs-link":{color:Do.AccentBlue,textDecoration:"underline"},"hljs-meta":{color:Do.AccentBlue},"hljs-selector-id":{color:Do.AccentBlue},"hljs-title":{color:Do.AccentBlue},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Do)});var $u,CYr,YYr=_e(()=>{"use strict";qb();$u={type:"dark",Background:"#282a36",Foreground:"#f8f8f2",LightBlue:"#8be9fd",AccentBlue:"#8be9fd",AccentPurple:"#ff79c6",AccentCyan:"#8be9fd",AccentGreen:"#50fa7b",AccentYellow:"#f1fa8c",AccentOrange:"#FF8C00",AccentRed:"#ff5555",DiffAdded:"#11431d",DiffRemoved:"#6e1818",Comment:"#6272a4",Gray:"#6272a4",InfoColor:"#B8A77E",GradientColors:["#ff79c6","#8be9fd"]},CYr=new ql("Dracula","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:$u.Background,color:$u.Foreground},"hljs-keyword":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-selector-tag":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-literal":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-section":{color:$u.AccentBlue,fontWeight:"bold"},"hljs-link":{color:$u.AccentBlue},"hljs-function .hljs-keyword":{color:$u.AccentPurple},"hljs-subst":{color:$u.Foreground},"hljs-string":{color:$u.AccentYellow},"hljs-title":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-name":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-type":{color:$u.AccentYellow,fontWeight:"bold"},"hljs-attribute":{color:$u.AccentYellow},"hljs-symbol":{color:$u.AccentYellow},"hljs-bullet":{color:$u.AccentYellow},"hljs-addition":{color:$u.AccentGreen},"hljs-variable":{color:$u.AccentYellow},"hljs-template-tag":{color:$u.AccentYellow},"hljs-template-variable":{color:$u.AccentYellow},"hljs-comment":{color:$u.Comment},"hljs-quote":{color:$u.Comment},"hljs-deletion":{color:$u.AccentRed},"hljs-meta":{color:$u.Comment},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},$u)});var Yl,VYr,QYr=_e(()=>{"use strict";qb();Yl={type:"dark",Background:"#24292e",Foreground:"#d1d5da",LightBlue:"#79B8FF",AccentBlue:"#79B8FF",AccentPurple:"#B392F0",AccentCyan:"#9ECBFF",AccentGreen:"#85E89D",AccentYellow:"#FFAB70",AccentOrange:"#FF8C00",AccentRed:"#F97583",DiffAdded:"#3C4636",DiffRemoved:"#502125",Comment:"#6A737D",Gray:"#6A737D",InfoColor:"#B8A77E",GradientColors:["#79B8FF","#85E89D"]},VYr=new ql("GitHub","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:Yl.Foreground,background:Yl.Background},"hljs-comment":{color:Yl.Comment,fontStyle:"italic"},"hljs-quote":{color:Yl.Comment,fontStyle:"italic"},"hljs-keyword":{color:Yl.AccentRed,fontWeight:"bold"},"hljs-selector-tag":{color:Yl.AccentRed,fontWeight:"bold"},"hljs-subst":{color:Yl.Foreground},"hljs-number":{color:Yl.LightBlue},"hljs-literal":{color:Yl.LightBlue},"hljs-variable":{color:Yl.AccentYellow},"hljs-template-variable":{color:Yl.AccentYellow},"hljs-tag .hljs-attr":{color:Yl.AccentYellow},"hljs-string":{color:Yl.AccentCyan},"hljs-doctag":{color:Yl.AccentCyan},"hljs-title":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-section":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:Yl.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Yl.AccentGreen,fontWeight:"bold"},"hljs-class .hljs-title":{color:Yl.AccentGreen,fontWeight:"bold"},"hljs-tag":{color:Yl.AccentGreen},"hljs-name":{color:Yl.AccentGreen},"hljs-attribute":{color:Yl.LightBlue},"hljs-regexp":{color:Yl.AccentCyan},"hljs-link":{color:Yl.AccentCyan},"hljs-symbol":{color:Yl.AccentPurple},"hljs-bullet":{color:Yl.AccentPurple},"hljs-built_in":{color:Yl.LightBlue},"hljs-builtin-name":{color:Yl.LightBlue},"hljs-meta":{color:Yl.LightBlue,fontWeight:"bold"},"hljs-deletion":{background:"#86181D",color:Yl.AccentRed},"hljs-addition":{background:"#144620",color:Yl.AccentGreen},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},Yl)});var nc,HYr,XYr=_e(()=>{"use strict";qb();nc={type:"light",Background:"#f8f8f8",Foreground:"#24292E",LightBlue:"#0086b3",AccentBlue:"#458",AccentPurple:"#900",AccentCyan:"#009926",AccentGreen:"#008080",AccentYellow:"#990073",AccentOrange:"#FF8C00",AccentRed:"#d14",DiffAdded:"#C6EAD8",DiffRemoved:"#FFCCCC",Comment:"#998",Gray:"#999",InfoColor:"#8B7355",GradientColors:["#458","#008080"]},HYr=new ql("GitHub Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",color:nc.Foreground,background:nc.Background},"hljs-comment":{color:nc.Comment,fontStyle:"italic"},"hljs-quote":{color:nc.Comment,fontStyle:"italic"},"hljs-keyword":{color:nc.Foreground,fontWeight:"bold"},"hljs-selector-tag":{color:nc.Foreground,fontWeight:"bold"},"hljs-subst":{color:nc.Foreground,fontWeight:"normal"},"hljs-number":{color:nc.AccentGreen},"hljs-literal":{color:nc.AccentGreen},"hljs-variable":{color:nc.AccentGreen},"hljs-template-variable":{color:nc.AccentGreen},"hljs-tag .hljs-attr":{color:nc.AccentGreen},"hljs-string":{color:nc.AccentRed},"hljs-doctag":{color:nc.AccentRed},"hljs-title":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-section":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-selector-id":{color:nc.AccentPurple,fontWeight:"bold"},"hljs-type":{color:nc.AccentBlue,fontWeight:"bold"},"hljs-class .hljs-title":{color:nc.AccentBlue,fontWeight:"bold"},"hljs-tag":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-name":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-attribute":{color:nc.AccentBlue,fontWeight:"normal"},"hljs-regexp":{color:nc.AccentCyan},"hljs-link":{color:nc.AccentCyan},"hljs-symbol":{color:nc.AccentYellow},"hljs-bullet":{color:nc.AccentYellow},"hljs-built_in":{color:nc.LightBlue},"hljs-builtin-name":{color:nc.LightBlue},"hljs-meta":{color:nc.Gray,fontWeight:"bold"},"hljs-deletion":{background:"#fdd"},"hljs-addition":{background:"#dfd"},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"}},nc)});var Vl,kYr,SYr=_e(()=>{"use strict";qb();Vl={type:"light",Background:"white",Foreground:"#444",LightBlue:"#066",AccentBlue:"#008",AccentPurple:"#606",AccentCyan:"#066",AccentGreen:"#080",AccentYellow:"#660",AccentOrange:"#FF8C00",AccentRed:"#800",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#5f6368",Gray:xl.Gray,InfoColor:"#8B7355",GradientColors:["#066","#606"]},kYr=new ql("Google Code","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:Vl.Background,color:Vl.Foreground},"hljs-comment":{color:Vl.AccentRed},"hljs-quote":{color:Vl.AccentRed},"hljs-keyword":{color:Vl.AccentBlue},"hljs-selector-tag":{color:Vl.AccentBlue},"hljs-section":{color:Vl.AccentBlue},"hljs-title":{color:Vl.AccentPurple},"hljs-name":{color:Vl.AccentBlue},"hljs-variable":{color:Vl.AccentYellow},"hljs-template-variable":{color:Vl.AccentYellow},"hljs-string":{color:Vl.AccentGreen},"hljs-selector-attr":{color:Vl.AccentGreen},"hljs-selector-pseudo":{color:Vl.AccentGreen},"hljs-regexp":{color:Vl.AccentGreen},"hljs-literal":{color:Vl.AccentCyan},"hljs-symbol":{color:Vl.AccentCyan},"hljs-bullet":{color:Vl.AccentCyan},"hljs-meta":{color:Vl.AccentCyan},"hljs-number":{color:Vl.AccentCyan},"hljs-link":{color:Vl.AccentCyan},"hljs-doctag":{color:Vl.AccentPurple,fontWeight:"bold"},"hljs-type":{color:Vl.AccentPurple},"hljs-attr":{color:Vl.AccentPurple},"hljs-built_in":{color:Vl.AccentPurple},"hljs-builtin-name":{color:Vl.AccentPurple},"hljs-params":{color:Vl.AccentPurple},"hljs-attribute":{color:Vl.Foreground},"hljs-subst":{color:Vl.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-selector-id":{color:Vl.AccentYellow},"hljs-selector-class":{color:Vl.AccentYellow},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},Vl)});var ns,Y0,LYr,JYr=_e(()=>{"use strict";qb();ns={type:"dark",Background:"#2d2b57",Foreground:"#e3dfff",LightBlue:"#847ace",AccentBlue:"#a599e9",AccentPurple:"#ac65ff",AccentCyan:"#a1feff",AccentGreen:"#A5FF90",AccentYellow:"#fad000",AccentOrange:"#FF8C00",AccentRed:"#ff628c",DiffAdded:"#383E45",DiffRemoved:"#572244",Comment:"#B362FF",Gray:"#726c86",InfoColor:"#B8A77E",GradientColors:["#4d21fc","#847ace","#ff628c"]},Y0={AccentYellowAlt:"#f8d000",AccentOrange:"#fb9e00",AccentPink:"#fa658d",AccentLightPurple:"#c991ff",AccentDarkPurple:"#6943ff",AccentTeal:"#2ee2fa"},LYr=new ql("Shades Of Purple","dark",{hljs:{display:"block",overflowX:"auto",background:ns.Background,color:ns.Foreground},"hljs-title":{color:ns.AccentYellow,fontWeight:"normal"},"hljs-name":{color:ns.AccentCyan,fontWeight:"normal"},"hljs-tag":{color:ns.Foreground},"hljs-attr":{color:Y0.AccentYellowAlt,fontStyle:"italic"},"hljs-built_in":{color:Y0.AccentOrange},"hljs-selector-tag":{color:Y0.AccentOrange,fontWeight:"normal"},"hljs-section":{color:Y0.AccentOrange},"hljs-keyword":{color:Y0.AccentOrange,fontWeight:"normal"},"hljs-subst":{color:ns.Foreground},"hljs-string":{color:ns.AccentGreen},"hljs-attribute":{color:ns.AccentGreen},"hljs-symbol":{color:ns.AccentGreen},"hljs-bullet":{color:ns.AccentGreen},"hljs-addition":{color:ns.AccentGreen},"hljs-code":{color:ns.AccentGreen},"hljs-regexp":{color:ns.AccentGreen},"hljs-selector-class":{color:ns.AccentGreen},"hljs-selector-attr":{color:ns.AccentGreen},"hljs-selector-pseudo":{color:ns.AccentGreen},"hljs-template-tag":{color:ns.AccentGreen},"hljs-quote":{color:ns.AccentGreen},"hljs-deletion":{color:ns.AccentRed},"hljs-meta":{color:Y0.AccentOrange},"hljs-meta-string":{color:Y0.AccentOrange},"hljs-comment":{color:ns.AccentPurple},"hljs-literal":{color:Y0.AccentPink,fontWeight:"normal"},"hljs-number":{color:Y0.AccentPink},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-diff":{color:ns.Foreground},"hljs-meta.hljs-diff":{color:ns.AccentBlue},"hljs-ln":{color:ns.Gray},"hljs-type":{color:ns.AccentYellow,fontWeight:"normal"},"hljs-variable":{color:ns.AccentYellow},"hljs-template-variable":{color:ns.AccentGreen},"hljs-function .hljs-keyword":{color:Y0.AccentOrange},"hljs-link":{color:ns.LightBlue},"hljs-doctag":{fontWeight:"bold"},"hljs-params":{color:Y0.AccentLightPurple,fontStyle:"italic"},"hljs-class":{color:ns.AccentCyan,fontWeight:"bold"},"hljs-function":{color:ns.AccentCyan},"hljs-property":{color:ns.AccentBlue},"hljs-operator":{color:Y0.AccentDarkPurple},"hljs-punctuation":{color:ns.Gray},"hljs-selector-id":{color:ns.AccentYellow,fontWeight:"bold"},"hljs-char":{color:ns.AccentGreen},"hljs-escape":{color:Y0.AccentPink,fontWeight:"bold"},"hljs-meta-keyword":{color:Y0.AccentOrange,fontWeight:"bold"},"hljs-builtin-name":{color:Y0.AccentTeal},"hljs-module":{color:ns.AccentCyan},"hljs-namespace":{color:ns.LightBlue},"hljs-important":{color:ns.AccentRed,fontWeight:"bold"},"hljs-formula":{color:ns.AccentCyan,fontStyle:"italic"},"hljs-decorator":{color:Y0.AccentTeal,fontWeight:"bold"},"hljs-symbol.ruby":{color:Y0.AccentPink},"hljs-keyword.sql":{color:Y0.AccentOrange,textTransform:"uppercase"},"hljs-section.markdown":{color:ns.AccentYellow,fontWeight:"bold"},"hljs-attr.json":{color:ns.AccentCyan},"hljs-tag .hljs-name":{color:ns.AccentRed},"hljs-tag .hljs-attr":{color:Y0.AccentYellowAlt},"hljs.hljs-line-numbers":{borderRight:`1px solid ${ns.Gray}`},"hljs.hljs-line-numbers .hljs-ln-numbers":{color:ns.Gray,paddingRight:"1em"},"hljs.hljs-line-numbers .hljs-ln-code":{paddingLeft:"1em"},"hljs::selection":{background:ns.AccentBlue+"40"},"hljs ::-moz-selection":{background:ns.AccentBlue+"40"},"hljs .hljs-highlight":{background:ns.AccentPurple+"20",display:"block",width:"100%"}},ns)});var ol,BYr,TYr=_e(()=>{"use strict";qb();ol={type:"light",Background:"#fff",Foreground:"#444",LightBlue:"#0E0EFF",AccentBlue:"#1c00cf",AccentPurple:"#aa0d91",AccentCyan:"#3F6E74",AccentGreen:"#007400",AccentYellow:"#836C28",AccentOrange:"#FF8C00",AccentRed:"#c41a16",DiffAdded:"#C6EAD8",DiffRemoved:"#FEDEDE",Comment:"#007400",Gray:"#c0c0c0",InfoColor:"#8B7355",GradientColors:["#1c00cf","#007400"]},BYr=new ql("Xcode","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:ol.Background,color:ol.Foreground},"xml .hljs-meta":{color:ol.Gray},"hljs-comment":{color:ol.Comment},"hljs-quote":{color:ol.Comment},"hljs-tag":{color:ol.AccentPurple},"hljs-attribute":{color:ol.AccentPurple},"hljs-keyword":{color:ol.AccentPurple},"hljs-selector-tag":{color:ol.AccentPurple},"hljs-literal":{color:ol.AccentPurple},"hljs-name":{color:ol.AccentPurple},"hljs-variable":{color:ol.AccentCyan},"hljs-template-variable":{color:ol.AccentCyan},"hljs-code":{color:ol.AccentRed},"hljs-string":{color:ol.AccentRed},"hljs-meta-string":{color:ol.AccentRed},"hljs-regexp":{color:ol.LightBlue},"hljs-link":{color:ol.LightBlue},"hljs-title":{color:ol.AccentBlue},"hljs-symbol":{color:ol.AccentBlue},"hljs-bullet":{color:ol.AccentBlue},"hljs-number":{color:ol.AccentBlue},"hljs-section":{color:ol.AccentYellow},"hljs-meta":{color:ol.AccentYellow},"hljs-class .hljs-title":{color:ol.AccentPurple},"hljs-type":{color:ol.AccentPurple},"hljs-built_in":{color:ol.AccentPurple},"hljs-builtin-name":{color:ol.AccentPurple},"hljs-params":{color:ol.AccentPurple},"hljs-attr":{color:ol.AccentYellow},"hljs-subst":{color:ol.Foreground},"hljs-formula":{backgroundColor:"#eee",fontStyle:"italic"},"hljs-addition":{backgroundColor:"#baeeba"},"hljs-deletion":{backgroundColor:"#ffc8bd"},"hljs-selector-id":{color:ol.AccentYellow},"hljs-selector-class":{color:ol.AccentYellow},"hljs-doctag":{fontWeight:"bold"},"hljs-strong":{fontWeight:"bold"},"hljs-emphasis":{fontStyle:"italic"}},ol)});var jVn,DYr,OYr=_e(()=>{"use strict";qb();jVn={type:"dark",Background:"black",Foreground:"white",LightBlue:"bluebright",AccentBlue:"blue",AccentPurple:"magenta",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"yellow",AccentOrange:"yellow",AccentRed:"red",DiffAdded:"#003300",DiffRemoved:"#4D0000",Comment:"gray",Gray:"gray",InfoColor:"yellow",GradientColors:["cyan","green"]},DYr=new ql("ANSI","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"black",color:"white"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"yellow"},"hljs-meta-string":{color:"yellow"},"hljs-regexp":{color:"red"},"hljs-template-tag":{color:"red"},"hljs-subst":{color:"white"},"hljs-function":{color:"white"},"hljs-title":{color:"white"},"hljs-params":{color:"white"},"hljs-formula":{color:"white"},"hljs-comment":{color:"green"},"hljs-quote":{color:"green"},"hljs-doctag":{color:"green"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"magenta"},"hljs-template-variable":{color:"magenta"},"hljs-attr":{color:"bluebright"},"hljs-attribute":{color:"bluebright"},"hljs-builtin-name":{color:"bluebright"},"hljs-section":{color:"yellow"},"hljs-emphasis":{},"hljs-strong":{},"hljs-bullet":{color:"yellow"},"hljs-selector-tag":{color:"yellow"},"hljs-selector-id":{color:"yellow"},"hljs-selector-class":{color:"yellow"},"hljs-selector-attr":{color:"yellow"},"hljs-selector-pseudo":{color:"yellow"}},jVn)});var qVn,MYr,UYr=_e(()=>{"use strict";qb();qVn={type:"light",Background:"white",Foreground:"#444",LightBlue:"blue",AccentBlue:"blue",AccentPurple:"purple",AccentCyan:"cyan",AccentGreen:"green",AccentYellow:"orange",AccentOrange:"yellow",AccentRed:"red",DiffAdded:"#E5F2E5",DiffRemoved:"#FFE5E5",Comment:"gray",Gray:"gray",InfoColor:"yellow",GradientColors:["blue","green"]},MYr=new ql("ANSI Light","light",{hljs:{display:"block",overflowX:"auto",padding:"0.5em",background:"white",color:"black"},"hljs-keyword":{color:"blue"},"hljs-literal":{color:"blue"},"hljs-symbol":{color:"blue"},"hljs-name":{color:"blue"},"hljs-link":{color:"blue"},"hljs-built_in":{color:"cyan"},"hljs-type":{color:"cyan"},"hljs-number":{color:"green"},"hljs-class":{color:"green"},"hljs-string":{color:"red"},"hljs-meta-string":{color:"red"},"hljs-regexp":{color:"magenta"},"hljs-template-tag":{color:"magenta"},"hljs-subst":{color:"black"},"hljs-function":{color:"black"},"hljs-title":{color:"black"},"hljs-params":{color:"black"},"hljs-formula":{color:"black"},"hljs-comment":{color:"gray"},"hljs-quote":{color:"gray"},"hljs-doctag":{color:"gray"},"hljs-meta":{color:"gray"},"hljs-meta-keyword":{color:"gray"},"hljs-tag":{color:"gray"},"hljs-variable":{color:"purple"},"hljs-template-variable":{color:"purple"},"hljs-attr":{color:"blue"},"hljs-attribute":{color:"blue"},"hljs-builtin-name":{color:"blue"},"hljs-section":{color:"orange"},"hljs-bullet":{color:"orange"},"hljs-selector-tag":{color:"orange"},"hljs-selector-id":{color:"orange"},"hljs-selector-class":{color:"orange"},"hljs-selector-attr":{color:"orange"},"hljs-selector-pseudo":{color:"orange"}},qVn)});var KVn,zYr,_Yr=_e(()=>{"use strict";qb();KVn={type:"ansi",Background:"",Foreground:"",LightBlue:"",AccentBlue:"",AccentPurple:"",AccentCyan:"",AccentGreen:"",AccentYellow:"",AccentOrange:"",AccentRed:"",DiffAdded:"",DiffRemoved:"",Comment:"",Gray:"",InfoColor:""},zYr=new ql("NoColor","dark",{hljs:{display:"block",overflowX:"auto",padding:"0.5em"},"hljs-keyword":{},"hljs-literal":{},"hljs-symbol":{},"hljs-name":{},"hljs-link":{textDecoration:"underline"},"hljs-built_in":{},"hljs-type":{},"hljs-number":{},"hljs-class":{},"hljs-string":{},"hljs-meta-string":{},"hljs-regexp":{},"hljs-template-tag":{},"hljs-subst":{},"hljs-function":{},"hljs-title":{},"hljs-params":{},"hljs-formula":{},"hljs-comment":{fontStyle:"italic"},"hljs-quote":{fontStyle:"italic"},"hljs-doctag":{},"hljs-meta":{},"hljs-meta-keyword":{},"hljs-tag":{},"hljs-variable":{},"hljs-template-variable":{},"hljs-attr":{},"hljs-attribute":{},"hljs-builtin-name":{},"hljs-section":{},"hljs-emphasis":{fontStyle:"italic"},"hljs-strong":{fontWeight:"bold"},"hljs-bullet":{},"hljs-selector-tag":{},"hljs-selector-id":{},"hljs-selector-class":{},"hljs-selector-attr":{},"hljs-selector-pseudo":{},"hljs-addition":{display:"inline-block",width:"100%"},"hljs-deletion":{display:"inline-block",width:"100%"}},KVn)});import $Vn from"node:process";var B5,Mmt,Ao,C9=_e(()=>{"use strict";wYr();AYr();xYr();YYr();QYr();XYr();SYr();xmt();Cmt();JYr();TYr();qb();OYr();UYr();_Yr();B5=eL,Mmt=class{availableThemes;activeTheme;customThemes=new Map;constructor(){this.availableThemes=[FYr,RYr,EYr,CYr,X_,eL,VYr,HYr,kYr,LYr,BYr,DYr,MYr],this.activeTheme=B5}loadCustomThemes(e){if(this.customThemes.clear(),!!e){for(let[r,n]of Object.entries(e)){let i=JCr(n);if(i.isValid){i.warning&&console.warn(`Theme "${r}": ${i.warning}`);let s={...B5.colors,...n,name:n.name||r,type:"custom"};try{let t=LCr(s);this.customThemes.set(r,t)}catch(t){console.warn(`Failed to load custom theme "${r}":`,t)}}else console.warn(`Invalid custom theme "${r}": ${i.error}`)}this.activeTheme&&this.activeTheme.type==="custom"&&this.customThemes.has(this.activeTheme.name)&&(this.activeTheme=this.customThemes.get(this.activeTheme.name))}}setActiveTheme(e){let r=this.findThemeByName(e);return r?(this.activeTheme=r,!0):!1}getActiveTheme(){return $Vn.env.NO_COLOR?zYr:((!this.activeTheme||!this.findThemeByName(this.activeTheme.name))&&(this.activeTheme=B5),this.activeTheme)}getCustomThemeNames(){return Array.from(this.customThemes.keys())}isCustomTheme(e){return this.customThemes.has(e)}getAvailableThemes(){let e=this.availableThemes.map(s=>({name:s.name,type:s.type,isCustom:!1})),r=Array.from(this.customThemes.values()).map(s=>({name:s.name,type:s.type,isCustom:!0}));return[...e,...r].sort((s,t)=>{let o=I=>{switch(I){case"dark":return 1;case"light":return 2;case"ansi":return 3;case"custom":return 4;default:return 5}},d=o(s.type)-o(t.type);return d!==0?d:s.name.localeCompare(t.name)})}getTheme(e){return this.findThemeByName(e)}findThemeByName(e){if(!e)return B5;let r=this.availableThemes.find(n=>n.name===e);return r||this.customThemes.get(e)}},Ao=new Mmt});var Ue,za=_e(()=>{"use strict";C9();Ue={get type(){return Ao.getActiveTheme().colors.type},get Foreground(){return Ao.getActiveTheme().colors.Foreground},get Background(){return Ao.getActiveTheme().colors.Background},get LightBlue(){return Ao.getActiveTheme().colors.LightBlue},get AccentBlue(){return Ao.getActiveTheme().colors.AccentBlue},get AccentPurple(){return Ao.getActiveTheme().colors.AccentPurple},get AccentCyan(){return Ao.getActiveTheme().colors.AccentCyan},get AccentGreen(){return Ao.getActiveTheme().colors.AccentGreen},get AccentYellow(){return Ao.getActiveTheme().colors.AccentYellow},get AccentOrange(){return Ao.getActiveTheme().colors.AccentOrange},get AccentRed(){return Ao.getActiveTheme().colors.AccentRed},get DiffAdded(){return Ao.getActiveTheme().colors.DiffAdded},get DiffRemoved(){return Ao.getActiveTheme().colors.DiffRemoved},get Comment(){return Ao.getActiveTheme().colors.Comment},get Gray(){return Ao.getActiveTheme().colors.Gray},get InfoColor(){return Ao.getActiveTheme().colors.InfoColor},get GradientColors(){return Ao.getActiveTheme().colors.GradientColors}}});var IVr={};Xs(IVr,{buildSwitchMessage:()=>sAe,detectNLTrigger:()=>_mt,getNoiseWords:()=>d9n,getToolToggleRules:()=>u9n});function zmt(a){let e=a.replace(/^custom:/,""),r=e.indexOf(":");if(r<0)return a;let n=e.slice(r+1),i=n.lastIndexOf("@");return i>0?n.slice(0,i):n}function lVr(a){let e=a;e=e.replace(/[。,!?.,!?;;::、~~\s]+$/g,"");for(let r of uVr)e=e.replace(r,"");return e.trim()}function l9n(a){let e=["\u81EA\u5B9A\u4E49\u7684","\u81EA\u5B9A\u4E49"];for(let r of e)if(a.includes(r))return{customOnly:!0,cleaned:a.replace(r,"").trim()};return{customOnly:!1,cleaned:a}}function cVr(a,e){let r=a.toLowerCase();for(let n of e)if(r.startsWith(n.toLowerCase()))return n;for(let n of e)if(r.indexOf(n.toLowerCase())>0)return n;return null}function c9n(a,e,r,n){let i=a.toLowerCase(),s=n?e.filter(d=>d.isCustom):e,t=d=>({modelName:d.name,modelDisplayName:d.displayName||d.name,isCustom:d.isCustom||!1});for(let d of s)if(d.name.toLowerCase()===i)return t(d);if(!n){for(let d of e.filter(I=>I.isCustom))if(zmt(d.name).toLowerCase()===i)return t(d)}for(let d of s)if(d.displayName?.toLowerCase()===i)return t(d);let o=i.split(/\s+/).filter(d=>d.length>0);for(let d of s){let I=d.name.toLowerCase(),u=(d.displayName||"").toLowerCase(),h=`${I} ${u}`;if(o.every(c=>h.includes(c)))return t(d)}if(!n)for(let d of e.filter(I=>I.isCustom)){let I=zmt(d.name).toLowerCase(),u=(d.displayName||"").toLowerCase(),h=`${I} ${u}`;if(o.every(c=>h.includes(c)))return t(d)}if(r){let d=r[i];if(d)for(let I of s){let u=I.name.toLowerCase(),h=I.isCustom?zmt(I.name).toLowerCase():u;if(u.startsWith(d)||h.startsWith(d))return t(I)}}if(!n){for(let d of s)if(d.name.toLowerCase().startsWith(i))return t(d)}return null}function _mt(a,e){if(!a)return null;let r=a.trim();if(r.length<2||r.startsWith("/")||r.startsWith("?"))return null;for(let n of dVr)switch(n.type){case"modelSwitch":{if(!e?.favorites?.length)continue;let i="",s="";for(let u of n.keywords){if(r.startsWith(u)){i=u,s=r.slice(u.length).trim();break}let h=r.indexOf(u);if(h>0&&h+u.length<r.length){i=u,s=r.slice(h+u.length).trim();break}}if(!i||!s)continue;let{customOnly:t,cleaned:o}=l9n(s),d=lVr(o);if(!d)continue;let I=c9n(d,e.favorites,n.vendorAliases,t);return I?{type:"modelSwitch",matchedKeyword:i,modelName:I.modelName,modelDisplayName:I.modelDisplayName,isCustom:I.isCustom}:null}case"command":{let i=cVr(r,n.keywords);if(i)return{type:"command",matchedKeyword:i,slashCommand:n.slashCommand};let s=lVr(r);if(s!==r){let t=cVr(s,n.keywords);if(t)return{type:"command",matchedKeyword:t,slashCommand:n.slashCommand}}break}case"toolToggle":{if(n.enableKeywords.includes(r))return{type:"toolToggle",matchedKeyword:r,slashCommand:n.enableSlashCommand};if(n.disableKeywords.includes(r))return{type:"toolToggle",matchedKeyword:r,slashCommand:n.disableSlashCommand};break}}return null}function sAe(a,e){return`\u{1F504} \u5DF2\u5207\u6362\u6A21\u578B\u4E3A\uFF1A${a}`}function u9n(){return dVr.filter(a=>a.type==="toolToggle")}function d9n(){return[...uVr]}var uVr,dVr,Pmt=_e(()=>{"use strict";uVr=["\u6A21\u578B","\u7684","\u4E00\u4E0B","\u5E2E\u6211","\u7ED9\u6211","\u5E2E\u5FD9","\u73B0\u5728","\u7136\u540E","\u90A3\u4E2A","\u8FD9\u4E2A","\u8BF7","\u9EBB\u70E6","\u6362","\u5207\u6362","\u5207\u6362\u81F3","\u6362\u4E3A","\u6362\u5230"];dVr=[{type:"modelSwitch",priority:1,keywords:["\u5207\u6362\u6A21\u578B","\u5207\u6362\u4E3A","\u5207\u6362\u5230","\u5207\u6362\u81F3","\u5207\u6362","\u5207\u5230","\u6362\u6210","\u6362\u4E3A","\u6362\u5230","\u6362\u6210\u6A21\u578B","\u7528\u6A21\u578B","\u4F7F\u7528\u6A21\u578B","\u7528","\u6362","\u5207"],vendorAliases:{\u667A\u8C31:"glm",zhipu:"glm",chatglm:"glm",\u6DF1\u5EA6\u6C42\u7D22:"deepseek",ds:"deepseek",\u53CC\u5B50\u661F:"gemini",\u8C37\u6B4C:"gemini",\u5C0F\u7C73:"mimo",xiaomi:"mimo"}},{type:"command",priority:2,keywords:["\u66F4\u65B0\u4E00\u4E0B\u4F60\u81EA\u5DF1","\u66F4\u65B0\u81EA\u5DF1","\u5347\u7EA7\u4E00\u4E0B\u4F60\u81EA\u5DF1","\u5347\u7EA7\u81EA\u5DF1","update yourself","self-update","self update"],slashCommand:"/update"},{type:"command",priority:2,keywords:["\u65B0\u5BF9\u8BDD","\u5F00\u4E2A\u65B0\u5BF9\u8BDD","\u6362\u4E2A\u8BDD\u9898","\u6E05\u7A7A\u5BF9\u8BDD","\u5F00\u59CB\u65B0\u5BF9\u8BDD","\u91CD\u65B0\u5F00\u59CB","\u65B0\u5EFA\u5BF9\u8BDD","\u5F00\u65B0\u5BF9\u8BDD"],slashCommand:"/new"},{type:"command",priority:3,keywords:["\u538B\u7F29\u4E0A\u4E0B\u6587","\u538B\u7F29\u5BF9\u8BDD","\u538B\u7F29\u4E00\u4E0B","\u7F29\u5C0F\u4E0A\u4E0B\u6587","\u7CBE\u7B80\u5BF9\u8BDD","\u603B\u7ED3\u5BF9\u8BDD","\u538B\u7F29\u4E0B\u4E0A\u4E0B\u6587"],slashCommand:"/compress"},{type:"command",priority:4,keywords:["\u6574\u7406\u77E5\u8BC6\u5E93","\u66F4\u65B0\u77E5\u8BC6\u5E93","\u77E5\u8BC6\u5E93\u96C6\u53D6","\u6444\u53D6\u6587\u6863\u5230\u77E5\u8BC6\u5E93","\u77E5\u8BC6\u5E93\u66F4\u65B0","\u77E5\u8BC6\u5E93\u6444\u53D6"],slashCommand:"/wiki ingest ."},{type:"toolToggle",priority:12,keywords:["\u5F00\u542F\u97F3\u9891","\u6253\u5F00\u97F3\u9891","\u542F\u7528\u97F3\u9891","\u5173\u95ED\u97F3\u9891","\u505C\u7528\u97F3\u9891","\u7981\u7528\u97F3\u9891"],toolName:"audio_reader",enableKeywords:["\u5F00\u542F\u97F3\u9891","\u6253\u5F00\u97F3\u9891","\u542F\u7528\u97F3\u9891"],disableKeywords:["\u5173\u95ED\u97F3\u9891","\u505C\u7528\u97F3\u9891","\u7981\u7528\u97F3\u9891"],enableSlashCommand:"/tool enable audio_reader",disableSlashCommand:"/tool disable audio_reader"},{type:"toolToggle",priority:13,keywords:["\u5F00\u542F\u641C\u7D22","\u6253\u5F00\u641C\u7D22","\u542F\u7528\u641C\u7D22","\u5F00\u542F\u7F51\u9875\u641C\u7D22","\u6253\u5F00\u7F51\u9875\u641C\u7D22","\u5173\u95ED\u641C\u7D22","\u505C\u7528\u641C\u7D22","\u7981\u7528\u641C\u7D22","\u5173\u95ED\u7F51\u9875\u641C\u7D22","\u505C\u7528\u7F51\u9875\u641C\u7D22"],toolName:"google_web_search",enableKeywords:["\u5F00\u542F\u641C\u7D22","\u6253\u5F00\u641C\u7D22","\u542F\u7528\u641C\u7D22","\u5F00\u542F\u7F51\u9875\u641C\u7D22","\u6253\u5F00\u7F51\u9875\u641C\u7D22"],disableKeywords:["\u5173\u95ED\u641C\u7D22","\u505C\u7528\u641C\u7D22","\u7981\u7528\u641C\u7D22","\u5173\u95ED\u7F51\u9875\u641C\u7D22","\u505C\u7528\u7F51\u9875\u641C\u7D22"],enableSlashCommand:"/tool enable google_web_search",disableSlashCommand:"/tool disable google_web_search"},{type:"toolToggle",priority:14,keywords:["\u5F00\u542F\u98DE\u4E66","\u6253\u5F00\u98DE\u4E66","\u542F\u7528\u98DE\u4E66","\u5F00\u542Flark","\u6253\u5F00lark","\u5173\u95ED\u98DE\u4E66","\u505C\u7528\u98DE\u4E66","\u7981\u7528\u98DE\u4E66","\u5173\u95EDlark","\u505C\u7528lark"],toolName:"lark_cli",enableKeywords:["\u5F00\u542F\u98DE\u4E66","\u6253\u5F00\u98DE\u4E66","\u542F\u7528\u98DE\u4E66","\u5F00\u542Flark","\u6253\u5F00lark"],disableKeywords:["\u5173\u95ED\u98DE\u4E66","\u505C\u7528\u98DE\u4E66","\u7981\u7528\u98DE\u4E66","\u5173\u95EDlark","\u505C\u7528lark"],enableSlashCommand:"/tool enable lark_cli",disableSlashCommand:"/tool disable lark_cli"},{type:"toolToggle",priority:16,keywords:["\u5F00\u542F\u5DE5\u4F5C\u6D41","\u6253\u5F00\u5DE5\u4F5C\u6D41","\u542F\u7528\u5DE5\u4F5C\u6D41","\u5173\u95ED\u5DE5\u4F5C\u6D41","\u505C\u7528\u5DE5\u4F5C\u6D41","\u7981\u7528\u5DE5\u4F5C\u6D41"],toolName:"workflow",enableKeywords:["\u5F00\u542F\u5DE5\u4F5C\u6D41","\u6253\u5F00\u5DE5\u4F5C\u6D41","\u542F\u7528\u5DE5\u4F5C\u6D41"],disableKeywords:["\u5173\u95ED\u5DE5\u4F5C\u6D41","\u505C\u7528\u5DE5\u4F5C\u6D41","\u7981\u7528\u5DE5\u4F5C\u6D41"],enableSlashCommand:"/tool enable workflow",disableSlashCommand:"/tool disable workflow"},{type:"toolToggle",priority:17,keywords:["\u5F00\u542F\u59D4\u6258","\u6253\u5F00\u59D4\u6258","\u542F\u7528\u59D4\u6258","\u5F00\u542Fdelegate","\u6253\u5F00delegate","\u5173\u95ED\u59D4\u6258","\u505C\u7528\u59D4\u6258","\u7981\u7528\u59D4\u6258","\u5173\u95EDdelegate","\u505C\u7528delegate"],toolName:"delegate_to_agent",enableKeywords:["\u5F00\u542F\u59D4\u6258","\u6253\u5F00\u59D4\u6258","\u542F\u7528\u59D4\u6258","\u5F00\u542Fdelegate","\u6253\u5F00delegate"],disableKeywords:["\u5173\u95ED\u59D4\u6258","\u505C\u7528\u59D4\u6258","\u7981\u7528\u59D4\u6258","\u5173\u95EDdelegate","\u505C\u7528delegate"],enableSlashCommand:"/tool enable delegate_to_agent",disableSlashCommand:"/tool disable delegate_to_agent"},{type:"toolToggle",priority:18,keywords:["\u5F00\u542F\u59D4\u6258\u67E5\u8BE2","\u6253\u5F00\u59D4\u6258\u67E5\u8BE2","\u542F\u7528\u59D4\u6258\u67E5\u8BE2","\u5173\u95ED\u59D4\u6258\u67E5\u8BE2","\u505C\u7528\u59D4\u6258\u67E5\u8BE2","\u7981\u7528\u59D4\u6258\u67E5\u8BE2"],toolName:"check_delegate_status",enableKeywords:["\u5F00\u542F\u59D4\u6258\u67E5\u8BE2","\u6253\u5F00\u59D4\u6258\u67E5\u8BE2","\u542F\u7528\u59D4\u6258\u67E5\u8BE2"],disableKeywords:["\u5173\u95ED\u59D4\u6258\u67E5\u8BE2","\u505C\u7528\u59D4\u6258\u67E5\u8BE2","\u7981\u7528\u59D4\u6258\u67E5\u8BE2"],enableSlashCommand:"/tool enable check_delegate_status",disableSlashCommand:"/tool disable check_delegate_status"}]});import*as XE from"fs";import*as oAe from"path";function fVr(a){return oAe.join(a,I9n,h9n)}function m9n(a){let e=oAe.dirname(a);XE.existsSync(e)||XE.mkdirSync(e,{recursive:!0})}function mVr(a){return`${a.rounds}|${a.models.join(",")}|${a.topic}`}function wce(a){let e=fVr(a);try{if(!XE.existsSync(e))return[];let r=XE.readFileSync(e,"utf-8"),n=JSON.parse((0,pVr.default)(r));if(!n||!Array.isArray(n.presets))return[];let i=n.presets.filter(p9n);return i.sort((s,t)=>new Date(t.savedAt).getTime()-new Date(s.savedAt).getTime()),i.slice(0,bVr)}catch(r){return console.warn(`[debateStorage] Failed to load presets from ${e}: ${r instanceof Error?r.message:String(r)}`),[]}}function p9n(a){if(!a||typeof a!="object")return!1;let e=a;return typeof e.topic=="string"&&e.topic.length>0&&Array.isArray(e.models)&&e.models.length>=2&&e.models.length<=4&&e.models.every(r=>typeof r=="string"&&r.length>0)&&typeof e.rounds=="number"&&e.rounds>=1&&typeof e.savedAt=="string"}function GVr(a,e){let r=fVr(a);try{let n=wce(a),i=mVr(e),s=n.filter(d=>mVr(d)!==i),o=[{topic:e.topic,models:[...e.models],rounds:e.rounds,savedAt:new Date().toISOString()},...s].slice(0,bVr);m9n(r),XE.writeFileSync(r,JSON.stringify({presets:o},null,2),"utf-8")}catch(n){console.warn(`[debateStorage] Failed to save preset to ${r}: ${n instanceof Error?n.message:String(n)}`)}}var pVr,I9n,h9n,bVr,jmt=_e(()=>{"use strict";pVr=Qt(S4e(),1);Uh();I9n=C2,h9n="debate-history.json",bVr=3});var qmt,yVr=_e(()=>{"use strict";qmt="[99;5u"});var lAe,f9n,G9n,Rce,Ace,ZVr,Kmt=_e(async()=>{"use strict";await wa();lAe=Qt(qr(),1);f9n="\x1B[?1004h",G9n="\x1B[?1004l",Rce="\x1B[I",Ace="\x1B[O",ZVr=()=>{let{stdin:a}=UF(),{stdout:e}=FK(),[r,n]=(0,lAe.useState)(!0);return(0,lAe.useEffect)(()=>{let i=s=>{let t=s.toString(),o=t.lastIndexOf(Rce),d=t.lastIndexOf(Ace);o>d?n(!0):d>o&&n(!1)};return e?.write(f9n),a?.on("data",i),()=>{e?.write(G9n),a?.removeListener("data",i)}},[a,e]),r}});import dAe from"node:readline";import{PassThrough as w9n}from"node:stream";function wVr(){let a=(0,$b.useContext)(FVr);if(!a)throw new Error("useKeypressContext must be used within a KeypressProvider");return a}function RVr({children:a,config:e,onBackgroundModeRequested:r}){let{stdin:n,setRawMode:i}=UF(),s=(0,$b.useRef)(new Set).current,t=(0,$b.useRef)(!1),o=(0,$b.useRef)(""),d=(0,$b.useRef)(null),I=(0,$b.useRef)([]),u=(0,$b.useRef)(null),h=(0,$b.useCallback)(m=>{s.add(m)},[s]),c=(0,$b.useCallback)(m=>{s.delete(m)},[s]);return(0,$b.useEffect)(()=>{let m=()=>{d.current&&(clearTimeout(d.current),d.current=null)},Z=()=>{u.current&&(clearTimeout(u.current),u.current=null)},v=()=>{if(I.current.length>0){let H=I.current.map(S=>S.sequence).join("");I.current=[],G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:H})}},N=H=>{if(!!(H.ctrl||H.meta)){if(I.current.length>0)if(Z(),I.current.length>=$mt)v();else{for(let T of I.current)G(T);I.current=[]}return!1}return I.current.push(H),Z(),u.current=setTimeout(()=>{if(I.current.length>=$mt)v();else{for(let T of I.current)G(T);I.current=[]}},x9n),!0},g=n.isRaw;g===!1&&i(!0);let E=new w9n,w=!0;(parseInt(process.versions.node.split(".")[0],10)<=20||process.env.PASTE_WORKAROUND==="1"||process.env.PASTE_WORKAROUND==="true")&&(w=!0);let p=!1,y="",W="",R=null,f=!1,b=H=>{let S=new RegExp(`^${mv}\\[Z`),T=H.match(S);if(T)return{key:{name:"tab",ctrl:!1,meta:!1,shift:!0,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length};let L=new RegExp(`^${mv}\\[1;(\\d+)Z`);if(T=H.match(L),T){let x=parseInt(T[1],10);x>=128&&(x-=128);let Y=x-1,B=(Y&2)===2;return{key:{name:"tab",ctrl:(Y&4)===4,meta:B,shift:!0,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let k=new RegExp(`^${mv}\\[1;(\\d+)([ABCDHFPQSR])`);if(T=H.match(k),T){let x=parseInt(T[1],10);x>=128&&(x-=128);let Y=x-1,B=(Y&1)===1,M=(Y&2)===2,O=(Y&4)===4,J=T[2],U={A:"up",B:"down",C:"right",D:"left",H:"home",F:"end",P:"f1",Q:"f2",R:"f3",S:"f4"}[J]||"";return U?{key:{name:U,ctrl:O,meta:M,shift:B,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}:null}let Q=new RegExp(`^${mv}\\[(\\d+)(;(\\d+))?([u~])`);if(T=H.match(Q),T){let x=parseInt(T[1],10),Y=T[3]?parseInt(T[3],10):1;Y>=128&&(Y-=128);let B=Y-1,M=(B&1)===1,O=(B&2)===2,J=(B&4)===4;if(T[4]==="~"){let _=null;switch(x){case 1:_="home";break;case 2:_="insert";break;case 3:_="delete";break;case 4:_="end";break;case 5:_="pageup";break;case 6:_="pagedown";break;default:break}if(_)return{key:{name:_,ctrl:J,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let z={27:"escape",9:"tab",127:"backspace",13:"return",57414:"return"}[x];if(z)return{key:{name:z,ctrl:J,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length};if(J&&x>=97&&x<=122)return{key:{name:String.fromCharCode(x),ctrl:!0,meta:O,shift:M,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}let V=new RegExp(`^${mv}\\[([ABCDHF])`);if(T=H.match(V),T){let x=T[1];return{key:{name:{A:"up",B:"down",C:"right",D:"left",H:"home",F:"end"}[x],ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:H.slice(0,T[0].length),kittyProtocol:!0},length:T[0].length}}return null},G=H=>{for(let S of s)S(H)},F=(H,S)=>{if(S.name==="paste-start"){p=!0;return}if(S.name==="paste-end"){p=!1,G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:y}),y="";return}if(p){y+=S.sequence;return}if(!(!S.paste&&!S.name&&S.sequence.length>1&&N(S))){if(S.sequence===A9n||S.sequence===E9n||t.current){t.current=!0,o.current+=S.sequence,m(),d.current=setTimeout(()=>{t.current=!1;let T=o.current;o.current="",T&&G({...S,name:"",paste:!0,sequence:T})},R9n);return}if(S.name==="return"&&f){R&&(clearTimeout(R),R=null),f=!1,G({...S,shift:!0,sequence:"\r"});return}if(S.sequence==="\\"&&!S.name){f=!0,R=setTimeout(()=>{f=!1,R=null,G(S)},5);return}if(f&&S.name!=="return"&&(R&&(clearTimeout(R),R=null),f=!1,G({name:"",sequence:"\\",ctrl:!1,meta:!1,shift:!1,paste:!1})),["up","down","left","right"].includes(S.name)){G(S);return}if(S.ctrl&&S.name==="b"){console.log("[KeypressContext] \u{1F3AF} Ctrl+B detected!",{ctrl:S.ctrl,name:S.name}),r&&(console.log("[KeypressContext] Calling onBackgroundModeRequested(true)"),r(!0));let T=globalThis.__backgroundModeCallback;T?(console.log("[KeypressContext] Calling global __backgroundModeCallback(true)"),T(!0)):console.log("[KeypressContext] \u26A0\uFE0F No callback found!");return}if(S.ctrl&&S.name==="c"||S.sequence===`${mv}${qmt}`){W="",S.sequence===`${mv}${qmt}`?G({name:"c",ctrl:!0,meta:!1,shift:!1,paste:!1,sequence:S.sequence,kittyProtocol:!0}):G(S);return}if(W||S.sequence.startsWith(`${mv}[`)&&!S.sequence.startsWith(NVr)&&!S.sequence.startsWith(WVr)&&!S.sequence.startsWith(Rce)&&!S.sequence.startsWith(Ace)){W+=S.sequence;let T=!1;for(;W;){let L=b(W);if(!L){let k=W.indexOf(`${mv}[`,1);if(k>0){W=W.slice(k);continue}break}W=W.slice(L.length),G(L.key),T=!0}if(T)return;if(e?.getDebugMode()){let L=Array.from(W).map(k=>k.charCodeAt(0));console.warn("Kitty sequence buffer has char codes:",L)}if(W.length>32)W="";else return}S.name==="return"&&S.sequence===`${mv}\r`&&(S.meta=!0),!(S.sequence===Rce||S.sequence===Ace)&&G({...S,paste:p})}},C=H=>{let S=Buffer.isBuffer(H)?H:Buffer.from(H),T=Buffer.from(NVr),L=Buffer.from(WVr),k=Buffer.from(Rce),Q=Buffer.from(Ace),V=S,x=V.indexOf(k);for(;x!==-1;){let D=V.subarray(0,x),U=V.subarray(x+k.length);V=Buffer.concat([D,U]),x=V.indexOf(k)}let Y=V.indexOf(Q);for(;Y!==-1;){let D=V.subarray(0,Y),U=V.subarray(Y+Q.length);V=Buffer.concat([D,U]),Y=V.indexOf(Q)}if(V.length===0)return;let B=V.toString("utf8"),M=V.includes(T)||V.includes(L);if(!p&&!M&&V.length>=C9n&&!B.includes(mv)&&/^[\t\r\n\x20-\x7E\u0080-\uFFFF]+$/.test(B)){G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:B});return}let J=0;for(;J<V.length;){let D=V.indexOf(T,J),U=V.indexOf(L,J),z=D!==-1&&(U===-1||D<U),_=U!==-1&&(D===-1||U<D),P=-1,j=0;if(z?P=D:_&&(P=U),j=L.length,P===-1){E.write(V.slice(J));return}let ee=V.slice(J,P);ee.length>0&&E.write(ee);let K=re=>({name:re,ctrl:!1,meta:!1,shift:!1,paste:!1,sequence:""});z?F(void 0,K("paste-start")):_&&F(void 0,K("paste-end")),J=P+j}},X;return w?(X=dAe.createInterface({input:E,escapeCodeTimeout:0}),dAe.emitKeypressEvents(E,X),E.on("keypress",F),n.on("data",C)):(X=dAe.createInterface({input:n,escapeCodeTimeout:0}),dAe.emitKeypressEvents(n,X),n.on("keypress",F)),()=>{w?(E.removeListener("keypress",F),n.removeListener("data",C)):n.removeListener("keypress",F),X.close(),g===!1&&i(!1),R&&(clearTimeout(R),R=null),p&&(G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:y}),y=""),d.current&&(clearTimeout(d.current),d.current=null),t.current&&o.current&&(G({name:"",ctrl:!1,meta:!1,shift:!1,paste:!0,sequence:o.current}),t.current=!1,o.current=""),Z(),I.current.length>0&&I.current.length>=$mt?v():I.current=[]}},[n,i,e,s]),(0,AVr.jsx)(FVr.Provider,{value:{subscribe:h,unsubscribe:c,onBackgroundModeRequested:r},children:a})}var $b,AVr,mv,NVr,WVr,R9n,A9n,E9n,$mt,x9n,C9n,FVr,ept=_e(async()=>{"use strict";await wa();$b=Qt(qr(),1);yVr();await Kmt();AVr=Qt(Fr(),1);mv="\x1B",NVr=`${mv}[200~`,WVr=`${mv}[201~`,R9n=100,A9n="'",E9n='"',$mt=5,x9n=5,C9n=32,FVr=(0,$b.createContext)(void 0)});function Vp(a,{isActive:e}){let{subscribe:r,unsubscribe:n}=wVr();(0,EVr.useEffect)(()=>{if(e)return r(a),()=>{n(a)}},[e,a,r,n])}var EVr,kE=_e(async()=>{"use strict";EVr=Qt(qr(),1);await ept();});function Y9n(a,e=15){return $S(a)<=e?a:a.split(/\r?\n/).slice(0,e).join(`
5351
5351
  `)+`
5352
5352
  ...`}function xVr(a,e=15){return $S(a)>e}function CVr(a,e=15){let r=$S(a);if(r<=e)return a;let n=a.split(/\r?\n/);if(r<=e*2)return Y9n(a,e);let i=Math.floor(e*.6),s=Math.floor(e*.3),t=r-i-s,o=n.slice(0,i).join(`
5353
5353
  `),d=n.slice(-s).join(`
@@ -5479,7 +5479,7 @@ ${c}`),n?i.reset(c):c}function oQn(a,e,r,n={}){if(!d9r){d9r=!0;let s="Passing li
5479
5479
 
5480
5480
  ${e}
5481
5481
  `:""}`}set message(e){this.#r=e}#n(e){if(!this.#t)return;let r=this.#e,n=dQn(r,this.#t.message);if(n)return(0,v9r.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#a??=this.#n(!0),this.#a}get rawCodeFrame(){return this.#i??=this.#n(!1),this.#i}},dQn=(a,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:cpt(a,Number(n),{oneBased:!0})},IQn=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${uQn(n)})`)});var Jce=He((g2s,Z9r)=>{"use strict";var hQn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{};Z9r.exports=hQn});var Bce=He((v2s,N9r)=>{"use strict";var mQn="2.0.0",pQn=Number.MAX_SAFE_INTEGER||9007199254740991,bQn=16,fQn=250,GQn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];N9r.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:bQn,MAX_SAFE_BUILD_LENGTH:fQn,MAX_SAFE_INTEGER:pQn,RELEASE_TYPES:GQn,SEMVER_SPEC_VERSION:mQn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var rP=He((U5,W9r)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ipt,MAX_SAFE_BUILD_LENGTH:gQn,MAX_LENGTH:vQn}=Bce(),yQn=Jce();U5=W9r.exports={};var ZQn=U5.re=[],NQn=U5.safeRe=[],An=U5.src=[],WQn=U5.safeSrc=[],En=U5.t={},FQn=0,hpt="[a-zA-Z0-9-]",wQn=[["\\s",1],["\\d",vQn],[hpt,gQn]],RQn=a=>{for(let[e,r]of wQn)a=a.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return a},Gs=(a,e,r)=>{let n=RQn(e),i=FQn++;yQn(a,i,e),En[a]=i,An[i]=e,WQn[i]=n,ZQn[i]=new RegExp(e,r?"g":void 0),NQn[i]=new RegExp(n,r?"g":void 0)};Gs("NUMERICIDENTIFIER","0|[1-9]\\d*");Gs("NUMERICIDENTIFIERLOOSE","\\d+");Gs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${hpt}*`);Gs("MAINVERSION",`(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})`);Gs("MAINVERSIONLOOSE",`(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASEIDENTIFIER",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIER]})`);Gs("PRERELEASEIDENTIFIERLOOSE",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASE",`(?:-(${An[En.PRERELEASEIDENTIFIER]}(?:\\.${An[En.PRERELEASEIDENTIFIER]})*))`);Gs("PRERELEASELOOSE",`(?:-?(${An[En.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${An[En.PRERELEASEIDENTIFIERLOOSE]})*))`);Gs("BUILDIDENTIFIER",`${hpt}+`);Gs("BUILD",`(?:\\+(${An[En.BUILDIDENTIFIER]}(?:\\.${An[En.BUILDIDENTIFIER]})*))`);Gs("FULLPLAIN",`v?${An[En.MAINVERSION]}${An[En.PRERELEASE]}?${An[En.BUILD]}?`);Gs("FULL",`^${An[En.FULLPLAIN]}$`);Gs("LOOSEPLAIN",`[v=\\s]*${An[En.MAINVERSIONLOOSE]}${An[En.PRERELEASELOOSE]}?${An[En.BUILD]}?`);Gs("LOOSE",`^${An[En.LOOSEPLAIN]}$`);Gs("GTLT","((?:<|>)?=?)");Gs("XRANGEIDENTIFIERLOOSE",`${An[En.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Gs("XRANGEIDENTIFIER",`${An[En.NUMERICIDENTIFIER]}|x|X|\\*`);Gs("XRANGEPLAIN",`[v=\\s]*(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:${An[En.PRERELEASE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGEPLAINLOOSE",`[v=\\s]*(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:${An[En.PRERELEASELOOSE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAIN]}$`);Gs("XRANGELOOSE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAINLOOSE]}$`);Gs("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ipt}})(?:\\.(\\d{1,${Ipt}}))?(?:\\.(\\d{1,${Ipt}}))?`);Gs("COERCE",`${An[En.COERCEPLAIN]}(?:$|[^\\d])`);Gs("COERCEFULL",An[En.COERCEPLAIN]+`(?:${An[En.PRERELEASE]})?(?:${An[En.BUILD]})?(?:$|[^\\d])`);Gs("COERCERTL",An[En.COERCE],!0);Gs("COERCERTLFULL",An[En.COERCEFULL],!0);Gs("LONETILDE","(?:~>?)");Gs("TILDETRIM",`(\\s*)${An[En.LONETILDE]}\\s+`,!0);U5.tildeTrimReplace="$1~";Gs("TILDE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAIN]}$`);Gs("TILDELOOSE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("LONECARET","(?:\\^)");Gs("CARETTRIM",`(\\s*)${An[En.LONECARET]}\\s+`,!0);U5.caretTrimReplace="$1^";Gs("CARET",`^${An[En.LONECARET]}${An[En.XRANGEPLAIN]}$`);Gs("CARETLOOSE",`^${An[En.LONECARET]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("COMPARATORLOOSE",`^${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]})$|^$`);Gs("COMPARATOR",`^${An[En.GTLT]}\\s*(${An[En.FULLPLAIN]})$|^$`);Gs("COMPARATORTRIM",`(\\s*)${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]}|${An[En.XRANGEPLAIN]})`,!0);U5.comparatorTrimReplace="$1$2$3";Gs("HYPHENRANGE",`^\\s*(${An[En.XRANGEPLAIN]})\\s+-\\s+(${An[En.XRANGEPLAIN]})\\s*$`);Gs("HYPHENRANGELOOSE",`^\\s*(${An[En.XRANGEPLAINLOOSE]})\\s+-\\s+(${An[En.XRANGEPLAINLOOSE]})\\s*$`);Gs("STAR","(<|>)?=?\\s*\\*");Gs("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Gs("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var yAe=He((y2s,F9r)=>{"use strict";var AQn=Object.freeze({loose:!0}),EQn=Object.freeze({}),xQn=a=>a?typeof a!="object"?AQn:a:EQn;F9r.exports=xQn});var mpt=He((Z2s,A9r)=>{"use strict";var w9r=/^[0-9]+$/,R9r=(a,e)=>{if(typeof a=="number"&&typeof e=="number")return a===e?0:a<e?-1:1;let r=w9r.test(a),n=w9r.test(e);return r&&n&&(a=+a,e=+e),a===e?0:r&&!n?-1:n&&!r?1:a<e?-1:1},CQn=(a,e)=>R9r(e,a);A9r.exports={compareIdentifiers:R9r,rcompareIdentifiers:CQn}});var rf=He((N2s,x9r)=>{"use strict";var ZAe=Jce(),{MAX_LENGTH:E9r,MAX_SAFE_INTEGER:NAe}=Bce(),{safeRe:WAe,t:FAe}=rP(),YQn=yAe(),{compareIdentifiers:ppt}=mpt(),bpt=class a{constructor(e,r){if(r=YQn(r),e instanceof a){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>E9r)throw new TypeError(`version is longer than ${E9r} characters`);ZAe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?WAe[FAe.LOOSE]:WAe[FAe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>NAe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>NAe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>NAe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<NAe)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ZAe("SemVer.compare",this.version,this.options,e),!(e instanceof a)){if(typeof e=="string"&&e===this.version)return 0;e=new a(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof a||(e=new a(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(ZAe("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ppt(n,i)}while(++r)}compareBuild(e){e instanceof a||(e=new a(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(ZAe("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ppt(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?WAe[FAe.PRERELEASELOOSE]:WAe[FAe.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),ppt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};x9r.exports=bpt});var uL=He((W2s,Y9r)=>{"use strict";var C9r=rf(),VQn=(a,e,r=!1)=>{if(a instanceof C9r)return a;try{return new C9r(a,e)}catch(n){if(!r)return null;throw n}};Y9r.exports=VQn});var fpt=He((F2s,V9r)=>{"use strict";var QQn=uL(),HQn=(a,e)=>{let r=QQn(a,e);return r?r.version:null};V9r.exports=HQn});var Gpt=He((w2s,Q9r)=>{"use strict";var XQn=uL(),kQn=(a,e)=>{let r=XQn(a.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Q9r.exports=kQn});var gpt=He((R2s,SQn)=>{SQn.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var H9r=He((A2s,LQn)=>{LQn.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var X9r=He((E2s,JQn)=>{JQn.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var S9r=He((x2s,k9r)=>{"use strict";var BQn=[].concat(gpt()).concat(H9r()),TQn=X9r();k9r.exports=function(a){var e=0;function r(){return e<a.length}function n(Z){if(Z instanceof RegExp){var v=a.slice(e),N=v.match(Z);if(N)return e+=N[0].length,N[0]}else if(a.indexOf(Z,e)===e)return e+=Z.length,Z}function i(){n(/[ ]*/)}function s(){for(var Z,v=["WITH","AND","OR","(",")",":","+"],N=0;N<v.length&&(Z=n(v[N]),!Z);N++);if(Z==="+"&&e>1&&a[e-2]===" ")throw new Error("Space before `+`");return Z&&{type:"OPERATOR",string:Z}}function t(){return n(/[A-Za-z0-9-.]+/)}function o(){var Z=t();if(!Z)throw new Error("Expected idstring at offset "+e);return Z}function d(){if(n("DocumentRef-")){var Z=o();return{type:"DOCUMENTREF",string:Z}}}function I(){if(n("LicenseRef-")){var Z=o();return{type:"LICENSEREF",string:Z}}}function u(){var Z=e,v=t();if(BQn.indexOf(v)!==-1)return{type:"LICENSE",string:v};if(TQn.indexOf(v)!==-1)return{type:"EXCEPTION",string:v};e=Z}function h(){return s()||d()||I()||u()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+a[e]+"` at offset "+e);c.push(m)}return c}});var J9r=He((C2s,L9r)=>{"use strict";L9r.exports=function(a){var e=0;function r(){return e<a.length}function n(){return r()?a[e]:null}function i(){if(!r())throw new Error;e++}function s(v){var N=n();if(N&&N.type==="OPERATOR"&&v===N.string)return i(),N.string}function t(){if(s("WITH")){var v=n();if(v&&v.type==="EXCEPTION")return i(),v.string;throw new Error("Expected exception after `WITH`")}}function o(){var v=e,N="",g=n();if(g.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+g.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(g=n(),g.type==="LICENSEREF")return i(),N+="LicenseRef-"+g.string,{license:N};e=v}function d(){var v=n();if(v&&v.type==="LICENSE"){i();var N={license:v.string};s("+")&&(N.plus=!0);var g=t();return g&&(N.exception=g),N}}function I(){var v=s("(");if(v){var N=m();if(!s(")"))throw new Error("Expected `)`");return N}}function u(){return I()||o()||d()}function h(v,N){return function g(){var E=N();if(E){if(!s(v))return E;var w=g();if(!w)throw new Error("Expected expression");return{left:E,conjunction:v.toLowerCase(),right:w}}}}var c=h("AND",u),m=h("OR",c),Z=m();if(!Z||r())throw new Error("Syntax error");return Z}});var vpt=He((Y2s,B9r)=>{"use strict";var DQn=S9r(),OQn=J9r();B9r.exports=function(a){return OQn(DQn(a))}});var j9r=He((V2s,P9r)=>{var MQn=vpt(),UQn=gpt();function wAe(a){try{return MQn(a),!0}catch{return!1}}function _9r(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var T9r=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(_9r),zQn=0,_Qn=1,D9r=[function(a){return a.toUpperCase()},function(a){return a.trim()},function(a){return a.replace(/\./g,"")},function(a){return a.replace(/\s+/g,"")},function(a){return a.replace(/\s+/g,"-")},function(a){return a.replace("v","-")},function(a){return a.replace(/,?\s*(\d)/,"-$1")},function(a){return a.replace(/,?\s*(\d)/,"-$1.0")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(a){return a[0].toUpperCase()+a.slice(1)},function(a){return a.replace("/","-")},function(a){return a.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(a){return a.indexOf("3.0")!==-1?a+"-or-later":a+"-only"},function(a){return a+"only"},function(a){return a.replace(/(\d)$/,"-$1.0")},function(a){return a.replace(/(-| )?(\d)$/,"-$2-Clause")},function(a){return a.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(a){return a.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(a){return a.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(a){return a.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(a){return a.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(a){return a.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(a){return"CC-"+a},function(a){return"CC-"+a+"-4.0"},function(a){return a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(a){return"CC-"+a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],ypt=UQn.map(function(a){var e=/^(.*)-\d+\.\d+$/.exec(a);return e?[e[0],e[1]]:[a,null]}).reduce(function(a,e){var r=e[1];return a[r]=a[r]||[],a[r].push(e[0]),a},{}),PQn=Object.keys(ypt).map(function(e){return[e,ypt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});ypt=void 0;var O9r=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(PQn).sort(_9r),jQn=0,qQn=1,M9r=function(a){for(var e=0;e<D9r.length;e++){var r=D9r[e](a).trim();if(r!==a&&wAe(r))return r}return null},U9r=function(a){for(var e=a.toUpperCase(),r=0;r<O9r.length;r++){var n=O9r[r];if(e.indexOf(n[jQn])>-1)return n[qQn]}return null},z9r=function(a,e){for(var r=0;r<T9r.length;r++){var n=T9r[r],i=n[zQn];if(a.indexOf(i)>-1){var s=a.replace(i,n[_Qn]),t=e(s);if(t!==null)return t}}return null};P9r.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(o){return r?KQn(o):o}var i=typeof a=="string"&&a.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(a=a.trim(),wAe(a))return n(a);var s=a.replace(/\+$/,"").trim();if(wAe(s))return n(s);var t=M9r(a);return t!==null||(t=z9r(a,function(o){return wAe(o)?o:M9r(o)}),t!==null)||(t=U9r(a),t!==null)||(t=z9r(a,U9r),t!==null)?n(t):null};function KQn(a){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(a)!==-1?a+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(a)!==-1?a.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(a)!==-1?a+"-or-later":a}});var eQr=He((Q2s,$9r)=>{var $Qn=vpt(),eHn=j9r(),q9r='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',tHn=/^SEE LICEN[CS]E IN (.+)$/;function K9r(a,e){return e.slice(0,a.length)===a}function Zpt(a){if(a.hasOwnProperty("license")){var e=a.license;return K9r("LicenseRef",e)||K9r("DocumentRef",e)}else return Zpt(a.left)||Zpt(a.right)}$9r.exports=function(a){var e;try{e=$Qn(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=tHn.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[q9r]};if(a.trim().length!==0){var i=eHn(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return Zpt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[q9r]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var iQr=He(AAe=>{"use strict";Object.defineProperty(AAe,"__esModule",{value:!0});AAe.LRUCache=void 0;var aP=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,rQr=new Set,Npt=typeof process=="object"&&process?process:{},aQr=(a,e,r,n)=>{typeof Npt.emitWarning=="function"?Npt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},RAe=globalThis.AbortController,tQr=globalThis.AbortSignal;if(typeof RAe>"u"){tQr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},RAe=class{constructor(){e()}signal=new tQr;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let a=Npt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,aQr("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var rHn=a=>!rQr.has(a),k2s=Symbol("type"),Q9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),nQr=a=>Q9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?nP:null:null,nP=class extends Array{constructor(e){super(e),this.fill(0)}},Wpt=class a{heap;length;static#e=!1;static create(e){let r=nQr(e);if(!r)return[];a.#e=!0;let n=new a(e,r);return a.#e=!1,n}constructor(e,r){if(!a.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Fpt=class a{#e;#t;#r;#a;#i;#n;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#I;#d;#h;#l;#p;#b;#G;#m;#N;#y;#W;#F;#v;#g;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#W,sizes:e.#N,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#p},get tail(){return e.#b},free:e.#G,isBackgroundFetch:r=>e.#Z(r),backgroundFetch:(r,n,i,s)=>e.#C(r,n,i,s),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#E(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#n}get dispose(){return this.#r}get disposeAfter(){return this.#a}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:t,updateAgeOnHas:o,allowStale:d,dispose:I,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:Z=0,sizeCalculation:v,fetchMethod:N,memoMethod:g,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:p,ignoreFetchAbort:y}=e;if(r!==0&&!Q9(r))throw new TypeError("max option must be a nonnegative integer");let W=r?nQr(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=Z||this.#t,this.sizeCalculation=v,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#n=g,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=N,this.#v=!!N,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new W(r),this.#l=new W(r),this.#p=0,this.#b=0,this.#G=Wpt.create(r),this.#c=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof u=="function"?(this.#a=u,this.#m=[]):(this.#a=void 0,this.#m=void 0),this.#F=!!this.#r,this.#g=!!this.#a,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!p,this.ignoreFetchAbort=!!y,this.maxEntrySize!==0){if(this.#t!==0&&!Q9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Q9(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!o,this.ttlResolution=Q9(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Q9(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#w()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let R="LRU_CACHE_UNBOUNDED";rHn(R)&&(rQr.add(R),aQr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",R,a))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#w(){let e=new nP(this.#e),r=new nP(this.#e);this.#W=e,this.#y=r,this.#H=(s,t,o=aP.now())=>{if(r[s]=t!==0?o:0,e[s]=t,t!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#E(s)&&this.#k(this.#I[s],"expire")},t+1);d.unref&&d.unref()}},this.#A=s=>{r[s]=e[s]!==0?aP.now():0},this.#u=(s,t)=>{if(e[t]){let o=e[t],d=r[t];if(!o||!d)return;s.ttl=o,s.start=d,s.now=n||i();let I=s.now-d;s.remainingTTL=o-I}};let n=0,i=()=>{let s=aP.now();if(this.ttlResolution>0){n=s;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return s};this.getRemainingTTL=s=>{let t=this.#s.get(s);if(t===void 0)return 0;let o=e[t],d=r[t];if(!o||!d)return 1/0;let I=(n||i())-d;return o-I},this.#E=s=>{let t=r[s],o=e[s];return!!o&&!!t&&(n||i())-t>o}}#A=()=>{};#u=()=>{};#H=()=>{};#E=()=>!1;#x(){let e=new nP(this.#e);this.#o=0,this.#N=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#R=(r,n,i,s)=>{if(this.#Z(n))return 0;if(!Q9(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Q9(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#o>s;)this.#J(!0)}this.#o+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,n)=>{};#R=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#b;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#p));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#p;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#b));)r=this.#h[r]}#X(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*keys(){for(let e of this.#L()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#I[n],this))return this.get(this.#I[n],r)}}forEach(e,r=this){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}rforEach(e,r=this){for(let n of this.#V()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#E(r)&&(this.#k(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#d[r],i=this.#Z(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#W&&this.#y){let t=this.#W[r],o=this.#y[r];if(t&&o){let d=t-(aP.now()-o);s.ttl=d,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let n=this.#I[r],i=this.#d[r],s=this.#Z(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let t={value:s};if(this.#W&&this.#y){t.ttl=this.#W[r];let o=aP.now()-this.#y[r];t.start=Math.floor(Date.now()-o)}this.#N&&(t.size=this.#N[r]),e.unshift([n,t])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=aP.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:d}=n,{noUpdateTTL:I=this.noUpdateTTL}=n,u=this.#R(e,r,n.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let h=this.#c===0?void 0:this.#s.get(e);if(h===void 0)h=this.#c===0?this.#b:this.#G.length!==0?this.#G.pop():this.#c===this.#e?this.#J(!1):this.#c,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#b]=h,this.#l[h]=this.#b,this.#b=h,this.#c++,this.#S(h,u,d),d&&(d.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#v&&this.#Z(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#F&&this.#r?.(m,e,"set"),this.#g&&this.#m?.push([m,e,"set"]))}else t||(this.#F&&this.#r?.(c,e,"set"),this.#g&&this.#m?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,u,d),this.#d[h]=r,d){d.set="replace";let m=c&&this.#Z(c)?c.__staleWhileFetching:c;m!==void 0&&(d.oldValue=m)}}else d&&(d.set="update")}if(i!==0&&!this.#W&&this.#w(),this.#W&&(I||this.#H(h,i,s),d&&this.#u(d,h)),!t&&this.#g&&this.#m){let c=this.#m,m;for(;m=c?.shift();)this.#a?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#p];if(this.#J(!0),this.#Z(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#g&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#a?.(...r)}}}#J(e){let r=this.#p,n=this.#I[r],i=this.#d[r];return this.#v&&this.#Z(i)?i.__abortController.abort(new Error("evicted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(i,n,"evict"),this.#g&&this.#m?.push([i,n,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#G.push(r)),this.#c===1?(this.#p=this.#b=0,this.#G.length=0):this.#p=this.#h[r],this.#s.delete(n),this.#c--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#s.get(e);if(s!==void 0){let t=this.#d[s];if(this.#Z(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#E(s))i&&(i.has="stale",this.#u(i,s));else return n&&this.#A(s),i&&(i.has="hit",this.#u(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!n&&this.#E(i))return;let s=this.#d[i];return this.#Z(s)?s.__staleWhileFetching:s}#C(e,r,n,i){let s=r===void 0?void 0:this.#d[r];if(this.#Z(s))return s;let t=new RAe,{signal:o}=n;o?.addEventListener("abort",()=>t.abort(o.reason),{signal:t.signal});let d={signal:t.signal,options:n,context:i},I=(v,N=!1)=>{let{aborted:g}=t.signal,E=n.ignoreFetchAbort&&v!==void 0;if(n.status&&(g&&!N?(n.status.fetchAborted=!0,n.status.fetchError=t.signal.reason,E&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),g&&!E&&!N)return h(t.signal.reason);let w=m;return this.#d[r]===m&&(v===void 0?w.__staleWhileFetching?this.#d[r]=w.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,v,d.options))),v},u=v=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=v),h(v)),h=v=>{let{aborted:N}=t.signal,g=N&&n.allowStaleOnFetchAbort,E=g||n.allowStaleOnFetchRejection,w=E||n.noDeleteOnFetchRejection,A=m;if(this.#d[r]===m&&(!w||A.__staleWhileFetching===void 0?this.#k(e,"fetch"):g||(this.#d[r]=A.__staleWhileFetching)),E)return n.status&&A.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw v},c=(v,N)=>{let g=this.#i?.(e,s,d);g&&g instanceof Promise&&g.then(E=>v(E===void 0?void 0:E),N),t.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(v(void 0),n.allowStaleOnFetchAbort&&(v=E=>I(E,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(c).then(I,u),Z=Object.assign(m,{__abortController:t,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,Z,{...d.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=Z,Z}#Z(e){if(!this.#v)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof RAe}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:d=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:v,forceRefresh:N=!1,status:g,signal:E}=r;if(!this.#v)return g&&(g.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:g});let w={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:t,noDisposeOnSet:o,size:d,sizeCalculation:I,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:Z,ignoreFetchAbort:m,status:g,signal:E},A=this.#s.get(e);if(A===void 0){g&&(g.fetch="miss");let p=this.#C(e,A,w,v);return p.__returned=p}else{let p=this.#d[A];if(this.#Z(p)){let b=n&&p.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",b&&(g.returnedStale=!0)),b?p.__staleWhileFetching:p.__returned=p}let y=this.#E(A);if(!N&&!y)return g&&(g.fetch="hit"),this.#D(A),i&&this.#A(A),g&&this.#u(g,A),p;let W=this.#C(e,A,w,v),f=W.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=y?"stale":"refresh",f&&y&&(g.returnedStale=!0)),f?W.__staleWhileFetching:W.__returned=W}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#n;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...t}=r,o=this.get(e,t);if(!s&&o!==void 0)return o;let d=n(e,o,{options:t,context:i});return this.set(e,d,t),d}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:t}=r,o=this.#s.get(e);if(o!==void 0){let d=this.#d[o],I=this.#Z(d);return t&&this.#u(t,o),this.#E(o)?(t&&(t.get="stale"),I?(t&&n&&d.__staleWhileFetching!==void 0&&(t.returnedStale=!0),n?d.__staleWhileFetching:void 0):(s||this.#k(e,"expire"),t&&n&&(t.returnedStale=!0),n?d:void 0)):(t&&(t.get="hit"),I?d.__staleWhileFetching:(this.#D(o),i&&this.#A(o),d))}else t&&(t.get="miss")}#T(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#p?this.#p=this.#h[e]:this.#T(this.#l[e],this.#h[e]),this.#T(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let n=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(n=!0,this.#c===1)this.#f(r);else{this.#Y(i);let s=this.#d[i];if(this.#Z(s)?s.__abortController.abort(new Error("deleted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(s,e,r),this.#g&&this.#m?.push([s,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#b)this.#b=this.#l[i];else if(i===this.#p)this.#p=this.#h[i];else{let t=this.#l[i];this.#h[t]=this.#h[i];let o=this.#h[i];this.#l[o]=this.#l[i]}this.#c--,this.#G.push(i)}}if(this.#g&&this.#m?.length){let i=this.#m,s;for(;s=i?.shift();)this.#a?.(...s)}return n}clear(){return this.#f("delete")}#f(e){for(let r of this.#V({allowStale:!0})){let n=this.#d[r];if(this.#Z(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#F&&this.#r?.(n,i,e),this.#g&&this.#m?.push([n,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#W&&this.#y&&(this.#W.fill(0),this.#y.fill(0)),this.#N&&this.#N.fill(0),this.#p=0,this.#b=0,this.#G.length=0,this.#o=0,this.#c=0,this.#g&&this.#m){let r=this.#m,n;for(;n=r?.shift();)this.#a?.(...n)}}};AAe.LRUCache=Fpt});var lQr=He((L2s,oQr)=>{"use strict";var Hl=(...a)=>a.every(e=>e)?a.join(""):"",zh=a=>a?encodeURIComponent(a):"",sQr=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),aHn={sshtemplate:({domain:a,user:e,project:r,committish:n})=>`git@${a}:${e}/${r}.git${Hl("#",n)}`,sshurltemplate:({domain:a,user:e,project:r,committish:n})=>`git+ssh://git@${a}/${e}/${r}.git${Hl("#",n)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i,path:s})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n||"HEAD"),"/",s)}`,browsetemplate:({domain:a,user:e,project:r,committish:n,treepath:i})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n))}`,browsetreetemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Hl("#",o(t||""))}`,browseblobtemplate:({domain:a,user:e,project:r,committish:n,blobpath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Hl("#",o(t||""))}`,docstemplate:({domain:a,user:e,project:r,treepath:n,committish:i})=>`https://${a}/${e}/${r}${Hl("/",n,"/",zh(i))}#readme`,httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/raw/${zh(n||"HEAD")}/${i}`,shortcuttemplate:({type:a,user:e,project:r,committish:n})=>`${a}:${e}/${r}${Hl("#",n)}`,pathtemplate:({user:a,project:e,committish:r})=>`${a}/${e}${Hl("#",r)}`,bugstemplate:({domain:a,user:e,project:r})=>`https://${a}/${e}/${r}/issues`,hashformat:sQr},H9={};H9.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:a,user:e,project:r,committish:n,path:i})=>`https://${Hl(a,"@")}raw.githubusercontent.com/${e}/${r}/${zh(n||"HEAD")}/${i}`,gittemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://codeload.${a}/${e}/${r}/tar.gz/${zh(n||"HEAD")}`,extract:a=>{let[,e,r,n,i]=a.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=a.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};H9.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,editpath:t})=>`https://${a}/${e}/${r}${Hl("/",i,"/",zh(n||"HEAD"),"/",s,t)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/get/${zh(n||"HEAD")}.tar.gz`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};H9.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Hl(a,"@")}${e}/${r}/${n}.git${Hl("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/repository/archive.tar.gz?ref=${zh(n||"HEAD")}`,extract:a=>{let e=a.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:a.hash.slice(1)}}};H9.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:a,project:e,committish:r})=>`git@${a}:${e}.git${Hl("#",r)}`,sshurltemplate:({domain:a,project:e,committish:r})=>`git+ssh://git@${a}/${e}.git${Hl("#",r)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i})=>`https://${a}/${e}/${r}${Hl("/",zh(n))}/${i}`,browsetemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Hl("/",zh(r))}`,browsetreetemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Hl("/",zh(r))}${Hl("#",i(n))}`,browseblobtemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Hl("/",zh(r))}${Hl("#",i(n))}`,docstemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Hl("/",zh(r))}`,httpstemplate:({domain:a,project:e,committish:r})=>`git+https://${a}/${e}.git${Hl("#",r)}`,filetemplate:({user:a,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${a}/${e}/raw${Hl("/",zh(r))}/${n}`,shortcuttemplate:({type:a,project:e,committish:r})=>`${a}:${e}${Hl("#",r)}`,pathtemplate:({project:a,committish:e})=>`${a}${Hl("#",e)}`,bugstemplate:({domain:a,project:e})=>`https://${a}/${e}`,gittemplate:({domain:a,project:e,committish:r})=>`git://${a}/${e}.git${Hl("#",r)}`,tarballtemplate:({project:a,committish:e})=>`https://codeload.github.com/gist/${a}/tar.gz/${zh(e||"HEAD")}`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:a.hash.slice(1)}}},hashformat:function(a){return a&&"file-"+sQr(a)}};H9.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/blob/${zh(n)||"HEAD"}/${i}`,httpstemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}.git${Hl("#",n)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/archive/${zh(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};for(let[a,e]of Object.entries(H9))H9[a]=Object.assign({},aHn,e);oQr.exports=H9});var Rpt=He((J2s,uQr)=>{var nHn=Ct("url"),wpt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},cQr=a=>{try{return new nHn.URL(a)}catch{}},iHn=(a,e)=>{let r=a.indexOf(":"),n=a.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return a;let i=a.indexOf("@");return i>-1?i>r?`git+ssh://${a}`:a:a.indexOf("//")===r+1?a:`${a.slice(0,r+1)}//${a.slice(r+1)}`},sHn=a=>{let e=wpt(a,"@","#"),r=wpt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),wpt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};uQr.exports=(a,e)=>{let r=e?iHn(a,e):a;return cQr(r)||cQr(sHn(r))}});var IQr=He((B2s,dQr)=>{"use strict";var oHn=Rpt(),lHn=a=>{let e=a.indexOf("#"),r=a.indexOf("/"),n=a.indexOf("/",r+1),i=a.indexOf(":"),s=/\s/.exec(a),t=a.indexOf("@"),o=!s||e>-1&&s.index>e,d=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,u=n===-1||e>-1&&n>e,h=r>0,c=e>-1?a[e-1]!=="/":!a.endsWith("/"),m=!a.startsWith(".");return o&&h&&c&&m&&d&&I&&u};dQr.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=lHn(a)?`github:${a}`:a,s=oHn(i,n);if(!s)return;let t=r.byShortcut[s.protocol],o=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],d=t||o;if(!d)return;let I=r[t||o],u=null;n[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let h=null,c=null,m=null,Z=null;try{if(t){let v=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,N=v.indexOf("@");N>-1&&(v=v.slice(N+1));let g=v.lastIndexOf("/");g>-1?(c=decodeURIComponent(v.slice(0,g)),c||(c=null),m=decodeURIComponent(v.slice(g+1))):m=decodeURIComponent(v),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(h=decodeURIComponent(s.hash.slice(1))),Z="shortcut"}else{if(!I.protocols.includes(s.protocol))return;let v=I.extract(s);if(!v)return;c=v.user&&decodeURIComponent(v.user),m=decodeURIComponent(v.project),h=decodeURIComponent(v.committish),Z=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(v){if(v instanceof URIError)return;throw v}return[d,c,u,m,h,Z,e]}});var mQr=He((T2s,hQr)=>{"use strict";var{LRUCache:cHn}=iQr(),uHn=lQr(),dHn=IQr(),IHn=Rpt(),Apt=new cHn({max:1e3}),EAe=class a{constructor(e,r,n,i,s,t,o={}){Object.assign(this,a.#e[e],{type:e,user:r,auth:n,project:i,committish:s,default:t,opts:o})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){a.#e[e]=r,a.#e.byDomain[r.domain]=e,a.#e.byShortcut[`${e}:`]=e,a.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!Apt.has(n)){let i=dHn(e,r,{gitHosts:a.#e,protocols:a.#t});Apt.set(n,i?new a(...i):void 0)}return Apt.get(n)}static parseUrl(e){return IHn(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let i=e(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[a,e]of Object.entries(uHn))EAe.addHost(a,e);hQr.exports=EAe});var bQr=He((D2s,pQr)=>{pQr.exports=hHn;function hHn(a){if(!a||a==="ERROR: No README data found!")return;a=a.trim().split(`
5482
- `);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var fQr=He((O2s,mHn)=>{mHn.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var yQr=He((M2s,vQr)=>{var pHn=fpt(),bHn=Gpt(),fHn=eQr(),xAe=mQr(),GHn=Ct("node:module"),gHn=["dependencies","devDependencies","optionalDependencies"],vHn=bQr(),Ept=Ct("url"),X9=fQr(),GQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");vQr.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=xAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){AHn(a,this.warn),wHn(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=xAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!pHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=bHn(a.version,r),!0},fixPeople:function(a){gQr(a,WHn),gQr(a,FHn)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),NHn(a.name,r,e.allowLegacyCase),GHn.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=vHn(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=xAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")GQr(a.bugs)?a.bugs={email:a.bugs}:Ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{EHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&GQr(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=xAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;Ept.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!fHn(e).validForNewPackages)return this.warn("invalidLicense")}};function yHn(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function ZHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function NHn(a,e,r){if(a.charAt(0)==="."||!(yHn(a)||ZHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function gQr(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function WHn(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function FHn(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function wHn(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function RHn(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function AHn(a,e){gHn.forEach(function(r){a[r]&&(a[r]=RHn(a[r],r,e))})}function EHn(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var ZQr=He((U2s,xHn)=>{xHn.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var FQr=He((z2s,WQr)=>{var NQr=Ct("util"),xpt=ZQr();WQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return CHn.apply(null,a);var r=xpt[e]?xpt[e]:e+": '%s'";return a.unshift(r),NQr.format.apply(null,a)};function CHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),NQr.format(xpt.typo,a,e)}});var EQr=He((_2s,AQr)=>{AQr.exports=wQr;var Cpt=yQr();wQr.fixer=Cpt;var YHn=FQr(),VHn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],QHn=["dependencies","people","typos"],Ypt=VHn.map(function(a){return RQr(a)+"Field"});Ypt=Ypt.concat(QHn);function wQr(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),Cpt.warn=function(){e(YHn.apply(null,arguments))},Ypt.forEach(function(n){Cpt["fix"+RQr(n)](a,r)}),a._id=a.name+"@"+a.version}function RQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var xQr=_e(()=>{});import{fileURLToPath as HHn}from"node:url";function CQr(a){return a instanceof URL?HHn(a):a}var YQr=_e(()=>{xQr()});import XHn from"node:fs/promises";import kHn from"node:path";async function QQr({cwd:a,normalize:e=!0}={}){let r=await XHn.readFile(SHn(a),"utf8");return LHn(r,e)}var VQr,SHn,LHn,HQr=_e(()=>{y9r();VQr=Qt(EQr(),1);YQr();SHn=a=>kHn.resolve(CQr(a)??".","package.json"),LHn=(a,e)=>{let r=typeof a=="string"?dpt(a):a;return e&&(0,VQr.default)(r),r}});import JHn from"node:path";async function XQr(a){let e=await zVr("package.json",a);if(e)return{packageJson:await QQr({...a,cwd:JHn.dirname(e)}),path:e}}var kQr=_e(()=>{_Vr();HQr()});import{fileURLToPath as BHn}from"url";import THn from"path";async function sP(){if(iP)return iP;let a=await XQr({cwd:OHn});if(!a){let e="hwjcode-cli",r="1.1.127";return e&&r?(iP={name:e,version:r},iP):void 0}return iP=a.packageJson,iP}var DHn,OHn,iP,CAe=_e(()=>{"use strict";kQr();DHn=BHn(import.meta.url),OHn=THn.dirname(DHn)});var SQr={};Xs(SQr,{getCliVersion:()=>DW});async function DW(){let a=await sP();return"1.1.127"}var dL=_e(()=>{"use strict";CAe();});import IL from"node:process";var LQr,JQr=_e(()=>{"use strict";dL();Wi();ks();ma();LQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=IL.platform,r="no sandbox";IL.env.SANDBOX&&IL.env.SANDBOX!=="sandbox-exec"?r=IL.env.SANDBOX:IL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${IL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=IL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var BQr,TQr=_e(()=>{"use strict";Wi();ma();BQr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var DQr,OQr=_e(()=>{"use strict";Wi();ma();DQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var MQr,UQr=_e(()=>{"use strict";ks();Wi();ma();MQr={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function MHn(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
5482
+ `);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var fQr=He((O2s,mHn)=>{mHn.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var yQr=He((M2s,vQr)=>{var pHn=fpt(),bHn=Gpt(),fHn=eQr(),xAe=mQr(),GHn=Ct("node:module"),gHn=["dependencies","devDependencies","optionalDependencies"],vHn=bQr(),Ept=Ct("url"),X9=fQr(),GQr=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");vQr.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=xAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){AHn(a,this.warn),wHn(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=xAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!pHn(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=bHn(a.version,r),!0},fixPeople:function(a){gQr(a,WHn),gQr(a,FHn)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),NHn(a.name,r,e.allowLegacyCase),GHn.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=vHn(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=xAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")GQr(a.bugs)?a.bugs={email:a.bugs}:Ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{EHn(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&Ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&GQr(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=xAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;Ept.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!fHn(e).validForNewPackages)return this.warn("invalidLicense")}};function yHn(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function ZHn(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function NHn(a,e,r){if(a.charAt(0)==="."||!(yHn(a)||ZHn(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function gQr(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function WHn(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function FHn(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function wHn(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function RHn(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function AHn(a,e){gHn.forEach(function(r){a[r]&&(a[r]=RHn(a[r],r,e))})}function EHn(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var ZQr=He((U2s,xHn)=>{xHn.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var FQr=He((z2s,WQr)=>{var NQr=Ct("util"),xpt=ZQr();WQr.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return CHn.apply(null,a);var r=xpt[e]?xpt[e]:e+": '%s'";return a.unshift(r),NQr.format.apply(null,a)};function CHn(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),NQr.format(xpt.typo,a,e)}});var EQr=He((_2s,AQr)=>{AQr.exports=wQr;var Cpt=yQr();wQr.fixer=Cpt;var YHn=FQr(),VHn=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],QHn=["dependencies","people","typos"],Ypt=VHn.map(function(a){return RQr(a)+"Field"});Ypt=Ypt.concat(QHn);function wQr(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),Cpt.warn=function(){e(YHn.apply(null,arguments))},Ypt.forEach(function(n){Cpt["fix"+RQr(n)](a,r)}),a._id=a.name+"@"+a.version}function RQr(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var xQr=_e(()=>{});import{fileURLToPath as HHn}from"node:url";function CQr(a){return a instanceof URL?HHn(a):a}var YQr=_e(()=>{xQr()});import XHn from"node:fs/promises";import kHn from"node:path";async function QQr({cwd:a,normalize:e=!0}={}){let r=await XHn.readFile(SHn(a),"utf8");return LHn(r,e)}var VQr,SHn,LHn,HQr=_e(()=>{y9r();VQr=Qt(EQr(),1);YQr();SHn=a=>kHn.resolve(CQr(a)??".","package.json"),LHn=(a,e)=>{let r=typeof a=="string"?dpt(a):a;return e&&(0,VQr.default)(r),r}});import JHn from"node:path";async function XQr(a){let e=await zVr("package.json",a);if(e)return{packageJson:await QQr({...a,cwd:JHn.dirname(e)}),path:e}}var kQr=_e(()=>{_Vr();HQr()});import{fileURLToPath as BHn}from"url";import THn from"path";async function sP(){if(iP)return iP;let a=await XQr({cwd:OHn});if(!a){let e="hwjcode-cli",r="1.1.129";return e&&r?(iP={name:e,version:r},iP):void 0}return iP=a.packageJson,iP}var DHn,OHn,iP,CAe=_e(()=>{"use strict";kQr();DHn=BHn(import.meta.url),OHn=THn.dirname(DHn)});var SQr={};Xs(SQr,{getCliVersion:()=>DW});async function DW(){let a=await sP();return"1.1.129"}var dL=_e(()=>{"use strict";CAe();});import IL from"node:process";var LQr,JQr=_e(()=>{"use strict";dL();Wi();ks();ma();LQr={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=IL.platform,r="no sandbox";IL.env.SANDBOX&&IL.env.SANDBOX!=="sandbox-exec"?r=IL.env.SANDBOX:IL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${IL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=IL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var BQr,TQr=_e(()=>{"use strict";Wi();ma();BQr={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var DQr,OQr=_e(()=>{"use strict";Wi();ma();DQr={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var MQr,UQr=_e(()=>{"use strict";ks();Wi();ma();MQr={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function MHn(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
5483
5483
 
5484
5484
  ${we("command.config.available.options")}:
5485
5485
 
@@ -6618,10 +6618,10 @@ _\u6B63\u5728\u67E5\u8BE2\u672C\u673A CLI \u7684\u4F1A\u8BDD\u2026_`):(e.push(`*
6618
6618
  \u{1F916} \u9ED8\u8BA4\u6D3E\u53D1\u65B9\uFF1A**${PP(r.agent)}**\uFF08\u672C\u7FA4\u6240\u6709\u975E\u547D\u4EE4\u6D88\u606F\u90FD\u5C06\u81EA\u52A8\u6D3E\u53D1\u5230\u8BE5 agent \u6267\u884C\uFF09\u3002`:"",A=r.agent?"\n\n\u{1F4A1} \u4E3A\u4E86\u66F4\u597D\u5730\u7BA1\u7406\u5916\u90E8 Agent \u7684\u5DE5\u4F5C\uFF0C\u5EFA\u8BAE\u5C06\u672C\u7FA4\u6A21\u578B\u8BBE\u4E3A\u6027\u4EF7\u6BD4\u826F\u597D\u7684\u6A21\u578B\u4F5C\u4E3A\u4E8B\u52A1\u534F\u8C03\u6A21\u578B\uFF0C\u4F8B\u5982\u53D1\u9001 `/model deepseek-v4-pro` \u5C06 dsv4pro \u8BBE\u4E3A\u4E8B\u52A1\u534F\u8C03\u6A21\u578B\u3002":"",p=g?`
6619
6619
  \u{1F333} **\u5DE5\u4F5C\u533A\u9694\u79BB**: \u672C\u7FA4\u5DF2\u521B\u5EFA\u72EC\u7ACB Git Worktree\uFF08\u5206\u652F \`${g.branch}\`\uFF09\uFF0C\u4E0E\u5176\u4ED6\u7FA4\u804A\u4E92\u4E0D\u5E72\u6270\u3002
6620
6620
 
6621
- \u{1F4A1} **\u63D0\u4EA4\u4E0E\u540C\u6B65**:
6622
- \u2022 \`/worktree commit\` \u6216\u300C\u63D0\u4EA4\u4EE3\u7801\u300D\u2014 \u63D0\u4EA4\u5B58\u6863\uFF08\u4FDD\u7559\u5DE5\u4F5C\u533A\uFF0C\u7EE7\u7EED\u5E72\u6D3B\uFF09
6623
- \u2022 \`/worktree done\` \u6216\u300C\u5B8C\u6210\u4EFB\u52A1\u300D\u2014 \u63D0\u4EA4+\u6E05\u7406\uFF08\u4EFB\u52A1\u6536\u5DE5\uFF0C\u7FA4\u5207\u56DE\u4E3B\u76EE\u5F55\uFF09
6624
- \u2022 \`/worktree push\` \u6216\u300C\u63A8\u9001\u4EE3\u7801\u300D\u2014 \u63A8\u9001\u672C\u5206\u652F\u5230\u8FDC\u7A0B\uFF08\u4E0D\u5F71\u54CD\u5176\u4ED6\u5206\u652F\uFF09`:"",y=`\u{1F44B} \u60A8\u597D\uFF01\u672C\u7FA4\u9879\u76EE\u5DE5\u4F5C\u76EE\u5F55 \`${g?g.directory:v}\` \u5DF2\u7ECF\u6210\u529F\u5C31\u7EEA\u3002${w}${p}
6621
+ \u{1F4A1} **\u5DE5\u4F5C\u533A\u7BA1\u7406**:
6622
+ \u2022 \`/worktree commit\` \u2014 \u63D0\u4EA4\u5B58\u6863\uFF08\u4FDD\u7559\u5DE5\u4F5C\u533A\uFF0C\u7EE7\u7EED\u5E72\u6D3B\uFF09
6623
+ \u2022 \`/worktree done\` \u2014 \u63D0\u4EA4+\u6E05\u7406\uFF08\u4EFB\u52A1\u6536\u5DE5\uFF0C\u7FA4\u5207\u56DE\u4E3B\u76EE\u5F55\uFF09
6624
+ \u2022 \`/worktree push\` \u2014 \u63A8\u9001\u672C\u5206\u652F\u5230\u8FDC\u7A0B\uFF08\u4E0D\u5F71\u54CD\u5176\u4ED6\u5206\u652F\uFF09`:"",y=`\u{1F44B} \u60A8\u597D\uFF01\u672C\u7FA4\u9879\u76EE\u5DE5\u4F5C\u76EE\u5F55 \`${g?g.directory:v}\` \u5DF2\u7ECF\u6210\u529F\u5C31\u7EEA\u3002${w}${p}
6625
6625
  \u73B0\u5728\u60A8\u53EF\u4EE5\u968F\u65F6\u5728\u8FD9\u4E2A\u4E13\u5C5E\u9879\u76EE\u7FA4\u91CC\u76F4\u63A5\u63D0\u95EE\uFF0C\u6211\u5C06\u5168\u529B\u4E3A\u60A8\u670D\u52A1\uFF01`+A,W={schema:"2.0",config:{wide_screen_mode:!0},header:{template:"green",title:{tag:"plain_text",content:"\u{1F389} \u9879\u76EE\u7FA4\u5DF2\u5C31\u7EEA"}},body:{elements:[{tag:"markdown",content:y}]}};if(await s.sendRawInteractiveCard(N,W)||await s.sendMessage(N,y),r.task&&r.task.trim()){let F={schema:"2.0",config:{wide_screen_mode:!0},header:{template:"blue",title:{tag:"plain_text",content:"\u{1F4CB} \u4EFB\u52A1\u89C4\u5212"}},body:{elements:[{tag:"markdown",content:r.task.trim()}]}};await s.sendRawInteractiveCard(N,F)||await s.sendMessage(N,r.task.trim())}let f=o();f&&(async()=>{try{let F=await vL(s.getAppId(),s.getAppSecret(),s.getDomain());if(F&&(!F.grantedScopes||!F.grantedScopes.includes(t3))){let C=iR({appId:s.getAppId(),scopes:[t3],brand:s.getDomain(),tokenType:"tenant"}),X=ide({appId:s.getAppId(),brand:s.getDomain()}),H=nde({appId:s.getAppId(),brand:s.getDomain()}),S=`\u{1F4AC} **\u3010\u91CD\u8981\u4F53\u9A8C\u63D0\u793A \u2014 \u514D @ \u6743\u9650\u3011**
6626
6626
 
6627
6627
  \u60A8\u521A\u624D\u6210\u529F\u521B\u5EFA\u4E86\u9879\u76EE\u7FA4\u300C${r.group_name}\u300D\u3002
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "hwjcode-cli",
3
- "version": "1.1.127",
3
+ "version": "1.1.129",
4
4
  "type": "module"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hwjcode-personal",
3
- "version": "1.1.127",
3
+ "version": "1.1.129",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },