dskcode 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +47 -0
  2. package/dist/index.js +15 -15
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{a as td}from"./chunk-KMMG6QC6.js";import{a as Oe,b as Yn,c as Sa}from"./chunk-5Z3DMHRQ.js";import{a as ed}from"./chunk-MDFCAIOB.js";import{a as ma,b as ha,c as Ot,d as ga,e as Zu,f as ya,g as ba}from"./chunk-V5VB2WRZ.js";import{a as Yu,b as Qu,c as is,f as as}from"./chunk-O3L436MU.js";import{a as Sn,b as xa,c as nn,d as Zn,e as Tt,f as wa,h as ka}from"./chunk-V3LN4R4P.js";import{a as Pg,b as Ju,c as Lg,d as p}from"./chunk-LPD7BHH5.js";var sp=Pg((cA,op)=>{"use strict";p();var el,{defineProperty:Tb,getPrototypeOf:Cb,setPrototypeOf:rp,create:_b,keys:vb}=Object,at="",{round:Ss,max:Rb}=Math,tl=e=>{let t=/([a-f\d]{3,6})/i.exec(e)?.[0],n=t?.length,r="0x"+(6^n?3^n?"0":t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t)|0;return[r>>16,r>>8&255,255&r]},Qd=e=>{if(8>e)return 30+e;if(16>e)return 82+e;if(e>231)return e>243?37:30;let t=(e-=16)%36,n=e/36|0,r=t/6|0,o=t%6;return 30+(n>2|(r>2)<<1|(o>2)<<2)+(Rb(n,r,o)>4?60:0)},ep={open:at,close:at},tp=(e,{open:t="",close:n="",f:r})=>{let o=(e.open||at)+t,s=n+(e.close||at),i=(a,...l)=>{if(!a){if(!n)return t;if((a??at)===at)return at}let c,u=r?r(a,...l):a.raw?String.raw({raw:a},...l):at+a,d=i;if(u.includes("\x1B"))for(;d=d.p;){let{t:m,o:h}=d,f=h.length,g=at,w=0;if(f)for(;~(c=u.indexOf(h,w));w=c+f)g+=u.slice(w,c)+m;u=g+u.slice(w)}return o+(u.includes(`
3
- `)?u.replace(/(\r?\n)/g,s+"$1"+o):u)+s};return rp(i,Cb(e)).p={t,o:n,p:e.p},i.open=o,i.close=s,i},np=new function e(t=globalThis){let n=typeof t=="number"?t:(_=>{let S=_.process??{},D=S.argv??[],H=S.env??{},E=0;try{E=((ce,Q,j)=>(el=Q.TERM,{"24bit":3,truecolor:3,ansi256:2,ansi:1}[Q.COLORTERM]||(Q.CI?/,GITHUB/.test(j)?3:1:(Q.PM2_HOME||/edge/.test(Q.NEXT_RUNTIME)||ce.stdout?.isTTY)&&el!=="dumb"?ce.platform==="win32"?3:/-256/.test(el)?2:1:0)))(S,H,","+vb(H).join(","))}catch{H={}}let I,B=E||1,Y="FORCE_COLOR",q={false:0,0:0,1:1,2:2,3:3}[H[Y]]??B,ae=-1;for(I of D)/^--color=?(true|always)?$/.test(I)&&(ae=B),/^--(no-color|color=(false|never))$/.test(I)&&(ae=0);return _.window?.chrome?3:Y in H?q:~ae?ae:H.NO_COLOR?0:E})(t),r={},o={Ansis:e,level:n,isSupported:()=>l,strip:_=>_.replace(/][^]*|[›][[()#;?]*(?:\d+(?:;\d*)*)?[\dA-ORZcf-nqry=><]/g,at),extend(_){for(let S in _){let D=_[S];(typeof D)[0]==="s"&&(s(u(S),x(...tl(D))),D=w(...tl(D))),s(S,D)}return rp(o,_b({},r))}},s=(_,S)=>{r[_]={get(){return Tb(this,_,{value:S.call?(...D)=>tp(this,S(...D)):tp(this,S)})[_]}}},i=1^n,a=n>2,l=n>0,c=(_,S)=>l?{open:`\x1B[${_}m`,close:S?`\x1B[${S}m`:at}:ep,u=_=>"bg"+_[0].toUpperCase()+_.slice(1),d=_=>S=>_(...tl(S)),m=(_,S)=>(D,H,E)=>c(`${_}8;2;${D};${H};${E}`,S),h=_=>(S,D,H)=>_(((E,I,B)=>E^I|I^B?16+36*Ss(E/51)+6*Ss(I/51)+Ss(B/51):8>E?16:E>248?231:Ss(24*(E-8)/247)+232)(S,D,H)),f=_=>c(i?"38;5;"+_:Qd(_),39),g=_=>c(i?"48;5;"+_:Qd(_)+10,49),w=a?m(3,39):h(f),x=a?m(4,49):h(g),T={fg:f,bg:g,rgb:w,bgRgb:x,hex:d(w),bgHex:d(x),visible:ep,reset:c(0,at),bold:c(1,22),dim:c(2,22),italic:c(3,23),underline:c(4,24),inverse:c(7,27),hidden:c(8,28),strikethrough:c(9,29),link:{f:(_,S=_)=>l?`\x1B]8;;${_}\x07${S}\x1B]8;;\x07`:S!=_?S+` (\u200B${_}\u200B)`:_}},v=(_,S)=>{T[_]=c(S,39),T[u(_)]=c(S+10,49)};return"gray,black,red,green,yellow,blue,magenta,cyan,white".split(",").map(((_,S)=>{S?v(_+"Bright",89+S):S=61,v(_,29+S)})),o.extend(T)};op.exports=np.default=np});p();p();import{Command as a_}from"commander";import{useEffect as l_,useState as c_}from"react";p();p();p();import{mkdir as $g,readFile as Og,writeFile as Dg}from"fs/promises";import{dirname as Ng}from"path";function ls(e){let t=process.env.VOLC_ASR_APP_ID?.trim(),n=process.env.VOLC_ASR_ACCESS_KEY?.trim(),r=t||e?.appId||"",o=n||e?.accessKey||"",s={appId:t?"env":e?.appId?"settings":"missing",accessKey:n?"env":e?.accessKey?"settings":"missing"},i=[];return r||i.push("appId"),o||i.push("accessKey"),{resolved:i.length===0,missing:i.length>0?i:void 0,source:s,config:{appId:r,accessKey:o,resourceId:e?.resourceId??"volc.bigasr.sauc.duration",language:e?.language??"zh-CN",sampleRate:e?.sampleRate??16e3,enabled:e?.enabled??!0}}}async function Ta(e,t,n,r){let o={};try{let i=await Og(e,"utf8"),a=JSON.parse(i);a&&typeof a=="object"&&(o=a)}catch(i){if(i.code!=="ENOENT")throw i}let s=o.voice??{appId:"",accessKey:""};o.voice={...s,appId:t,accessKey:n,resourceId:r?.resourceId??s.resourceId??"volc.bigasr.sauc.duration",language:r?.language??s.language??"zh-CN",enabled:s.enabled??!0},await $g(Ng(e),{recursive:!0}),await Dg(e,JSON.stringify(o,null,2)+`
2
+ import{a as td}from"./chunk-KMMG6QC6.js";import{a as Oe,b as Yn,c as Sa}from"./chunk-5Z3DMHRQ.js";import{a as ed}from"./chunk-MDFCAIOB.js";import{a as ma,b as ha,c as Ot,d as ga,e as Zu,f as ya,g as ba}from"./chunk-V5VB2WRZ.js";import{a as Yu,b as Qu,c as is,f as as}from"./chunk-O3L436MU.js";import{a as Sn,b as xa,c as nn,d as Zn,e as Tt,f as wa,h as ka}from"./chunk-V3LN4R4P.js";import{a as Pg,b as Ju,c as Lg,d as p}from"./chunk-LPD7BHH5.js";var sp=Pg((dA,op)=>{"use strict";p();var el,{defineProperty:Tb,getPrototypeOf:Cb,setPrototypeOf:rp,create:_b,keys:vb}=Object,at="",{round:Ss,max:Rb}=Math,tl=e=>{let t=/([a-f\d]{3,6})/i.exec(e)?.[0],n=t?.length,r="0x"+(6^n?3^n?"0":t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t)|0;return[r>>16,r>>8&255,255&r]},Qd=e=>{if(8>e)return 30+e;if(16>e)return 82+e;if(e>231)return e>243?37:30;let t=(e-=16)%36,n=e/36|0,r=t/6|0,o=t%6;return 30+(n>2|(r>2)<<1|(o>2)<<2)+(Rb(n,r,o)>4?60:0)},ep={open:at,close:at},tp=(e,{open:t="",close:n="",f:r})=>{let o=(e.open||at)+t,s=n+(e.close||at),i=(a,...l)=>{if(!a){if(!n)return t;if((a??at)===at)return at}let c,u=r?r(a,...l):a.raw?String.raw({raw:a},...l):at+a,d=i;if(u.includes("\x1B"))for(;d=d.p;){let{t:m,o:h}=d,f=h.length,g=at,w=0;if(f)for(;~(c=u.indexOf(h,w));w=c+f)g+=u.slice(w,c)+m;u=g+u.slice(w)}return o+(u.includes(`
3
+ `)?u.replace(/(\r?\n)/g,s+"$1"+o):u)+s};return rp(i,Cb(e)).p={t,o:n,p:e.p},i.open=o,i.close=s,i},np=new function e(t=globalThis){let n=typeof t=="number"?t:(_=>{let S=_.process??{},D=S.argv??[],H=S.env??{},E=0;try{E=((ce,Q,j)=>(el=Q.TERM,{"24bit":3,truecolor:3,ansi256:2,ansi:1}[Q.COLORTERM]||(Q.CI?/,GITHUB/.test(j)?3:1:(Q.PM2_HOME||/edge/.test(Q.NEXT_RUNTIME)||ce.stdout?.isTTY)&&el!=="dumb"?ce.platform==="win32"?3:/-256/.test(el)?2:1:0)))(S,H,","+vb(H).join(","))}catch{H={}}let I,B=E||1,Y="FORCE_COLOR",q={false:0,0:0,1:1,2:2,3:3}[H[Y]]??B,ae=-1;for(I of D)/^--color=?(true|always)?$/.test(I)&&(ae=B),/^--(no-color|color=(false|never))$/.test(I)&&(ae=0);return _.window?.chrome?3:Y in H?q:~ae?ae:H.NO_COLOR?0:E})(t),r={},o={Ansis:e,level:n,isSupported:()=>l,strip:_=>_.replace(/][^]*|[›][[()#;?]*(?:\d+(?:;\d*)*)?[\dA-ORZcf-nqry=><]/g,at),extend(_){for(let S in _){let D=_[S];(typeof D)[0]==="s"&&(s(u(S),x(...tl(D))),D=w(...tl(D))),s(S,D)}return rp(o,_b({},r))}},s=(_,S)=>{r[_]={get(){return Tb(this,_,{value:S.call?(...D)=>tp(this,S(...D)):tp(this,S)})[_]}}},i=1^n,a=n>2,l=n>0,c=(_,S)=>l?{open:`\x1B[${_}m`,close:S?`\x1B[${S}m`:at}:ep,u=_=>"bg"+_[0].toUpperCase()+_.slice(1),d=_=>S=>_(...tl(S)),m=(_,S)=>(D,H,E)=>c(`${_}8;2;${D};${H};${E}`,S),h=_=>(S,D,H)=>_(((E,I,B)=>E^I|I^B?16+36*Ss(E/51)+6*Ss(I/51)+Ss(B/51):8>E?16:E>248?231:Ss(24*(E-8)/247)+232)(S,D,H)),f=_=>c(i?"38;5;"+_:Qd(_),39),g=_=>c(i?"48;5;"+_:Qd(_)+10,49),w=a?m(3,39):h(f),x=a?m(4,49):h(g),T={fg:f,bg:g,rgb:w,bgRgb:x,hex:d(w),bgHex:d(x),visible:ep,reset:c(0,at),bold:c(1,22),dim:c(2,22),italic:c(3,23),underline:c(4,24),inverse:c(7,27),hidden:c(8,28),strikethrough:c(9,29),link:{f:(_,S=_)=>l?`\x1B]8;;${_}\x07${S}\x1B]8;;\x07`:S!=_?S+` (\u200B${_}\u200B)`:_}},v=(_,S)=>{T[_]=c(S,39),T[u(_)]=c(S+10,49)};return"gray,black,red,green,yellow,blue,magenta,cyan,white".split(",").map(((_,S)=>{S?v(_+"Bright",89+S):S=61,v(_,29+S)})),o.extend(T)};op.exports=np.default=np});p();p();import{Command as c_}from"commander";import{useEffect as u_,useState as d_}from"react";p();p();p();import{mkdir as $g,readFile as Og,writeFile as Dg}from"fs/promises";import{dirname as Ng}from"path";function ls(e){let t=process.env.VOLC_ASR_APP_ID?.trim(),n=process.env.VOLC_ASR_ACCESS_KEY?.trim(),r=t||e?.appId||"",o=n||e?.accessKey||"",s={appId:t?"env":e?.appId?"settings":"missing",accessKey:n?"env":e?.accessKey?"settings":"missing"},i=[];return r||i.push("appId"),o||i.push("accessKey"),{resolved:i.length===0,missing:i.length>0?i:void 0,source:s,config:{appId:r,accessKey:o,resourceId:e?.resourceId??"volc.bigasr.sauc.duration",language:e?.language??"zh-CN",sampleRate:e?.sampleRate??16e3,enabled:e?.enabled??!0}}}async function Ta(e,t,n,r){let o={};try{let i=await Og(e,"utf8"),a=JSON.parse(i);a&&typeof a=="object"&&(o=a)}catch(i){if(i.code!=="ENOENT")throw i}let s=o.voice??{appId:"",accessKey:""};o.voice={...s,appId:t,accessKey:n,resourceId:r?.resourceId??s.resourceId??"volc.bigasr.sauc.duration",language:r?.language??s.language??"zh-CN",enabled:s.enabled??!0},await $g(Ng(e),{recursive:!0}),await Dg(e,JSON.stringify(o,null,2)+`
4
4
  `,"utf8")}async function nd(){let e=this.optsWithGlobals(),t=e.verbose??!1,n,r=[];try{let o=await Ot(e.config);if(n=o.config,o.errors.length>0)for(let s of o.errors)r.push(s.message)}catch{n=structuredClone(ma)}if(n=ha(n,{verbose:t,model:e.model}),r.length>0&&t)for(let o of r)console.error(` \u26A0 ${o}`);return{config:n,verbose:t}}p();import Re from"chalk";function rd(e){let t=[];t.push(""),t.push(Re.bold("\u7528\u6CD5:")),t.push(` ${Re.cyan("dskcode")} ${Re.dim("[global-options]")} ${Re.green("<command>")} ${Re.dim("[options]")}`),t.push("");let n=e.options.filter(o=>o.long!=="--help"&&o.long!=="--version"&&o.long!=="--config");if(n.length>0){t.push(Re.bold("\u5168\u5C40\u9009\u9879:"));for(let o of n){let s=[o.short,o.long].filter(Boolean).join(", ");t.push(` ${Re.cyan(s.padEnd(24))} ${o.description??""}`)}t.push("")}t.push(Re.bold("\u5185\u7F6E\u9009\u9879:"));for(let o of["-h, --help","-V, --version"]){let s=e.options.find(i=>i.long===(o.includes("help")?"--help":"--version"));s&&t.push(` ${Re.cyan(o.padEnd(24))} ${s.description??""}`)}t.push("");let r=e.commands.filter(o=>!o.name().startsWith("help"));if(r.length>0){t.push(Re.bold("\u547D\u4EE4:"));for(let o of r)t.push(` ${Re.green(o.name().padEnd(24))} ${o.description()}`);t.push("")}return t.push(Re.bold("\u793A\u4F8B:")),t.push(` ${Re.dim("# \u542F\u52A8\u4EA4\u4E92\u5F0F\u5BF9\u8BDD(\u65E0\u53C2\u9ED8\u8BA4\u884C\u4E3A)")}`),t.push(" dskcode"),t.push(` ${Re.dim("# \u8BA9 AI \u6267\u884C\u4E00\u4E2A\u4EFB\u52A1")}`),t.push(" dskcode run \u4FEE\u6539\u6240\u6709 TODO \u6CE8\u91CA"),t.push(` ${Re.dim("# \u8FD0\u884C\u914D\u7F6E\u5411\u5BFC")}`),t.push(" dskcode setup"),t.push(` ${Re.dim("# \u751F\u6210 shell \u81EA\u52A8\u8865\u5168")}`),t.push(" dskcode completion"),t.push(` ${Re.dim("# \u67E5\u770B\u81EA\u9009\u80A1\u884C\u60C5")}`),t.push(" dskcode stock"),t.push(` ${Re.dim("# \u67E5\u770B\u6307\u5B9A\u80A1\u7968\u884C\u60C5")}`),t.push(" dskcode stock sh513090 sz000001"),t.push(""),t.join(`
5
5
  `)}p();import{createInterface as od}from"readline";import ge from"chalk";function sd(e){return!!(e.some(t=>t.apiKey)||process.env.DEEPSEEK_API_KEY)}var Ca=10;async function id(){console.log(ge.yellow(`
6
6
  \u26A0 \u672A\u68C0\u6D4B\u5230 API Key \u914D\u7F6E`)),console.log(ge.dim(" \u4F60\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u4EFB\u4E00\u65B9\u5F0F\u914D\u7F6E\uFF1A")),console.log(ge.dim(" \xB7 \u73AF\u5883\u53D8\u91CF: export DEEPSEEK_API_KEY=sk-xxx")),console.log(ge.dim(" \xB7 \u914D\u7F6E\u6587\u4EF6: ~/.dskcode/settings.json")),console.log(ge.dim(` \xB7 \u4E0B\u9762\u76F4\u63A5\u8F93\u5165\uFF0C\u81EA\u52A8\u4FDD\u5B58\u5230\u5168\u5C40\u914D\u7F6E
@@ -13,7 +13,7 @@ import{a as td}from"./chunk-KMMG6QC6.js";import{a as Oe,b as Yn,c as Sa}from"./c
13
13
  `);if(console.log(r),n.length>5&&console.log(Xe.dim(` \xB7 ...\u7B49 ${String(n.length)} \u4E2A`)),console.log(Xe.dim(` \u6E90\u76EE\u5F55: ${_a()}`)),console.log(Xe.dim(` \u76EE\u6807\u76EE\u5F55: ${tr()}
14
14
  `)),!await Vg(` ${Xe.cyan("\u{1F4E6}")} \u662F\u5426\u5C06\u8FD9\u4E9B skill \u5BFC\u5165\u5230 dskcode\uFF1F${Xe.dim("[y/N] ")} `)){console.log(Xe.dim(` \u5DF2\u8DF3\u8FC7 skill \u5BFC\u5165
15
15
  `));return}try{let{imported:s,skipped:i}=await zg(n);s.length>0&&console.log(Xe.green(` \u2714 \u5DF2\u5BFC\u5165 ${String(s.length)} \u4E2A skill \u5230 ~/.dskcode/skills`)),i.length>0&&console.log(Xe.yellow(` \u26A0 ${String(i.length)} \u4E2A skill \u5DF2\u5B58\u5728\uFF0C\u5DF2\u8DF3\u8FC7\uFF1A${i.join(", ")}`)),console.log("")}catch(s){console.log(Xe.red(` \u2716 \u5BFC\u5165 skill \u5931\u8D25: ${s instanceof Error?s.message:String(s)}`)),console.log(Xe.dim(` \u4F60\u53EF\u4EE5\u7A0D\u540E\u624B\u52A8\u590D\u5236 ~/.claude/skills \u5230 ~/.dskcode/skills
16
- `))}}async function Xg(){let e=tr();if(!Dt(e))return[];let t;try{t=await er(e)}catch{return[]}let n=[];for(let r of t){let o=Je(e,r);Qn(o).isDirectory()&&await nr(o)&&n.push(r)}return n}async function Jg(e){let t=va(e);if(!Dt(t))return[];let n;try{n=await er(t)}catch{return[]}let r=[];for(let o of n){let s=Je(t,o);Qn(s).isDirectory()&&await nr(s)&&r.push(o)}return r}async function ld(e){try{let n=(await Wg(Je(e,"SKILL.md"),"utf-8")).match(/^---\n([\s\S]*?)\n---/);if(!n)return null;let r=n[1],o=r.match(/^name:\s*(.+)$/m),s=r.match(/^description:\s*(.+)$/m);return{name:o?.[1]?.trim()??"",description:s?.[1]?.trim()??""}}catch{return null}}async function dd(e){let[t,n]=await Promise.all([Xg(),Jg(e)]),r=new Set,o=[];for(let l of[...n,...t])r.has(l)||(r.add(l),o.push(l));let s=tr(),i=va(e),a=[];for(let l of o){let c=Je(i,l),u=null;if(Dt(c)&&(u=await ld(c)),!u){let d=Je(s,l);Dt(d)&&(u=await ld(d))}a.push(u??{name:l,description:""})}return a}import{readFile as u_}from"fs/promises";import{join as fg}from"path";p();p();import{render as Zg}from"ink";function Br(e){let{waitUntilExit:t,clear:n,unmount:r}=Zg(e,{exitOnCtrlC:!1});return{waitUntilExit:t(),clear:n,unmount:r}}p();import{Text as gv}from"ink";import bv from"ink-spinner";import{jsx as kv,jsxs as Sv}from"react/jsx-runtime";p();import{Box as _v,Text as vv}from"ink";import{jsxs as Ev}from"react/jsx-runtime";p();import{Box as Lv,Text as $v}from"ink";import{useEffect as Dv,useState as Nv}from"react";import{jsx as Fv}from"react/jsx-runtime";var Fr=["#00ffff","#ff00ff","#00ff41","#ff1493","#8b00ff"],Aa=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557"," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D"," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2554\u255D "," \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"];p();import{Box as G,Text as F,useInput as oC,Static as sC}from"ink";import{useEffect as Ne,useState as U,useCallback as bt,useMemo as vh,useRef as le}from"react";p();import{useState as Yg,useCallback as Qg,useEffect as ey,useRef as pd}from"react";var ty=1500;function Tn(e){let[t,n]=Yg(!1),r=pd(null),o=pd(e);o.current=e,ey(()=>()=>{r.current&&clearTimeout(r.current)},[]);let s=Qg(()=>{if(t){o.current();return}n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n(!1),r.current=null},ty)},[t]);return{doubleCtrlC:t,handleCtrlC:s}}import iC from"ink-spinner";p();import{Box as _t,Text as Nt}from"ink";import{useEffect as Ly,useRef as Cd,useState as _d}from"react";p();import{mkdir as ny,readFile as ry,writeFile as oy}from"fs/promises";import{join as Ea}from"path";var Fe=class e{static#e=new Set;static async flushAll(){await Promise.allSettled([...e.#e].map(t=>t.flush()))}#t;#r;#o;#n;#a;#u;#i=[];#p;#s;#l=!1;#m=!1;constructor(t={}){let n=process.env.HOME??process.env.USERPROFILE??"~";this.#t=t.costDir??Ea(n,".dskcode","costs"),this.#r=t.budgetLimit??0,this.#o=t.tokenBudgetLimit??0,this.#n=t.onBudgetExceeded,this.#a=fd(),this.#u=new Date().toISOString();let r=Ia();this.#p=r,this.#s=md(r),e.#e.add(this)}record(t,n){let r=Tt(t,n),o={timestamp:new Date().toISOString(),model:n,usage:{...t},cost:{...r}};return this.#i.push(o),this.#f(),this.#d(o),this.#l=!0,this.#b(),r}get sessionId(){return this.#a}get records(){return this.#i}get sessionSummary(){let t=0,n=0,r=0,o=0;for(let s of this.#i)t+=s.usage.promptTokens,n+=s.usage.completionTokens,r+=s.usage.cachedPromptTokens??0,o+=s.cost.totalCost;return{sessionId:this.#a,startedAt:this.#u,totalPromptTokens:t,totalCompletionTokens:n,totalCachedTokens:r,totalCost:o,records:[...this.#i]}}get sessionTotalCost(){return this.#i.reduce((t,n)=>t+n.cost.totalCost,0)}get sessionPromptTokens(){return this.#i.reduce((t,n)=>t+n.usage.promptTokens,0)}get sessionCompletionTokens(){return this.#i.reduce((t,n)=>t+n.usage.completionTokens,0)}get sessionCallCount(){return this.#i.length}get todaySummary(){return this.#f(),{...this.#s}}get todayTotalCost(){return this.#f(),this.#s.totalCost}get todayCallCount(){return this.#f(),this.#s.totalCalls}get isBudgetExceeded(){return this.#r>0&&this.todayTotalCost>=this.#r||this.#o>0&&this.#s.totalPromptTokens+this.#s.totalCompletionTokens>=this.#o}get remainingBudget(){return this.#r<=0?1/0:Math.max(0,this.#r-this.todayTotalCost)}async load(){await this.#g();let t=await this.#h(),n=Ia();t.daily[n]&&(this.#s=t.daily[n],this.#p=n)}async flush(){if(!(!this.#l||this.#m)){this.#m=!0,this.#l=!1;try{await this.#g(),await this.#c()}catch(t){this.#l=!0,console.error("[CostTracker] flush \u5931\u8D25:",t)}finally{this.#m=!1}}}async queryRange(t,n){let r=await this.#h(),o=n??t,s=[];for(let[i,a]of Object.entries(r.daily))i>=t&&i<=o&&s.push(a);return s.sort((i,a)=>i.date.localeCompare(a.date)),s}resetSession(){this.#a=fd(),this.#u=new Date().toISOString(),this.#i.length=0}async dispose(){e.#e.delete(this),await this.flush()}#f(){let t=Ia();t!==this.#p&&(this.#p=t,this.#s=md(t),this.#l=!0)}#d(t){this.#s.totalPromptTokens+=t.usage.promptTokens,this.#s.totalCompletionTokens+=t.usage.completionTokens,this.#s.totalCachedTokens+=t.usage.cachedPromptTokens??0,this.#s.totalCost+=t.cost.totalCost,this.#s.totalCalls+=1;let n=t.model;this.#s.byModel[n]||(this.#s.byModel[n]={model:t.model,totalPromptTokens:0,totalCompletionTokens:0,totalCachedTokens:0,totalCost:0,totalCalls:0});let r=this.#s.byModel[n];r.totalPromptTokens+=t.usage.promptTokens,r.totalCompletionTokens+=t.usage.completionTokens,r.totalCachedTokens+=t.usage.cachedPromptTokens??0,r.totalCost+=t.cost.totalCost,r.totalCalls+=1}#b(){this.isBudgetExceeded&&this.#n?.(this)}async#h(){let t=Ea(this.#t,"history.json");try{let n=await ry(t,"utf-8");return JSON.parse(n)}catch{return{version:1,daily:{}}}}async#g(){await ny(this.#t,{recursive:!0})}async#c(){let t=await this.#h();t.daily[this.#p]=this.#s;let n=sy(90),r=Object.keys(t.daily).filter(s=>s<n);for(let s of r)delete t.daily[s];let o=Ea(this.#t,"history.json");await oy(o,JSON.stringify(t,null,2),"utf-8")}};function fd(){let e=Date.now().toString(36),t=Math.random().toString(36).slice(2,8);return`${e}-${t}`}function Ia(){return new Date().toISOString().slice(0,10)}function sy(e){let t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}function md(e){return{date:e,totalPromptTokens:0,totalCompletionTokens:0,totalCachedTokens:0,totalCost:0,totalCalls:0,byModel:{}}}function Pa(e){return`\xA5${e.toFixed(4)}`}p();import{Box as jr,Text as Ct}from"ink";p();var iy=new Set(["password","token","apikey","api_key","secret","authorization","auth","credential","credentials","private_key","privatekey"]);function cs(e,t){if(!gd(t))return`${e}()`;switch(e){case"read_file":return`${e}(path=${st(t.path)})`;case"write_file":return`${e}(path=${st(t.path)})`;case"edit_file":return`${e}(path=${st(t.path)}, old_text=${st(t.old_text,30)})`;case"multi_edit":{let s=Array.isArray(t.edits)?t.edits.length:0;return`${e}(path=${st(t.path)}, edits=${s})`}case"delete_range":return`${e}(path=${st(t.path)})`;case"bash":return`${e}(command=${st(t.command,60)})`;case"ls":return`${e}(path=${st(t.path??".")})`;case"glob":return`${e}(pattern=${st(t.pattern)})`;case"grep":return`${e}(pattern=${st(t.pattern)}, path=${st(t.path??".")})`;case"fetch":return`${e}(url=${st(t.url,60)})`;default:let n=Object.keys(t);if(n.length===0)return`${e}()`;let r=n.slice(0,4).map(s=>`${s}=\u2026`).join(", "),o=n.length>4?`, +${n.length-4}`:"";return`${e}(${r}${o})`}}function Gr(e){return La(e,new WeakSet)}function La(e,t){if(e==null||typeof e!="object")return e;let n=e;if(t.has(n))return"****";if(t.add(n),Array.isArray(e))return e.map(o=>La(o,t));let r={};for(let[o,s]of Object.entries(n))iy.has(o.toLowerCase())?r[o]="****":r[o]=La(s,t);return r}function hd(e,t={}){let n=t.valueMaxLen??80,r=t.maskSensitive!==!1,o=t.maxKeys??6;if(!gd(e))return $a(e,n);let s=r?Gr(e):e,i=Object.entries(s),l=i.slice(0,o).map(([c,u])=>`${c}: ${$a(u,n)}`);return i.length>o&&l.push(`+${i.length-o} more`),l.join(`
16
+ `))}}async function Xg(){let e=tr();if(!Dt(e))return[];let t;try{t=await er(e)}catch{return[]}let n=[];for(let r of t){let o=Je(e,r);Qn(o).isDirectory()&&await nr(o)&&n.push(r)}return n}async function Jg(e){let t=va(e);if(!Dt(t))return[];let n;try{n=await er(t)}catch{return[]}let r=[];for(let o of n){let s=Je(t,o);Qn(s).isDirectory()&&await nr(s)&&r.push(o)}return r}async function ld(e){try{let n=(await Wg(Je(e,"SKILL.md"),"utf-8")).match(/^---\n([\s\S]*?)\n---/);if(!n)return null;let r=n[1],o=r.match(/^name:\s*(.+)$/m),s=r.match(/^description:\s*(.+)$/m);return{name:o?.[1]?.trim()??"",description:s?.[1]?.trim()??""}}catch{return null}}async function dd(e){let[t,n]=await Promise.all([Xg(),Jg(e)]),r=new Set,o=[];for(let l of[...n,...t])r.has(l)||(r.add(l),o.push(l));let s=tr(),i=va(e),a=[];for(let l of o){let c=Je(i,l),u=null;if(Dt(c)&&(u=await ld(c)),!u){let d=Je(s,l);Dt(d)&&(u=await ld(d))}a.push(u??{name:l,description:""})}return a}import{readFile as p_}from"fs/promises";import{join as fg}from"path";p();p();import{render as Zg}from"ink";function Br(e){let{waitUntilExit:t,clear:n,unmount:r}=Zg(e,{exitOnCtrlC:!1});return{waitUntilExit:t(),clear:n,unmount:r}}p();import{Text as bv}from"ink";import wv from"ink-spinner";import{jsx as Tv,jsxs as Cv}from"react/jsx-runtime";p();import{Box as Rv,Text as Av}from"ink";import{jsxs as Pv}from"react/jsx-runtime";p();import{Box as Ov,Text as Dv}from"ink";import{useEffect as Mv,useState as Bv}from"react";import{jsx as jv}from"react/jsx-runtime";var Fr=["#00ffff","#ff00ff","#00ff41","#ff1493","#8b00ff"],Aa=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557"," \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D"," \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2554\u255D "," \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"];p();import{Box as G,Text as F,useInput as oC,Static as sC}from"ink";import{useEffect as Ne,useState as U,useCallback as bt,useMemo as vh,useRef as le}from"react";p();import{useState as Yg,useCallback as Qg,useEffect as ey,useRef as pd}from"react";var ty=1500;function Tn(e){let[t,n]=Yg(!1),r=pd(null),o=pd(e);o.current=e,ey(()=>()=>{r.current&&clearTimeout(r.current)},[]);let s=Qg(()=>{if(t){o.current();return}n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n(!1),r.current=null},ty)},[t]);return{doubleCtrlC:t,handleCtrlC:s}}import iC from"ink-spinner";p();import{Box as _t,Text as Nt}from"ink";import{useEffect as Ly,useRef as Cd,useState as _d}from"react";p();import{mkdir as ny,readFile as ry,writeFile as oy}from"fs/promises";import{join as Ea}from"path";var Fe=class e{static#e=new Set;static async flushAll(){await Promise.allSettled([...e.#e].map(t=>t.flush()))}#t;#r;#o;#n;#a;#u;#i=[];#p;#s;#l=!1;#m=!1;constructor(t={}){let n=process.env.HOME??process.env.USERPROFILE??"~";this.#t=t.costDir??Ea(n,".dskcode","costs"),this.#r=t.budgetLimit??0,this.#o=t.tokenBudgetLimit??0,this.#n=t.onBudgetExceeded,this.#a=fd(),this.#u=new Date().toISOString();let r=Ia();this.#p=r,this.#s=md(r),e.#e.add(this)}record(t,n){let r=Tt(t,n),o={timestamp:new Date().toISOString(),model:n,usage:{...t},cost:{...r}};return this.#i.push(o),this.#f(),this.#d(o),this.#l=!0,this.#b(),r}get sessionId(){return this.#a}get records(){return this.#i}get sessionSummary(){let t=0,n=0,r=0,o=0;for(let s of this.#i)t+=s.usage.promptTokens,n+=s.usage.completionTokens,r+=s.usage.cachedPromptTokens??0,o+=s.cost.totalCost;return{sessionId:this.#a,startedAt:this.#u,totalPromptTokens:t,totalCompletionTokens:n,totalCachedTokens:r,totalCost:o,records:[...this.#i]}}get sessionTotalCost(){return this.#i.reduce((t,n)=>t+n.cost.totalCost,0)}get sessionPromptTokens(){return this.#i.reduce((t,n)=>t+n.usage.promptTokens,0)}get sessionCompletionTokens(){return this.#i.reduce((t,n)=>t+n.usage.completionTokens,0)}get sessionCallCount(){return this.#i.length}get todaySummary(){return this.#f(),{...this.#s}}get todayTotalCost(){return this.#f(),this.#s.totalCost}get todayCallCount(){return this.#f(),this.#s.totalCalls}get isBudgetExceeded(){return this.#r>0&&this.todayTotalCost>=this.#r||this.#o>0&&this.#s.totalPromptTokens+this.#s.totalCompletionTokens>=this.#o}get remainingBudget(){return this.#r<=0?1/0:Math.max(0,this.#r-this.todayTotalCost)}async load(){await this.#g();let t=await this.#h(),n=Ia();t.daily[n]&&(this.#s=t.daily[n],this.#p=n)}async flush(){if(!(!this.#l||this.#m)){this.#m=!0,this.#l=!1;try{await this.#g(),await this.#c()}catch(t){this.#l=!0,console.error("[CostTracker] flush \u5931\u8D25:",t)}finally{this.#m=!1}}}async queryRange(t,n){let r=await this.#h(),o=n??t,s=[];for(let[i,a]of Object.entries(r.daily))i>=t&&i<=o&&s.push(a);return s.sort((i,a)=>i.date.localeCompare(a.date)),s}resetSession(){this.#a=fd(),this.#u=new Date().toISOString(),this.#i.length=0}async dispose(){e.#e.delete(this),await this.flush()}#f(){let t=Ia();t!==this.#p&&(this.#p=t,this.#s=md(t),this.#l=!0)}#d(t){this.#s.totalPromptTokens+=t.usage.promptTokens,this.#s.totalCompletionTokens+=t.usage.completionTokens,this.#s.totalCachedTokens+=t.usage.cachedPromptTokens??0,this.#s.totalCost+=t.cost.totalCost,this.#s.totalCalls+=1;let n=t.model;this.#s.byModel[n]||(this.#s.byModel[n]={model:t.model,totalPromptTokens:0,totalCompletionTokens:0,totalCachedTokens:0,totalCost:0,totalCalls:0});let r=this.#s.byModel[n];r.totalPromptTokens+=t.usage.promptTokens,r.totalCompletionTokens+=t.usage.completionTokens,r.totalCachedTokens+=t.usage.cachedPromptTokens??0,r.totalCost+=t.cost.totalCost,r.totalCalls+=1}#b(){this.isBudgetExceeded&&this.#n?.(this)}async#h(){let t=Ea(this.#t,"history.json");try{let n=await ry(t,"utf-8");return JSON.parse(n)}catch{return{version:1,daily:{}}}}async#g(){await ny(this.#t,{recursive:!0})}async#c(){let t=await this.#h();t.daily[this.#p]=this.#s;let n=sy(90),r=Object.keys(t.daily).filter(s=>s<n);for(let s of r)delete t.daily[s];let o=Ea(this.#t,"history.json");await oy(o,JSON.stringify(t,null,2),"utf-8")}};function fd(){let e=Date.now().toString(36),t=Math.random().toString(36).slice(2,8);return`${e}-${t}`}function Ia(){return new Date().toISOString().slice(0,10)}function sy(e){let t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}function md(e){return{date:e,totalPromptTokens:0,totalCompletionTokens:0,totalCachedTokens:0,totalCost:0,totalCalls:0,byModel:{}}}function Pa(e){return`\xA5${e.toFixed(4)}`}p();import{Box as jr,Text as Ct}from"ink";p();var iy=new Set(["password","token","apikey","api_key","secret","authorization","auth","credential","credentials","private_key","privatekey"]);function cs(e,t){if(!gd(t))return`${e}()`;switch(e){case"read_file":return`${e}(path=${st(t.path)})`;case"write_file":return`${e}(path=${st(t.path)})`;case"edit_file":return`${e}(path=${st(t.path)}, old_text=${st(t.old_text,30)})`;case"multi_edit":{let s=Array.isArray(t.edits)?t.edits.length:0;return`${e}(path=${st(t.path)}, edits=${s})`}case"delete_range":return`${e}(path=${st(t.path)})`;case"bash":return`${e}(command=${st(t.command,60)})`;case"ls":return`${e}(path=${st(t.path??".")})`;case"glob":return`${e}(pattern=${st(t.pattern)})`;case"grep":return`${e}(pattern=${st(t.pattern)}, path=${st(t.path??".")})`;case"fetch":return`${e}(url=${st(t.url,60)})`;default:let n=Object.keys(t);if(n.length===0)return`${e}()`;let r=n.slice(0,4).map(s=>`${s}=\u2026`).join(", "),o=n.length>4?`, +${n.length-4}`:"";return`${e}(${r}${o})`}}function Gr(e){return La(e,new WeakSet)}function La(e,t){if(e==null||typeof e!="object")return e;let n=e;if(t.has(n))return"****";if(t.add(n),Array.isArray(e))return e.map(o=>La(o,t));let r={};for(let[o,s]of Object.entries(n))iy.has(o.toLowerCase())?r[o]="****":r[o]=La(s,t);return r}function hd(e,t={}){let n=t.valueMaxLen??80,r=t.maskSensitive!==!1,o=t.maxKeys??6;if(!gd(e))return $a(e,n);let s=r?Gr(e):e,i=Object.entries(s),l=i.slice(0,o).map(([c,u])=>`${c}: ${$a(u,n)}`);return i.length>o&&l.push(`+${i.length-o} more`),l.join(`
17
17
  `)}function $a(e,t=80){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"\u2026":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.length<=3?JSON.stringify(e):`[\u2026${e.length} items\u2026]`;if(typeof e=="object"){let n=e,r=Object.keys(n);return r.length<=3?JSON.stringify(n):`{\u2026${r.length} keys\u2026}`}return JSON.stringify(e)}function st(e,t=40){return e==null?String(e):typeof e!="string"?$a(e,t):e.length===0?"(\u7A7A)":e.length>t?e.slice(0,t-1)+"\u2026":e}function gd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}p();function rr(e){if(e===""||e===void 0||e===null)return{ok:!0,args:{},fixed:""};try{return{ok:!0,args:JSON.parse(e),fixed:e}}catch(t){let n=ay(e);try{return{ok:!0,args:JSON.parse(n),fixed:n}}catch{let o=t instanceof Error?t.message:String(t);return ly(o,e)?{ok:!1,reason:"PARTIAL",partial:e,hint:"\u53C2\u6570 JSON \u5C1A\u672A\u6536\u5168\uFF0C\u6D41\u5F0F\u62FC\u63A5\u4E2D\uFF1B\u53EF\u80FD\u662F\u7F51\u7EDC/\u5FC3\u8DF3\u5BFC\u81F4\u534A\u622A"}:{ok:!1,reason:"INVALID_JSON",raw:e,error:o}}}}function ay(e){let t=e.length,n=0;for(let a=e.length-1;a>=0&&e[a]==="\\";a--)n++;n%2===1&&t--;let r=e.slice(0,t),o=[],s=!1,i=!1;for(let a=0;a<r.length;a++){let l=r[a];if(i){i=!1;continue}if(l==="\\"){i=!0;continue}if(l==='"'){s=!s;continue}s||(l==="{"?o.push("}"):l==="["?o.push("]"):(l==="}"||l==="]")&&o.pop())}for(s&&(r+='"');o.length>0;)r+=o.pop();return r}function ly(e,t){return!!(e.includes("Unexpected end of JSON")||e.includes("Unterminated string")||t.length<5)}import{jsx as Oa,jsxs as Ze}from"react/jsx-runtime";function Da({call:e,parsedArgs:t,schemaIssues:n,denial:r}){let o=t??dy(e.arguments),s=Gr(o),i=cs(e.name,s),a=hd(s);return Ze(jr,{flexDirection:"column",marginLeft:3,marginTop:1,children:[Ze(jr,{children:[Ze(Ct,{dimColor:!0,children:["\u{1F4E6} ",e.name]}),Ze(Ct,{dimColor:!0,children:[" ","\u2500".repeat(Math.max(1,30-e.name.length))]})]}),Ze(jr,{flexDirection:"column",marginLeft:2,children:[Oa(Ct,{dimColor:!0,children:i}),Oa(Ct,{dimColor:!0,children:a})]}),n&&n.length>0&&Ze(jr,{flexDirection:"column",marginLeft:2,children:[Ze(Ct,{color:"yellow",children:["\u26A0 schema \u95EE\u9898\uFF08",n.length,"\uFF09"]}),n.slice(0,3).map((l,c)=>Ze(Ct,{color:"yellow",children:[" - ",l.message]},c)),n.length>3&&Ze(Ct,{color:"yellow",children:[" ...\u8FD8\u6709 ",n.length-3," \u6761"]})]}),r&&Oa(cy,{denial:r})]})}function cy({denial:e}){let t=uy[e.source]??e.source,n=e.source==="hardcoded_blacklist"?"\u{1F6AB}":"\u{1F6D1}";return Ze(jr,{flexDirection:"column",marginLeft:2,marginTop:1,borderStyle:"round",borderColor:"red",paddingX:1,children:[Ze(Ct,{color:"red",bold:!0,children:[n," \u88AB\u6743\u9650\u7CFB\u7EDF\u62D2\u7EDD\uFF08",t,"\uFF09"]}),Ze(Ct,{color:"red",children:[" \u539F\u56E0\uFF1A",e.reason]}),e.hint&&Ze(Ct,{color:"yellow",children:[" \u63D0\u793A\uFF1A",e.hint]})]})}var uy={hardcoded_blacklist:"\u786C\u7F16\u7801\u5B89\u5168\u89C4\u5219",permission_rule:"\u7528\u6237\u914D\u7F6E\u89C4\u5219",user_prompt:"\u7528\u6237\u624B\u52A8\u62D2\u7EDD"};function dy(e){if(!e)return{};let t=rr(e);return t.ok?t.args:{}}p();import{Box as us,Text as Le}from"ink";p();function yd(e){return e>=4352&&e<=4447||e===9001||e===9002||e>=11904&&e<=42191||e>=43360&&e<=43391||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65040&&e<=65055||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=126976&&e<=131071||e>=12288&&e<=12351||e>=131072&&e<=196607?2:e<32||e>=127&&e<160?0:1}function Ur(e){let t=0;for(let n of e){let r=n.codePointAt(0);r!==void 0&&r!==8205&&(r>=65024&&r<=65039||(t+=yd(r)))}return t}function*py(e){for(let t of e){let n=t.codePointAt(0);n!==void 0&&n!==8205&&(n>=65024&&n<=65039||(yield{ch:t,width:yd(n)}))}}function fy(e,t){if(t<=0)return[e];let n=[];for(let r of e.split(`
18
18
  `)){if(r.length===0){n.push("");continue}let o=my(r,t);for(let s of o)n.push(s)}return n.length===0?[""]:n}function my(e,t){if(Ur(e)<=t)return[e];let n=[],r="",o=0,s=-1,i=0;for(let{ch:a,width:l}of py(e)){if(a===" "||a===" "){s=r.length,i=o+l,r+=a,o+=l;continue}if(o+l>t)if(s>0){let c=r.slice(0,s).replace(/[ \t]+$/,"");n.push(c),r=r.slice(s).replace(/^[ \t]+/,"")+a,o=Ur(r),s=-1,i=0}else n.push(r),r=a,o=l;else r+=a,o+=l}return r.length>0&&n.push(r),n}function hy(e,t,n){return e.map((r,o)=>{let s=t[o]??3;return fy(r,s).map(a=>gy(a,s,n[o]??"left"))})}function gy(e,t,n="left"){let r=Ur(e),o=t-r;if(o<=0)return e;let s=n==="right"?o:n==="center"?Math.floor(o/2):0,i=o-s;return" ".repeat(s)+e+" ".repeat(i)}function Na(e){let t=e.trim();return!t.startsWith("|")||!t.endsWith("|")?[]:t.slice(1,t.length-1).split("|").map(r=>r.trim())}function yy(e){return Na(e).map(t=>{let n=t.startsWith(":"),r=t.endsWith(":");return n&&r?"center":r?"right":"left"})}function bd(e,t={}){let n=t.termWidth??80,r=t.outerMargin??0,o=Math.max(n-r,20),s=e.split(`
19
19
  `).filter(E=>E.trim().length>0);if(s.length<2)return{lines:s,colWidths:[],totalWidth:0};let i=-1;for(let E=0;E<s.length;E++){let I=(s[E]??"").trim();if(/^\|[-: |]+\|$/.test(I)&&I.includes("-")){i=E;break}}if(i===-1)return{lines:s,colWidths:[],totalWidth:0};let a=Na(s.slice(0,i).join("")),l=yy(s[i]??""),c=s.slice(i+1).map(Na),u=a.length;if(u===0)return{lines:s,colWidths:[],totalWidth:0};let d=[];for(let E=0;E<u;E++){let I=Ur(a[E]??"");for(let B of c){let Y=Ur(B[E]??"");Y>I&&(I=Y)}d.push(Math.max(I,3))}let m=2,h=d.reduce((E,I)=>E+I+m,1),f;if(h<=o)f=d;else{let E=o-1-m*u,I=d.reduce((Y,q)=>Y+q,0);f=d.map(Y=>Math.max(3,Math.floor(Y/I*E)));let B=f.reduce((Y,q)=>Y+q+m,1);for(;B>o&&f.length>0;){let Y=f.length-1,q=f[Y]??3;if(q<=3)break;f[Y]=q-1,B=f.reduce((ae,ce)=>ae+ce+m,1)}}let g="\u2500",w=(E,I,B)=>E+f.map(Y=>g.repeat(Y+m)).join(I)+B,x=w("\u250C","\u252C","\u2510"),T=w("\u251C","\u253C","\u2524"),v=w("\u2514","\u2534","\u2518");function _(E){let I=hy(E,f,l),B=Math.max(1,...I.map(q=>q.length)),Y=[];for(let q=0;q<B;q++){let ae="\u2502";for(let ce=0;ce<u;ce++){let j=(I[ce]??[])[q]??" ".repeat(f[ce]??3);ae+=" "+j+" ",ce<u-1&&(ae+="\u2502")}ae+="\u2502",Y.push(ae)}return Y}let S=_(a),D=c.map(_),H=f.reduce((E,I)=>E+I+m,1);return{lines:[x,...S,T,...D.flat(),v],colWidths:f,totalWidth:H}}function xd(){let e=process.stdout?.columns;return typeof e=="number"&&e>0?e:void 0}import{jsx as ke,jsxs as Ba}from"react/jsx-runtime";function by(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf("```",n);if(r===-1){t.push({text:e.slice(n),type:"plain"});break}r>n&&t.push({text:e.slice(n,r),type:"plain"});let o=e.indexOf("```",r+3);if(o===-1){t.push({text:e.slice(r),type:"plain"});break}let s=e.slice(r+3,o);t.push({text:s,type:"code_block"}),n=o+3}return t}function Ma(e){let t=e.trim();return/^\|.+\|$/.test(t)}function xy(e){let t=e.trim();return/^\|[-: |]+\|$/.test(t)&&t.includes("-")}function wy(e){let t=e.split(`
@@ -22,8 +22,8 @@ import{a as td}from"./chunk-KMMG6QC6.js";import{a as Oe,b as Yn,c as Sa}from"./c
22
22
  `+i:r=i}return o(),n}function ky(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf("**",n);if(r===-1){t.push({text:e.slice(n),type:"plain"});break}r>n&&t.push({text:e.slice(n,r),type:"plain"});let o=e.indexOf("**",r+2);if(o===-1){t.push({text:e.slice(r),type:"plain"});break}t.push({text:e.slice(r+2,o),type:"bold"}),n=o+2}return t}function Sy(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf("`",n);if(r===-1){t.push({text:e.slice(n),type:"plain"});break}r>n&&t.push({text:e.slice(n,r),type:"plain"});let o=1;for(;r+o<e.length&&e[r+o]==="`";)o++;if(o===1){let s=e.indexOf("`",r+1);if(s===-1){t.push({text:e.slice(r),type:"plain"});break}t.push({text:e.slice(r+1,s),type:"code"}),n=s+1}else t.push({text:e.slice(r,r+o),type:"plain"}),n=r+o}return t}function Ty(e){let t=[];for(let n of e){if(n.type==="code_block"||n.type==="table"){t.push(n);continue}let r=Sy(n.text);for(let o of r)o.type==="code"?t.push(o):n.type==="bold"?t.push({text:o.text,type:"bold"}):t.push(o)}return t}var Cy="#22c55e",_y="#ef4444",vy="#00cccc";function Ry({code:e}){let t=e.split(`
23
23
  `),n=t[0]??"",r=n.trim().length>0&&!n.startsWith("+")&&!n.startsWith("-")&&!n.startsWith("@@")&&!n.startsWith(" "),o=r?n:void 0,s=r?t.slice(1):t;return s.length===0?r?ke(us,{marginLeft:2,children:Ba(Le,{color:"#888888",children:["\u250C ",o]})}):null:Ba(us,{flexDirection:"column",marginLeft:2,marginTop:1,children:[o&&Ba(Le,{color:"#888888",children:["\u250C ",o]}),s.map((i,a)=>i.startsWith("+")?ke(Le,{color:Cy,children:i},a):i.startsWith("-")?ke(Le,{color:_y,children:i},a):i.startsWith("@@")?ke(Le,{color:vy,children:i},a):ke(Le,{children:i},a))]})}function Ay({text:e}){let t=xd(),n=bd(e,{termWidth:t});return n.colWidths.length===0?ke(Le,{children:e}):ke(us,{flexDirection:"column",marginTop:1,children:n.lines.map((r,o)=>{let s=o===0,i=o===n.lines.length-1,a=!s&&!i&&r.startsWith("\u251C");return ke(Le,{color:s||i||a?"#888888":void 0,children:r},o)})})}var Ey=/[\u{1F000}-\u{1FFFF}\u{FE00}-\u{FE0F}\u{200D}\u{20E3}\u{2600}-\u{27BF}\u{231A}-\u{23FF}\u{2934}\u{2935}\u{25AA}-\u{25FE}\u{2B50}\u{2B55}\u{00A9}\u{00AE}\u{2122}\u{3030}\u{303D}\u{3297}\u{3299}]/u;function Iy(e){return Ey.test(e)}function Py(e){try{return[...new Intl.Segmenter("en",{granularity:"grapheme"}).segment(e)].map(r=>({text:r.segment,isEmoji:Iy(r.segment)}))}catch{return[{text:e,isEmoji:!1}]}}function wd(e,t){let n=Py(e);if(n.length===1&&!n[0].isEmoji)return ke(Le,{color:Sd,children:e},t);let r=[];for(let o of n){let s=r[r.length-1];s&&s.isEmoji===o.isEmoji?s.text+=o.text:r.push({text:o.text,isEmoji:o.isEmoji})}return ke(Le,{children:r.map((o,s)=>o.isEmoji?o.text:ke(Le,{color:Sd,children:o.text},s))},t)}var kd="#00BFFF",Sd="#A855F7";function Td({children:e}){let t=by(e),n=[];for(let c of t)c.type==="code_block"?n.push(c):n.push(...wy(c.text));let r=[];for(let c of n)c.type==="code_block"||c.type==="table"?r.push(c):r.push(...ky(c.text));let o=Ty(r);if(!o.some(c=>c.type==="code_block"||c.type==="table"))return o.length===1&&o[0].type==="plain"?ke(Le,{wrap:"wrap",children:e}):ke(Le,{wrap:"wrap",children:o.map((u,d)=>u.type==="code"?ke(Le,{color:kd,children:u.text},d):u.type==="bold"?wd(u.text,d):u.text)});let i=[],a=[];function l(c){if(a.length===0)return;a.length===1&&a[0].type==="plain"?i.push(ke(Le,{wrap:"wrap",children:a[0].text},c)):i.push(ke(Le,{wrap:"wrap",children:a.map((d,m)=>d.type==="code"?ke(Le,{color:kd,children:d.text},m):d.type==="bold"?wd(d.text,m):d.text)},c)),a=[]}for(let c of o)c.type==="code_block"?(l(i.length),i.push(ke(Ry,{code:c.text},`b${i.length}`))):c.type==="table"?(l(i.length),i.push(ke(Ay,{text:c.text},`t${i.length}`))):a.push(c);return l(i.length),ke(us,{flexDirection:"column",children:i})}import{Fragment as Dy,jsx as vt,jsxs as Ye}from"react/jsx-runtime";function $y(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Oy({usage:e,cost:t}){let n=e?e.promptTokens+e.completionTokens:0,r=t??0,[o,s]=_d(n),[i,a]=_d(r),l=Cd(null),c=Cd(null);return Ly(()=>{if(l.current&&l.current.toTokens===n&&l.current.toCost===r)return;if(n<=o&&r<=i){s(n),a(r),l.current={fromTokens:n,fromCost:r,toTokens:n,toCost:r,startMs:Date.now(),durationMs:0};return}let u=n-o,d=r-i,m=Math.min(600,Math.max(220,Math.max(u,0)*1.2+220));return l.current={fromTokens:o,fromCost:i,toTokens:n,toCost:r,startMs:Date.now(),durationMs:m},c.current&&clearInterval(c.current),c.current=setInterval(()=>{let h=l.current;if(!h)return;let f=Date.now()-h.startMs;if(f>=h.durationMs){s(h.toTokens),a(h.toCost),c.current&&(clearInterval(c.current),c.current=null);return}let g=f/h.durationMs,w=1-Math.pow(1-g,3),x=h.fromTokens+(h.toTokens-h.fromTokens)*w,T=h.fromCost+(h.toCost-h.fromCost)*w;s(x),a(T)},33),()=>{c.current&&(clearInterval(c.current),c.current=null)}},[n,r]),Ye(Dy,{children:[e&&Ye(Nt,{color:"#888888",children:[Math.round(o).toLocaleString()," tokens"]}),t!==void 0&&t>0&&Ye(Nt,{color:"#888888",children:[" \xB7 ","\xA5",i.toFixed(4)]})]})}function ds({content:e,toolCalls:t,isStreaming:n=!1,usage:r,elapsed:o,cost:s,model:i,toolResults:a}){return!e&&(!t||t.length===0)&&!n?null:Ye(_t,{flexDirection:"row",marginTop:1,children:[vt(_t,{width:1,backgroundColor:"#E040FB",flexShrink:0}),Ye(_t,{flexGrow:1,paddingLeft:1,flexDirection:"column",children:[Ye(_t,{flexDirection:"row",children:[vt(_t,{width:4,flexShrink:0,children:vt(Nt,{bold:!0,color:"#ff00ff",children:"\u{1F916}"})}),Ye(_t,{flexGrow:1,flexDirection:"column",children:[e&&vt(Td,{children:e}),n&&!e&&vt(Nt,{color:"#888888",children:"..."})]})]}),t&&t.length>0&&vt(_t,{flexDirection:"column",children:t.map((l,c)=>vt(Da,{call:l,denial:a?.get(l.id??"")?.denial},l.id??c))}),n&&(r||s!==void 0)&&vt(_t,{flexDirection:"row",marginTop:1,marginLeft:3,children:Ye(Nt,{color:"#666666",dimColor:!0,children:["\u23F3 \u5DF2\u6D88\u8017 ",vt(Oy,{usage:r,cost:s})]})}),!n&&(r||o!==void 0)&&Ye(_t,{flexDirection:"column",marginTop:1,marginLeft:3,children:[vt(Nt,{color:"#555555",children:"\u2500".repeat(36)}),Ye(_t,{flexDirection:"row",gap:2,children:[s!==void 0&&s>0&&Ye(Nt,{color:"yellow",children:["\u{1F4B0} \u672C\u6B21 ",Pa(s)]}),o!==void 0&&Ye(Nt,{color:"cyan",children:["\u{1F550} ",$y(o)]}),r&&Ye(Nt,{color:"#888888",children:["\u{1F4E6} ",(r.promptTokens+r.completionTokens).toLocaleString()," tokens"]})]})]})]})]})}p();import{Box as Fa,Text as Cn}from"ink";import{jsx as _n,jsxs as ps}from"react/jsx-runtime";function Ga({diff:e}){let{patch:t,additions:n,deletions:r,existedBefore:o,filePath:s}=e;if(!t||t.length===0)return null;let i=t.split(`
24
24
  `),a=s.replace(/\\/g,"/").split("/").pop()??s;return ps(Fa,{flexDirection:"column",marginTop:1,children:[ps(Fa,{flexDirection:"row",gap:1,children:[ps(Cn,{bold:!0,color:"#00ffff",children:["\u{1F4DD} ",o?"\u4FEE\u6539":"\u65B0\u5EFA",":"]}),_n(Cn,{bold:!0,children:a}),ps(Cn,{color:"#555555",children:["(+",n," -",r,")"]})]}),_n(Fa,{flexDirection:"column",marginLeft:2,children:i.filter(l=>!l.startsWith("---")&&!l.startsWith("+++")).map((l,c)=>_n(Ny,{line:l},c))})]})}function Ny({line:e}){return e.startsWith("---")||e.startsWith("+++")?null:e.startsWith("@@")?_n(Cn,{color:"#00cccc",children:e}):e.startsWith("+")?_n(Cn,{color:"#22c55e",children:e}):e.startsWith("-")?_n(Cn,{color:"#ef4444",children:e}):_n(Cn,{color:"#6b7280",children:e})}p();import{Box as ja,Text as Ua}from"ink";import{jsx as fs,jsxs as vd}from"react/jsx-runtime";var My="#00bfff";function Wa({skills:e,input:t,selectedIndex:n}){let r=t.match(/(?:^|\s)\/([^/]*)$/);if(!r)return null;let o=r[1].toLowerCase().trim();if(e.length===0)return null;let s=!o&&t.startsWith("/")?e.slice(0,3):e.filter(i=>i.name.toLowerCase().includes(o)).slice(0,3);return o&&s.some(i=>i.name.toLowerCase()===o)||s.length===0?null:vd(ja,{flexDirection:"column",marginLeft:4,marginTop:1,children:[fs(Ua,{color:"#808080",dimColor:!0,children:"\u652F\u6301\u7684 Skill\uFF1A"}),s.map((i,a)=>fs(ja,{children:vd(Ua,{color:a===n?My:"#808080",children:[a===n?" \u203A ":" ",i.name]})},i.name)),fs(ja,{marginTop:1,children:fs(Ua,{color:"#808080",dimColor:!0,children:"\u2191\u2193 \u9009\u62E9 \xB7 Tab \u8865\u5168"})})]})}p();import{Box as cn,Text as hr}from"ink";import{useEffect as pk,useState as fk}from"react";p();import{Box as mr,Text as Dn}from"ink";import{useEffect as ak,useState as lk}from"react";p();p();p();function By(e){return Qa(e)}function Qa(e){return Array.isArray(e)?Fy(e):e instanceof RegExp?e:typeof e=="object"?Gy(e):e}function Fy(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Qa(e[n]);return t}function Gy(e){let t={};for(let n in e)t[n]=Qa(e[n]);return t}function Dd(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Nd(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Nd(e.substring(0,e.length-1)):e.substr(~t+1)}var Ha=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ms=class{static hasCaptures(e){return e===null?!1:(Ha.lastIndex=0,Ha.test(e))}static replaceCaptures(e,t,n){return e.replace(Ha,(r,o,s,i)=>{let a=n[parseInt(o||s,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Md(e,t){return e<t?-1:e>t?1:0}function Bd(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let o=0;o<n;o++){let s=Md(e[o],t[o]);if(s!==0)return s}return 0}return n-r}function Rd(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fd(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gd=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Vr=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Wy(e),t)}static createFromParsedTheme(e,t){return Vy(e,t)}_cachedMatchRoot=new Gd(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,r=this._cachedMatchRoot.get(t).find(o=>jy(e.parent,o.parentScopes));return r?new jd(r.fontStyle,r.foreground,r.background):null}},Va=class hs{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(let r of n)t=new hs(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new hs(n,t[r]);return n}push(t){return new hs(this,t)}getSegments(){let t=this,n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){let n=[],r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function jy(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!Uy(e.scopeName,r);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Uy(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var jd=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Wy(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let o=0,s=t.length;o<s;o++){let i=t[o];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let d=i.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),a=d.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let d=i.settings.fontStyle.split(" ");for(let m=0,h=d.length;m<h;m++)switch(d[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof i.settings.foreground=="string"&&Rd(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Rd(i.settings.background)&&(u=i.settings.background);for(let d=0,m=a.length;d<m;d++){let f=a[d].trim().split(" "),g=f[f.length-1],w=null;f.length>1&&(w=f.slice(0,f.length-1),w.reverse()),n[r++]=new Hy(g,w,o,l,c,u)}}return n}var Hy=class{constructor(e,t,n,r,o,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=s}},pe=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(pe||{});function Vy(e,t){e.sort((l,c)=>{let u=Md(l.scope,c.scope);return u!==0||(u=Bd(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(o=l.background)}let s=new zy(t),i=new jd(n,s.getId(r),s.getId(o)),a=new Ky(new qa(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let u=e[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,s.getId(u.foreground),s.getId(u.background))}return new Vr(s,i,a)}var zy=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},qy=Object.freeze([]),qa=class Ud{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,o,s){this.scopeDepth=t,this.parentScopes=n||qy,this.fontStyle=r,this.foreground=o,this.background=s}clone(){return new Ud(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,o=t.length;r<o;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),o!==0&&(this.background=o)}},Ky=class Ka{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,o=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[o]===">"&&o++,!(r>=t.parentScopes.length||o>=n.parentScopes.length);){let s=n.parentScopes[o].length-t.parentScopes[r].length;if(s!==0)return s;r++,o++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),o,s;if(r===-1?(o=t,s=""):(o=t.substring(0,r),s=t.substring(r+1)),this._children.hasOwnProperty(o))return this._children[o].match(s)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ka._cmpBySpecificity),n}insert(t,n,r,o,s,i){if(n===""){this._doInsertHere(t,r,o,s,i);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Ka(this._mainRule.clone(),qa.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(t+1,c,r,o,s,i)}_doInsertHere(t,n,r,o,s){if(n===null){this._mainRule.acceptOverwrite(t,r,o,s);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(Bd(l.parentScopes,n)===0){l.acceptOverwrite(t,r,o,s);return}}r===-1&&(r=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new qa(t,n,r,o,s))}},rn=class it{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let n=it.getLanguageId(t),r=it.getTokenType(t),o=it.getFontStyle(t),s=it.getForeground(t),i=it.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:s,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,o,s,i,a){let l=it.getLanguageId(t),c=it.getTokenType(t),u=it.containsBalancedBrackets(t)?1:0,d=it.getFontStyle(t),m=it.getForeground(t),h=it.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),o!==null&&(u=o?1:0),s!==-1&&(d=s),i!==0&&(m=i),a!==0&&(h=a),(l<<0|c<<8|u<<10|d<<11|m<<15|h<<24)>>>0}};function ys(e,t){let n=[],r=Xy(e),o=r.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let c=i();if(n.push({matcher:c,priority:l}),o!==",")break;o=r.next()}return n;function s(){if(o==="-"){o=r.next();let l=s();return c=>!!l&&!l(c)}if(o==="("){o=r.next();let l=a();return o===")"&&(o=r.next()),l}if(Ad(o)){let l=[];do l.push(o),o=r.next();while(Ad(o));return c=>t(l,c)}return null}function i(){let l=[],c=s();for(;c;)l.push(c),c=s();return u=>l.every(d=>d(u))}function a(){let l=[],c=i();for(;c&&(l.push(c),o==="|"||o===",");){do o=r.next();while(o==="|"||o===",");c=i()}return u=>l.some(d=>d(u))}}function Ad(e){return!!e&&!!e.match(/[\w\.:]+/)}function Xy(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Wd(e){typeof e.dispose=="function"&&e.dispose()}var zr=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Jy=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Zy=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yy=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new zr(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Zy;for(let n of e)Qy(n,this.initialScopeName,this.repo,t);for(let n of t.references)if(n instanceof zr){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Qy(e,t,n,r){let o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}let s=n.lookup(t);e instanceof zr?gs({baseGrammar:s,selfGrammar:o},r):Xa(e.ruleName,{baseGrammar:s,selfGrammar:o,repository:o.repository},r);let i=n.injections(e.scopeName);if(i)for(let a of i)r.add(new zr(a))}function Xa(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];bs([r],t,n)}}function gs(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&bs(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&bs(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function bs(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let o=r.repository?Dd({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&bs(r.patterns,{...t,repository:o},n);let s=r.include;if(!s)continue;let i=Hd(s);switch(i.kind){case 0:gs({...t,selfGrammar:t.baseGrammar},n);break;case 1:gs(t,n);break;case 2:Xa(i.ruleName,{...t,repository:o},n);break;case 3:case 4:let a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){let l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:o};i.kind===4?Xa(i.ruleName,l,n):gs(l,n)}else i.kind===4?n.add(new Jy(i.scopeName,i.ruleName)):n.add(new zr(i.scopeName));break}}}var eb=class{kind=0},tb=class{kind=1},nb=class{constructor(e){this.ruleName=e}kind=2},rb=class{constructor(e){this.scopeName=e}kind=3},ob=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Hd(e){if(e==="$base")return new eb;if(e==="$self")return new tb;let t=e.indexOf("#");if(t===-1)return new rb(e);if(t===0)return new nb(e.substring(1));{let n=e.substring(0,t),r=e.substring(t+1);return new ob(n,r)}}var sb=/\\(\d+)/,Ed=/\\(\d+)/g;var ib=-1,Vd=-2;var Xr=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ms.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ms.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Nd(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ms.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ms.replaceCaptures(this._contentName,e,t)}},ab=class extends Xr{retokenizeCapturedWithRuleId;constructor(e,t,n,r,o){super(e,t,n,r),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},lb=class extends Xr{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,null),this._match=new qr(r,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Kr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Id=class extends Xr{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,r),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Kr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ja=class extends Xr{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o,s,i,a,l,c){super(e,t,n,r),this._begin=new qr(o,this.id),this.beginCaptures=s,this._end=new qr(i||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Kr;for(let n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},xs=class extends Xr{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,o,s,i,a,l){super(e,t,n,r),this._begin=new qr(o,this.id),this.beginCaptures=s,this.whileCaptures=a,this._while=new qr(i,Vd),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Kr;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Kr,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"\uFFFF"),this._cachedCompiledWhilePatterns}},zd=class De{static createCaptureRule(t,n,r,o,s){return t.registerRule(i=>new ab(n,i,r,o,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new lb(t.$vscodeTextmateLocation,t.id,t.name,t.match,De._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Dd({},r,t.repository));let s=t.patterns;return typeof s>"u"&&t.include&&(s=[{include:t.include}]),new Id(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,De._compilePatterns(s,n,r))}return t.while?new xs(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,De._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,De._compileCaptures(t.whileCaptures||t.captures,n,r),De._compilePatterns(t.patterns,n,r)):new Ja(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,De._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,De._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,De._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let o=[];if(t){let s=0;for(let i in t){if(i==="$vscodeTextmateLocation")continue;let a=parseInt(i,10);a>s&&(s=a)}for(let i=0;i<=s;i++)o[i]=null;for(let i in t){if(i==="$vscodeTextmateLocation")continue;let a=parseInt(i,10),l=0;t[i].patterns&&(l=De.getCompiledRuleId(t[i],n,r)),o[a]=De.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,l)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let s=0,i=t.length;s<i;s++){let a=t[s],l=-1;if(a.include){let c=Hd(a.include);switch(c.kind){case 0:case 1:l=De.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=De.getCompiledRuleId(u,n,r));break;case 3:case 4:let d=c.scopeName,m=c.kind===4?c.ruleName:null,h=n.getExternalGrammar(d,r);if(h)if(m){let f=h.repository[m];f&&(l=De.getCompiledRuleId(f,n,h.repository))}else l=De.getCompiledRuleId(h.repository.$self,n,h.repository);break}}else l=De.getCompiledRuleId(a,n,r);if(l!==-1){let c=n.getRule(l),u=!1;if((c instanceof Id||c instanceof Ja||c instanceof xs)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;o.push(l)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},qr=class qd{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){let r=t.length,o=0,s=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){let c=t.charAt(a+1);c==="z"?(s.push(t.substring(o,a)),s.push("$(?!\\n)(?<!\\n)"),o=a+2):(c==="A"||c==="G")&&(i=!0),a++}this.hasAnchor=i,o===0?this.source=t:(s.push(t.substring(o,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=sb.test(this.source):this.hasBackReferences=!1}clone(){return new qd(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(o=>t.substring(o.start,o.end));return Ed.lastIndex=0,this.source.replace(Ed,(o,s)=>Fd(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],o=[],s,i,a,l;for(s=0,i=this.source.length;s<i;s++)a=this.source.charAt(s),t[s]=a,n[s]=a,r[s]=a,o[s]=a,a==="\\"&&s+1<i&&(l=this.source.charAt(s+1),l==="A"?(t[s+1]="\uFFFF",n[s+1]="\uFFFF",r[s+1]="A",o[s+1]="A"):l==="G"?(t[s+1]="\uFFFF",n[s+1]="G",r[s+1]="\uFFFF",o[s+1]="G"):(t[s+1]=l,n[s+1]=l,r[s+1]=l,o[s+1]=l),s++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:o.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Kr=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Pd(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(o=>o.resolveAnchors(t,n));return new Pd(e,r,this._items.map(o=>o.ruleId))}},Pd=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
25
- `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},za=class{constructor(e,t){this.languageId=e,this.tokenType=t}},cb=class Za{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new za(t,8),this._embeddedLanguagesMatcher=new ub(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Za._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new za(0,0);_getBasicScopeAttributes=new Gd(t=>{let n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new za(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let n=t.match(Za.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ub=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([n,r])=>Fd(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},AR={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Kd=!1,Ld=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Xd(e,t,n,r,o,s,i,a){let l=t.content.length,c=!1,u=-1;if(i){let h=db(e,t,n,r,o,s);o=h.stack,r=h.linePos,n=h.isFirstLine,u=h.anchorPosition}let d=Date.now();for(;!c;){if(a!==0&&Date.now()-d>a)return new Ld(o,!0);m()}return new Ld(o,!1);function m(){let h=pb(e,t,n,r,o,u);if(!h){s.produce(o,l),c=!0;return}let f=h.captureIndices,g=h.matchedRuleId,w=f&&f.length>0?f[0].end>r:!1;if(g===ib){let x=o.getRule(e);s.produce(o,f[0].start),o=o.withContentNameScopesList(o.nameScopesList),Wr(e,t,n,o,s,x.endCaptures,f),s.produce(o,f[0].end);let T=o;if(o=o.parent,u=T.getAnchorPos(),!w&&T.getEnterPos()===r){o=T,s.produce(o,l),c=!0;return}}else{let x=e.getRule(g);s.produce(o,f[0].start);let T=o,v=x.getName(t.content,f),_=o.contentNameScopesList.pushAttributed(v,e);if(o=o.push(g,r,u,f[0].end===l,null,_,_),x instanceof Ja){let S=x;Wr(e,t,n,o,s,S.beginCaptures,f),s.produce(o,f[0].end),u=f[0].end;let D=S.getContentName(t.content,f),H=_.pushAttributed(D,e);if(o=o.withContentNameScopesList(H),S.endHasBackReferences&&(o=o.withEndRule(S.getEndWithResolvedBackReferences(t.content,f))),!w&&T.hasSameRuleAs(o)){o=o.pop(),s.produce(o,l),c=!0;return}}else if(x instanceof xs){let S=x;Wr(e,t,n,o,s,S.beginCaptures,f),s.produce(o,f[0].end),u=f[0].end;let D=S.getContentName(t.content,f),H=_.pushAttributed(D,e);if(o=o.withContentNameScopesList(H),S.whileHasBackReferences&&(o=o.withEndRule(S.getWhileWithResolvedBackReferences(t.content,f))),!w&&T.hasSameRuleAs(o)){o=o.pop(),s.produce(o,l),c=!0;return}}else if(Wr(e,t,n,o,s,x.captures,f),s.produce(o,f[0].end),o=o.pop(),!w){o=o.safePop(),s.produce(o,l),c=!0;return}}f[0].end>r&&(r=f[0].end,n=!1)}}function db(e,t,n,r,o,s){let i=o.beginRuleCapturedEOL?0:-1,a=[];for(let l=o;l;l=l.pop()){let c=l.getRule(e);c instanceof xs&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){let{ruleScanner:c,findOptions:u}=hb(l.rule,e,l.stack.endRule,n,r===i),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==Vd){o=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(s.produce(l.stack,d.captureIndices[0].start),Wr(e,t,n,l.stack,s,l.rule.whileCaptures,d.captureIndices),s.produce(l.stack,d.captureIndices[0].end),i=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{o=l.stack.pop();break}}return{stack:o,linePos:r,anchorPosition:i,isFirstLine:n}}function pb(e,t,n,r,o,s){let i=fb(e,t,n,r,o,s),a=e.getInjections();if(a.length===0)return i;let l=mb(a,e,t,n,r,o,s);if(!l)return i;if(!i)return l;let c=i.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:i}function fb(e,t,n,r,o,s){let i=o.getRule(e),{ruleScanner:a,findOptions:l}=Jd(i,e,o.endRule,n,r===s),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function mb(e,t,n,r,o,s,i){let a=Number.MAX_VALUE,l=null,c,u=0,d=s.contentNameScopesList.getScopeNames();for(let m=0,h=e.length;m<h;m++){let f=e[m];if(!f.matcher(d))continue;let g=t.getRule(f.ruleId),{ruleScanner:w,findOptions:x}=Jd(g,t,null,r,o===i),T=w.findNextMatchSync(n,o,x);if(!T)continue;let v=T.captureIndices[0].start;if(!(v>=a)&&(a=v,l=T.captureIndices,c=T.ruleId,u=f.priority,a===o))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Jd(e,t,n,r,o){if(Kd){let i=e.compile(t,n),a=Zd(r,o);return{ruleScanner:i,findOptions:a}}return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function hb(e,t,n,r,o){if(Kd){let i=e.compileWhile(t,n),a=Zd(r,o);return{ruleScanner:i,findOptions:a}}return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function Zd(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Wr(e,t,n,r,o,s,i){if(s.length===0)return;let a=t.content,l=Math.min(s.length,i.length),c=[],u=i[0].end;for(let d=0;d<l;d++){let m=s[d];if(m===null)continue;let h=i[d];if(h.length===0)continue;if(h.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=h.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,h.start):o.produce(r,h.start),m.retokenizeCapturedWithRuleId){let g=m.getName(a,i),w=r.contentNameScopesList.pushAttributed(g,e),x=m.getContentName(a,i),T=w.pushAttributed(x,e),v=r.push(m.retokenizeCapturedWithRuleId,h.start,-1,!1,null,w,T),_=e.createOnigString(a.substring(0,h.end));Xd(e,_,n&&h.start===0,h.start,v,o,!1,0),Wd(_);continue}let f=m.getName(a,i);if(f!==null){let w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);c.push(new gb(w,h.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var gb=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function yb(e,t,n,r,o,s,i,a){return new xb(e,t,n,r,o,s,i,a)}function $d(e,t,n,r,o){let s=ys(t,ws),i=zd.getCompiledRuleId(n,r,o.repository);for(let a of s)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:o,priority:a.priority})}function ws(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let o=n;o<t.length;o++)if(bb(t[o],r))return n=o+1,!0;return!1})}function bb(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var xb=class{constructor(e,t,n,r,o,s,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=a,this._basicScopeAttributesProvider=new cb(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Od(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(let l of Object.keys(o)){let c=ys(l,ws);for(let u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:o[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let o=r.injections;if(o)for(let i in o)$d(t,i,o[i],this,r);let s=this._grammarRepository.injections(n);s&&s.forEach(i=>{let a=this.getExternalGrammar(i);if(a){let l=a.injectionSelector;l&&$d(t,l,a,this,a)}})}return t.sort((o,s)=>o.priority-s.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Od(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=zd.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===Ya.NULL){o=!0;let c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=rn.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),m=this.getRule(this._rootId).getName(null,null),h;m?h=Hr.createRootAndLookUpScopeName(m,d,this):h=Hr.createRoot("unknown",d),t=new Ya(null,this._rootId,-1,-1,!1,null,h,h)}else o=!1,t.reset();e=e+`
26
- `;let s=this.createOnigString(e),i=s.content.length,a=new kb(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Xd(this,s,o,0,t,a,!0,r);return Wd(s),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Od(e,t){return e=By(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Hr=class Rt{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,o=t?.scopePath??null;for(let s of n)o=Va.push(o,s.scopeNames),r=new Rt(r,o,s.encodedTokenAttributes);return r}static createRoot(t,n){return new Rt(null,new Va(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let o=r.getMetadataForScope(t),s=new Va(null,t),i=r.themeProvider.themeMatch(s),a=Rt.mergeAttributes(n,o,i);return new Rt(null,s,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Rt.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let o=-1,s=0,i=0;return r!==null&&(o=r.fontStyle,s=r.foregroundId,i=r.backgroundId),rn.set(t,n.languageId,n.tokenType,null,o,s,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Rt._pushAttributed(this,t,n);let r=t.split(/ /g),o=this;for(let s of r)o=Rt._pushAttributed(o,s,n);return o}static _pushAttributed(t,n,r){let o=r.getMetadataForScope(n),s=t.scopePath.push(n),i=r.themeProvider.themeMatch(s),a=Rt.mergeAttributes(t.tokenAttributes,o,i);return new Rt(t,s,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let n=[],r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},Ya=class vn{constructor(t,n,r,o,s,i,a,l){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=o}_stackElementBrand=void 0;static NULL=new vn(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:vn._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Hr.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){vn._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,s,i,a){return new vn(this,t,n,r,o,s,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){let t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new vn(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Hr.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new vn(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Hr.fromExtension(r,n.contentNameScopesList))}},wb=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):ys(n,ws).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>ys(n,ws).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},kb=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,o=!1;if(this.balancedBracketSelectors?.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let s=e?.getScopeNames()??[];for(let i of this._tokenTypeOverrides)i.matcher(s)&&(r=rn.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(s))}if(o&&(r=rn.set(r,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n}},Sb=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,o){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,yb(e,s,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},Yd=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Sb(Vr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Vr.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new wb(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,o){let s=new Yy(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(i=>this._loadSingleGrammar(i.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,n,r,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,o)}},ks=Ya.NULL;p();var nl=Lg(sp(),1),or=nl.default,{Ansis:dA,fg:pA,bg:fA,rgb:mA,bgRgb:hA,hex:gA,bgHex:yA,reset:bA,inverse:xA,hidden:wA,visible:kA,link:SA,bold:TA,dim:CA,italic:_A,underline:vA,strikethrough:RA,black:AA,red:EA,green:IA,yellow:PA,blue:LA,magenta:$A,cyan:OA,white:DA,gray:NA,redBright:MA,greenBright:BA,yellowBright:FA,blueBright:GA,magentaBright:jA,cyanBright:UA,whiteBright:WA,bgBlack:HA,bgRed:VA,bgGreen:zA,bgYellow:qA,bgBlue:KA,bgMagenta:XA,bgCyan:JA,bgWhite:ZA,bgGray:YA,bgRedBright:QA,bgGreenBright:eE,bgYellowBright:tE,bgBlueBright:nE,bgMagentaBright:rE,bgCyanBright:oE,bgWhiteBright:sE}=nl.default;p();p();var rl=Object.defineProperty,Ab=Object.getOwnPropertyDescriptor,Eb=Object.getOwnPropertyNames,Ib=Object.prototype.hasOwnProperty,sr=(e,t)=>{let n={};for(var r in e)rl(n,r,{get:e[r],enumerable:!0});return t||rl(n,Symbol.toStringTag,{value:"Module"}),n},ip=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Eb(t),s=0,i=o.length,a;s<i;s++)a=o[s],!Ib.call(e,a)&&a!==n&&rl(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=Ab(t,a))||r.enumerable});return e},Ts=(e,t,n)=>(ip(e,t,"default"),n&&ip(n,t,"default"));p();var ir=[{id:"abap",name:"ABAP",import:(()=>import("./abap-3IAGZ3PS.js"))},{id:"actionscript-3",name:"ActionScript",import:(()=>import("./actionscript-3-C46RIPM4.js"))},{id:"ada",name:"Ada",import:(()=>import("./ada-DNTYS66P.js"))},{id:"angular-html",name:"Angular HTML",import:(()=>import("./angular-html-FD45HTTF.js"))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>import("./angular-ts-XKF3LV22.js"))},{id:"apache",name:"Apache Conf",import:(()=>import("./apache-DU26FTNI.js"))},{id:"apex",name:"Apex",import:(()=>import("./apex-27CRTE2E.js"))},{id:"apl",name:"APL",import:(()=>import("./apl-DZEE5XRN.js"))},{id:"applescript",name:"AppleScript",import:(()=>import("./applescript-TT4XSRXH.js"))},{id:"ara",name:"Ara",import:(()=>import("./ara-Q7AJDKA4.js"))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>import("./asciidoc-6DTTKQ3A.js"))},{id:"asm",name:"Assembly",import:(()=>import("./asm-D3LJR7GV.js"))},{id:"astro",name:"Astro",import:(()=>import("./astro-AZ66H24C.js"))},{id:"awk",name:"AWK",import:(()=>import("./awk-DCAM52A7.js"))},{id:"ballerina",name:"Ballerina",import:(()=>import("./ballerina-44XARFEK.js"))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>import("./bat-WM4RL2AB.js"))},{id:"beancount",name:"Beancount",import:(()=>import("./beancount-5PUWGPVT.js"))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>import("./berry-YAK4XTWX.js"))},{id:"bibtex",name:"BibTeX",import:(()=>import("./bibtex-2ISWNMJJ.js"))},{id:"bicep",name:"Bicep",import:(()=>import("./bicep-EOACOM4G.js"))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>import("./bird2-ZG3DO533.js"))},{id:"blade",name:"Blade",import:(()=>import("./blade-6Y7SALML.js"))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>import("./bsl-TNLQPNE3.js"))},{id:"c",name:"C",import:(()=>import("./c-G7V525MX.js"))},{id:"c3",name:"C3",import:(()=>import("./c3-4Z2YI6YO.js"))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>import("./cadence-U32GKKTR.js"))},{id:"cairo",name:"Cairo",import:(()=>import("./cairo-26RR6N4F.js"))},{id:"clarity",name:"Clarity",import:(()=>import("./clarity-4JIHRN2V.js"))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>import("./clojure-PKTTXYYS.js"))},{id:"cmake",name:"CMake",import:(()=>import("./cmake-HXKHWGGH.js"))},{id:"cobol",name:"COBOL",import:(()=>import("./cobol-KCXH3T3Q.js"))},{id:"codeowners",name:"CODEOWNERS",import:(()=>import("./codeowners-WCXRHQ2R.js"))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>import("./codeql-XZZ2USHF.js"))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>import("./coffee-SGQWHBUL.js"))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>import("./common-lisp-IK3DGBCK.js"))},{id:"coq",name:"Coq",import:(()=>import("./coq-UPTUVPLH.js"))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>import("./cpp-B4ITA36J.js"))},{id:"crystal",name:"Crystal",import:(()=>import("./crystal-DVILAEWU.js"))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>import("./csharp-VNJLKKRO.js"))},{id:"css",name:"CSS",import:(()=>import("./css-NLVM2B53.js"))},{id:"csv",name:"CSV",import:(()=>import("./csv-CRTD5FOL.js"))},{id:"cue",name:"CUE",import:(()=>import("./cue-IFMTDLM2.js"))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>import("./cypher-WH7754G7.js"))},{id:"d",name:"D",import:(()=>import("./d-VFMGCSG3.js"))},{id:"dart",name:"Dart",import:(()=>import("./dart-KG257MMB.js"))},{id:"dax",name:"DAX",import:(()=>import("./dax-Y4DTPR3K.js"))},{id:"desktop",name:"Desktop",import:(()=>import("./desktop-UYAYGPQT.js"))},{id:"diff",name:"Diff",import:(()=>import("./diff-BJDM3N45.js"))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>import("./docker-UOM4Q7PD.js"))},{id:"dotenv",name:"dotEnv",import:(()=>import("./dotenv-LK44WBD3.js"))},{id:"dream-maker",name:"Dream Maker",import:(()=>import("./dream-maker-7RP4JRQH.js"))},{id:"edge",name:"Edge",import:(()=>import("./edge-75EAMBUG.js"))},{id:"elixir",name:"Elixir",import:(()=>import("./elixir-NWFINHZW.js"))},{id:"elm",name:"Elm",import:(()=>import("./elm-THYL2NRS.js"))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>import("./emacs-lisp-NRIAYFLD.js"))},{id:"erb",name:"ERB",import:(()=>import("./erb-L6I32JVH.js"))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>import("./erlang-UNX5MMGA.js"))},{id:"fennel",name:"Fennel",import:(()=>import("./fennel-HYSSBG3N.js"))},{id:"fish",name:"Fish",import:(()=>import("./fish-PTKGQOJI.js"))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>import("./fluent-LEZHPPJV.js"))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>import("./fortran-fixed-form-J5AMEFMB.js"))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>import("./fortran-free-form-S3BNTBLS.js"))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>import("./fsharp-H4OIW62Z.js"))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>import("./gdresource-4NUZ6YCX.js"))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>import("./gdscript-YQUSJRNZ.js"))},{id:"gdshader",name:"GDShader",import:(()=>import("./gdshader-S5432GFE.js"))},{id:"genie",name:"Genie",import:(()=>import("./genie-RNVG5N7L.js"))},{id:"gherkin",name:"Gherkin",import:(()=>import("./gherkin-E5R62T6O.js"))},{id:"git-commit",name:"Git Commit Message",import:(()=>import("./git-commit-QGH6XOBG.js"))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>import("./git-rebase-XTCZTXU4.js"))},{id:"gleam",name:"Gleam",import:(()=>import("./gleam-W5WZ7CST.js"))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>import("./glimmer-js-EJYO25PG.js"))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>import("./glimmer-ts-Q2ZC2IIP.js"))},{id:"glsl",name:"GLSL",import:(()=>import("./glsl-PVW2OPUD.js"))},{id:"gn",name:"GN",import:(()=>import("./gn-FCAO7WI5.js"))},{id:"gnuplot",name:"Gnuplot",import:(()=>import("./gnuplot-Q6SE5CHZ.js"))},{id:"go",name:"Go",import:(()=>import("./go-WER5FUYJ.js"))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>import("./graphql-UN5O7U5U.js"))},{id:"groovy",name:"Groovy",import:(()=>import("./groovy-PJAEBBJY.js"))},{id:"hack",name:"Hack",import:(()=>import("./hack-FLOLYEQ5.js"))},{id:"haml",name:"Ruby Haml",import:(()=>import("./haml-SCHIB33Y.js"))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>import("./handlebars-BNURLECZ.js"))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>import("./haskell-NX6XRMNO.js"))},{id:"haxe",name:"Haxe",import:(()=>import("./haxe-7YNB7FVC.js"))},{id:"hcl",name:"HashiCorp HCL",import:(()=>import("./hcl-ZF75ASCX.js"))},{id:"hjson",name:"Hjson",import:(()=>import("./hjson-65TX6QOC.js"))},{id:"hlsl",name:"HLSL",import:(()=>import("./hlsl-U2O526MI.js"))},{id:"html",name:"HTML",import:(()=>import("./html-DXDULU5G.js"))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>import("./html-derivative-QD4CE6YQ.js"))},{id:"http",name:"HTTP",import:(()=>import("./http-KIGXJYY6.js"))},{id:"hurl",name:"Hurl",import:(()=>import("./hurl-BZB5LDD5.js"))},{id:"hxml",name:"HXML",import:(()=>import("./hxml-IGTXIURH.js"))},{id:"hy",name:"Hy",import:(()=>import("./hy-CLDGXJYP.js"))},{id:"imba",name:"Imba",import:(()=>import("./imba-NWHLCVE5.js"))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>import("./ini-R6WYP7NC.js"))},{id:"java",name:"Java",import:(()=>import("./java-DHBXDMBM.js"))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>import("./javascript-GNUEDNHO.js"))},{id:"jinja",name:"Jinja",import:(()=>import("./jinja-DC3WU6ZJ.js"))},{id:"jison",name:"Jison",import:(()=>import("./jison-64A6IJCV.js"))},{id:"json",name:"JSON",import:(()=>import("./json-2ELCHKXT.js"))},{id:"json5",name:"JSON5",import:(()=>import("./json5-QRH5UJYD.js"))},{id:"jsonc",name:"JSON with Comments",import:(()=>import("./jsonc-IXPVR4NY.js"))},{id:"jsonl",name:"JSON Lines",import:(()=>import("./jsonl-C57GMUK5.js"))},{id:"jsonnet",name:"Jsonnet",import:(()=>import("./jsonnet-VNADFLKI.js"))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>import("./jssm-CW4ZYDSF.js"))},{id:"jsx",name:"JSX",import:(()=>import("./jsx-YTENXENT.js"))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>import("./julia-CHGX5VFI.js"))},{id:"just",name:"Just",import:(()=>import("./just-XO4JBQP4.js"))},{id:"kdl",name:"KDL",import:(()=>import("./kdl-X3AS2HRT.js"))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>import("./kotlin-WGITM75W.js"))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>import("./kusto-55BKOIH6.js"))},{id:"latex",name:"LaTeX",import:(()=>import("./latex-7PE6CJI5.js"))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>import("./lean-DYWOENAS.js"))},{id:"less",name:"Less",import:(()=>import("./less-ZYJT7MPU.js"))},{id:"liquid",name:"Liquid",import:(()=>import("./liquid-OUYRJBEI.js"))},{id:"llvm",name:"LLVM IR",import:(()=>import("./llvm-F6576PPM.js"))},{id:"log",name:"Log file",import:(()=>import("./log-AXKDFD3L.js"))},{id:"logo",name:"Logo",import:(()=>import("./logo-E23LAFZY.js"))},{id:"lua",name:"Lua",import:(()=>import("./lua-QQ5QEPPO.js"))},{id:"luau",name:"Luau",import:(()=>import("./luau-7VRLQHZS.js"))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>import("./make-QFMWQJMG.js"))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>import("./markdown-D756RUOP.js"))},{id:"marko",name:"Marko",import:(()=>import("./marko-TQJFHH5J.js"))},{id:"matlab",name:"MATLAB",import:(()=>import("./matlab-ZKZ7YBAH.js"))},{id:"mdc",name:"MDC",import:(()=>import("./mdc-ZOKCGRSD.js"))},{id:"mdx",name:"MDX",import:(()=>import("./mdx-34BL2O4O.js"))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>import("./mermaid-54Z3SAII.js"))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>import("./mipsasm-NKQWJEL7.js"))},{id:"mojo",name:"Mojo",import:(()=>import("./mojo-NUFJUGRT.js"))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>import("./moonbit-IQKVCQX6.js"))},{id:"move",name:"Move",import:(()=>import("./move-4VWCI4YQ.js"))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>import("./narrat-4QSDQDLH.js"))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>import("./nextflow-OTA6EZBU.js"))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>import("./nextflow-groovy-434C6PKN.js"))},{id:"nginx",name:"Nginx",import:(()=>import("./nginx-DXHAXQRH.js"))},{id:"nim",name:"Nim",import:(()=>import("./nim-LBV5OEXG.js"))},{id:"nix",name:"Nix",import:(()=>import("./nix-WAYR4BYU.js"))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>import("./nushell-WFCCYAUY.js"))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>import("./objective-c-246HWLKT.js"))},{id:"objective-cpp",name:"Objective-C++",import:(()=>import("./objective-cpp-RJUXXPYQ.js"))},{id:"ocaml",name:"OCaml",import:(()=>import("./ocaml-P7NGS7PR.js"))},{id:"odin",name:"Odin",import:(()=>import("./odin-UPPZCJGN.js"))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>import("./openscad-JRK6K3FL.js"))},{id:"pascal",name:"Pascal",import:(()=>import("./pascal-RDFLUHHA.js"))},{id:"perl",name:"Perl",import:(()=>import("./perl-N2JOL2L5.js"))},{id:"php",name:"PHP",import:(()=>import("./php-OXA56EZC.js"))},{id:"pkl",name:"Pkl",import:(()=>import("./pkl-PAM76VXP.js"))},{id:"plsql",name:"PL/SQL",import:(()=>import("./plsql-3Y6UMFEG.js"))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>import("./po-GNTAKCTE.js"))},{id:"polar",name:"Polar",import:(()=>import("./polar-EVTMRLGV.js"))},{id:"postcss",name:"PostCSS",import:(()=>import("./postcss-42343LW7.js"))},{id:"powerquery",name:"PowerQuery",import:(()=>import("./powerquery-M34PNR4X.js"))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>import("./powershell-IR7ICFQW.js"))},{id:"prisma",name:"Prisma",import:(()=>import("./prisma-RXSIFLZX.js"))},{id:"prolog",name:"Prolog",import:(()=>import("./prolog-YBBQ4UD5.js"))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>import("./proto-U4FF45G6.js"))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>import("./pug-CWA4QCVE.js"))},{id:"puppet",name:"Puppet",import:(()=>import("./puppet-HWOKIYJP.js"))},{id:"purescript",name:"PureScript",import:(()=>import("./purescript-D45AJS5J.js"))},{id:"python",name:"Python",aliases:["py"],import:(()=>import("./python-QWA7UE2I.js"))},{id:"qml",name:"QML",import:(()=>import("./qml-RHCWFR3S.js"))},{id:"qmldir",name:"QML Directory",import:(()=>import("./qmldir-FBDC3XMZ.js"))},{id:"qss",name:"Qt Style Sheets",import:(()=>import("./qss-AD3WZQ45.js"))},{id:"r",name:"R",import:(()=>import("./r-NHIAHDOD.js"))},{id:"racket",name:"Racket",import:(()=>import("./racket-7G65C5N5.js"))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>import("./raku-IWS7BLGD.js"))},{id:"razor",name:"ASP.NET Razor",import:(()=>import("./razor-B3X33ONZ.js"))},{id:"reg",name:"Windows Registry Script",import:(()=>import("./reg-V4XLWESR.js"))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>import("./regexp-XP4MR635.js"))},{id:"rel",name:"Rel",import:(()=>import("./rel-DE6UXATM.js"))},{id:"riscv",name:"RISC-V",import:(()=>import("./riscv-5PDXBPPL.js"))},{id:"ron",name:"RON",import:(()=>import("./ron-G4N7ZKMH.js"))},{id:"rosmsg",name:"ROS Interface",import:(()=>import("./rosmsg-7LDUCZRQ.js"))},{id:"rst",name:"reStructuredText",import:(()=>import("./rst-D5R5URHP.js"))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>import("./ruby-DWCE4YYU.js"))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>import("./rust-Z2NYMT2Z.js"))},{id:"sas",name:"SAS",import:(()=>import("./sas-T7S4QIRM.js"))},{id:"sass",name:"Sass",import:(()=>import("./sass-75VDP7DE.js"))},{id:"scala",name:"Scala",import:(()=>import("./scala-7TJ4N6KC.js"))},{id:"scheme",name:"Scheme",import:(()=>import("./scheme-5XARZMKT.js"))},{id:"scss",name:"SCSS",import:(()=>import("./scss-RIXXNXKR.js"))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>import("./sdbl-6M55AJVA.js"))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>import("./shaderlab-322XNY5V.js"))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>import("./shellscript-F23VVVTW.js"))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>import("./shellsession-G65XJMCC.js"))},{id:"smalltalk",name:"Smalltalk",import:(()=>import("./smalltalk-LALIO5SC.js"))},{id:"solidity",name:"Solidity",import:(()=>import("./solidity-TQUKTJZZ.js"))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>import("./soy-4TQM2FCJ.js"))},{id:"sparql",name:"SPARQL",import:(()=>import("./sparql-ARI3MVK7.js"))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>import("./splunk-QEFG3NPJ.js"))},{id:"sql",name:"SQL",import:(()=>import("./sql-52F5XK5C.js"))},{id:"ssh-config",name:"SSH Config",import:(()=>import("./ssh-config-SC6RC6IV.js"))},{id:"stata",name:"Stata",import:(()=>import("./stata-6C4TLAPQ.js"))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>import("./stylus-YYWEHAK3.js"))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>import("./surrealql-5X7LI3J6.js"))},{id:"svelte",name:"Svelte",import:(()=>import("./svelte-NTV6SKXK.js"))},{id:"swift",name:"Swift",import:(()=>import("./swift-KMR3DOSF.js"))},{id:"system-verilog",name:"SystemVerilog",import:(()=>import("./system-verilog-46QRSGNM.js"))},{id:"systemd",name:"Systemd Units",import:(()=>import("./systemd-3PUVCSI7.js"))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>import("./talonscript-AK4LB3KC.js"))},{id:"tasl",name:"Tasl",import:(()=>import("./tasl-VHTYBUVI.js"))},{id:"tcl",name:"Tcl",import:(()=>import("./tcl-UUMKHRHL.js"))},{id:"templ",name:"Templ",import:(()=>import("./templ-U5PIZYER.js"))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>import("./terraform-GCGIT2RL.js"))},{id:"tex",name:"TeX",import:(()=>import("./tex-MVHXDK4A.js"))},{id:"toml",name:"TOML",import:(()=>import("./toml-7AH4HFBN.js"))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>import("./ts-tags-K7BWB4VX.js"))},{id:"tsv",name:"TSV",import:(()=>import("./tsv-EB3LRXYX.js"))},{id:"tsx",name:"TSX",import:(()=>import("./tsx-Y5YXGNIX.js"))},{id:"turtle",name:"Turtle",import:(()=>import("./turtle-KM6UGYIQ.js"))},{id:"twig",name:"Twig",import:(()=>import("./twig-7UZRHYW3.js"))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>import("./typescript-ZF5AMNEZ.js"))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>import("./typespec-535S7LOL.js"))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>import("./typst-ZOSAUKL5.js"))},{id:"v",name:"V",import:(()=>import("./v-HVLBO3DI.js"))},{id:"vala",name:"Vala",import:(()=>import("./vala-WWRVCJNF.js"))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>import("./vb-XFFF4O73.js"))},{id:"verilog",name:"Verilog",import:(()=>import("./verilog-XTDPJNP7.js"))},{id:"vhdl",name:"VHDL",import:(()=>import("./vhdl-OCZJ2AOZ.js"))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>import("./viml-PVA3ZJ5L.js"))},{id:"vue",name:"Vue",import:(()=>import("./vue-CKPBQTY7.js"))},{id:"vue-html",name:"Vue HTML",import:(()=>import("./vue-html-G4DE7FYD.js"))},{id:"vue-vine",name:"Vue Vine",import:(()=>import("./vue-vine-Q32TIQRB.js"))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>import("./vyper-SBDFKHRI.js"))},{id:"wasm",name:"WebAssembly",import:(()=>import("./wasm-SXNE4SKX.js"))},{id:"wenyan",name:"Wenyan",aliases:["\u6587\u8A00"],import:(()=>import("./wenyan-PMSCJP7P.js"))},{id:"wgsl",name:"WGSL",import:(()=>import("./wgsl-DOXQU7M4.js"))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>import("./wikitext-LGNEKWDX.js"))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>import("./wit-G62U2KBE.js"))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>import("./wolfram-YTZHUYN6.js"))},{id:"xml",name:"XML",import:(()=>import("./xml-WGLM4CWK.js"))},{id:"xsl",name:"XSL",import:(()=>import("./xsl-KAAH2GEK.js"))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>import("./yaml-JGEBDSVI.js"))},{id:"zenscript",name:"ZenScript",import:(()=>import("./zenscript-QQQPZNJ7.js"))},{id:"zig",name:"Zig",import:(()=>import("./zig-6LJUAPBA.js"))}],Jr=Object.fromEntries(ir.map(e=>[e.id,e.import])),Zr=Object.fromEntries(ir.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Yr={...Jr,...Zr};p();var Qr=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>import("./andromeeda-XSK3JERF.js"))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>import("./aurora-x-CGSVHL4H.js"))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>import("./ayu-dark-55BH6GCR.js"))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>import("./ayu-light-IPNR4FEJ.js"))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>import("./ayu-mirage-MOSAI7A2.js"))},{id:"catppuccin-frappe",displayName:"Catppuccin Frapp\xE9",type:"dark",import:(()=>import("./catppuccin-frappe-UZ4N3Z4I.js"))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>import("./catppuccin-latte-GCOWYLZG.js"))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>import("./catppuccin-macchiato-PJD7W5WJ.js"))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>import("./catppuccin-mocha-RRH4FOBS.js"))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>import("./dark-plus-PSM5XP2I.js"))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>import("./dracula-2VHT5LK5.js"))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>import("./dracula-soft-MSCUO73T.js"))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>import("./everforest-dark-AGVJEQ35.js"))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>import("./everforest-light-62GPFKVJ.js"))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>import("./github-dark-5OJVMBCE.js"))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>import("./github-dark-default-4WERFSZW.js"))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>import("./github-dark-dimmed-7VD3SZKC.js"))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>import("./github-dark-high-contrast-FVMMS656.js"))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>import("./github-light-SE4LEKO7.js"))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>import("./github-light-default-TV7BYQGI.js"))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>import("./github-light-high-contrast-WKO4I3G7.js"))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>import("./gruvbox-dark-hard-LOYZQIGI.js"))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>import("./gruvbox-dark-medium-UIMSJJ6K.js"))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>import("./gruvbox-dark-soft-PU6RNTTO.js"))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>import("./gruvbox-light-hard-ZQJ7XSZF.js"))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>import("./gruvbox-light-medium-CD3ZGYV6.js"))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>import("./gruvbox-light-soft-S74MAGOM.js"))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>import("./horizon-EAAZ4KVN.js"))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>import("./horizon-bright-CGMA7ELN.js"))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>import("./houston-UNRWGR67.js"))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>import("./kanagawa-dragon-BOSCCB42.js"))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>import("./kanagawa-lotus-NXMB2IVI.js"))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>import("./kanagawa-wave-YOHS63UF.js"))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>import("./laserwave-TS4AG4VO.js"))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>import("./light-plus-2HYW3NJ6.js"))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>import("./material-theme-KPDVFAGV.js"))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>import("./material-theme-darker-GVSTMSNT.js"))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>import("./material-theme-lighter-JWZNUXUH.js"))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>import("./material-theme-ocean-MU4N3XNQ.js"))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>import("./material-theme-palenight-VMWD73WM.js"))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>import("./min-dark-ASEVSA24.js"))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>import("./min-light-3H54BB3D.js"))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>import("./monokai-5QWQOFN6.js"))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>import("./night-owl-4QQBS2UX.js"))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>import("./night-owl-light-HR6A2OQO.js"))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>import("./nord-XK3AUNCF.js"))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>import("./one-dark-pro-ZV7CEA5M.js"))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>import("./one-light-FKZJCKM6.js"))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>import("./plastic-SXCQPKYC.js"))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>import("./poimandres-S3UYVG4O.js"))},{id:"red",displayName:"Red",type:"dark",import:(()=>import("./red-A6OC2HVL.js"))},{id:"rose-pine",displayName:"Ros\xE9 Pine",type:"dark",import:(()=>import("./rose-pine-GLWOWPBK.js"))},{id:"rose-pine-dawn",displayName:"Ros\xE9 Pine Dawn",type:"light",import:(()=>import("./rose-pine-dawn-HYE6T7LV.js"))},{id:"rose-pine-moon",displayName:"Ros\xE9 Pine Moon",type:"dark",import:(()=>import("./rose-pine-moon-VHVTDDVO.js"))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>import("./slack-dark-OPW5CYSY.js"))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>import("./slack-ochin-WTVMYBFH.js"))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>import("./snazzy-light-5UQ56PC5.js"))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>import("./solarized-dark-DSMP6D7D.js"))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>import("./solarized-light-3IZTZCIV.js"))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>import("./synthwave-84-JWI6CVJZ.js"))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>import("./tokyo-night-SRK4SADJ.js"))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>import("./vesper-DY3BCX5Y.js"))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>import("./vitesse-black-PEGI4HJX.js"))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>import("./vitesse-dark-M2ZAGPXG.js"))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>import("./vitesse-light-RICZI4IG.js"))}],eo=Object.fromEntries(Qr.map(e=>[e.id,e.import]));p();p();var ll={};Ju(ll,{createOnigurumaEngine:()=>al,getDefaultWasmLoader:()=>zb,loadWasm:()=>Rs,setDefaultWasmLoader:()=>Vb});p();var il=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Pb(){return 2147483648}function Lb(){return typeof performance<"u"?performance.now():Date.now()}var $b=(e,t)=>e+(t-e%t)%t;async function Ob(e){let t,n,r={};function o(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function s(h,f,g){r.HEAPU8.copyWithin(h,f,f+g)}function i(h){try{return t.grow(h-n.byteLength+65535>>>16),o(t.buffer),1}catch{}}function a(h){let f=r.HEAPU8.length;h=h>>>0;let g=Pb();if(h>g)return!1;for(let w=1;w<=4;w*=2){let x=f*(1+.2/w);x=Math.min(x,h+100663296);let T=Math.min(g,$b(Math.max(h,x),65536));if(i(T))return!0}return!1}let l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(h,f,g=1024){let w=f+g,x=f;for(;h[x]&&!(x>=w);)++x;if(x-f>16&&h.buffer&&l)return l.decode(h.subarray(f,x));let T="";for(;f<x;){let v=h[f++];if(!(v&128)){T+=String.fromCharCode(v);continue}let _=h[f++]&63;if((v&224)===192){T+=String.fromCharCode((v&31)<<6|_);continue}let S=h[f++]&63;if((v&240)===224?v=(v&15)<<12|_<<6|S:v=(v&7)<<18|_<<12|S<<6|h[f++]&63,v<65536)T+=String.fromCharCode(v);else{let D=v-65536;T+=String.fromCharCode(55296|D>>10,56320|D&1023)}}return T}function u(h,f){return h?c(r.HEAPU8,h,f):""}let d={emscripten_get_now:Lb,emscripten_memcpy_big:s,emscripten_resize_heap:a,fd_write:()=>0};async function m(){let f=await e({env:d,wasi_snapshot_preview1:d});t=f.memory,o(t.buffer),Object.assign(r,f),r.UTF8ToString=u}return await m(),r}var Db=Object.defineProperty,Nb=(e,t,n)=>t in e?Db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t,n)=>Nb(e,typeof t!="symbol"?t+"":t,n),Ae=null;function Mb(e){throw new il(e.UTF8ToString(e.getLastOnigError()))}var _s=class e{constructor(t){Ce(this,"utf16Length"),Ce(this,"utf8Length"),Ce(this,"utf16Value"),Ce(this,"utf8Value"),Ce(this,"utf16OffsetToUtf8"),Ce(this,"utf8OffsetToUtf16");let n=t.length,r=e._utf8ByteLength(t),o=r!==n,s=o?new Uint32Array(n+1):null;o&&(s[n]=r);let i=o?new Uint32Array(r+1):null;o&&(i[r]=n);let a=new Uint8Array(r),l=0;for(let c=0;c<n;c++){let u=t.charCodeAt(c),d=u,m=!1;if(u>=55296&&u<=56319&&c+1<n){let h=t.charCodeAt(c+1);h>=56320&&h<=57343&&(d=(u-55296<<10)+65536|h-56320,m=!0)}o&&(s[c]=l,m&&(s[c+1]=l),d<=127?i[l+0]=c:d<=2047?(i[l+0]=c,i[l+1]=c):d<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),m&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=s,this.utf8OffsetToUtf16=i}static _utf8ByteLength(t){let n=0;for(let r=0,o=t.length;r<o;r++){let s=t.charCodeAt(r),i=s,a=!1;if(s>=55296&&s<=56319&&r+1<o){let l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(s-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(t){let n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}},vs=class At{constructor(t){if(Ce(this,"id",++At.LAST_ID),Ce(this,"_onigBinding"),Ce(this,"content"),Ce(this,"utf16Length"),Ce(this,"utf8Length"),Ce(this,"utf16OffsetToUtf8"),Ce(this,"utf8OffsetToUtf16"),Ce(this,"ptr"),!Ae)throw new il("Must invoke loadWasm first.");this._onigBinding=Ae,this.content=t;let n=new _s(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!At._sharedPtrInUse?(At._sharedPtr||(At._sharedPtr=Ae.omalloc(1e4)),At._sharedPtrInUse=!0,Ae.HEAPU8.set(n.utf8Value,At._sharedPtr),this.ptr=At._sharedPtr):this.ptr=n.createString(Ae)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===At._sharedPtr?At._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Ce(vs,"LAST_ID",0);Ce(vs,"_sharedPtr",0);Ce(vs,"_sharedPtrInUse",!1);var ap=vs,sl=class{constructor(t){if(Ce(this,"_onigBinding"),Ce(this,"_ptr"),!Ae)throw new il("Must invoke loadWasm first.");let n=[],r=[];for(let a=0,l=t.length;a<l;a++){let c=new _s(t[a]);n[a]=c.createString(Ae),r[a]=c.utf8Length}let o=Ae.omalloc(4*t.length);Ae.HEAPU32.set(n,o/4);let s=Ae.omalloc(4*t.length);Ae.HEAPU32.set(r,s/4);let i=Ae.createOnigScanner(o,s,t.length);for(let a=0,l=t.length;a<l;a++)Ae.ofree(n[a]);Ae.ofree(s),Ae.ofree(o),i===0&&Mb(Ae),this._onigBinding=Ae,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let o=0;if(typeof r=="number"&&(o=r),typeof t=="string"){t=new ap(t);let s=this._findNextMatchSync(t,n,!1,o);return t.dispose(),s}return this._findNextMatchSync(t,n,!1,o)}_findNextMatchSync(t,n,r,o){let s=this._onigBinding,i=s.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),o);if(i===0)return null;let a=s.HEAPU32,l=i/4,c=a[l++],u=a[l++],d=[];for(let m=0;m<u;m++){let h=t.convertUtf8OffsetToUtf16(a[l++]),f=t.convertUtf8OffsetToUtf16(a[l++]);d[m]={start:h,end:f,length:f-h}}return{index:c,captureIndices:d}}};function Bb(e){return typeof e.instantiator=="function"}function Fb(e){return typeof e.default=="function"}function Gb(e){return typeof e.data<"u"}function jb(e){return typeof Response<"u"&&e instanceof Response}function Ub(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}var Cs;function Rs(e){if(Cs)return Cs;async function t(){Ae=await Ob(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Bb(r)?r=await r.instantiator(n):Fb(r)?r=await r.default(n):(Gb(r)&&(r=r.data),jb(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Wb(r)(n):r=await Hb(r)(n):Ub(r)?r=await ol(r)(n):r instanceof WebAssembly.Module?r=await ol(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await ol(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Cs=t(),Cs}function ol(e){return t=>WebAssembly.instantiate(e,t)}function Wb(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Hb(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var lp;function Vb(e){lp=e}function zb(){return lp}async function al(e){return e&&await Rs(e),{createScanner(t){return new sl(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new ap(t)}}}var cl=sr({});Ts(cl,ll);p();p();var te=class extends Error{constructor(e){super(e),this.name="ShikiError"}};p();function no(e,t){let n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(let[o,s]of Object.entries(t?.colorReplacements||{}))typeof s=="string"?n[o]=s:o===r&&Object.assign(n,s);return n}function Mt(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function fp(e){return Array.isArray(e)?e:[e]}async function ul(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function ro(e){return!e||["plaintext","txt","text","plain"].includes(e)}function dl(e){return e==="ansi"||ro(e)}function oo(e){return e==="none"}function pl(e){return oo(e)}var qb=/(\r?\n)/g;function ar(e,t=!1){if(e.length===0)return[["",0]];let n=e.split(qb),r=0,o=[];for(let s=0;s<n.length;s+=2){let i=t?n[s]+(n[s+1]||""):n[s];o.push([i,r]),r+=n[s].length,r+=n[s+1]?.length||0}return o}var cp={light:"#333333",dark:"#bbbbbb"},up={light:"#fffffe",dark:"#1e1e1e"},dp="__shiki_resolved";function As(e){if(e?.[dp])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let a=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?cp.light:cp.dark),n||(n=t.type==="light"?up.light:up.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0,s=new Map;function i(a){if(s.has(a))return s.get(a);o+=1;let l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?i(a):(s.set(a,l),l)}t.settings=t.settings.map(a=>{let l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;let u={...a,settings:{...a.settings}};if(l){let d=i(a.settings.foreground);t.colorReplacements[d]=a.settings.foreground,u.settings.foreground=d}if(c){let d=i(a.settings.background);t.colorReplacements[d]=a.settings.background,u.settings.background=d}return u});for(let a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){let l=i(t.colors[a]);t.colorReplacements[l]=t.colors[a],t.colors[a]=l}return Object.defineProperty(t,dp,{enumerable:!1,writable:!1,value:!0}),t}async function mp(e){return[...new Set((await Promise.all(e.filter(t=>!dl(t)).map(async t=>await ul(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function hp(e){return(await Promise.all(e.map(async t=>pl(t)?null:As(await ul(t))))).filter(t=>!!t)}function gp(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new te(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Kb=class extends Yd{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=As(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Vr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=gp(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,t.size)for(let o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let r of e)this.resolveEmbeddedLanguages(r);let t=[...this._langGraph.entries()],n=t.filter(([r,o])=>!o);if(n.length){let r=t.filter(([o,s])=>s?(s.embeddedLanguages||s.embeddedLangs)?.some(i=>n.map(([a])=>a).includes(i)):!1).filter(o=>!n.includes(o));throw new te(`Missing languages ${n.map(([o])=>`\`${o}\``).join(", ")}, required by ${r.map(([o])=>`\`${o}\``).join(", ")}`)}for(let[r,o]of t)this._resolver.addLanguage(o);for(let[r,o]of t)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let n of t)this._langGraph.set(n,this._langMap.get(n))}},Xb=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),n=[];for(let r=1;r<=t.length;r++){let o=t.slice(0,r).join(".");n=[...n,...this._injections.get(o)||[]]}return n}},to=0;function fl(e){to+=1,e.warnings!==!1&&to>=10&&to%10===0&&console.warn(`[Shiki] ${to} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new te("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(As),o=new Kb(new Xb(e.engine,n),r,n,e.langAlias),s;function i(T){return gp(T,e.langAlias)}function a(T){w();let v=o.getGrammar(typeof T=="string"?T:T.name);if(!v)throw new te(`Language \`${T}\` not found, you may need to load it first`);return v}function l(T){if(T==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();let v=o.getTheme(T);if(!v)throw new te(`Theme \`${T}\` not found, you may need to load it first`);return v}function c(T){w();let v=l(T);return s!==T&&(o.setTheme(v),s=T),{theme:v,colorMap:o.getColorMap()}}function u(){return w(),o.getLoadedThemes()}function d(){return w(),o.getLoadedLanguages()}function m(...T){w(),o.loadLanguages(T.flat(1))}async function h(...T){return m(await mp(T))}function f(...T){w();for(let v of T.flat(1))o.loadTheme(v)}async function g(...T){return w(),f(await hp(T))}function w(){if(t)throw new te("Shiki instance has been disposed")}function x(){t||(t=!0,o.dispose(),to-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:i,loadLanguage:h,loadLanguageSync:m,loadTheme:g,loadThemeSync:f,dispose:x,[Symbol.dispose]:x}}async function ml(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([hp(e.themes||[]),mp(e.langs||[]),e.engine]);return fl({...e,themes:t,langs:n,engine:r})}var yp=new WeakMap;function so(e,t){yp.set(e,t)}function lr(e){return yp.get(e)}var Es=class bp{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new bp(Object.fromEntries(fp(n).map(r=>[r,ks])),t)}constructor(...t){if(t.length===2){let[n,r]=t;this.lang=r,this._stacks=n}else{let[n,r,o]=t;this.lang=r,this._stacks={[o]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Jb(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Jb(e){let t=[],n=new Set;function r(o){if(n.has(o))return;n.add(o);let s=o?.nameScopesList?.scopeName;s&&t.push(s),o.parent&&r(o.parent)}return r(e),t}function Zb(e,t){if(!(e instanceof Es))throw new te("Invalid grammar state");return e.getInternalStack(t)}var Yb=/,/,Qb=/ /;function hl(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(ro(e.resolveLangAlias(n.lang||"text"))||oo(r))return ar(t).map(a=>[{content:a[0],offset:a[1]}]);let{theme:o,colorMap:s}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new te(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(o.name))throw new te(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return wp(t,i,o,s,n)}function xp(...e){if(e.length===2)return lr(e[1]);let[t,n,r={}]=e,{lang:o="text",theme:s=t.getLoadedThemes()[0]}=r;if(ro(o)||oo(s))throw new te("Plain language does not have grammar state");if(o==="ansi")throw new te("ANSI language does not have grammar state");let{theme:i,colorMap:a}=t.setTheme(s),l=t.getLanguage(o);return new Es(gl(n,l,i,a,r).stateStack,l.name,i.name)}function wp(e,t,n,r,o){let s=gl(e,t,n,r,o),i=new Es(s.stateStack,t.name,n.name);return so(s.tokens,i),s.tokens}function gl(e,t,n,r,o){let s=no(n,o),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:l=!1}=o,c=ar(e),u=o.grammarState?Zb(o.grammarState,n.name)??ks:o.grammarContextCode!=null?gl(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:ks,d=[],m=[];for(let h=0,f=c.length;h<f;h++){let[g,w]=c[h];if(g===""){d=[],m.push([]);continue}if(i>0&&g.length>=i){d=[],m.push([{content:g,offset:w,color:"",fontStyle:0}]);continue}let x,T,v;l&&l!=="tokenType"&&(x=t.tokenizeLine(g,u,a),T=x.tokens,v=0);let _=t.tokenizeLine2(g,u,a),S=_.tokens.length/2;for(let D=0;D<S;D++){let H=_.tokens[2*D],E=D+1<S?_.tokens[2*D+2]:g.length;if(H===E)continue;let I=_.tokens[2*D+1],B=Mt(r[rn.getForeground(I)],s),Y=rn.getFontStyle(I),q={content:g.substring(H,E),offset:w+H,color:B,fontStyle:Y};if(l==="tokenType")q.type=rn.getTokenType(I);else if(l){let ae=[];if(l!=="scopeName")for(let Q of n.settings){let j;switch(typeof Q.scope){case"string":j=Q.scope.split(Yb).map(re=>re.trim());break;case"object":j=Q.scope;break;default:continue}ae.push({settings:Q,selectors:j.map(re=>re.split(Qb))})}q.explanation=[];let ce=0;for(;H+ce<E;){let Q=T[v],j=g.substring(Q.startIndex,Q.endIndex);ce+=j.length,q.explanation.push({content:j,scopes:l==="scopeName"?ex(Q.scopes):tx(ae,Q.scopes)}),v+=1}}d.push(q)}m.push(d),d=[],u=_.ruleStack}return{tokens:m,stateStack:u}}function ex(e){return e.map(t=>({scopeName:t}))}function tx(e,t){let n=[];for(let r=0,o=t.length;r<o;r++){let s=t[r];n[r]={scopeName:s,themeMatches:rx(e,s,t.slice(0,r))}}return n}function pp(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function nx(e,t,n){if(!pp(e.at(-1),t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)pp(e[r],n[o])&&(r-=1),o-=1;return r===-1}function rx(e,t,n){let r=[];for(let{selectors:o,settings:s}of e)for(let i of o)if(nx(i,t,n)){r.push(s);break}return r}function Is(e,t,n,r=hl){let o=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=o.map(c=>{let u=r(e,t,{...n,theme:c.theme});return{tokens:u,state:lr(u),theme:typeof c.theme=="string"?c.theme:c.theme.name}}),i=ox(...s.map(c=>c.tokens)),a=i[0].map((c,u)=>c.map((d,m)=>{let h={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=d.explanation),i.forEach((f,g)=>{let{content:w,explanation:x,offset:T,...v}=f[u][m];h.variants[o[g].color]=v}),h})),l=s[0].state?new Es(Object.fromEntries(s.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),s[0].state.lang):void 0;return l&&so(a,l),a}function ox(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let o=e.map(l=>l[r]),s=t.map(()=>[]);t.forEach((l,c)=>l.push(s[c]));let i=o.map(()=>0),a=o.map(l=>l[0]);for(;a.every(l=>l);){let l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){let u=a[c];u.content.length===l?(s[c].push(u),i[c]+=1,a[c]=o[c][i[c]]):(s[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}p();p();p();var kp=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];p();p();p();var Bt=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Bt.prototype.normal={};Bt.prototype.property={};Bt.prototype.space=void 0;function yl(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Bt(n,r,t)}p();p();p();function io(e){return e.toLowerCase()}p();p();var Ee=class{constructor(t,n){this.attribute=n,this.property=t}};Ee.prototype.attribute="";Ee.prototype.booleanish=!1;Ee.prototype.boolean=!1;Ee.prototype.commaOrSpaceSeparated=!1;Ee.prototype.commaSeparated=!1;Ee.prototype.defined=!1;Ee.prototype.mustUseProperty=!1;Ee.prototype.number=!1;Ee.prototype.overloadedBoolean=!1;Ee.prototype.property="";Ee.prototype.spaceSeparated=!1;Ee.prototype.space=void 0;var ao={};Ju(ao,{boolean:()=>z,booleanish:()=>fe,commaOrSpaceSeparated:()=>We,commaSeparated:()=>Ft,number:()=>A,overloadedBoolean:()=>Ps,spaceSeparated:()=>ee});p();var sx=0,z=Rn(),fe=Rn(),Ps=Rn(),A=Rn(),ee=Rn(),Ft=Rn(),We=Rn();function Rn(){return 2**++sx}var bl=Object.keys(ao),An=class extends Ee{constructor(t,n,r,o){let s=-1;if(super(t,n),Sp(this,"space",o),typeof r=="number")for(;++s<bl.length;){let i=bl[s];Sp(this,bl[s],(r&ao[i])===ao[i])}}};An.prototype.defined=!0;function Sp(e,t,n){n&&(e[t]=n)}function lt(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let s=new An(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[io(r)]=r,n[io(s.attribute)]=r}return new Bt(t,n,e.space)}var xl=lt({properties:{ariaActiveDescendant:null,ariaAtomic:fe,ariaAutoComplete:null,ariaBusy:fe,ariaChecked:fe,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:ee,ariaCurrent:null,ariaDescribedBy:ee,ariaDetails:null,ariaDisabled:fe,ariaDropEffect:ee,ariaErrorMessage:null,ariaExpanded:fe,ariaFlowTo:ee,ariaGrabbed:fe,ariaHasPopup:null,ariaHidden:fe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ee,ariaLevel:A,ariaLive:null,ariaModal:fe,ariaMultiLine:fe,ariaMultiSelectable:fe,ariaOrientation:null,ariaOwns:ee,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:fe,ariaReadOnly:fe,ariaRelevant:null,ariaRequired:fe,ariaRoleDescription:ee,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:fe,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});p();p();p();function Ls(e,t){return t in e?e[t]:t}function $s(e,t){return Ls(e,t.toLowerCase())}var Tp=lt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ft,acceptCharset:ee,accessKey:ee,action:null,allow:null,allowFullScreen:z,allowPaymentRequest:z,allowUserMedia:z,alpha:z,alt:null,as:null,async:z,autoCapitalize:null,autoComplete:ee,autoFocus:z,autoPlay:z,blocking:ee,capture:null,charSet:null,checked:z,cite:null,className:ee,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:fe,controls:z,controlsList:ee,coords:A|Ft,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z,defer:z,dir:null,dirName:null,disabled:z,download:Ps,draggable:fe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z,formTarget:null,headers:ee,height:A,hidden:Ps,high:A,href:null,hrefLang:null,htmlFor:ee,httpEquiv:ee,id:null,imageSizes:null,imageSrcSet:null,inert:z,inputMode:null,integrity:null,is:null,isMap:z,itemId:null,itemProp:ee,itemRef:ee,itemScope:z,itemType:ee,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:z,muted:z,name:null,nonce:null,noModule:z,noValidate:z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:z,optimum:A,pattern:null,ping:ee,placeholder:null,playsInline:z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z,referrerPolicy:null,rel:ee,required:z,reversed:z,rows:A,rowSpan:A,sandbox:ee,scope:null,scoped:z,seamless:z,selected:z,shadowRootClonable:z,shadowRootCustomElementRegistry:z,shadowRootDelegatesFocus:z,shadowRootMode:null,shadowRootSerializable:z,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:fe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:z,useMap:null,value:fe,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ee,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z,declare:z,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:z,noHref:z,noShade:z,noWrap:z,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:fe,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:z,disablePictureInPicture:z,disableRemotePlayback:z,exportParts:Ft,part:ee,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:$s});p();var Cp=lt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:We,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:ee,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:z,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ft,g2:Ft,glyphName:Ft,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ee,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ls});p();var wl=lt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});p();var kl=lt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$s});p();var Sl=lt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});p();var ix=/[A-Z]/g,_p=/-[a-z]/g,ax=/^data[-\w.:]+$/i;function Tl(e,t){let n=io(t),r=t,o=Ee;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ax.test(t)){if(t.charAt(4)==="-"){let s=t.slice(5).replace(_p,cx);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{let s=t.slice(4);if(!_p.test(s)){let i=s.replace(ix,lx);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=An}return new o(r,t)}function lx(e){return"-"+e.toLowerCase()}function cx(e){return e.charAt(1).toUpperCase()}var vp=yl([xl,Tp,wl,kl,Sl],"html"),Os=yl([xl,Cp,wl,kl,Sl],"svg");p();p();var Rp={}.hasOwnProperty;function Ap(e,t){let n=t||{};function r(o,...s){let i=r.invalid,a=r.handlers;if(o&&Rp.call(o,e)){let l=String(o[e]);i=Rp.call(a,l)?a[l]:r.unknown}if(i)return i.call(this,o,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}p();p();p();var ux=/["&'<>`]/g,dx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,px=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,fx=/[|\\{}()[\]^$+*?.]/g,Ep=new WeakMap;function Ip(e,t){if(e=e.replace(t.subset?mx(t.subset):ux,r),t.subset||t.escapeOnly)return e;return e.replace(dx,n).replace(px,r);function n(o,s,i){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,i.charCodeAt(s+2),t)}function r(o,s,i){return t.format(o.charCodeAt(0),i.charCodeAt(s+1),t)}}function mx(e){let t=Ep.get(e);return t||(t=hx(e),Ep.set(e,t)),t}function hx(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(fx,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}p();p();var gx=/[\dA-Fa-f]/;function Pp(e,t,n){let r="&#x"+e.toString(16).toUpperCase();return n&&t&&!gx.test(String.fromCharCode(t))?r:r+";"}p();var yx=/\d/;function Lp(e,t,n){let r="&#"+String(e);return n&&t&&!yx.test(String.fromCharCode(t))?r:r+";"}p();p();var $p=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];p();var Ds={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};p();var Op=["cent","copy","divide","gt","lt","not","para","times"];var Dp={}.hasOwnProperty,Cl={},Ns;for(Ns in Ds)Dp.call(Ds,Ns)&&(Cl[Ds[Ns]]=Ns);var bx=/[^\dA-Za-z]/;function Np(e,t,n,r){let o=String.fromCharCode(e);if(Dp.call(Cl,o)){let s=Cl[o],i="&"+s;return n&&$p.includes(s)&&!Op.includes(s)&&(!r||t&&t!==61&&bx.test(String.fromCharCode(t)))?i:i+";"}return""}function Mp(e,t,n){let r=Pp(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=Np(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){let s=Lp(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Gt(e,t){return Ip(e,Object.assign({format:Mp},t))}var xx=/^>|^->|<!--|-->|--!>|<!-$/g,wx=[">"],kx=["<",">"];function Bp(e,t,n,r){return r.settings.bogusComments?"<?"+Gt(e.value,Object.assign({},r.settings.characterReferences,{subset:wx}))+">":"<!--"+e.value.replace(xx,o)+"-->";function o(s){return Gt(s,Object.assign({},r.settings.characterReferences,{subset:kx}))}}p();function Fp(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}p();p();function _l(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}p();function Gp(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}p();function jp(e){return e.join(" ").trim()}p();p();p();var Sx=/[ \t\n\f\r]/g;function En(e){return typeof e=="object"?e.type==="text"?Up(e.value):!1:Up(e)}function Up(e){return e.replace(Sx,"")===""}p();var ye=Wp(1),vl=Wp(-1),Tx=[];function Wp(e){return t;function t(n,r,o){let s=n?n.children:Tx,i=(r||0)+e,a=s[i];if(!o)for(;a&&En(a);)i+=e,a=s[i];return a}}p();var Cx={}.hasOwnProperty;function Ms(e){return t;function t(n,r,o){return Cx.call(e,n.tagName)&&e[n.tagName](n,r,o)}}var lo=Ms({body:vx,caption:Rl,colgroup:Rl,dd:Ix,dt:Ex,head:Rl,html:_x,li:Ax,optgroup:Px,option:Lx,p:Rx,rp:Hp,rt:Hp,tbody:Ox,td:Vp,tfoot:Dx,th:Vp,thead:$x,tr:Nx});function Rl(e,t,n){let r=ye(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&En(r.value.charAt(0)))}function _x(e,t,n){let r=ye(n,t);return!r||r.type!=="comment"}function vx(e,t,n){let r=ye(n,t);return!r||r.type!=="comment"}function Rx(e,t,n){let r=ye(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Ax(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Ex(e,t,n){let r=ye(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Ix(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Hp(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Px(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Lx(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function $x(e,t,n){let r=ye(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Ox(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Dx(e,t,n){return!ye(n,t)}function Nx(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Vp(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}p();var zp=Ms({body:Fx,colgroup:Gx,head:Bx,html:Mx,tbody:jx});function Mx(e){let t=ye(e,-1);return!t||t.type!=="comment"}function Bx(e){let t=new Set;for(let r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}let n=e.children[0];return!n||n.type==="element"}function Fx(e){let t=ye(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&En(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Gx(e,t,n){let r=vl(n,t),o=ye(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&lo(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function jx(e,t,n){let r=vl(n,t),o=ye(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&lo(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}var Bs={name:[[`
25
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},za=class{constructor(e,t){this.languageId=e,this.tokenType=t}},cb=class Za{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new za(t,8),this._embeddedLanguagesMatcher=new ub(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Za._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new za(0,0);_getBasicScopeAttributes=new Gd(t=>{let n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new za(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let n=t.match(Za.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ub=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([n,r])=>Fd(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},IR={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Kd=!1,Ld=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Xd(e,t,n,r,o,s,i,a){let l=t.content.length,c=!1,u=-1;if(i){let h=db(e,t,n,r,o,s);o=h.stack,r=h.linePos,n=h.isFirstLine,u=h.anchorPosition}let d=Date.now();for(;!c;){if(a!==0&&Date.now()-d>a)return new Ld(o,!0);m()}return new Ld(o,!1);function m(){let h=pb(e,t,n,r,o,u);if(!h){s.produce(o,l),c=!0;return}let f=h.captureIndices,g=h.matchedRuleId,w=f&&f.length>0?f[0].end>r:!1;if(g===ib){let x=o.getRule(e);s.produce(o,f[0].start),o=o.withContentNameScopesList(o.nameScopesList),Wr(e,t,n,o,s,x.endCaptures,f),s.produce(o,f[0].end);let T=o;if(o=o.parent,u=T.getAnchorPos(),!w&&T.getEnterPos()===r){o=T,s.produce(o,l),c=!0;return}}else{let x=e.getRule(g);s.produce(o,f[0].start);let T=o,v=x.getName(t.content,f),_=o.contentNameScopesList.pushAttributed(v,e);if(o=o.push(g,r,u,f[0].end===l,null,_,_),x instanceof Ja){let S=x;Wr(e,t,n,o,s,S.beginCaptures,f),s.produce(o,f[0].end),u=f[0].end;let D=S.getContentName(t.content,f),H=_.pushAttributed(D,e);if(o=o.withContentNameScopesList(H),S.endHasBackReferences&&(o=o.withEndRule(S.getEndWithResolvedBackReferences(t.content,f))),!w&&T.hasSameRuleAs(o)){o=o.pop(),s.produce(o,l),c=!0;return}}else if(x instanceof xs){let S=x;Wr(e,t,n,o,s,S.beginCaptures,f),s.produce(o,f[0].end),u=f[0].end;let D=S.getContentName(t.content,f),H=_.pushAttributed(D,e);if(o=o.withContentNameScopesList(H),S.whileHasBackReferences&&(o=o.withEndRule(S.getWhileWithResolvedBackReferences(t.content,f))),!w&&T.hasSameRuleAs(o)){o=o.pop(),s.produce(o,l),c=!0;return}}else if(Wr(e,t,n,o,s,x.captures,f),s.produce(o,f[0].end),o=o.pop(),!w){o=o.safePop(),s.produce(o,l),c=!0;return}}f[0].end>r&&(r=f[0].end,n=!1)}}function db(e,t,n,r,o,s){let i=o.beginRuleCapturedEOL?0:-1,a=[];for(let l=o;l;l=l.pop()){let c=l.getRule(e);c instanceof xs&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){let{ruleScanner:c,findOptions:u}=hb(l.rule,e,l.stack.endRule,n,r===i),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==Vd){o=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(s.produce(l.stack,d.captureIndices[0].start),Wr(e,t,n,l.stack,s,l.rule.whileCaptures,d.captureIndices),s.produce(l.stack,d.captureIndices[0].end),i=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{o=l.stack.pop();break}}return{stack:o,linePos:r,anchorPosition:i,isFirstLine:n}}function pb(e,t,n,r,o,s){let i=fb(e,t,n,r,o,s),a=e.getInjections();if(a.length===0)return i;let l=mb(a,e,t,n,r,o,s);if(!l)return i;if(!i)return l;let c=i.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:i}function fb(e,t,n,r,o,s){let i=o.getRule(e),{ruleScanner:a,findOptions:l}=Jd(i,e,o.endRule,n,r===s),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function mb(e,t,n,r,o,s,i){let a=Number.MAX_VALUE,l=null,c,u=0,d=s.contentNameScopesList.getScopeNames();for(let m=0,h=e.length;m<h;m++){let f=e[m];if(!f.matcher(d))continue;let g=t.getRule(f.ruleId),{ruleScanner:w,findOptions:x}=Jd(g,t,null,r,o===i),T=w.findNextMatchSync(n,o,x);if(!T)continue;let v=T.captureIndices[0].start;if(!(v>=a)&&(a=v,l=T.captureIndices,c=T.ruleId,u=f.priority,a===o))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Jd(e,t,n,r,o){if(Kd){let i=e.compile(t,n),a=Zd(r,o);return{ruleScanner:i,findOptions:a}}return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function hb(e,t,n,r,o){if(Kd){let i=e.compileWhile(t,n),a=Zd(r,o);return{ruleScanner:i,findOptions:a}}return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function Zd(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Wr(e,t,n,r,o,s,i){if(s.length===0)return;let a=t.content,l=Math.min(s.length,i.length),c=[],u=i[0].end;for(let d=0;d<l;d++){let m=s[d];if(m===null)continue;let h=i[d];if(h.length===0)continue;if(h.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=h.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,h.start):o.produce(r,h.start),m.retokenizeCapturedWithRuleId){let g=m.getName(a,i),w=r.contentNameScopesList.pushAttributed(g,e),x=m.getContentName(a,i),T=w.pushAttributed(x,e),v=r.push(m.retokenizeCapturedWithRuleId,h.start,-1,!1,null,w,T),_=e.createOnigString(a.substring(0,h.end));Xd(e,_,n&&h.start===0,h.start,v,o,!1,0),Wd(_);continue}let f=m.getName(a,i);if(f!==null){let w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);c.push(new gb(w,h.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var gb=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function yb(e,t,n,r,o,s,i,a){return new xb(e,t,n,r,o,s,i,a)}function $d(e,t,n,r,o){let s=ys(t,ws),i=zd.getCompiledRuleId(n,r,o.repository);for(let a of s)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:o,priority:a.priority})}function ws(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let o=n;o<t.length;o++)if(bb(t[o],r))return n=o+1,!0;return!1})}function bb(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var xb=class{constructor(e,t,n,r,o,s,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=a,this._basicScopeAttributesProvider=new cb(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Od(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(let l of Object.keys(o)){let c=ys(l,ws);for(let u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:o[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let o=r.injections;if(o)for(let i in o)$d(t,i,o[i],this,r);let s=this._grammarRepository.injections(n);s&&s.forEach(i=>{let a=this.getExternalGrammar(i);if(a){let l=a.injectionSelector;l&&$d(t,l,a,this,a)}})}return t.sort((o,s)=>o.priority-s.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Od(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=zd.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===Ya.NULL){o=!0;let c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=rn.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),m=this.getRule(this._rootId).getName(null,null),h;m?h=Hr.createRootAndLookUpScopeName(m,d,this):h=Hr.createRoot("unknown",d),t=new Ya(null,this._rootId,-1,-1,!1,null,h,h)}else o=!1,t.reset();e=e+`
26
+ `;let s=this.createOnigString(e),i=s.content.length,a=new kb(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Xd(this,s,o,0,t,a,!0,r);return Wd(s),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Od(e,t){return e=By(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Hr=class Rt{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,o=t?.scopePath??null;for(let s of n)o=Va.push(o,s.scopeNames),r=new Rt(r,o,s.encodedTokenAttributes);return r}static createRoot(t,n){return new Rt(null,new Va(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let o=r.getMetadataForScope(t),s=new Va(null,t),i=r.themeProvider.themeMatch(s),a=Rt.mergeAttributes(n,o,i);return new Rt(null,s,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Rt.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let o=-1,s=0,i=0;return r!==null&&(o=r.fontStyle,s=r.foregroundId,i=r.backgroundId),rn.set(t,n.languageId,n.tokenType,null,o,s,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Rt._pushAttributed(this,t,n);let r=t.split(/ /g),o=this;for(let s of r)o=Rt._pushAttributed(o,s,n);return o}static _pushAttributed(t,n,r){let o=r.getMetadataForScope(n),s=t.scopePath.push(n),i=r.themeProvider.themeMatch(s),a=Rt.mergeAttributes(t.tokenAttributes,o,i);return new Rt(t,s,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let n=[],r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},Ya=class vn{constructor(t,n,r,o,s,i,a,l){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=o}_stackElementBrand=void 0;static NULL=new vn(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:vn._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Hr.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){vn._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,s,i,a){return new vn(this,t,n,r,o,s,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){let t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new vn(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Hr.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new vn(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Hr.fromExtension(r,n.contentNameScopesList))}},wb=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):ys(n,ws).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>ys(n,ws).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},kb=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,o=!1;if(this.balancedBracketSelectors?.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let s=e?.getScopeNames()??[];for(let i of this._tokenTypeOverrides)i.matcher(s)&&(r=rn.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(s))}if(o&&(r=rn.set(r,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n}},Sb=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,o){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,yb(e,s,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},Yd=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Sb(Vr.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Vr.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new wb(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,o){let s=new Yy(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(i=>this._loadSingleGrammar(i.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,n,r,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,o)}},ks=Ya.NULL;p();var nl=Lg(sp(),1),or=nl.default,{Ansis:fA,fg:mA,bg:hA,rgb:gA,bgRgb:yA,hex:bA,bgHex:xA,reset:wA,inverse:kA,hidden:SA,visible:TA,link:CA,bold:_A,dim:vA,italic:RA,underline:AA,strikethrough:EA,black:IA,red:PA,green:LA,yellow:$A,blue:OA,magenta:DA,cyan:NA,white:MA,gray:BA,redBright:FA,greenBright:GA,yellowBright:jA,blueBright:UA,magentaBright:WA,cyanBright:HA,whiteBright:VA,bgBlack:zA,bgRed:qA,bgGreen:KA,bgYellow:XA,bgBlue:JA,bgMagenta:ZA,bgCyan:YA,bgWhite:QA,bgGray:eE,bgRedBright:tE,bgGreenBright:nE,bgYellowBright:rE,bgBlueBright:oE,bgMagentaBright:sE,bgCyanBright:iE,bgWhiteBright:aE}=nl.default;p();p();var rl=Object.defineProperty,Ab=Object.getOwnPropertyDescriptor,Eb=Object.getOwnPropertyNames,Ib=Object.prototype.hasOwnProperty,sr=(e,t)=>{let n={};for(var r in e)rl(n,r,{get:e[r],enumerable:!0});return t||rl(n,Symbol.toStringTag,{value:"Module"}),n},ip=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Eb(t),s=0,i=o.length,a;s<i;s++)a=o[s],!Ib.call(e,a)&&a!==n&&rl(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=Ab(t,a))||r.enumerable});return e},Ts=(e,t,n)=>(ip(e,t,"default"),n&&ip(n,t,"default"));p();var ir=[{id:"abap",name:"ABAP",import:(()=>import("./abap-3IAGZ3PS.js"))},{id:"actionscript-3",name:"ActionScript",import:(()=>import("./actionscript-3-C46RIPM4.js"))},{id:"ada",name:"Ada",import:(()=>import("./ada-DNTYS66P.js"))},{id:"angular-html",name:"Angular HTML",import:(()=>import("./angular-html-FD45HTTF.js"))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>import("./angular-ts-XKF3LV22.js"))},{id:"apache",name:"Apache Conf",import:(()=>import("./apache-DU26FTNI.js"))},{id:"apex",name:"Apex",import:(()=>import("./apex-27CRTE2E.js"))},{id:"apl",name:"APL",import:(()=>import("./apl-DZEE5XRN.js"))},{id:"applescript",name:"AppleScript",import:(()=>import("./applescript-TT4XSRXH.js"))},{id:"ara",name:"Ara",import:(()=>import("./ara-Q7AJDKA4.js"))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>import("./asciidoc-6DTTKQ3A.js"))},{id:"asm",name:"Assembly",import:(()=>import("./asm-D3LJR7GV.js"))},{id:"astro",name:"Astro",import:(()=>import("./astro-AZ66H24C.js"))},{id:"awk",name:"AWK",import:(()=>import("./awk-DCAM52A7.js"))},{id:"ballerina",name:"Ballerina",import:(()=>import("./ballerina-44XARFEK.js"))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>import("./bat-WM4RL2AB.js"))},{id:"beancount",name:"Beancount",import:(()=>import("./beancount-5PUWGPVT.js"))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>import("./berry-YAK4XTWX.js"))},{id:"bibtex",name:"BibTeX",import:(()=>import("./bibtex-2ISWNMJJ.js"))},{id:"bicep",name:"Bicep",import:(()=>import("./bicep-EOACOM4G.js"))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>import("./bird2-ZG3DO533.js"))},{id:"blade",name:"Blade",import:(()=>import("./blade-6Y7SALML.js"))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>import("./bsl-TNLQPNE3.js"))},{id:"c",name:"C",import:(()=>import("./c-G7V525MX.js"))},{id:"c3",name:"C3",import:(()=>import("./c3-4Z2YI6YO.js"))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>import("./cadence-U32GKKTR.js"))},{id:"cairo",name:"Cairo",import:(()=>import("./cairo-26RR6N4F.js"))},{id:"clarity",name:"Clarity",import:(()=>import("./clarity-4JIHRN2V.js"))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>import("./clojure-PKTTXYYS.js"))},{id:"cmake",name:"CMake",import:(()=>import("./cmake-HXKHWGGH.js"))},{id:"cobol",name:"COBOL",import:(()=>import("./cobol-KCXH3T3Q.js"))},{id:"codeowners",name:"CODEOWNERS",import:(()=>import("./codeowners-WCXRHQ2R.js"))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>import("./codeql-XZZ2USHF.js"))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>import("./coffee-SGQWHBUL.js"))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>import("./common-lisp-IK3DGBCK.js"))},{id:"coq",name:"Coq",import:(()=>import("./coq-UPTUVPLH.js"))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>import("./cpp-B4ITA36J.js"))},{id:"crystal",name:"Crystal",import:(()=>import("./crystal-DVILAEWU.js"))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>import("./csharp-VNJLKKRO.js"))},{id:"css",name:"CSS",import:(()=>import("./css-NLVM2B53.js"))},{id:"csv",name:"CSV",import:(()=>import("./csv-CRTD5FOL.js"))},{id:"cue",name:"CUE",import:(()=>import("./cue-IFMTDLM2.js"))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>import("./cypher-WH7754G7.js"))},{id:"d",name:"D",import:(()=>import("./d-VFMGCSG3.js"))},{id:"dart",name:"Dart",import:(()=>import("./dart-KG257MMB.js"))},{id:"dax",name:"DAX",import:(()=>import("./dax-Y4DTPR3K.js"))},{id:"desktop",name:"Desktop",import:(()=>import("./desktop-UYAYGPQT.js"))},{id:"diff",name:"Diff",import:(()=>import("./diff-BJDM3N45.js"))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>import("./docker-UOM4Q7PD.js"))},{id:"dotenv",name:"dotEnv",import:(()=>import("./dotenv-LK44WBD3.js"))},{id:"dream-maker",name:"Dream Maker",import:(()=>import("./dream-maker-7RP4JRQH.js"))},{id:"edge",name:"Edge",import:(()=>import("./edge-75EAMBUG.js"))},{id:"elixir",name:"Elixir",import:(()=>import("./elixir-NWFINHZW.js"))},{id:"elm",name:"Elm",import:(()=>import("./elm-THYL2NRS.js"))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>import("./emacs-lisp-NRIAYFLD.js"))},{id:"erb",name:"ERB",import:(()=>import("./erb-L6I32JVH.js"))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>import("./erlang-UNX5MMGA.js"))},{id:"fennel",name:"Fennel",import:(()=>import("./fennel-HYSSBG3N.js"))},{id:"fish",name:"Fish",import:(()=>import("./fish-PTKGQOJI.js"))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>import("./fluent-LEZHPPJV.js"))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>import("./fortran-fixed-form-J5AMEFMB.js"))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>import("./fortran-free-form-S3BNTBLS.js"))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>import("./fsharp-H4OIW62Z.js"))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>import("./gdresource-4NUZ6YCX.js"))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>import("./gdscript-YQUSJRNZ.js"))},{id:"gdshader",name:"GDShader",import:(()=>import("./gdshader-S5432GFE.js"))},{id:"genie",name:"Genie",import:(()=>import("./genie-RNVG5N7L.js"))},{id:"gherkin",name:"Gherkin",import:(()=>import("./gherkin-E5R62T6O.js"))},{id:"git-commit",name:"Git Commit Message",import:(()=>import("./git-commit-QGH6XOBG.js"))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>import("./git-rebase-XTCZTXU4.js"))},{id:"gleam",name:"Gleam",import:(()=>import("./gleam-W5WZ7CST.js"))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>import("./glimmer-js-EJYO25PG.js"))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>import("./glimmer-ts-Q2ZC2IIP.js"))},{id:"glsl",name:"GLSL",import:(()=>import("./glsl-PVW2OPUD.js"))},{id:"gn",name:"GN",import:(()=>import("./gn-FCAO7WI5.js"))},{id:"gnuplot",name:"Gnuplot",import:(()=>import("./gnuplot-Q6SE5CHZ.js"))},{id:"go",name:"Go",import:(()=>import("./go-WER5FUYJ.js"))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>import("./graphql-UN5O7U5U.js"))},{id:"groovy",name:"Groovy",import:(()=>import("./groovy-PJAEBBJY.js"))},{id:"hack",name:"Hack",import:(()=>import("./hack-FLOLYEQ5.js"))},{id:"haml",name:"Ruby Haml",import:(()=>import("./haml-SCHIB33Y.js"))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>import("./handlebars-BNURLECZ.js"))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>import("./haskell-NX6XRMNO.js"))},{id:"haxe",name:"Haxe",import:(()=>import("./haxe-7YNB7FVC.js"))},{id:"hcl",name:"HashiCorp HCL",import:(()=>import("./hcl-ZF75ASCX.js"))},{id:"hjson",name:"Hjson",import:(()=>import("./hjson-65TX6QOC.js"))},{id:"hlsl",name:"HLSL",import:(()=>import("./hlsl-U2O526MI.js"))},{id:"html",name:"HTML",import:(()=>import("./html-DXDULU5G.js"))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>import("./html-derivative-QD4CE6YQ.js"))},{id:"http",name:"HTTP",import:(()=>import("./http-KIGXJYY6.js"))},{id:"hurl",name:"Hurl",import:(()=>import("./hurl-BZB5LDD5.js"))},{id:"hxml",name:"HXML",import:(()=>import("./hxml-IGTXIURH.js"))},{id:"hy",name:"Hy",import:(()=>import("./hy-CLDGXJYP.js"))},{id:"imba",name:"Imba",import:(()=>import("./imba-NWHLCVE5.js"))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>import("./ini-R6WYP7NC.js"))},{id:"java",name:"Java",import:(()=>import("./java-DHBXDMBM.js"))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>import("./javascript-GNUEDNHO.js"))},{id:"jinja",name:"Jinja",import:(()=>import("./jinja-DC3WU6ZJ.js"))},{id:"jison",name:"Jison",import:(()=>import("./jison-64A6IJCV.js"))},{id:"json",name:"JSON",import:(()=>import("./json-2ELCHKXT.js"))},{id:"json5",name:"JSON5",import:(()=>import("./json5-QRH5UJYD.js"))},{id:"jsonc",name:"JSON with Comments",import:(()=>import("./jsonc-IXPVR4NY.js"))},{id:"jsonl",name:"JSON Lines",import:(()=>import("./jsonl-C57GMUK5.js"))},{id:"jsonnet",name:"Jsonnet",import:(()=>import("./jsonnet-VNADFLKI.js"))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>import("./jssm-CW4ZYDSF.js"))},{id:"jsx",name:"JSX",import:(()=>import("./jsx-YTENXENT.js"))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>import("./julia-CHGX5VFI.js"))},{id:"just",name:"Just",import:(()=>import("./just-XO4JBQP4.js"))},{id:"kdl",name:"KDL",import:(()=>import("./kdl-X3AS2HRT.js"))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>import("./kotlin-WGITM75W.js"))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>import("./kusto-55BKOIH6.js"))},{id:"latex",name:"LaTeX",import:(()=>import("./latex-7PE6CJI5.js"))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>import("./lean-DYWOENAS.js"))},{id:"less",name:"Less",import:(()=>import("./less-ZYJT7MPU.js"))},{id:"liquid",name:"Liquid",import:(()=>import("./liquid-OUYRJBEI.js"))},{id:"llvm",name:"LLVM IR",import:(()=>import("./llvm-F6576PPM.js"))},{id:"log",name:"Log file",import:(()=>import("./log-AXKDFD3L.js"))},{id:"logo",name:"Logo",import:(()=>import("./logo-E23LAFZY.js"))},{id:"lua",name:"Lua",import:(()=>import("./lua-QQ5QEPPO.js"))},{id:"luau",name:"Luau",import:(()=>import("./luau-7VRLQHZS.js"))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>import("./make-QFMWQJMG.js"))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>import("./markdown-D756RUOP.js"))},{id:"marko",name:"Marko",import:(()=>import("./marko-TQJFHH5J.js"))},{id:"matlab",name:"MATLAB",import:(()=>import("./matlab-ZKZ7YBAH.js"))},{id:"mdc",name:"MDC",import:(()=>import("./mdc-ZOKCGRSD.js"))},{id:"mdx",name:"MDX",import:(()=>import("./mdx-34BL2O4O.js"))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>import("./mermaid-54Z3SAII.js"))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>import("./mipsasm-NKQWJEL7.js"))},{id:"mojo",name:"Mojo",import:(()=>import("./mojo-NUFJUGRT.js"))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>import("./moonbit-IQKVCQX6.js"))},{id:"move",name:"Move",import:(()=>import("./move-4VWCI4YQ.js"))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>import("./narrat-4QSDQDLH.js"))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>import("./nextflow-OTA6EZBU.js"))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>import("./nextflow-groovy-434C6PKN.js"))},{id:"nginx",name:"Nginx",import:(()=>import("./nginx-DXHAXQRH.js"))},{id:"nim",name:"Nim",import:(()=>import("./nim-LBV5OEXG.js"))},{id:"nix",name:"Nix",import:(()=>import("./nix-WAYR4BYU.js"))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>import("./nushell-WFCCYAUY.js"))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>import("./objective-c-246HWLKT.js"))},{id:"objective-cpp",name:"Objective-C++",import:(()=>import("./objective-cpp-RJUXXPYQ.js"))},{id:"ocaml",name:"OCaml",import:(()=>import("./ocaml-P7NGS7PR.js"))},{id:"odin",name:"Odin",import:(()=>import("./odin-UPPZCJGN.js"))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>import("./openscad-JRK6K3FL.js"))},{id:"pascal",name:"Pascal",import:(()=>import("./pascal-RDFLUHHA.js"))},{id:"perl",name:"Perl",import:(()=>import("./perl-N2JOL2L5.js"))},{id:"php",name:"PHP",import:(()=>import("./php-OXA56EZC.js"))},{id:"pkl",name:"Pkl",import:(()=>import("./pkl-PAM76VXP.js"))},{id:"plsql",name:"PL/SQL",import:(()=>import("./plsql-3Y6UMFEG.js"))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>import("./po-GNTAKCTE.js"))},{id:"polar",name:"Polar",import:(()=>import("./polar-EVTMRLGV.js"))},{id:"postcss",name:"PostCSS",import:(()=>import("./postcss-42343LW7.js"))},{id:"powerquery",name:"PowerQuery",import:(()=>import("./powerquery-M34PNR4X.js"))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>import("./powershell-IR7ICFQW.js"))},{id:"prisma",name:"Prisma",import:(()=>import("./prisma-RXSIFLZX.js"))},{id:"prolog",name:"Prolog",import:(()=>import("./prolog-YBBQ4UD5.js"))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>import("./proto-U4FF45G6.js"))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>import("./pug-CWA4QCVE.js"))},{id:"puppet",name:"Puppet",import:(()=>import("./puppet-HWOKIYJP.js"))},{id:"purescript",name:"PureScript",import:(()=>import("./purescript-D45AJS5J.js"))},{id:"python",name:"Python",aliases:["py"],import:(()=>import("./python-QWA7UE2I.js"))},{id:"qml",name:"QML",import:(()=>import("./qml-RHCWFR3S.js"))},{id:"qmldir",name:"QML Directory",import:(()=>import("./qmldir-FBDC3XMZ.js"))},{id:"qss",name:"Qt Style Sheets",import:(()=>import("./qss-AD3WZQ45.js"))},{id:"r",name:"R",import:(()=>import("./r-NHIAHDOD.js"))},{id:"racket",name:"Racket",import:(()=>import("./racket-7G65C5N5.js"))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>import("./raku-IWS7BLGD.js"))},{id:"razor",name:"ASP.NET Razor",import:(()=>import("./razor-B3X33ONZ.js"))},{id:"reg",name:"Windows Registry Script",import:(()=>import("./reg-V4XLWESR.js"))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>import("./regexp-XP4MR635.js"))},{id:"rel",name:"Rel",import:(()=>import("./rel-DE6UXATM.js"))},{id:"riscv",name:"RISC-V",import:(()=>import("./riscv-5PDXBPPL.js"))},{id:"ron",name:"RON",import:(()=>import("./ron-G4N7ZKMH.js"))},{id:"rosmsg",name:"ROS Interface",import:(()=>import("./rosmsg-7LDUCZRQ.js"))},{id:"rst",name:"reStructuredText",import:(()=>import("./rst-D5R5URHP.js"))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>import("./ruby-DWCE4YYU.js"))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>import("./rust-Z2NYMT2Z.js"))},{id:"sas",name:"SAS",import:(()=>import("./sas-T7S4QIRM.js"))},{id:"sass",name:"Sass",import:(()=>import("./sass-75VDP7DE.js"))},{id:"scala",name:"Scala",import:(()=>import("./scala-7TJ4N6KC.js"))},{id:"scheme",name:"Scheme",import:(()=>import("./scheme-5XARZMKT.js"))},{id:"scss",name:"SCSS",import:(()=>import("./scss-RIXXNXKR.js"))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>import("./sdbl-6M55AJVA.js"))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>import("./shaderlab-322XNY5V.js"))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>import("./shellscript-F23VVVTW.js"))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>import("./shellsession-G65XJMCC.js"))},{id:"smalltalk",name:"Smalltalk",import:(()=>import("./smalltalk-LALIO5SC.js"))},{id:"solidity",name:"Solidity",import:(()=>import("./solidity-TQUKTJZZ.js"))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>import("./soy-4TQM2FCJ.js"))},{id:"sparql",name:"SPARQL",import:(()=>import("./sparql-ARI3MVK7.js"))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>import("./splunk-QEFG3NPJ.js"))},{id:"sql",name:"SQL",import:(()=>import("./sql-52F5XK5C.js"))},{id:"ssh-config",name:"SSH Config",import:(()=>import("./ssh-config-SC6RC6IV.js"))},{id:"stata",name:"Stata",import:(()=>import("./stata-6C4TLAPQ.js"))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>import("./stylus-YYWEHAK3.js"))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>import("./surrealql-5X7LI3J6.js"))},{id:"svelte",name:"Svelte",import:(()=>import("./svelte-NTV6SKXK.js"))},{id:"swift",name:"Swift",import:(()=>import("./swift-KMR3DOSF.js"))},{id:"system-verilog",name:"SystemVerilog",import:(()=>import("./system-verilog-46QRSGNM.js"))},{id:"systemd",name:"Systemd Units",import:(()=>import("./systemd-3PUVCSI7.js"))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>import("./talonscript-AK4LB3KC.js"))},{id:"tasl",name:"Tasl",import:(()=>import("./tasl-VHTYBUVI.js"))},{id:"tcl",name:"Tcl",import:(()=>import("./tcl-UUMKHRHL.js"))},{id:"templ",name:"Templ",import:(()=>import("./templ-U5PIZYER.js"))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>import("./terraform-GCGIT2RL.js"))},{id:"tex",name:"TeX",import:(()=>import("./tex-MVHXDK4A.js"))},{id:"toml",name:"TOML",import:(()=>import("./toml-7AH4HFBN.js"))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>import("./ts-tags-K7BWB4VX.js"))},{id:"tsv",name:"TSV",import:(()=>import("./tsv-EB3LRXYX.js"))},{id:"tsx",name:"TSX",import:(()=>import("./tsx-Y5YXGNIX.js"))},{id:"turtle",name:"Turtle",import:(()=>import("./turtle-KM6UGYIQ.js"))},{id:"twig",name:"Twig",import:(()=>import("./twig-7UZRHYW3.js"))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>import("./typescript-ZF5AMNEZ.js"))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>import("./typespec-535S7LOL.js"))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>import("./typst-ZOSAUKL5.js"))},{id:"v",name:"V",import:(()=>import("./v-HVLBO3DI.js"))},{id:"vala",name:"Vala",import:(()=>import("./vala-WWRVCJNF.js"))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>import("./vb-XFFF4O73.js"))},{id:"verilog",name:"Verilog",import:(()=>import("./verilog-XTDPJNP7.js"))},{id:"vhdl",name:"VHDL",import:(()=>import("./vhdl-OCZJ2AOZ.js"))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>import("./viml-PVA3ZJ5L.js"))},{id:"vue",name:"Vue",import:(()=>import("./vue-CKPBQTY7.js"))},{id:"vue-html",name:"Vue HTML",import:(()=>import("./vue-html-G4DE7FYD.js"))},{id:"vue-vine",name:"Vue Vine",import:(()=>import("./vue-vine-Q32TIQRB.js"))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>import("./vyper-SBDFKHRI.js"))},{id:"wasm",name:"WebAssembly",import:(()=>import("./wasm-SXNE4SKX.js"))},{id:"wenyan",name:"Wenyan",aliases:["\u6587\u8A00"],import:(()=>import("./wenyan-PMSCJP7P.js"))},{id:"wgsl",name:"WGSL",import:(()=>import("./wgsl-DOXQU7M4.js"))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>import("./wikitext-LGNEKWDX.js"))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>import("./wit-G62U2KBE.js"))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>import("./wolfram-YTZHUYN6.js"))},{id:"xml",name:"XML",import:(()=>import("./xml-WGLM4CWK.js"))},{id:"xsl",name:"XSL",import:(()=>import("./xsl-KAAH2GEK.js"))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>import("./yaml-JGEBDSVI.js"))},{id:"zenscript",name:"ZenScript",import:(()=>import("./zenscript-QQQPZNJ7.js"))},{id:"zig",name:"Zig",import:(()=>import("./zig-6LJUAPBA.js"))}],Jr=Object.fromEntries(ir.map(e=>[e.id,e.import])),Zr=Object.fromEntries(ir.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Yr={...Jr,...Zr};p();var Qr=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>import("./andromeeda-XSK3JERF.js"))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>import("./aurora-x-CGSVHL4H.js"))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>import("./ayu-dark-55BH6GCR.js"))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>import("./ayu-light-IPNR4FEJ.js"))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>import("./ayu-mirage-MOSAI7A2.js"))},{id:"catppuccin-frappe",displayName:"Catppuccin Frapp\xE9",type:"dark",import:(()=>import("./catppuccin-frappe-UZ4N3Z4I.js"))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>import("./catppuccin-latte-GCOWYLZG.js"))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>import("./catppuccin-macchiato-PJD7W5WJ.js"))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>import("./catppuccin-mocha-RRH4FOBS.js"))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>import("./dark-plus-PSM5XP2I.js"))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>import("./dracula-2VHT5LK5.js"))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>import("./dracula-soft-MSCUO73T.js"))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>import("./everforest-dark-AGVJEQ35.js"))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>import("./everforest-light-62GPFKVJ.js"))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>import("./github-dark-5OJVMBCE.js"))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>import("./github-dark-default-4WERFSZW.js"))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>import("./github-dark-dimmed-7VD3SZKC.js"))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>import("./github-dark-high-contrast-FVMMS656.js"))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>import("./github-light-SE4LEKO7.js"))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>import("./github-light-default-TV7BYQGI.js"))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>import("./github-light-high-contrast-WKO4I3G7.js"))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>import("./gruvbox-dark-hard-LOYZQIGI.js"))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>import("./gruvbox-dark-medium-UIMSJJ6K.js"))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>import("./gruvbox-dark-soft-PU6RNTTO.js"))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>import("./gruvbox-light-hard-ZQJ7XSZF.js"))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>import("./gruvbox-light-medium-CD3ZGYV6.js"))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>import("./gruvbox-light-soft-S74MAGOM.js"))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>import("./horizon-EAAZ4KVN.js"))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>import("./horizon-bright-CGMA7ELN.js"))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>import("./houston-UNRWGR67.js"))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>import("./kanagawa-dragon-BOSCCB42.js"))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>import("./kanagawa-lotus-NXMB2IVI.js"))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>import("./kanagawa-wave-YOHS63UF.js"))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>import("./laserwave-TS4AG4VO.js"))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>import("./light-plus-2HYW3NJ6.js"))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>import("./material-theme-KPDVFAGV.js"))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>import("./material-theme-darker-GVSTMSNT.js"))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>import("./material-theme-lighter-JWZNUXUH.js"))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>import("./material-theme-ocean-MU4N3XNQ.js"))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>import("./material-theme-palenight-VMWD73WM.js"))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>import("./min-dark-ASEVSA24.js"))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>import("./min-light-3H54BB3D.js"))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>import("./monokai-5QWQOFN6.js"))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>import("./night-owl-4QQBS2UX.js"))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>import("./night-owl-light-HR6A2OQO.js"))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>import("./nord-XK3AUNCF.js"))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>import("./one-dark-pro-ZV7CEA5M.js"))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>import("./one-light-FKZJCKM6.js"))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>import("./plastic-SXCQPKYC.js"))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>import("./poimandres-S3UYVG4O.js"))},{id:"red",displayName:"Red",type:"dark",import:(()=>import("./red-A6OC2HVL.js"))},{id:"rose-pine",displayName:"Ros\xE9 Pine",type:"dark",import:(()=>import("./rose-pine-GLWOWPBK.js"))},{id:"rose-pine-dawn",displayName:"Ros\xE9 Pine Dawn",type:"light",import:(()=>import("./rose-pine-dawn-HYE6T7LV.js"))},{id:"rose-pine-moon",displayName:"Ros\xE9 Pine Moon",type:"dark",import:(()=>import("./rose-pine-moon-VHVTDDVO.js"))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>import("./slack-dark-OPW5CYSY.js"))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>import("./slack-ochin-WTVMYBFH.js"))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>import("./snazzy-light-5UQ56PC5.js"))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>import("./solarized-dark-DSMP6D7D.js"))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>import("./solarized-light-3IZTZCIV.js"))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>import("./synthwave-84-JWI6CVJZ.js"))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>import("./tokyo-night-SRK4SADJ.js"))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>import("./vesper-DY3BCX5Y.js"))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>import("./vitesse-black-PEGI4HJX.js"))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>import("./vitesse-dark-M2ZAGPXG.js"))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>import("./vitesse-light-RICZI4IG.js"))}],eo=Object.fromEntries(Qr.map(e=>[e.id,e.import]));p();p();var ll={};Ju(ll,{createOnigurumaEngine:()=>al,getDefaultWasmLoader:()=>zb,loadWasm:()=>Rs,setDefaultWasmLoader:()=>Vb});p();var il=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Pb(){return 2147483648}function Lb(){return typeof performance<"u"?performance.now():Date.now()}var $b=(e,t)=>e+(t-e%t)%t;async function Ob(e){let t,n,r={};function o(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function s(h,f,g){r.HEAPU8.copyWithin(h,f,f+g)}function i(h){try{return t.grow(h-n.byteLength+65535>>>16),o(t.buffer),1}catch{}}function a(h){let f=r.HEAPU8.length;h=h>>>0;let g=Pb();if(h>g)return!1;for(let w=1;w<=4;w*=2){let x=f*(1+.2/w);x=Math.min(x,h+100663296);let T=Math.min(g,$b(Math.max(h,x),65536));if(i(T))return!0}return!1}let l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(h,f,g=1024){let w=f+g,x=f;for(;h[x]&&!(x>=w);)++x;if(x-f>16&&h.buffer&&l)return l.decode(h.subarray(f,x));let T="";for(;f<x;){let v=h[f++];if(!(v&128)){T+=String.fromCharCode(v);continue}let _=h[f++]&63;if((v&224)===192){T+=String.fromCharCode((v&31)<<6|_);continue}let S=h[f++]&63;if((v&240)===224?v=(v&15)<<12|_<<6|S:v=(v&7)<<18|_<<12|S<<6|h[f++]&63,v<65536)T+=String.fromCharCode(v);else{let D=v-65536;T+=String.fromCharCode(55296|D>>10,56320|D&1023)}}return T}function u(h,f){return h?c(r.HEAPU8,h,f):""}let d={emscripten_get_now:Lb,emscripten_memcpy_big:s,emscripten_resize_heap:a,fd_write:()=>0};async function m(){let f=await e({env:d,wasi_snapshot_preview1:d});t=f.memory,o(t.buffer),Object.assign(r,f),r.UTF8ToString=u}return await m(),r}var Db=Object.defineProperty,Nb=(e,t,n)=>t in e?Db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ce=(e,t,n)=>Nb(e,typeof t!="symbol"?t+"":t,n),Ae=null;function Mb(e){throw new il(e.UTF8ToString(e.getLastOnigError()))}var _s=class e{constructor(t){Ce(this,"utf16Length"),Ce(this,"utf8Length"),Ce(this,"utf16Value"),Ce(this,"utf8Value"),Ce(this,"utf16OffsetToUtf8"),Ce(this,"utf8OffsetToUtf16");let n=t.length,r=e._utf8ByteLength(t),o=r!==n,s=o?new Uint32Array(n+1):null;o&&(s[n]=r);let i=o?new Uint32Array(r+1):null;o&&(i[r]=n);let a=new Uint8Array(r),l=0;for(let c=0;c<n;c++){let u=t.charCodeAt(c),d=u,m=!1;if(u>=55296&&u<=56319&&c+1<n){let h=t.charCodeAt(c+1);h>=56320&&h<=57343&&(d=(u-55296<<10)+65536|h-56320,m=!0)}o&&(s[c]=l,m&&(s[c+1]=l),d<=127?i[l+0]=c:d<=2047?(i[l+0]=c,i[l+1]=c):d<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),m&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=s,this.utf8OffsetToUtf16=i}static _utf8ByteLength(t){let n=0;for(let r=0,o=t.length;r<o;r++){let s=t.charCodeAt(r),i=s,a=!1;if(s>=55296&&s<=56319&&r+1<o){let l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(s-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(t){let n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}},vs=class At{constructor(t){if(Ce(this,"id",++At.LAST_ID),Ce(this,"_onigBinding"),Ce(this,"content"),Ce(this,"utf16Length"),Ce(this,"utf8Length"),Ce(this,"utf16OffsetToUtf8"),Ce(this,"utf8OffsetToUtf16"),Ce(this,"ptr"),!Ae)throw new il("Must invoke loadWasm first.");this._onigBinding=Ae,this.content=t;let n=new _s(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!At._sharedPtrInUse?(At._sharedPtr||(At._sharedPtr=Ae.omalloc(1e4)),At._sharedPtrInUse=!0,Ae.HEAPU8.set(n.utf8Value,At._sharedPtr),this.ptr=At._sharedPtr):this.ptr=n.createString(Ae)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===At._sharedPtr?At._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Ce(vs,"LAST_ID",0);Ce(vs,"_sharedPtr",0);Ce(vs,"_sharedPtrInUse",!1);var ap=vs,sl=class{constructor(t){if(Ce(this,"_onigBinding"),Ce(this,"_ptr"),!Ae)throw new il("Must invoke loadWasm first.");let n=[],r=[];for(let a=0,l=t.length;a<l;a++){let c=new _s(t[a]);n[a]=c.createString(Ae),r[a]=c.utf8Length}let o=Ae.omalloc(4*t.length);Ae.HEAPU32.set(n,o/4);let s=Ae.omalloc(4*t.length);Ae.HEAPU32.set(r,s/4);let i=Ae.createOnigScanner(o,s,t.length);for(let a=0,l=t.length;a<l;a++)Ae.ofree(n[a]);Ae.ofree(s),Ae.ofree(o),i===0&&Mb(Ae),this._onigBinding=Ae,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let o=0;if(typeof r=="number"&&(o=r),typeof t=="string"){t=new ap(t);let s=this._findNextMatchSync(t,n,!1,o);return t.dispose(),s}return this._findNextMatchSync(t,n,!1,o)}_findNextMatchSync(t,n,r,o){let s=this._onigBinding,i=s.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),o);if(i===0)return null;let a=s.HEAPU32,l=i/4,c=a[l++],u=a[l++],d=[];for(let m=0;m<u;m++){let h=t.convertUtf8OffsetToUtf16(a[l++]),f=t.convertUtf8OffsetToUtf16(a[l++]);d[m]={start:h,end:f,length:f-h}}return{index:c,captureIndices:d}}};function Bb(e){return typeof e.instantiator=="function"}function Fb(e){return typeof e.default=="function"}function Gb(e){return typeof e.data<"u"}function jb(e){return typeof Response<"u"&&e instanceof Response}function Ub(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}var Cs;function Rs(e){if(Cs)return Cs;async function t(){Ae=await Ob(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Bb(r)?r=await r.instantiator(n):Fb(r)?r=await r.default(n):(Gb(r)&&(r=r.data),jb(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Wb(r)(n):r=await Hb(r)(n):Ub(r)?r=await ol(r)(n):r instanceof WebAssembly.Module?r=await ol(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await ol(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Cs=t(),Cs}function ol(e){return t=>WebAssembly.instantiate(e,t)}function Wb(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Hb(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var lp;function Vb(e){lp=e}function zb(){return lp}async function al(e){return e&&await Rs(e),{createScanner(t){return new sl(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new ap(t)}}}var cl=sr({});Ts(cl,ll);p();p();var te=class extends Error{constructor(e){super(e),this.name="ShikiError"}};p();function no(e,t){let n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(let[o,s]of Object.entries(t?.colorReplacements||{}))typeof s=="string"?n[o]=s:o===r&&Object.assign(n,s);return n}function Mt(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function fp(e){return Array.isArray(e)?e:[e]}async function ul(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function ro(e){return!e||["plaintext","txt","text","plain"].includes(e)}function dl(e){return e==="ansi"||ro(e)}function oo(e){return e==="none"}function pl(e){return oo(e)}var qb=/(\r?\n)/g;function ar(e,t=!1){if(e.length===0)return[["",0]];let n=e.split(qb),r=0,o=[];for(let s=0;s<n.length;s+=2){let i=t?n[s]+(n[s+1]||""):n[s];o.push([i,r]),r+=n[s].length,r+=n[s+1]?.length||0}return o}var cp={light:"#333333",dark:"#bbbbbb"},up={light:"#fffffe",dark:"#1e1e1e"},dp="__shiki_resolved";function As(e){if(e?.[dp])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let a=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?cp.light:cp.dark),n||(n=t.type==="light"?up.light:up.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0,s=new Map;function i(a){if(s.has(a))return s.get(a);o+=1;let l=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?i(a):(s.set(a,l),l)}t.settings=t.settings.map(a=>{let l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;let u={...a,settings:{...a.settings}};if(l){let d=i(a.settings.foreground);t.colorReplacements[d]=a.settings.foreground,u.settings.foreground=d}if(c){let d=i(a.settings.background);t.colorReplacements[d]=a.settings.background,u.settings.background=d}return u});for(let a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){let l=i(t.colors[a]);t.colorReplacements[l]=t.colors[a],t.colors[a]=l}return Object.defineProperty(t,dp,{enumerable:!1,writable:!1,value:!0}),t}async function mp(e){return[...new Set((await Promise.all(e.filter(t=>!dl(t)).map(async t=>await ul(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function hp(e){return(await Promise.all(e.map(async t=>pl(t)?null:As(await ul(t))))).filter(t=>!!t)}function gp(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new te(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Kb=class extends Yd{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=As(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Vr.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=gp(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,t.size)for(let o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let r of e)this.resolveEmbeddedLanguages(r);let t=[...this._langGraph.entries()],n=t.filter(([r,o])=>!o);if(n.length){let r=t.filter(([o,s])=>s?(s.embeddedLanguages||s.embeddedLangs)?.some(i=>n.map(([a])=>a).includes(i)):!1).filter(o=>!n.includes(o));throw new te(`Missing languages ${n.map(([o])=>`\`${o}\``).join(", ")}, required by ${r.map(([o])=>`\`${o}\``).join(", ")}`)}for(let[r,o]of t)this._resolver.addLanguage(o);for(let[r,o]of t)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let n of t)this._langGraph.set(n,this._langMap.get(n))}},Xb=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),n=[];for(let r=1;r<=t.length;r++){let o=t.slice(0,r).join(".");n=[...n,...this._injections.get(o)||[]]}return n}},to=0;function fl(e){to+=1,e.warnings!==!1&&to>=10&&to%10===0&&console.warn(`[Shiki] ${to} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new te("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(As),o=new Kb(new Xb(e.engine,n),r,n,e.langAlias),s;function i(T){return gp(T,e.langAlias)}function a(T){w();let v=o.getGrammar(typeof T=="string"?T:T.name);if(!v)throw new te(`Language \`${T}\` not found, you may need to load it first`);return v}function l(T){if(T==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();let v=o.getTheme(T);if(!v)throw new te(`Theme \`${T}\` not found, you may need to load it first`);return v}function c(T){w();let v=l(T);return s!==T&&(o.setTheme(v),s=T),{theme:v,colorMap:o.getColorMap()}}function u(){return w(),o.getLoadedThemes()}function d(){return w(),o.getLoadedLanguages()}function m(...T){w(),o.loadLanguages(T.flat(1))}async function h(...T){return m(await mp(T))}function f(...T){w();for(let v of T.flat(1))o.loadTheme(v)}async function g(...T){return w(),f(await hp(T))}function w(){if(t)throw new te("Shiki instance has been disposed")}function x(){t||(t=!0,o.dispose(),to-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:i,loadLanguage:h,loadLanguageSync:m,loadTheme:g,loadThemeSync:f,dispose:x,[Symbol.dispose]:x}}async function ml(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([hp(e.themes||[]),mp(e.langs||[]),e.engine]);return fl({...e,themes:t,langs:n,engine:r})}var yp=new WeakMap;function so(e,t){yp.set(e,t)}function lr(e){return yp.get(e)}var Es=class bp{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new bp(Object.fromEntries(fp(n).map(r=>[r,ks])),t)}constructor(...t){if(t.length===2){let[n,r]=t;this.lang=r,this._stacks=n}else{let[n,r,o]=t;this.lang=r,this._stacks={[o]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Jb(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Jb(e){let t=[],n=new Set;function r(o){if(n.has(o))return;n.add(o);let s=o?.nameScopesList?.scopeName;s&&t.push(s),o.parent&&r(o.parent)}return r(e),t}function Zb(e,t){if(!(e instanceof Es))throw new te("Invalid grammar state");return e.getInternalStack(t)}var Yb=/,/,Qb=/ /;function hl(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(ro(e.resolveLangAlias(n.lang||"text"))||oo(r))return ar(t).map(a=>[{content:a[0],offset:a[1]}]);let{theme:o,colorMap:s}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new te(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(o.name))throw new te(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return wp(t,i,o,s,n)}function xp(...e){if(e.length===2)return lr(e[1]);let[t,n,r={}]=e,{lang:o="text",theme:s=t.getLoadedThemes()[0]}=r;if(ro(o)||oo(s))throw new te("Plain language does not have grammar state");if(o==="ansi")throw new te("ANSI language does not have grammar state");let{theme:i,colorMap:a}=t.setTheme(s),l=t.getLanguage(o);return new Es(gl(n,l,i,a,r).stateStack,l.name,i.name)}function wp(e,t,n,r,o){let s=gl(e,t,n,r,o),i=new Es(s.stateStack,t.name,n.name);return so(s.tokens,i),s.tokens}function gl(e,t,n,r,o){let s=no(n,o),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:l=!1}=o,c=ar(e),u=o.grammarState?Zb(o.grammarState,n.name)??ks:o.grammarContextCode!=null?gl(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:ks,d=[],m=[];for(let h=0,f=c.length;h<f;h++){let[g,w]=c[h];if(g===""){d=[],m.push([]);continue}if(i>0&&g.length>=i){d=[],m.push([{content:g,offset:w,color:"",fontStyle:0}]);continue}let x,T,v;l&&l!=="tokenType"&&(x=t.tokenizeLine(g,u,a),T=x.tokens,v=0);let _=t.tokenizeLine2(g,u,a),S=_.tokens.length/2;for(let D=0;D<S;D++){let H=_.tokens[2*D],E=D+1<S?_.tokens[2*D+2]:g.length;if(H===E)continue;let I=_.tokens[2*D+1],B=Mt(r[rn.getForeground(I)],s),Y=rn.getFontStyle(I),q={content:g.substring(H,E),offset:w+H,color:B,fontStyle:Y};if(l==="tokenType")q.type=rn.getTokenType(I);else if(l){let ae=[];if(l!=="scopeName")for(let Q of n.settings){let j;switch(typeof Q.scope){case"string":j=Q.scope.split(Yb).map(re=>re.trim());break;case"object":j=Q.scope;break;default:continue}ae.push({settings:Q,selectors:j.map(re=>re.split(Qb))})}q.explanation=[];let ce=0;for(;H+ce<E;){let Q=T[v],j=g.substring(Q.startIndex,Q.endIndex);ce+=j.length,q.explanation.push({content:j,scopes:l==="scopeName"?ex(Q.scopes):tx(ae,Q.scopes)}),v+=1}}d.push(q)}m.push(d),d=[],u=_.ruleStack}return{tokens:m,stateStack:u}}function ex(e){return e.map(t=>({scopeName:t}))}function tx(e,t){let n=[];for(let r=0,o=t.length;r<o;r++){let s=t[r];n[r]={scopeName:s,themeMatches:rx(e,s,t.slice(0,r))}}return n}function pp(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function nx(e,t,n){if(!pp(e.at(-1),t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)pp(e[r],n[o])&&(r-=1),o-=1;return r===-1}function rx(e,t,n){let r=[];for(let{selectors:o,settings:s}of e)for(let i of o)if(nx(i,t,n)){r.push(s);break}return r}function Is(e,t,n,r=hl){let o=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=o.map(c=>{let u=r(e,t,{...n,theme:c.theme});return{tokens:u,state:lr(u),theme:typeof c.theme=="string"?c.theme:c.theme.name}}),i=ox(...s.map(c=>c.tokens)),a=i[0].map((c,u)=>c.map((d,m)=>{let h={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=d.explanation),i.forEach((f,g)=>{let{content:w,explanation:x,offset:T,...v}=f[u][m];h.variants[o[g].color]=v}),h})),l=s[0].state?new Es(Object.fromEntries(s.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),s[0].state.lang):void 0;return l&&so(a,l),a}function ox(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let o=e.map(l=>l[r]),s=t.map(()=>[]);t.forEach((l,c)=>l.push(s[c]));let i=o.map(()=>0),a=o.map(l=>l[0]);for(;a.every(l=>l);){let l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){let u=a[c];u.content.length===l?(s[c].push(u),i[c]+=1,a[c]=o[c][i[c]]):(s[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}p();p();p();var kp=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];p();p();p();var Bt=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Bt.prototype.normal={};Bt.prototype.property={};Bt.prototype.space=void 0;function yl(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Bt(n,r,t)}p();p();p();function io(e){return e.toLowerCase()}p();p();var Ee=class{constructor(t,n){this.attribute=n,this.property=t}};Ee.prototype.attribute="";Ee.prototype.booleanish=!1;Ee.prototype.boolean=!1;Ee.prototype.commaOrSpaceSeparated=!1;Ee.prototype.commaSeparated=!1;Ee.prototype.defined=!1;Ee.prototype.mustUseProperty=!1;Ee.prototype.number=!1;Ee.prototype.overloadedBoolean=!1;Ee.prototype.property="";Ee.prototype.spaceSeparated=!1;Ee.prototype.space=void 0;var ao={};Ju(ao,{boolean:()=>z,booleanish:()=>fe,commaOrSpaceSeparated:()=>We,commaSeparated:()=>Ft,number:()=>A,overloadedBoolean:()=>Ps,spaceSeparated:()=>ee});p();var sx=0,z=Rn(),fe=Rn(),Ps=Rn(),A=Rn(),ee=Rn(),Ft=Rn(),We=Rn();function Rn(){return 2**++sx}var bl=Object.keys(ao),An=class extends Ee{constructor(t,n,r,o){let s=-1;if(super(t,n),Sp(this,"space",o),typeof r=="number")for(;++s<bl.length;){let i=bl[s];Sp(this,bl[s],(r&ao[i])===ao[i])}}};An.prototype.defined=!0;function Sp(e,t,n){n&&(e[t]=n)}function lt(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let s=new An(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[io(r)]=r,n[io(s.attribute)]=r}return new Bt(t,n,e.space)}var xl=lt({properties:{ariaActiveDescendant:null,ariaAtomic:fe,ariaAutoComplete:null,ariaBusy:fe,ariaChecked:fe,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:ee,ariaCurrent:null,ariaDescribedBy:ee,ariaDetails:null,ariaDisabled:fe,ariaDropEffect:ee,ariaErrorMessage:null,ariaExpanded:fe,ariaFlowTo:ee,ariaGrabbed:fe,ariaHasPopup:null,ariaHidden:fe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ee,ariaLevel:A,ariaLive:null,ariaModal:fe,ariaMultiLine:fe,ariaMultiSelectable:fe,ariaOrientation:null,ariaOwns:ee,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:fe,ariaReadOnly:fe,ariaRelevant:null,ariaRequired:fe,ariaRoleDescription:ee,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:fe,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});p();p();p();function Ls(e,t){return t in e?e[t]:t}function $s(e,t){return Ls(e,t.toLowerCase())}var Tp=lt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ft,acceptCharset:ee,accessKey:ee,action:null,allow:null,allowFullScreen:z,allowPaymentRequest:z,allowUserMedia:z,alpha:z,alt:null,as:null,async:z,autoCapitalize:null,autoComplete:ee,autoFocus:z,autoPlay:z,blocking:ee,capture:null,charSet:null,checked:z,cite:null,className:ee,closedBy:null,colorSpace:null,cols:A,colSpan:A,command:null,commandFor:null,content:null,contentEditable:fe,controls:z,controlsList:ee,coords:A|Ft,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z,defer:z,dir:null,dirName:null,disabled:z,download:Ps,draggable:fe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z,formTarget:null,headers:ee,height:A,hidden:Ps,high:A,href:null,hrefLang:null,htmlFor:ee,httpEquiv:ee,id:null,imageSizes:null,imageSrcSet:null,inert:z,inputMode:null,integrity:null,is:null,isMap:z,itemId:null,itemProp:ee,itemRef:ee,itemScope:z,itemType:ee,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:z,muted:z,name:null,nonce:null,noModule:z,noValidate:z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:z,optimum:A,pattern:null,ping:ee,placeholder:null,playsInline:z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z,referrerPolicy:null,rel:ee,required:z,reversed:z,rows:A,rowSpan:A,sandbox:ee,scope:null,scoped:z,seamless:z,selected:z,shadowRootClonable:z,shadowRootCustomElementRegistry:z,shadowRootDelegatesFocus:z,shadowRootMode:null,shadowRootSerializable:z,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:fe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:z,useMap:null,value:fe,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ee,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z,declare:z,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:z,noHref:z,noShade:z,noWrap:z,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:fe,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:z,disablePictureInPicture:z,disableRemotePlayback:z,exportParts:Ft,part:ee,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:$s});p();var Cp=lt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:We,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:ee,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:z,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ft,g2:Ft,glyphName:Ft,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ee,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ls});p();var wl=lt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});p();var kl=lt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$s});p();var Sl=lt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});p();var ix=/[A-Z]/g,_p=/-[a-z]/g,ax=/^data[-\w.:]+$/i;function Tl(e,t){let n=io(t),r=t,o=Ee;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ax.test(t)){if(t.charAt(4)==="-"){let s=t.slice(5).replace(_p,cx);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{let s=t.slice(4);if(!_p.test(s)){let i=s.replace(ix,lx);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=An}return new o(r,t)}function lx(e){return"-"+e.toLowerCase()}function cx(e){return e.charAt(1).toUpperCase()}var vp=yl([xl,Tp,wl,kl,Sl],"html"),Os=yl([xl,Cp,wl,kl,Sl],"svg");p();p();var Rp={}.hasOwnProperty;function Ap(e,t){let n=t||{};function r(o,...s){let i=r.invalid,a=r.handlers;if(o&&Rp.call(o,e)){let l=String(o[e]);i=Rp.call(a,l)?a[l]:r.unknown}if(i)return i.call(this,o,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}p();p();p();var ux=/["&'<>`]/g,dx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,px=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,fx=/[|\\{}()[\]^$+*?.]/g,Ep=new WeakMap;function Ip(e,t){if(e=e.replace(t.subset?mx(t.subset):ux,r),t.subset||t.escapeOnly)return e;return e.replace(dx,n).replace(px,r);function n(o,s,i){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,i.charCodeAt(s+2),t)}function r(o,s,i){return t.format(o.charCodeAt(0),i.charCodeAt(s+1),t)}}function mx(e){let t=Ep.get(e);return t||(t=hx(e),Ep.set(e,t)),t}function hx(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(fx,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}p();p();var gx=/[\dA-Fa-f]/;function Pp(e,t,n){let r="&#x"+e.toString(16).toUpperCase();return n&&t&&!gx.test(String.fromCharCode(t))?r:r+";"}p();var yx=/\d/;function Lp(e,t,n){let r="&#"+String(e);return n&&t&&!yx.test(String.fromCharCode(t))?r:r+";"}p();p();var $p=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];p();var Ds={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};p();var Op=["cent","copy","divide","gt","lt","not","para","times"];var Dp={}.hasOwnProperty,Cl={},Ns;for(Ns in Ds)Dp.call(Ds,Ns)&&(Cl[Ds[Ns]]=Ns);var bx=/[^\dA-Za-z]/;function Np(e,t,n,r){let o=String.fromCharCode(e);if(Dp.call(Cl,o)){let s=Cl[o],i="&"+s;return n&&$p.includes(s)&&!Op.includes(s)&&(!r||t&&t!==61&&bx.test(String.fromCharCode(t)))?i:i+";"}return""}function Mp(e,t,n){let r=Pp(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=Np(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){let s=Lp(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Gt(e,t){return Ip(e,Object.assign({format:Mp},t))}var xx=/^>|^->|<!--|-->|--!>|<!-$/g,wx=[">"],kx=["<",">"];function Bp(e,t,n,r){return r.settings.bogusComments?"<?"+Gt(e.value,Object.assign({},r.settings.characterReferences,{subset:wx}))+">":"<!--"+e.value.replace(xx,o)+"-->";function o(s){return Gt(s,Object.assign({},r.settings.characterReferences,{subset:kx}))}}p();function Fp(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}p();p();function _l(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}p();function Gp(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}p();function jp(e){return e.join(" ").trim()}p();p();p();var Sx=/[ \t\n\f\r]/g;function En(e){return typeof e=="object"?e.type==="text"?Up(e.value):!1:Up(e)}function Up(e){return e.replace(Sx,"")===""}p();var ye=Wp(1),vl=Wp(-1),Tx=[];function Wp(e){return t;function t(n,r,o){let s=n?n.children:Tx,i=(r||0)+e,a=s[i];if(!o)for(;a&&En(a);)i+=e,a=s[i];return a}}p();var Cx={}.hasOwnProperty;function Ms(e){return t;function t(n,r,o){return Cx.call(e,n.tagName)&&e[n.tagName](n,r,o)}}var lo=Ms({body:vx,caption:Rl,colgroup:Rl,dd:Ix,dt:Ex,head:Rl,html:_x,li:Ax,optgroup:Px,option:Lx,p:Rx,rp:Hp,rt:Hp,tbody:Ox,td:Vp,tfoot:Dx,th:Vp,thead:$x,tr:Nx});function Rl(e,t,n){let r=ye(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&En(r.value.charAt(0)))}function _x(e,t,n){let r=ye(n,t);return!r||r.type!=="comment"}function vx(e,t,n){let r=ye(n,t);return!r||r.type!=="comment"}function Rx(e,t,n){let r=ye(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Ax(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Ex(e,t,n){let r=ye(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Ix(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Hp(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Px(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Lx(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function $x(e,t,n){let r=ye(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Ox(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Dx(e,t,n){return!ye(n,t)}function Nx(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Vp(e,t,n){let r=ye(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}p();var zp=Ms({body:Fx,colgroup:Gx,head:Bx,html:Mx,tbody:jx});function Mx(e){let t=ye(e,-1);return!t||t.type!=="comment"}function Bx(e){let t=new Set;for(let r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}let n=e.children[0];return!n||n.type==="element"}function Fx(e){let t=ye(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&En(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Gx(e,t,n){let r=vl(n,t),o=ye(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&lo(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function jx(e,t,n){let r=vl(n,t),o=ye(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&lo(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}var Bs={name:[[`
27
27
  \f\r &/=>`.split(""),`
28
28
  \f\r "&'/=>\``.split("")],[`\0
29
29
  \f\r "&'/<=>`.split(""),`\0
@@ -173,7 +173,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[dr(e),e])),C0=new Map([["s",_e(383)],[_e(383
173
173
  ]`:`(?>\r
174
174
  ?|[
175
175
  \v\f\x85\u2028\u2029])`),t));else if(l==="posix")if(!o&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let d={graph:"!-~",print:" -~"}[u];c&&(d=`\0-${_e(d.codePointAt(0)-1)}${_e(d.codePointAt(2)+1)}-\u{10FFFF}`),n(be(Vt(`[${d}]`),t))}else n(be(Zl(Vt(R0.get(u)),c),t));else if(l==="property")ec.has(dr(u))||(e.key="sc");else if(l==="space")n(ln(Ln("space",{negate:c}),t));else if(l==="word")n(be(Zl(Vt(Ht),c),t));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:o,removeAllPrevSiblings:s,removeAllNextSiblings:i}){let{kind:a,flags:l}=e;if(a==="flags")if(!l.enable&&!l.disable)r();else{let c=Qe({flags:l});c.body[0].body=i(),o(be(c,t),{traverse:!0})}else if(a==="keep"){let c=n.body[0],d=n.body.length===1&&zs(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(t.parent!==d||d.body.length>1)throw new Error(X`Uses "\K" in a way that's unsupported`);let m=sn({behind:!0});m.body[0].body=s(),o(be(m,t))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r==="fail")n(be(sn({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){let t=Qe();t.body[0].body.push(e.body),e.body=be(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,o=!1;for(let s of e.body)if(s.body.length===1&&s.body[0].kind==="search_start")s.body.pop();else{let i=Zf(s.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):o=!0}r&&!o&&n.forEach(s=>t.add(s))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(X`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!Jl(n)&&(n=Xl(n,t),e.ref=n)}},P0={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:o}=e;r||n.set(e,[...t.get(o).map(({node:s})=>s)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:o,groupsByName:s,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){let c=o.get(e);if(c&&a.has(e.number)){let d=ln(Gf(e.number),t);l.set(d,a.get(e.number)),n(d);return}a.set(e.number,e),i.set(e.number,[]),e.name&&yo(i,e.name,[]);let u=i.get(e.name??e.number);for(let d=0;d<u.length;d++){let m=u[d];if(c===m.node||c&&c===m.origin||e===m.origin){u.splice(d,1);break}}if(i.get(e.number).push({node:e,origin:c}),e.name&&i.get(e.name).push({node:e,origin:c}),e.name){let d=yo(s,e.name,new Map),m=!1;if(c)m=!0;else for(let h of d.values())if(!h.hasDuplicateNameToRemove){m=!0;break}s.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:m})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Qs(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:o,ref:s}=e;if(o){let u=t;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===s||u.number===s)););r.reffedNodesByReferencer.set(e,u);return}let i=r.subroutineRefMap.get(s),a=s===0,l=a?Gf(0):Kf(i,r.groupOriginByCopy,null),c=l;if(!a){let u=Xf(D0(i,m=>m.type==="Group"&&!!m.flags)),d=u?Qs(r.globalFlags,u):r.globalFlags;$0(d,r.currentFlags)||(c=Qe({flags:N0(d)}),c.body[0].body.push(l))}n(be(c,t),{traverse:!a})}},L0={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let s=r.reffedNodesByReferencer.get(e).filter(i=>O0(i,e));if(!s.length)n(be(sn({negate:!0}),t));else if(s.length>1){let i=Qe({atomic:!0,body:s.reverse().map(a=>Wt({body:[qs(a.number)]}))});n(be(i,t))}else e.ref=s[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){let o=Fl();e.body.at(-1).body.push(o)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function qf(e){$n(e,{"*"({node:t,parent:n}){t.parent=n}})}function $0(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function O0(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;let r=Jf(n.parent);for(let o of r){if(o===n)break;if(o===e||Yf(o,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Kf(e,t,n,r){let o=Array.isArray(e)?[]:{};for(let[s,i]of Object.entries(e))s==="parent"?o.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?o[s]=Kf(i,t,o,n):(s==="type"&&i==="CapturingGroup"&&t.set(o,t.get(e)??e),o[s]=i);return o}function Gf(e){let t=jl(e);return t.isRecursive=!0,t}function D0(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Xl(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Xf(e){let t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(o=>{r.enable?.[o]&&(delete n.disable[o],n.enable[o]=!0),r.disable?.[o]&&(n.disable[o]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function N0({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Jf(e){if(!e)throw new Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Zf(e){let t=e.find(n=>n.kind==="search_start"||F0(n,{negate:!1})||!M0(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){let n=[];for(let r of t.body){let o=Zf(r.body);if(!o)return null;Array.isArray(o)?n.push(...o):n.push(o)}return n}return null}function Yf(e,t){let n=Jf(e)??[];for(let r of n)if(r===t||Yf(r,t))return!0;return!1}function M0({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function B0(e){let t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function F0(e,t){let n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&zs(e.body[0],{type:"Assertion",kind:"search_start"})}function Jl(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Vt(e,t){let r=Ks(e,{...t,unicodePropertyMap:ec}).body;return r.length>1||r[0].body.length>1?Qe({body:r}):r[0].body[0]}function Zl(e,t){return e.negate=t,e}function ln(e,t){return e.parent=t,e}function be(e,t){return qf(e),e.parent=t,e}function G0(e,t){let n=Hf(t),r=Yl(n.target,"ES2024"),o=Yl(n.target,"ES2025"),s=n.rules.recursionLimit;if(!Number.isInteger(s)||s<2||s>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!o){let h=[e.flags.ignoreCase];$n(e,j0,{getCurrentModI:()=>h.at(-1),popModI(){h.pop()},pushModI(f){h.push(f)},setHasCasedChar(){h.at(-1)?i=!0:a=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!a)},c=e,u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:s,useAppliedIgnoreCase:!!(!o&&i&&a),useFlagMods:o,useFlagV:r,verbose:n.verbose};function d(h){return u.lastNode=c,c=h,w0(U0[h.type],`Unexpected node type "${h.type}"`)(h,u,d)}let m={pattern:e.body.map(d).join("|"),flags:d(e.flags),options:{...e.options}};return r||(delete m.options.force.v,m.options.disable.v=!0,m.options.unicodeSetsPlugin=null),m._captureTransfers=new Map,m._hiddenCaptures=[],u.captureMap.forEach((h,f)=>{h.hidden&&m._hiddenCaptures.push(f),h.transferTo&&yo(m._captureTransfers,h.transferTo,[]).push(f)}),m}var j0={"*":{enter({node:e},t){if(Uf(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Qs({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Uf(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){tc(_e(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Qf(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&zf.has(e.value)&&t.setHasCasedChar()}},U0={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?X`\B`:X`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){let{body:r,name:o,number:s}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,s>a.number&&(i.transferTo=a.number)),t.captureMap.set(s,i),`(${o?`?<${o}>`:""}${r.map(n).join("|")})`},Character({value:e},t){let n=_e(e),r=fr(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&tc(n)){let o=Vf(n);return t.inCharClass?o.join(""):o.length>1?`[${o.join("")}]`:o[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:o,parent:s}=e,{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ht.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(Wf)&&(i=[ur(45),...i.filter(c=>!Wf(c))]);let a=()=>`[${o?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ht.bugNestedClassIgnoresNegation)&&!o){let u=i.filter(d=>d.type==="CharacterClass"&&d.kind==="union"&&d.negate);if(u.length){let d=Qe(),m=d.body[0];return d.parent=s,m.parent=d,i=i.filter(h=>!u.includes(h)),e.body=i,i.length?(e.parent=m,m.body.push(e)):d.body.pop(),u.forEach(h=>{let f=Wt({body:[h]});h.parent=f,f.parent=d,d.body.push(f)}),n(d)}}t.inCharClass=!0;let c=a();return t.inCharClass=!1,c}let l=i[0];if(r==="union"&&!o&&l&&((!t.useFlagV||!t.verbose)&&s.kind==="union"&&!(ht.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&s.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&s.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,o={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},s=fr(n,o),i=fr(r,o),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let l=Qf(e);q0(l).forEach(u=>{a.add(Array.isArray(u)?`${fr(u[0],o)}-${fr(u[1],o)}`:fr(u,o))})}return`${s}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},o){if(e==="dot")return o.currentFlags.dotAll?o.appliedGlobalFlags.dotAll||o.useFlagMods?".":"[^]":X`[^\n]`;if(e==="digit")return t?X`\D`:X`\d`;if(e==="property"){if(o.useAppliedIgnoreCase&&o.currentFlags.ignoreCase&&zf.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?X`\P`:X`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?X`\W`:X`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},o,s){let i=o.currentFlags;n&&(o.currentFlags=Qs(i,n));let a=t.map(s).join("|"),l=!o.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!o.useFlagMods||!n)?a:`(?${K0(e,n,o.useFlagMods)}${a})`;return o.currentFlags=i,l},LookaroundAssertion({body:e,kind:t,negate:n},r,o){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(o).join("|")})`},Quantifier(e,t,n){return n(e.body)+X0(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");let r=n.recursionLimit;return t===0?`(?R=${r})`:X`\g<${t}&R=${r}>`}},W0=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),H0=new Set(["-","\\","]","^","["]),V0=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),jf=new Map([[9,X`\t`],[10,X`\n`],[11,X`\v`],[12,X`\f`],[13,X`\r`],[8232,X`\u2028`],[8233,X`\u2029`],[65279,X`\uFEFF`]]),z0=new RegExp("^\\p{Cased}$","u");function tc(e){return z0.test(e)}function Qf(e,t){let n=!!t?.firstOnly,r=e.min.value,o=e.max.value,s=[];if(r<65&&(o===65535||o>=131071)||r===65536&&o>=131071)return s;for(let i=r;i<=o;i++){let a=_e(i);if(!tc(a))continue;let l=Vf(a).filter(c=>{let u=c.codePointAt(0);return u<r||u>o});if(l.length&&(s.push(...l),n))break}return s}function fr(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(jf.has(e))return jf.get(e);if(e<32||e>126&&e<160||e>262143||t&&J0(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let o=n?r?V0:H0:W0,s=_e(e);return(o.has(s)?"\\":"")+s}function q0(e){let t=e.map(o=>o.codePointAt(0)).sort((o,s)=>o-s),n=[],r=null;for(let o=0;o<t.length;o++)t[o+1]===t[o]+1?r??=t[o]:r===null?n.push(t[o]):(n.push([r,t[o]]),r=null);return n}function K0(e,t,n){if(e)return">";let r="";if(t&&n){let{enable:o,disable:s}=t;r=(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")+(s?"-":"")+(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")}return`${r}:`}function X0({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function Uf({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function J0(e){return e>47&&e<58}function Wf({type:e,value:t}){return e==="Character"&&t===45}var Z0=class Ql extends RegExp{#e=new Map;#t=null;#r;#o=null;#n=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,n,r){let o=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");let s=t;super(s,n),this.#r=s.source,s instanceof Ql&&(this.#e=s.#e,this.#o=s.#o,this.#n=s.#n,this.rawOptions=s.rawOptions)}else{let s={hiddenCaptures:[],strategy:null,transfers:[],...r};super(o?"":t,n),this.#r=t,this.#e=Q0(s.hiddenCaptures,s.transfers),this.#n=s.strategy,this.rawOptions=r??{}}o||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:o,...s}=this.rawOptions;this.#t=new Ql(this.#r,this.flags,s)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#n==="clip_search"&&n&&r){this.lastIndex=0;let o=this.#a(t.slice(r));return o&&(Y0(o,r,t,this.hasIndices),this.lastIndex+=r),o}return this.#a(t)}#a(t){this.#t.lastIndex=this.lastIndex;let n=super.exec.call(this.#t,t);if(this.lastIndex=this.#t.lastIndex,!n||!this.#e.size)return n;let r=[...n];n.length=1;let o;this.hasIndices&&(o=[...n.indices],n.indices.length=1);let s=[0];for(let i=1;i<r.length;i++){let{hidden:a,transferTo:l}=this.#e.get(i)??{};if(a?s.push(null):(s.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(o[i])),l&&r[i]!==void 0){let c=s[l];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=o[i]),n.groups){this.#o||(this.#o=ek(this.source));let u=this.#o.get(l);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=o[i]))}}}return n}};function Y0(e,t,n,r){if(e.index+=t,e.input=n,r){let o=e.indices;for(let i=0;i<o.length;i++){let a=o[i];a&&(o[i]=[a[0]+t,a[1]+t])}let s=o.groups;s&&Object.keys(s).forEach(i=>{let a=s[i];a&&(s[i]=[a[0]+t,a[1]+t])})}}function Q0(e,t){let n=new Map;for(let r of e)n.set(r,{hidden:!0});for(let[r,o]of t)for(let s of o)yo(n,s,{}).transferTo=r;return n}function ek(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,o=0,s;for(;s=t.exec(e);){let{0:i,groups:{capture:a,name:l}}=s;i==="["?r++:r?i==="]"&&r--:a&&(o++,l&&n.set(o,l))}return n}function em(e,t){let n=tk(e,t);return n.options?new Z0(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function tk(e,t){let n=Hf(t),r=Ks(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:ec}),o=E0(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),s=G0(o,n),i=Bf(s.pattern,{captureTransfers:s._captureTransfers,hiddenCaptures:s._hiddenCaptures,mode:"external"}),a=Vl(i.pattern),l=Hl(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${s.flags}${s.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{let u=l.hiddenCaptures.sort((f,g)=>f-g),d=Array.from(l.captureTransfers),m=o._strategy,h=c.pattern.length>=n.lazyCompileLength;(u.length||d.length||m||h)&&(c.options={...u.length&&{hiddenCaptures:u},...d.length&&{transfers:d},...m&&{strategy:m},...h&&{lazyCompile:h}})}return c}function ti(e,t){return em(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function nc(e={}){let t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>ti(n,{target:t.target}),{createScanner(n){return new lf(n,t)},createString(n){return{content:n}}}}Ts(sr({bundledLanguages:()=>Yr,bundledLanguagesAlias:()=>Zr,bundledLanguagesBase:()=>Jr,bundledLanguagesInfo:()=>ir,bundledThemes:()=>eo,bundledThemesInfo:()=>Qr,codeToHast:()=>$l,codeToHtml:()=>Ll,codeToTokens:()=>Ol,codeToTokensBase:()=>co,codeToTokensWithThemes:()=>Dl,createHighlighter:()=>Hs,createJavaScriptRegexEngine:()=>nc,createOnigurumaEngine:()=>al,defaultJavaScriptRegexConstructor:()=>ti,getLastGrammarState:()=>Nl,getSingletonHighlighter:()=>uo,loadWasm:()=>Rs}),af);var nk=/#/;function rk(e){return e=e.replace(nk,""),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length===4&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),e.length===6&&(e=`${e}ff`),e.toLowerCase()}function ok(e){return e=rk(e),{r:Number.parseInt(e.slice(0,2),16),g:Number.parseInt(e.slice(2,4),16),b:Number.parseInt(e.slice(4,6),16),a:Number.parseInt(e.slice(6,8),16)/255}}function tm(e,t,n){return[e,t,n].map(r=>{let o=r.toString(16);return o.length===1?`0${o}`:o}).join("")}function sk(e,t="dark"){let{r:n,g:r,b:o,a:s}=ok(e);return t==="dark"?tm(n*s,r*s,o*s):tm(n*s+255*(1-s),r*s+255*(1-s),o*s+255*(1-s))}async function rc(e,t,n){let r="",o=await co(e,{lang:t,theme:n}),s=(await uo()).getTheme(n);for(let i of o){for(let a of i){let l=a.content,c=a.color||s.fg;c&&(l=or.hex(sk(c,s.type))(l)),a.fontStyle&&(a.fontStyle&pe.Bold&&(l=or.bold(l)),a.fontStyle&pe.Italic&&(l=or.italic(l)),a.fontStyle&pe.Underline&&(l=or.underline(l)),a.fontStyle&pe.Strikethrough&&(l=or.strikethrough(l))),r+=l}r+=`
176
- `}return r}p();var rm={".ts":"typescript",".tsx":"tsx",".cts":"typescript",".mts":"typescript",".js":"javascript",".jsx":"jsx",".cjs":"javascript",".mjs":"javascript",".vue":"vue",".svelte":"svelte",".astro":"astro",".css":"css",".scss":"scss",".less":"less",".html":"html",".htm":"html",".xml":"xml",".svg":"xml",".json":"json",".jsonc":"json",".md":"markdown",".mdx":"markdown",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".sh":"bash",".bash":"bash",".zsh":"bash",".py":"python",".rb":"ruby",".rs":"rust",".go":"go",".java":"java",".kt":"kotlin",".swift":"swift",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".cs":"csharp",".php":"php",".sql":"sql",".graphql":"graphql",".dockerfile":"dockerfile",".lua":"lua",".r":"r",".dart":"dart",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hs":"haskell",".scala":"scala",".pl":"perl"},nm={Dockerfile:"dockerfile",Makefile:"makefile",Rakefile:"ruby",Gemfile:"ruby",".bashrc":"bash",".zshrc":"bash",".profile":"bash"};function om(e){let t=e.split(/[\\/]/).pop()??"";if(nm[t])return nm[t];let n=t.lastIndexOf(".");if(n<0)return;let r=t.slice(n).toLowerCase();return rm[r]}var i$=new Set(Object.keys(rm));p();function im(e,t){if(!e)return 1e3;let n=e.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return 1e3;let r=n[0],o=t.toLowerCase();if(o===r)return 0;if(o.startsWith(r))return 5;let s=o.indexOf(r);return s>=0?s+10:null}function am(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),o=n.split(/\s+/).filter(Boolean);return o.length===0?!0:o.every(s=>r.includes(s))}function oc(e,t){let n=[];for(let r of t){if(!am(e,r))continue;let o=im(e,r);o!==null&&n.push({path:r,score:o})}return n.sort((r,o)=>r.score-o.score),n}var ni=10;function bo(e,t){let n=e.match(/(?:^|\s)@([^@]*)$/);if(!n)return null;let o=(n[1]??"").toLowerCase().trim();if(!o)return e.startsWith("@")?[...t]:[];let s=oc(o,t);return s.length===0?[]:s[0]?.path.toLowerCase()===o?[]:s.map(i=>i.path)}var sm="\x1B[0m";function lm(e){return e>=4352&&e<=4447||e>=11904&&e<=12350||e>=12353&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=40960&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65376||e>=65504&&e<=65510}function ik(e){let t=0;for(let n=0;n<e.length;){let o=e[n].charCodeAt(0);if(o===27&&n+1<e.length&&e[n+1]==="["){for(n+=2;n<e.length;){let i=e.charCodeAt(n);if(n++,i>=64&&i<=126)break}continue}if(o===27&&n+1<e.length&&e[n+1]==="]"){for(n+=2;n<e.length;){let i=e.charCodeAt(n);if(i===7){n++;break}if(i===27&&n+1<e.length&&e[n+1]==="\\"){n+=2;break}n++}continue}let s=e.codePointAt(n);t+=lm(s)?2:1,n+=s>65535?2:1}return t}function cm(e,t){if(t<=0)return"";if(ik(e)<=t)return e;let r=t-1;if(r<=0)return"\u2026"+sm;let o="",s=0;for(let i=0;i<e.length;){let l=e[i].charCodeAt(0);if(l===27&&i+1<e.length&&e[i+1]==="["){let d=i;for(i+=2;i<e.length;){let m=e.charCodeAt(i);if(i++,m>=64&&m<=126)break}o+=e.slice(d,i);continue}if(l===27&&i+1<e.length&&e[i+1]==="]"){let d=i;for(i+=2;i<e.length;){let m=e.charCodeAt(i);if(m===7){i++;break}if(m===27&&i+1<e.length&&e[i+1]==="\\"){i+=2;break}i++}o+=e.slice(d,i);continue}let c=e.codePointAt(i),u=lm(c)?2:1;if(s+u>r)break;o+=String.fromCodePoint(c),s+=u,i+=c>65535?2:1}return o+"\u2026"+sm}import{jsx as zt,jsxs as ri}from"react/jsx-runtime";var ck="github-dark",uk=512*1024,dm=4e3;var sc="#808080",ic="#ff4444",um=512;async function dk(e,t,n){let{stat:r,readFile:o}=await import("fs/promises"),{join:s}=await import("path"),i=s(t,e),a;try{a=await r(i)}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}if(!a.isFile())return{kind:"error",message:"\u4E0D\u662F\u6587\u4EF6"};try{let f=await(await import("fs/promises")).open(i,"r");try{let g=Buffer.alloc(um),{bytesRead:w}=await f.read(g,0,um,0);for(let x=0;x<w;x++)if(g[x]===0)return{kind:"binary"}}finally{await f.close()}}catch{}let l=a.size>uk,c=l?dm:a.size,u;try{u=(await o(i)).subarray(0,c).toString("utf8")}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}if(n.cancelled)return{kind:"idle"};let d=om(e),m;if(d)try{m=await rc(u,d,ck)}catch(h){return{kind:"error",message:`\u9AD8\u4EAE\u5931\u8D25: ${h instanceof Error?h.message:String(h)}`}}else m=u;return n.cancelled?{kind:"idle"}:{kind:"ready",ansi:m,truncated:l}}function oi({relativePath:e,cwd:t,width:n,maxLines:r}){let[o,s]=lk({kind:"idle"});if(ak(()=>{if(!e){s({kind:"idle"});return}let f={cancelled:!1};return s({kind:"loading"}),dk(e,t,f).then(g=>{f.cancelled||s(g)}),()=>{f.cancelled=!0}},[e,t]),!e)return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:sc,dimColor:!0,children:"\u2190 \u9009\u62E9\u5DE6\u4FA7\u6587\u4EF6\u67E5\u770B\u9AD8\u4EAE\u4EE3\u7801"})});if(o.kind==="loading"||o.kind==="idle")return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:sc,children:"\u2699 \u52A0\u8F7D\u4E2D\u2026"})});if(o.kind==="binary")return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:ic,children:"\u26A0 \u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u652F\u6301\u9884\u89C8"})});if(o.kind==="too-large")return zt(mr,{flexDirection:"column",paddingX:1,children:ri(Dn,{color:ic,children:["\u26A0 \u6587\u4EF6\u8FC7\u5927\uFF08",o.bytes," \u5B57\u8282\uFF09\uFF0C\u4E0D\u652F\u6301\u9884\u89C8"]})});if(o.kind==="error")return zt(mr,{flexDirection:"column",paddingX:1,children:ri(Dn,{color:ic,children:["\u26A0 \u8BFB\u53D6\u5931\u8D25: ",o.message]})});let i=Math.max(n-4,8),a=o.truncated?1:0,l=Math.max(r-a,1),c=o.ansi.split(`
176
+ `}return r}p();var rm={".ts":"typescript",".tsx":"tsx",".cts":"typescript",".mts":"typescript",".js":"javascript",".jsx":"jsx",".cjs":"javascript",".mjs":"javascript",".vue":"vue",".svelte":"svelte",".astro":"astro",".css":"css",".scss":"scss",".less":"less",".html":"html",".htm":"html",".xml":"xml",".svg":"xml",".json":"json",".jsonc":"json",".md":"markdown",".mdx":"markdown",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".sh":"bash",".bash":"bash",".zsh":"bash",".py":"python",".rb":"ruby",".rs":"rust",".go":"go",".java":"java",".kt":"kotlin",".swift":"swift",".c":"c",".h":"c",".cpp":"cpp",".hpp":"cpp",".cs":"csharp",".php":"php",".sql":"sql",".graphql":"graphql",".dockerfile":"dockerfile",".lua":"lua",".r":"r",".dart":"dart",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hs":"haskell",".scala":"scala",".pl":"perl"},nm={Dockerfile:"dockerfile",Makefile:"makefile",Rakefile:"ruby",Gemfile:"ruby",".bashrc":"bash",".zshrc":"bash",".profile":"bash"};function om(e){let t=e.split(/[\\/]/).pop()??"";if(nm[t])return nm[t];let n=t.lastIndexOf(".");if(n<0)return;let r=t.slice(n).toLowerCase();return rm[r]}var l$=new Set(Object.keys(rm));p();function im(e,t){if(!e)return 1e3;let n=e.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return 1e3;let r=n[0],o=t.toLowerCase();if(o===r)return 0;if(o.startsWith(r))return 5;let s=o.indexOf(r);return s>=0?s+10:null}function am(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),o=n.split(/\s+/).filter(Boolean);return o.length===0?!0:o.every(s=>r.includes(s))}function oc(e,t){let n=[];for(let r of t){if(!am(e,r))continue;let o=im(e,r);o!==null&&n.push({path:r,score:o})}return n.sort((r,o)=>r.score-o.score),n}var ni=10;function bo(e,t){let n=e.match(/(?:^|\s)@([^@]*)$/);if(!n)return null;let o=(n[1]??"").toLowerCase().trim();if(!o)return e.startsWith("@")?[...t]:[];let s=oc(o,t);return s.length===0?[]:s[0]?.path.toLowerCase()===o?[]:s.map(i=>i.path)}var sm="\x1B[0m";function lm(e){return e>=4352&&e<=4447||e>=11904&&e<=12350||e>=12353&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=40960&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65376||e>=65504&&e<=65510}function ik(e){let t=0;for(let n=0;n<e.length;){let o=e[n].charCodeAt(0);if(o===27&&n+1<e.length&&e[n+1]==="["){for(n+=2;n<e.length;){let i=e.charCodeAt(n);if(n++,i>=64&&i<=126)break}continue}if(o===27&&n+1<e.length&&e[n+1]==="]"){for(n+=2;n<e.length;){let i=e.charCodeAt(n);if(i===7){n++;break}if(i===27&&n+1<e.length&&e[n+1]==="\\"){n+=2;break}n++}continue}let s=e.codePointAt(n);t+=lm(s)?2:1,n+=s>65535?2:1}return t}function cm(e,t){if(t<=0)return"";if(ik(e)<=t)return e;let r=t-1;if(r<=0)return"\u2026"+sm;let o="",s=0;for(let i=0;i<e.length;){let l=e[i].charCodeAt(0);if(l===27&&i+1<e.length&&e[i+1]==="["){let d=i;for(i+=2;i<e.length;){let m=e.charCodeAt(i);if(i++,m>=64&&m<=126)break}o+=e.slice(d,i);continue}if(l===27&&i+1<e.length&&e[i+1]==="]"){let d=i;for(i+=2;i<e.length;){let m=e.charCodeAt(i);if(m===7){i++;break}if(m===27&&i+1<e.length&&e[i+1]==="\\"){i+=2;break}i++}o+=e.slice(d,i);continue}let c=e.codePointAt(i),u=lm(c)?2:1;if(s+u>r)break;o+=String.fromCodePoint(c),s+=u,i+=c>65535?2:1}return o+"\u2026"+sm}import{jsx as zt,jsxs as ri}from"react/jsx-runtime";var ck="github-dark",uk=512*1024,dm=4e3;var sc="#808080",ic="#ff4444",um=512;async function dk(e,t,n){let{stat:r,readFile:o}=await import("fs/promises"),{join:s}=await import("path"),i=s(t,e),a;try{a=await r(i)}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}if(!a.isFile())return{kind:"error",message:"\u4E0D\u662F\u6587\u4EF6"};try{let f=await(await import("fs/promises")).open(i,"r");try{let g=Buffer.alloc(um),{bytesRead:w}=await f.read(g,0,um,0);for(let x=0;x<w;x++)if(g[x]===0)return{kind:"binary"}}finally{await f.close()}}catch{}let l=a.size>uk,c=l?dm:a.size,u;try{u=(await o(i)).subarray(0,c).toString("utf8")}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}if(n.cancelled)return{kind:"idle"};let d=om(e),m;if(d)try{m=await rc(u,d,ck)}catch(h){return{kind:"error",message:`\u9AD8\u4EAE\u5931\u8D25: ${h instanceof Error?h.message:String(h)}`}}else m=u;return n.cancelled?{kind:"idle"}:{kind:"ready",ansi:m,truncated:l}}function oi({relativePath:e,cwd:t,width:n,maxLines:r}){let[o,s]=lk({kind:"idle"});if(ak(()=>{if(!e){s({kind:"idle"});return}let f={cancelled:!1};return s({kind:"loading"}),dk(e,t,f).then(g=>{f.cancelled||s(g)}),()=>{f.cancelled=!0}},[e,t]),!e)return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:sc,dimColor:!0,children:"\u2190 \u9009\u62E9\u5DE6\u4FA7\u6587\u4EF6\u67E5\u770B\u9AD8\u4EAE\u4EE3\u7801"})});if(o.kind==="loading"||o.kind==="idle")return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:sc,children:"\u2699 \u52A0\u8F7D\u4E2D\u2026"})});if(o.kind==="binary")return zt(mr,{flexDirection:"column",paddingX:1,children:zt(Dn,{color:ic,children:"\u26A0 \u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u652F\u6301\u9884\u89C8"})});if(o.kind==="too-large")return zt(mr,{flexDirection:"column",paddingX:1,children:ri(Dn,{color:ic,children:["\u26A0 \u6587\u4EF6\u8FC7\u5927\uFF08",o.bytes," \u5B57\u8282\uFF09\uFF0C\u4E0D\u652F\u6301\u9884\u89C8"]})});if(o.kind==="error")return zt(mr,{flexDirection:"column",paddingX:1,children:ri(Dn,{color:ic,children:["\u26A0 \u8BFB\u53D6\u5931\u8D25: ",o.message]})});let i=Math.max(n-4,8),a=o.truncated?1:0,l=Math.max(r-a,1),c=o.ansi.split(`
177
177
  `),u=c.length>l,d=u?c.slice(0,Math.max(l-1,0)):c,m=d.map(f=>cm(f,i)).join(`
178
178
  `),h=u&&l>0?`${m}
179
179
  \u2026 \u4EE5\u4E0B ${c.length-d.length} \u884C\u672A\u663E\u793A`:m;return ri(mr,{flexDirection:"column",paddingX:1,children:[o.truncated&&ri(Dn,{color:sc,dimColor:!0,children:["\u26A0 \u6587\u4EF6\u8FC7\u5927\uFF0C\u4EC5\u663E\u793A\u524D ",dm," \u5B57\u8282"]}),zt(Dn,{children:h})]})}import{jsx as Nn,jsxs as un}from"react/jsx-runtime";var pm="#00ff41",gr="#808080",ac=4,mk=60,hk=20;function gk(e,t){return t<=0?"":e.length<=t?e:t<=1?"\u2026":e.slice(0,t-1)+"\u2026"}function lc({files:e,input:t,selectedIndex:n,cwd:r,width:o}){let s=bo(t,e);if(!s||s.length===0)return null;let i=ni,a=Math.max(1,Math.ceil(s.length/i)),[l,c]=fk(0);pk(()=>{c(v=>v<0||v>=s.length?Math.floor(n/i)*i:n<v?Math.max(0,Math.floor(n/i)*i):n>=v+i?Math.floor(n/i)*i:v)},[n,s.length,i]);let u=l,d=s.slice(u,u+i);if(!(o>=mk))return un(cn,{flexDirection:"column",marginLeft:ac,marginTop:1,children:[un(hr,{color:gr,dimColor:!0,children:["\u5339\u914D\u6587\u4EF6\uFF08",s.length,"\uFF09",a>1?` \xB7 ${Math.floor(l/i)+1}/${a}`:""]}),d.map((v,_)=>{let D=u+_===n;return Nn(cn,{children:un(hr,{color:D?pm:gr,children:[D?" \u203A ":" ",v]})},v)})]});let h=o-ac,f=Math.max(Math.floor(h/3),hk),g=Math.max(h-f-1,20),w=10,x=n>=0&&n<s.length?s[n]??null:null,T=Math.max(f-2,4);return un(cn,{flexDirection:"row",paddingLeft:ac,marginTop:1,children:[un(cn,{flexDirection:"column",width:f,flexShrink:0,children:[un(hr,{color:gr,dimColor:!0,children:["\u5339\u914D\u6587\u4EF6\uFF08",s.length,"\uFF09",a>1?` \xB7 ${Math.floor(l/i)+1}/${a}`:""]}),Nn(cn,{flexDirection:"column",marginTop:1,children:d.map((v,_)=>{let D=u+_===n;return un(hr,{color:D?pm:gr,bold:D,children:[D?"\u25B8 ":" ",gk(v,T)]},v)})})]}),Nn(cn,{width:1,flexShrink:0,children:Nn(hr,{color:gr,children:"\u2502"})}),un(cn,{flexDirection:"column",width:g,flexShrink:0,children:[Nn(hr,{color:gr,dimColor:!0,children:x?`\u{1F4C4} ${x}`:"\u{1F4C4} \uFF08\u672A\u9009\u62E9\u6587\u4EF6\uFF09"}),Nn(cn,{flexDirection:"column",marginTop:1,children:Nn(oi,{relativePath:x,cwd:r,width:g,maxLines:w})})]})]})}p();import{Box as Et,Text as Mn,useInput as yk}from"ink";import bk from"ink-text-input";import{useEffect as fm,useMemo as xk,useState as cc}from"react";import{jsx as ut,jsxs as Bn}from"react/jsx-runtime";var wk="#00ff41",xo="#808080",si="#00ffff",It=ni;function mm({files:e,cwd:t,width:n,height:r,onPick:o,onClose:s}){let[i,a]=cc(""),[l,c]=cc(0),u=xk(()=>i.trim()?oc(i,e):[],[i,e]),d=Math.max(1,Math.ceil(u.length/It)),[m,h]=cc(0);fm(()=>{h(0),c(0)},[i]),fm(()=>{h(S=>u.length===0?0:S<0||S>=u.length?Math.floor(l/It)*It:l<S?Math.max(0,Math.floor(l/It)*It):l>=S+It?Math.floor(l/It)*It:S)},[l,u.length]);let f=m,g=u.slice(f,f+It),w=l>=f&&l<f+g.length?l-f:0;yk((S,D)=>{if(D.ctrl&&S==="p"){s();return}if(D.escape){s();return}if(D.upArrow){if(u.length===0)return;c(H=>(H-1+u.length)%u.length);return}if(D.downArrow){if(u.length===0)return;c(H=>(H+1)%u.length);return}if(D.return){let H=u[l];H&&o(H.path);return}},{isActive:!0});let x=Math.max(Math.floor(n/3),24),T=Math.max(n-x-1,20),v=Math.max(r-11,4),_=u[l]?.path??null;return Bn(Et,{flexDirection:"column",height:r,children:[Bn(Et,{flexDirection:"row",borderStyle:"round",borderColor:si,paddingX:1,children:[ut(Mn,{bold:!0,color:si,children:"\u{1F50D} "}),ut(Et,{flexGrow:1,children:ut(bk,{value:i,onChange:a,placeholder:"\u8F93\u5165\u6587\u4EF6\u540D"})})]}),Bn(Et,{flexDirection:"row",flexGrow:1,marginTop:1,children:[Bn(Et,{flexDirection:"column",width:x,borderStyle:"single",borderColor:si,paddingX:1,flexShrink:0,children:[Bn(Mn,{color:xo,dimColor:!0,children:["\u5339\u914D\u6587\u4EF6 (",u.length," \u6761)",d>1?` \xB7 ${Math.floor(m/It)+1}/${d}`:""]}),ut(Et,{flexDirection:"column",marginTop:1,children:g.length===0?ut(Mn,{color:xo,dimColor:!0,children:i.trim()?e.length===0?"\uFF08\u9879\u76EE\u65E0\u6587\u4EF6\uFF09":"\uFF08\u65E0\u5339\u914D\uFF09":"\uFF08\u8F93\u5165\u5173\u952E\u5B57\u5F00\u59CB\u5339\u914D\uFF09"}):g.map((S,D)=>{let H=D===w;return Bn(Mn,{color:H?wk:void 0,bold:H,children:[H?"\u25B8 ":" ",S.path]},S.path)})})]}),ut(Et,{width:1,flexShrink:0,children:ut(Mn,{color:xo,children:"\u2502"})}),Bn(Et,{flexDirection:"column",width:T,borderStyle:"single",borderColor:si,flexShrink:0,children:[ut(Mn,{color:xo,dimColor:!0,children:_?`\u{1F4C4} ${_}`:"\u{1F4C4} \uFF08\u672A\u9009\u62E9\u6587\u4EF6\uFF09"}),ut(Et,{flexDirection:"column",marginTop:1,children:ut(oi,{relativePath:_,cwd:t,width:T,maxLines:v})})]})]}),ut(Et,{marginTop:1,children:ut(Mn,{color:xo,dimColor:!0,children:"\u2191\u2193 \u9009\u62E9 \xB7 Enter \u56DE\u586B\u8DEF\u5F84\u5230\u8F93\u5165\u6846 \xB7 Esc / Ctrl+P \u5173\u95ED"})})]})}p();import{Text as Fn,useInput as kk}from"ink";import{jsx as wo,jsxs as hm}from"react/jsx-runtime";function gm({value:e,onChange:t,onSubmit:n,placeholder:r="",focus:o=!0}){if(kk((s,i)=>{if(o&&!(i.upArrow||i.downArrow||i.leftArrow||i.rightArrow)&&!(i.pageDown||i.pageUp||i.home||i.end)){if(i.return){n?.(e);return}if(!i.escape&&!i.tab&&!(i.shift&&i.tab)&&!i.ctrl){if(i.backspace||i.delete){t(e.slice(0,-1));return}s&&t(e+s)}}},{isActive:o}),!o)return!e&&r?wo(Fn,{dimColor:!0,children:r}):wo(Fn,{children:e});if(!e&&r){let s=r[0],i=r.slice(1);return hm(Fn,{children:[wo(Fn,{inverse:!0,children:s}),wo(Fn,{dimColor:!0,children:i})]})}return hm(Fn,{children:[e,wo(Fn,{inverse:!0,children:" "})]})}p();p();function uc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Sk(e){return e.replace(/<skill_content/g,"&lt;skill_content").replace(/<\/skill_content/g,"&lt;/skill_content")}function ii(e,t){let n=uc(e.name),r=uc(e.source),o=uc(e.directoryPath),s=Sk(t.trim());return`<skill_content name="${n}">
@@ -186,7 +186,7 @@ ${s}
186
186
  `}var Tk=/^\/(\S+)(?:\s+(.*))?$/;async function ym(e,t){let n=Tk.exec(e);if(!n)return{kind:"no-match"};let r=n[1],o=(n[2]??"").trim(),s=t.find(l=>l.name===r);if(!s)return{kind:"no-match"};let i;try{i=await as(s.skillFilePath)}catch(l){return{kind:"error",message:l instanceof Error?l.message:String(l)}}let a=ii(s,i);return{kind:"text",text:o?`${a}
187
187
 
188
188
  ${o}`:a}}p();import{Box as dc,Text as Gn}from"ink";import Ck from"ink-spinner";import{jsx as Pt,jsxs as xm}from"react/jsx-runtime";function bm(e){switch(e){case"pending":return"\u2610";case"done":return"\u2611";case"failed":return"\u2717";case"skipped":return"\u2298";case"running":return"\u25B6"}}function _k({status:e}){return e==="running"?Pt(Gn,{color:"cyan",children:Pt(Ck,{type:"dots"})}):e==="done"?Pt(Gn,{color:"green",children:"\u2705"}):e==="failed"?Pt(Gn,{color:"red",children:bm(e)}):Pt(Gn,{dimColor:!0,children:bm(e)})}function pc({items:e}){return e.length===0?null:xm(dc,{flexDirection:"column",marginTop:1,children:[Pt(dc,{children:Pt(Gn,{dimColor:!0,children:"\u{1F527} \u4EFB\u52A1\u8FDB\u5EA6"})}),e.map(t=>xm(dc,{children:[Pt(Gn,{dimColor:!0,children:" "}),Pt(_k,{status:t.status}),Pt(Gn,{dimColor:!0,children:` ${t.content}`})]},t.id))]})}p();import{Box as Ge,Text as Te}from"ink";import vk from"ink-spinner";import{useMemo as wm}from"react";import{Fragment as $k,jsx as xe,jsxs as ve}from"react/jsx-runtime";function Rk(e){if(e.phase==="idle")return 0;if(e.phase==="done"||e.phase==="error")return 100;let t=e.progress;if(!t)return 5;if(t.type==="start")return 10;if(t.type==="summary_delta"){let n=Math.min(t.totalSoFar.length/800,1);return Math.min(10+n*80,90)}return t.type==="fallback"?95:5}function Ak(e){if(e.phase==="error")return{icon:"\u2717",text:"\u538B\u7F29\u51FA\u9519",color:"#ff6347"};if(e.phase==="done")return e.strategy==="fallback"?{icon:"\u2714",text:"\u538B\u7F29\u5B8C\u6210\uFF08\u672C\u5730\u515C\u5E95\uFF09",color:"#ff9800"}:{icon:"\u2714",text:"\u538B\u7F29\u5B8C\u6210",color:"#00ff41"};let t=e.progress;return t?t.type==="start"?{icon:"\u280B",text:`\u51C6\u5907\u6458\u8981 ${t.droppedTurns} \u4E2A\u65E7\u56DE\u5408...`,color:"#00ffff"}:t.type==="summary_delta"?{icon:"\u280B",text:"\u8C03\u7528 LLM \u751F\u6210\u6458\u8981...",color:"#00ffff"}:t.type==="fallback"?{icon:"\u26A0",text:`LLM \u6458\u8981\u5931\u8D25\uFF0C\u4F7F\u7528\u672C\u5730\u515C\u5E95\uFF1A${t.reason}`,color:"#ff9800"}:{icon:"\u280B",text:"\u538B\u7F29\u4E2D...",color:"#00ffff"}:{icon:"\u280B",text:"\u51C6\u5907\u538B\u7F29...",color:"#00ffff"}}function Ek({percent:e,color:t}){let r=Math.round(e/100*24),o=24-r;return ve(Te,{children:[xe(Te,{color:t,children:"\u2588".repeat(r)}),xe(Te,{color:"#444444",children:"\u2591".repeat(o)}),ve(Te,{color:t,children:[" ",e.toFixed(0),"%"]})]})}function Ik({state:e}){let t=(()=>{if(e.phase==="idle")return 0;if(e.phase==="error"){let o=e.progress;return o?.type==="summary_delta"||o?.type==="start"?1:2}if(e.phase==="done")return 3;let r=e.progress;return!r||r.type==="start"?0:r.type==="summary_delta"?1:(r.type==="fallback",2)})(),n=["\u542F\u52A8","LLM \u6458\u8981","\u5E94\u7528\u538B\u7F29","\u5B8C\u6210"];return xe(Ge,{children:n.map((r,o)=>{let s=o===t,i=o<t;return ve(Ge,{marginRight:1,children:[ve(Te,{color:i?"#00ff41":s?"#00ffff":"#444444",children:[i?"\u2713":s?"\u25B8":"\xB7"," ",r]}),o<n.length-1&&xe(Te,{color:"#444444",children:" \u2192 "})]},r)})})}function Pk({text:e,contentWidth:t}){let r=Math.max(t-6,20);if(!e)return xe(Te,{dimColor:!0,children:" (\u7B49\u5F85 LLM \u8F93\u51FA...)"});let s=Lk(e,r).slice(-4);return xe(Ge,{flexDirection:"column",children:s.map((i,a)=>ve(Te,{dimColor:!0,children:[" ",i]},a))})}function Lk(e,t){if(e==="")return[];if(t<=0)return[e];let n=[];for(let r of e.split(`
189
- `)){if(r.length===0){n.push("");continue}let o="",s=0;for(let i of r){let l=i.codePointAt(0)>11904?2:1;s+l>t&&o.length>0?(n.push(o),o=i,s=l):(o+=i,s+=l)}o.length>0&&n.push(o)}return n}function km(e){return e.toLocaleString()}function fc({state:e,contentWidth:t}){let n=wm(()=>Rk(e),[e]),r=wm(()=>Ak(e),[e]),o=e.progress?.type==="summary_delta"?e.progress.totalSoFar:e.progress?.type==="fallback"?e.progress.fallbackSummary:(e.phase==="done"&&e.strategy==="summary",""),s=e.phase==="done"&&e.strategy==="summary"?e.progress?.type==="summary_delta"?e.progress.totalSoFar:"":o,i=e.phase==="error"?"#ff6347":"#00ffff";return xe(Ge,{flexDirection:"column",marginTop:1,children:ve(Ge,{flexDirection:"row",children:[xe(Ge,{width:1,backgroundColor:"#9b59b6",flexShrink:0}),ve(Ge,{flexGrow:1,paddingLeft:1,flexDirection:"column",children:[ve(Ge,{children:[xe(Te,{bold:!0,color:i,children:"\u{1F5DC} \u4E0A\u4E0B\u6587\u538B\u7F29"}),xe(Ge,{flexGrow:1}),e.phase==="running"&&ve(Te,{color:r.color,children:[xe(vk,{type:"dots"})," ",r.text]}),e.phase==="done"&&ve(Te,{color:r.color,children:[r.icon," ",r.text]}),e.phase==="error"&&ve(Te,{color:r.color,children:[r.icon," ",r.text]})]}),ve(Ge,{marginTop:1,children:[xe(Te,{color:"#808080",children:"\u8FDB\u5EA6: "}),xe(Ek,{percent:n,color:e.phase==="error"?"#ff6347":r.color})]}),xe(Ge,{marginTop:1,children:xe(Ik,{state:e})}),(e.beforeTokens!==void 0||e.droppedTurns!==void 0)&&ve(Ge,{marginTop:1,flexDirection:"column",children:[e.droppedTurns!==void 0&&ve(Te,{color:"#00ff41",children:["\u{1F4CA} \u56DE\u5408: ",e.droppedTurns," \u6298\u53E0 \u2192 ",e.keptTurns??0," \u4FDD\u7559"]}),e.beforeTokens!==void 0&&ve(Te,{color:"#ff9800",children:["\u{1F4E6} token: ",km(e.beforeTokens),e.afterTokens!==void 0&&ve($k,{children:[" \u2192 ",xe(Te,{color:"#00ff41",bold:!0,children:km(e.afterTokens)}),ve(Te,{color:"#808080",children:[" (\u8282\u7701 ",((e.beforeTokens-e.afterTokens)/Math.max(e.beforeTokens,1)*100).toFixed(1),"%)"]})]})]})]}),(e.phase==="running"||e.phase==="done")&&s&&ve(Ge,{marginTop:1,flexDirection:"column",children:[xe(Te,{color:"#808080",children:"\u2504\u2504\u2504 LLM \u6458\u8981\u9884\u89C8 \u2504\u2504\u2504"}),xe(Pk,{text:s,contentWidth:t})]}),e.phase==="done"&&e.strategy==="fallback"&&xe(Ge,{marginTop:1,children:xe(Te,{color:"#ff9800",children:"\u26A0 LLM \u6458\u8981\u5931\u8D25\uFF0C\u4F7F\u7528\u672C\u5730\u515C\u5E95\u6458\u8981\u3002\u538B\u7F29\u5DF2\u751F\u6548\u4F46\u6458\u8981\u8D28\u91CF\u8F83\u4F4E\u3002"})}),e.phase==="error"&&e.errorMessage&&xe(Ge,{marginTop:1,children:ve(Te,{color:"#ff6347",children:["\u26A0 ",e.errorMessage]})})]})]})})}p();var Sm={name:"dskcode",version:"0.1.46",keywords:["cli","ink","commander","deepseek","asciichart"],description:"A DeepSeek-native AI coding agent for your terminal",type:"module",bin:{dskcode:"dist/index.js"},exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["dist","README.md","LICENSE","!dist/**/*.map"],scripts:{dev:"tsup --watch",debug:"npm run build && node dist/index.js",build:"tsup",obfuscate:"node scripts/obfuscate.mjs","build:clean":"node scripts/clean-sourcemaps.mjs","type-check":"tsc --noEmit",lint:"oxlint src/ tests/","lint:fix":"oxlint --fix src/ tests/",format:"prettier --write src/ tests/","format:check":"prettier --check src/ tests/",test:"vitest run --exclude 'tests/checkpoint.test.ts' --exclude 'tests/session-rewind.test.ts'","test:checkpoint":"vitest run tests/checkpoint.test.ts tests/session-rewind.test.ts",prepublishOnly:"npm run build && npm run test && npm run build:clean"},dependencies:{asciichart:"^1.5.25",chalk:"^5.6.2",commander:"^13.1.0",handlebars:"^4.7.9",ink:"^7.1.0","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0",react:"^19.2.7",ws:"^8.21.0",yaml:"^2.6.0",zod:"^3.25.76"},devDependencies:{"@shikijs/cli":"^4.3.1","@types/node":"^22.14.0","@types/react":"^19.2.17","@types/ws":"^8.18.1","javascript-obfuscator":"^4.1.1",oxlint:"^1.71.0","oxlint-tsgolint":"^0.23.0",prettier:"^3.5.3",tsup:"^8.4.0",typescript:"^5.8.3",vitest:"^3.1.1"},engines:{node:">=22.0.0"},license:"MIT"};var ko=Sm.version;p();p();var ai=class{#e=new Map;#t=new Map;register(t,n){this.#e.set(t,n)}get(t,n){if(!xa(n.model))throw new wa(n.model);let r=`${t}:${n.baseUrl}:${n.model}`,o=this.#t.get(r);if(o)return o;let s=this.#e.get(t);if(!s){let a=[...this.#e.keys()].join(", ");throw new Error(`\u672A\u6CE8\u518C\u7684 Provider: "${t}"\u3002\u53EF\u7528: ${a}`)}let i=s(n);return this.#t.set(r,i),i}list(){return[...this.#e.keys()]}clear(){this.#t.clear()}},mc=new ai;mc.register("deepseek",e=>new ka({apiKey:e.apiKey,baseUrl:e.baseUrl,model:e.model}));function hc(e){return mc.get(e.name,e)}p();p();import _m from"handlebars";var Tm=`\u4F60\u662F dskcode\uFF0C\u4E00\u4E2A\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\uFF0C\u8FD0\u884C\u5728\u7528\u6237\u7EC8\u7AEF\u4E2D\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u5F00\u53D1\u8005\u7F16\u5199\u3001\u7406\u89E3\u3001\u8C03\u8BD5\u548C\u91CD\u6784\u4EE3\u7801\u3002\r
189
+ `)){if(r.length===0){n.push("");continue}let o="",s=0;for(let i of r){let l=i.codePointAt(0)>11904?2:1;s+l>t&&o.length>0?(n.push(o),o=i,s=l):(o+=i,s+=l)}o.length>0&&n.push(o)}return n}function km(e){return e.toLocaleString()}function fc({state:e,contentWidth:t}){let n=wm(()=>Rk(e),[e]),r=wm(()=>Ak(e),[e]),o=e.progress?.type==="summary_delta"?e.progress.totalSoFar:e.progress?.type==="fallback"?e.progress.fallbackSummary:(e.phase==="done"&&e.strategy==="summary",""),s=e.phase==="done"&&e.strategy==="summary"?e.progress?.type==="summary_delta"?e.progress.totalSoFar:"":o,i=e.phase==="error"?"#ff6347":"#00ffff";return xe(Ge,{flexDirection:"column",marginTop:1,children:ve(Ge,{flexDirection:"row",children:[xe(Ge,{width:1,backgroundColor:"#9b59b6",flexShrink:0}),ve(Ge,{flexGrow:1,paddingLeft:1,flexDirection:"column",children:[ve(Ge,{children:[xe(Te,{bold:!0,color:i,children:"\u{1F5DC} \u4E0A\u4E0B\u6587\u538B\u7F29"}),xe(Ge,{flexGrow:1}),e.phase==="running"&&ve(Te,{color:r.color,children:[xe(vk,{type:"dots"})," ",r.text]}),e.phase==="done"&&ve(Te,{color:r.color,children:[r.icon," ",r.text]}),e.phase==="error"&&ve(Te,{color:r.color,children:[r.icon," ",r.text]})]}),ve(Ge,{marginTop:1,children:[xe(Te,{color:"#808080",children:"\u8FDB\u5EA6: "}),xe(Ek,{percent:n,color:e.phase==="error"?"#ff6347":r.color})]}),xe(Ge,{marginTop:1,children:xe(Ik,{state:e})}),(e.beforeTokens!==void 0||e.droppedTurns!==void 0)&&ve(Ge,{marginTop:1,flexDirection:"column",children:[e.droppedTurns!==void 0&&ve(Te,{color:"#00ff41",children:["\u{1F4CA} \u56DE\u5408: ",e.droppedTurns," \u6298\u53E0 \u2192 ",e.keptTurns??0," \u4FDD\u7559"]}),e.beforeTokens!==void 0&&ve(Te,{color:"#ff9800",children:["\u{1F4E6} token: ",km(e.beforeTokens),e.afterTokens!==void 0&&ve($k,{children:[" \u2192 ",xe(Te,{color:"#00ff41",bold:!0,children:km(e.afterTokens)}),ve(Te,{color:"#808080",children:[" (\u8282\u7701 ",((e.beforeTokens-e.afterTokens)/Math.max(e.beforeTokens,1)*100).toFixed(1),"%)"]})]})]})]}),(e.phase==="running"||e.phase==="done")&&s&&ve(Ge,{marginTop:1,flexDirection:"column",children:[xe(Te,{color:"#808080",children:"\u2504\u2504\u2504 LLM \u6458\u8981\u9884\u89C8 \u2504\u2504\u2504"}),xe(Pk,{text:s,contentWidth:t})]}),e.phase==="done"&&e.strategy==="fallback"&&xe(Ge,{marginTop:1,children:xe(Te,{color:"#ff9800",children:"\u26A0 LLM \u6458\u8981\u5931\u8D25\uFF0C\u4F7F\u7528\u672C\u5730\u515C\u5E95\u6458\u8981\u3002\u538B\u7F29\u5DF2\u751F\u6548\u4F46\u6458\u8981\u8D28\u91CF\u8F83\u4F4E\u3002"})}),e.phase==="error"&&e.errorMessage&&xe(Ge,{marginTop:1,children:ve(Te,{color:"#ff6347",children:["\u26A0 ",e.errorMessage]})})]})]})})}p();var Sm={name:"dskcode",version:"0.1.47",keywords:["cli","ink","commander","deepseek","asciichart"],description:"A DeepSeek-native AI coding agent for your terminal",type:"module",bin:{dskcode:"dist/index.js"},exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["dist","README.md","LICENSE","!dist/**/*.map"],scripts:{dev:"tsup --watch",debug:"npm run build && node dist/index.js",build:"tsup",obfuscate:"node scripts/obfuscate.mjs","build:clean":"node scripts/clean-sourcemaps.mjs","type-check":"tsc --noEmit",lint:"oxlint src/ tests/","lint:fix":"oxlint --fix src/ tests/",format:"prettier --write src/ tests/","format:check":"prettier --check src/ tests/",test:"vitest run --exclude 'tests/checkpoint.test.ts' --exclude 'tests/session-rewind.test.ts'","test:checkpoint":"vitest run tests/checkpoint.test.ts tests/session-rewind.test.ts",prepublishOnly:"npm run build && npm run test && npm run build:clean"},dependencies:{asciichart:"^1.5.25",chalk:"^5.6.2",commander:"^13.1.0",handlebars:"^4.7.9",ink:"^7.1.0","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0",react:"^19.2.7",ws:"^8.21.0",yaml:"^2.6.0",zod:"^3.25.76"},devDependencies:{"@shikijs/cli":"^4.3.1","@types/node":"^22.14.0","@types/react":"^19.2.17","@types/ws":"^8.18.1","javascript-obfuscator":"^4.1.1",oxlint:"^1.71.0","oxlint-tsgolint":"^0.23.0",prettier:"^3.5.3",tsup:"^8.4.0",typescript:"^5.8.3",vitest:"^3.1.1"},engines:{node:">=22.0.0"},license:"MIT"};var ko=Sm.version;p();p();var ai=class{#e=new Map;#t=new Map;register(t,n){this.#e.set(t,n)}get(t,n){if(!xa(n.model))throw new wa(n.model);let r=`${t}:${n.baseUrl}:${n.model}`,o=this.#t.get(r);if(o)return o;let s=this.#e.get(t);if(!s){let a=[...this.#e.keys()].join(", ");throw new Error(`\u672A\u6CE8\u518C\u7684 Provider: "${t}"\u3002\u53EF\u7528: ${a}`)}let i=s(n);return this.#t.set(r,i),i}list(){return[...this.#e.keys()]}clear(){this.#t.clear()}},mc=new ai;mc.register("deepseek",e=>new ka({apiKey:e.apiKey,baseUrl:e.baseUrl,model:e.model}));function hc(e){return mc.get(e.name,e)}p();p();import _m from"handlebars";var Tm=`\u4F60\u662F dskcode\uFF0C\u4E00\u4E2A\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\uFF0C\u8FD0\u884C\u5728\u7528\u6237\u7EC8\u7AEF\u4E2D\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u5F00\u53D1\u8005\u7F16\u5199\u3001\u7406\u89E3\u3001\u8C03\u8BD5\u548C\u91CD\u6784\u4EE3\u7801\u3002\r
190
190
  \r
191
191
  ## \u6838\u5FC3\u539F\u5219\r
192
192
  - \u56DE\u7B54\u4F7F\u7528\u4E2D\u6587\uFF0C\u4EE3\u7801\u6807\u8BC6\u7B26\u4FDD\u6301\u82F1\u6587\r
@@ -481,7 +481,7 @@ ${o}`:a}}p();import{Box as dc,Text as Gn}from"ink";import Ck from"ink-spinner";i
481
481
  `)}async function Vk(e,t){if(e.length===0)return"";let n=Hk(e);try{let r=[{role:"system",content:jk},{role:"user",content:`\u8BF7\u628A\u4EE5\u4E0B ${e.length} \u8F6E\u5BF9\u8BDD\u5386\u53F2\u538B\u7F29\u6210\u7ED3\u6784\u5316\u6458\u8981\uFF1A
482
482
 
483
483
  ${n}`}],o=t.provider.chat(r,{...t.signal?{signal:t.signal}:{},temperature:.2}),s="";for await(let i of o)if(i.content&&(s+=i.content,t.onProgress))try{t.onProgress({type:"summary_delta",delta:i.content,totalSoFar:s})}catch{}if(!s.trim()){let i=Om(e);if(t.onProgress)try{t.onProgress({type:"fallback",reason:"LLM \u8FD4\u56DE\u7A7A\u5B57\u7B26\u4E32",fallbackSummary:i})}catch{}return i}return s.trim()}catch(r){let o=r instanceof Error?r.message:String(r),s=Om(e);if(t.onProgress)try{t.onProgress({type:"fallback",reason:o,fallbackSummary:s})}catch{}return s}}function zk(e){return{role:"system",content:`${Gk}
484
- ${e}`}}async function wc(e,t){let n=gc(e),r=li(e),o=t.minTurnsToCompact??ci,s=t.preserveRecentRounds??bc;if(r.length<o)return{messages:e.slice(),summary:"",droppedTurns:0,keptTurns:r.length,beforeTokens:n,afterTokens:n};if(r.length<=s)return{messages:e.slice(),summary:"",droppedTurns:0,keptTurns:r.length,beforeTokens:n,afterTokens:n};let i=r.length-s,a=r.slice(0,i),l=r.slice(i);if(t.onProgress)try{t.onProgress({type:"start",droppedTurns:a.length,beforeTokens:n})}catch{}let c=await Vk(a,t),u=[zk(c)];for(let m of l)for(let h of m)u.push(h);let d=gc(u);if(t.onProgress)try{t.onProgress({type:"done",droppedTurns:a.length,keptTurns:l.length,beforeTokens:n,afterTokens:d})}catch{}return{messages:u,summary:c,droppedTurns:a.length,keptTurns:l.length,beforeTokens:n,afterTokens:d}}p();var dn=class{#e=new Map;#t;#r;#o;static ALL_TOOL_NAMES=[];constructor(t){this.#t=new Set(t?.disabledTools??[]),this.#r=t?.featureFlagChecker??(()=>!0),this.#o=t?.provider}register(t){return this.registerErased(Oe(t))}registerErased(t){if(this.#e.has(t.name))throw new Error(`\u5DE5\u5177 "${t.name}" \u5DF2\u6CE8\u518C\uFF0C\u4E0D\u80FD\u91CD\u590D\u6CE8\u518C`);return this.#e.set(t.name,t),this}registerAll(t){for(let n of t)this.registerErased(n);return this}unregister(t){return this.#e.delete(t)}get(t){if(this.#n(t))return this.#e.get(t)}list(){let t=[];for(let[n,r]of this.#e)this.#n(n)&&t.push(r);return t}listByKind(t){return this.list().filter(n=>n.kind===t)}listReadTools(){return this.listByKind("read")}listWriteTools(){return this.list().filter(t=>!Yn(t.kind))}names(){return[...this.#e.keys()]}has(t){return this.#e.has(t)}isEnabled(t){return this.#e.has(t)&&this.#n(t)}disable(t){this.#t.add(t)}enable(t){this.#t.delete(t)}kindOf(t){return this.#e.get(t)?.kind}async execute(t,n,r){let o=this.get(t);if(!o)return{success:!1,data:`\u5DE5\u5177 "${t}" \u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u7981\u7528`,error:"TOOL_NOT_FOUND"};try{return await o.execute(n,r)}catch(s){let i=s instanceof Error?s.message:String(s);return{success:!1,data:`\u5DE5\u5177 "${t}" \u6267\u884C\u5F02\u5E38\uFF1A${i}`,error:"EXECUTION_ERROR"}}}#n(t){let n=this.#e.get(t);return!(!n||this.#t.has(t)||!this.#r(t)||this.#o&&n.supportedProviders.length>0&&!n.supportedProviders.includes(this.#o))}};p();p();p();import{z as lD}from"zod";function kc(e,t){let n=t.safeParse(e);if(n.success)return{ok:!0,issues:[]};let r=n.error.issues.map(o=>qk(o,e));return{ok:r.length===0,issues:r}}function qk(e,t){let n=Kk(e.path),r=Xk(e),o=Jk(t,e.path),s=Zk(n,r,o,e);return{path:n,expected:r,received:o,message:s}}function Kk(e){if(e.length===0)return"$";let t="$";for(let n of e)typeof n=="number"?t+=`[${n}]`:typeof n=="string"?t+=`.${n}`:t+="[]";return t}function Xk(e){switch(e.code){case"invalid_type":return e.expected;case"too_small":{let t=e.type,n=e.minimum;return t==="string"?`length >= ${n}`:t==="array"?`length >= ${n}`:t==="number"?`>= ${n}`:`>= ${n}`}case"too_big":{let t=e.type,n=e.maximum;return t==="string"?`length <= ${n}`:t==="array"?`length <= ${n}`:t==="number"?`<= ${n}`:`<= ${n}`}case"invalid_enum_value":return`enum[${e.options.map(n=>JSON.stringify(n)).join(",")}]`;case"invalid_string":return`string ${e.validation}`;case"unrecognized_keys":return`\u672A\u5728 schema \u4E2D\u5B9A\u4E49: ${e.keys.join(",")}`;case"invalid_literal":{let t=e.expected;return`literal[${JSON.stringify(t)}]`}default:return e.code}}function Jk(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object")return"undefined";if(typeof r=="number"){if(!Array.isArray(n))return"undefined";n=n[r]}else if(typeof r=="string")n=n[r];else return"undefined"}return n===null?"null":n===void 0?"undefined":typeof n=="string"?n.length>60?JSON.stringify(n.slice(0,57)+"..."):JSON.stringify(n):typeof n=="number"||typeof n=="boolean"?JSON.stringify(n):Array.isArray(n)?`array(len=${n.length})`:typeof n=="object"?`object{keys=${Object.keys(n).length}}`:typeof n}function Zk(e,t,n,r){if(r.code==="invalid_type")return`${e} \u5E94\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${n}`;if(r.code==="too_small"){let o=r.type,s=r.minimum;return o==="string"?`${e} \u957F\u5EA6\u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="array"?`${e} \u957F\u5EA6\u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="number"?`${e} \u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:`${e} \u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`}if(r.code==="too_big"){let o=r.type,s=r.maximum;return o==="string"?`${e} \u957F\u5EA6\u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="array"?`${e} \u957F\u5EA6\u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="number"?`${e} \u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:`${e} \u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`}if(r.code==="invalid_enum_value")return`${e} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${n}`;if(r.code==="unrecognized_keys"){let o=r.keys;return`${e} \u4E0D\u5141\u8BB8\u952E: ${o.join(", ")}`}return r.code==="invalid_literal"?`${e} \u5E94\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${n}`:r.code==="invalid_string"?`${e} \u4E0D\u5339\u914D ${t}`:`${e} ${r.message}\uFF08\u671F\u671B ${t}\uFF0C\u5B9E\u9645 ${n}\uFF09`}function Nm(e,t){if(Yk(t))return kc(e,t);let n=[];return Fm(t)?t.type!==void 0&&t.type!=="object"?{ok:!0,issues:n}:(Mm(e,t,"$",n),{ok:n.length===0,issues:n}):{ok:!0,issues:n}}function Yk(e){if(e===null||typeof e!="object")return!1;let t=e;return"_def"in t&&typeof t.parse=="function"&&typeof t.safeParse=="function"}function Mm(e,t,n,r){if(!Fm(e)){r.push({path:n,expected:"object",received:pn(e),message:`${n} \u5E94\u4E3A object\uFF0C\u5B9E\u9645\u4E3A ${pn(e)}`});return}for(let i of t.required??[])i in e||r.push({path:`${n}.${i}`,expected:"present",received:"missing",message:`${n}.${i} \u662F\u5FC5\u586B\u5B57\u6BB5`});let o=t.properties??{},s=t.additionalProperties;for(let[i,a]of Object.entries(e)){let l=o[i];if(l===void 0){s===!1&&r.push({path:`${n}.${i}`,expected:"\u672A\u5728 schema \u4E2D\u5B9A\u4E49",received:pn(a),message:`${n}.${i} \u4E0D\u5728\u5141\u8BB8\u5B57\u6BB5\u4E2D`});continue}Bm(a,l,`${n}.${i}`,r)}}function Bm(e,t,n,r){if(t.type!==void 0){let o=eS(e);if(!tS(o,t.type)){r.push({path:n,expected:t.type,received:pn(e),message:`${n} \u5E94\u4E3A ${t.type}\uFF0C\u5B9E\u9645\u4E3A ${o}`});return}}if(t.enum&&t.enum.length>0&&(Qk(e)?t.enum.includes(e)||r.push({path:n,expected:`enum[${t.enum.map(o=>JSON.stringify(o)).join(",")}]`,received:pn(e),message:`${n} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${JSON.stringify(e)}`}):r.push({path:n,expected:`enum[${t.enum.map(o=>JSON.stringify(o)).join(",")}]`,received:pn(e),message:`${n} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${pn(e)}`})),typeof e=="number"&&(t.minimum!==void 0&&e<t.minimum&&r.push({path:n,expected:`>= ${t.minimum}`,received:String(e),message:`${n} \u5E94 >= ${t.minimum}\uFF0C\u5B9E\u9645\u4E3A ${e}`}),t.maximum!==void 0&&e>t.maximum&&r.push({path:n,expected:`<= ${t.maximum}`,received:String(e),message:`${n} \u5E94 <= ${t.maximum}\uFF0C\u5B9E\u9645\u4E3A ${e}`})),typeof e=="string"&&(t.minLength!==void 0&&e.length<t.minLength&&r.push({path:n,expected:`length >= ${t.minLength}`,received:`length ${e.length}`,message:`${n} \u957F\u5EA6\u5E94 >= ${t.minLength}\uFF0C\u5B9E\u9645\u4E3A ${e.length}`}),t.maxLength!==void 0&&e.length>t.maxLength&&r.push({path:n,expected:`length <= ${t.maxLength}`,received:`length ${e.length}`,message:`${n} \u957F\u5EA6\u5E94 <= ${t.maxLength}\uFF0C\u5B9E\u9645\u4E3A ${e.length}`}),t.pattern!==void 0))try{new RegExp(t.pattern).test(e)||r.push({path:n,expected:`pattern ${t.pattern}`,received:pn(e),message:`${n} \u4E0D\u5339\u914D pattern ${t.pattern}`})}catch{}if(t.properties!==void 0&&Mm(e,t,n,r),t.items!==void 0&&Array.isArray(e))for(let o=0;o<e.length;o++)Bm(e[o],t.items,`${n}[${o}]`,r)}function Fm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Qk(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function eS(e){return e===null?"null":Array.isArray(e)?"array":typeof e=="object"?"object":typeof e=="number"?Number.isInteger(e)?"integer":"number":typeof e}function tS(e,t){return e===t||t==="integer"&&e==="number"||t==="number"&&e==="integer"}function pn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string"){let t=e.length>60?e.slice(0,57)+"...":e;return JSON.stringify(t)}return typeof e=="number"||typeof e=="boolean"?JSON.stringify(e):Array.isArray(e)?`array(len=${e.length})`:typeof e=="object"?`object{keys=${Object.keys(e).length}}`:typeof e}var ui=class{#e;#t;#r;#o;constructor(t){this.#e=t.registry,this.#t=t.gate,this.#r={cwd:t.baseCtx.cwd,signal:t.baseCtx.signal,writeRoots:t.baseCtx.writeRoots,...t.baseCtx.timeout!==void 0?{timeout:t.baseCtx.timeout}:{}},this.#o=t.maxParallel??8}async executeBatch(t){return t.length===0?{items:[],records:[]}:this.#n(t)&&t.length>1?this.#a(t):this.#u(t)}#n(t){return t.every(n=>{let r=this.#e.get(n.name);return r?Yn(r.kind):!0})}async#a(t){let n=[],r=[];for(let o=0;o<t.length;o+=this.#o){let s=t.slice(o,o+this.#o),i=await Promise.all(s.map(a=>this.#i(a)));for(let a of i)n.push(a.item),a.record.success||r.push(a.record)}return{items:n,records:r}}async#u(t){let n=[],r=[];for(let o of t){let s=await this.#i(o);if(n.push(s.item),!s.record.success&&(r.push(s.record),s.record.error==="GATE_DENIED"&&s.item.result.denial?.source==="user_prompt"))break}return{items:n,records:r}}async#i(t){let n=t.name,r=Date.now(),o=this.#e.get(n);if(!o){let u=`\u5DE5\u5177 "${n}" \u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u7981\u7528`;return{item:{name:n,callId:t.id,result:{success:!1,data:u,error:"TOOL_NOT_FOUND"}},record:{name:n,success:!1,error:"TOOL_NOT_FOUND",timestamp:r}}}let s=rr(t.arguments??"");if(!s.ok){if(s.reason==="PARTIAL"){let d=`\u5DE5\u5177 "${n}" \u53C2\u6570\u5C1A\u672A\u6536\u5168\uFF0C\u672C\u8F6E\u8DF3\u8FC7\uFF08\u6D41\u5F0F\u5206\u7247\u5BFC\u81F4\uFF09\uFF1A${s.hint}`;return{item:{name:n,callId:t.id,result:{success:!1,data:d,error:"PARTIAL_JSON"}},record:{name:n,success:!1,error:"PARTIAL_JSON",timestamp:r}}}let u=`\u5DE5\u5177 "${n}" \u53C2\u6570\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${s.error}
484
+ ${e}`}}async function wc(e,t){let n=gc(e),r=li(e),o=t.minTurnsToCompact??ci,s=t.preserveRecentRounds??bc;if(r.length<o)return{messages:e.slice(),summary:"",droppedTurns:0,keptTurns:r.length,beforeTokens:n,afterTokens:n};if(r.length<=s)return{messages:e.slice(),summary:"",droppedTurns:0,keptTurns:r.length,beforeTokens:n,afterTokens:n};let i=r.length-s,a=r.slice(0,i),l=r.slice(i);if(t.onProgress)try{t.onProgress({type:"start",droppedTurns:a.length,beforeTokens:n})}catch{}let c=await Vk(a,t),u=[zk(c)];for(let m of l)for(let h of m)u.push(h);let d=gc(u);if(t.onProgress)try{t.onProgress({type:"done",droppedTurns:a.length,keptTurns:l.length,beforeTokens:n,afterTokens:d})}catch{}return{messages:u,summary:c,droppedTurns:a.length,keptTurns:l.length,beforeTokens:n,afterTokens:d}}p();var dn=class{#e=new Map;#t;#r;#o;static ALL_TOOL_NAMES=[];constructor(t){this.#t=new Set(t?.disabledTools??[]),this.#r=t?.featureFlagChecker??(()=>!0),this.#o=t?.provider}register(t){return this.registerErased(Oe(t))}registerErased(t){if(this.#e.has(t.name))throw new Error(`\u5DE5\u5177 "${t.name}" \u5DF2\u6CE8\u518C\uFF0C\u4E0D\u80FD\u91CD\u590D\u6CE8\u518C`);return this.#e.set(t.name,t),this}registerAll(t){for(let n of t)this.registerErased(n);return this}unregister(t){return this.#e.delete(t)}get(t){if(this.#n(t))return this.#e.get(t)}list(){let t=[];for(let[n,r]of this.#e)this.#n(n)&&t.push(r);return t}listByKind(t){return this.list().filter(n=>n.kind===t)}listReadTools(){return this.listByKind("read")}listWriteTools(){return this.list().filter(t=>!Yn(t.kind))}names(){return[...this.#e.keys()]}has(t){return this.#e.has(t)}isEnabled(t){return this.#e.has(t)&&this.#n(t)}disable(t){this.#t.add(t)}enable(t){this.#t.delete(t)}kindOf(t){return this.#e.get(t)?.kind}async execute(t,n,r){let o=this.get(t);if(!o)return{success:!1,data:`\u5DE5\u5177 "${t}" \u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u7981\u7528`,error:"TOOL_NOT_FOUND"};try{return await o.execute(n,r)}catch(s){let i=s instanceof Error?s.message:String(s);return{success:!1,data:`\u5DE5\u5177 "${t}" \u6267\u884C\u5F02\u5E38\uFF1A${i}`,error:"EXECUTION_ERROR"}}}#n(t){let n=this.#e.get(t);return!(!n||this.#t.has(t)||!this.#r(t)||this.#o&&n.supportedProviders.length>0&&!n.supportedProviders.includes(this.#o))}};p();p();p();import{z as uD}from"zod";function kc(e,t){let n=t.safeParse(e);if(n.success)return{ok:!0,issues:[]};let r=n.error.issues.map(o=>qk(o,e));return{ok:r.length===0,issues:r}}function qk(e,t){let n=Kk(e.path),r=Xk(e),o=Jk(t,e.path),s=Zk(n,r,o,e);return{path:n,expected:r,received:o,message:s}}function Kk(e){if(e.length===0)return"$";let t="$";for(let n of e)typeof n=="number"?t+=`[${n}]`:typeof n=="string"?t+=`.${n}`:t+="[]";return t}function Xk(e){switch(e.code){case"invalid_type":return e.expected;case"too_small":{let t=e.type,n=e.minimum;return t==="string"?`length >= ${n}`:t==="array"?`length >= ${n}`:t==="number"?`>= ${n}`:`>= ${n}`}case"too_big":{let t=e.type,n=e.maximum;return t==="string"?`length <= ${n}`:t==="array"?`length <= ${n}`:t==="number"?`<= ${n}`:`<= ${n}`}case"invalid_enum_value":return`enum[${e.options.map(n=>JSON.stringify(n)).join(",")}]`;case"invalid_string":return`string ${e.validation}`;case"unrecognized_keys":return`\u672A\u5728 schema \u4E2D\u5B9A\u4E49: ${e.keys.join(",")}`;case"invalid_literal":{let t=e.expected;return`literal[${JSON.stringify(t)}]`}default:return e.code}}function Jk(e,t){let n=e;for(let r of t){if(n==null||typeof n!="object")return"undefined";if(typeof r=="number"){if(!Array.isArray(n))return"undefined";n=n[r]}else if(typeof r=="string")n=n[r];else return"undefined"}return n===null?"null":n===void 0?"undefined":typeof n=="string"?n.length>60?JSON.stringify(n.slice(0,57)+"..."):JSON.stringify(n):typeof n=="number"||typeof n=="boolean"?JSON.stringify(n):Array.isArray(n)?`array(len=${n.length})`:typeof n=="object"?`object{keys=${Object.keys(n).length}}`:typeof n}function Zk(e,t,n,r){if(r.code==="invalid_type")return`${e} \u5E94\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${n}`;if(r.code==="too_small"){let o=r.type,s=r.minimum;return o==="string"?`${e} \u957F\u5EA6\u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="array"?`${e} \u957F\u5EA6\u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="number"?`${e} \u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:`${e} \u5E94 >= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`}if(r.code==="too_big"){let o=r.type,s=r.maximum;return o==="string"?`${e} \u957F\u5EA6\u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="array"?`${e} \u957F\u5EA6\u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:o==="number"?`${e} \u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`:`${e} \u5E94 <= ${s}\uFF0C\u5B9E\u9645\u4E3A ${n}`}if(r.code==="invalid_enum_value")return`${e} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${n}`;if(r.code==="unrecognized_keys"){let o=r.keys;return`${e} \u4E0D\u5141\u8BB8\u952E: ${o.join(", ")}`}return r.code==="invalid_literal"?`${e} \u5E94\u4E3A ${t}\uFF0C\u5B9E\u9645\u4E3A ${n}`:r.code==="invalid_string"?`${e} \u4E0D\u5339\u914D ${t}`:`${e} ${r.message}\uFF08\u671F\u671B ${t}\uFF0C\u5B9E\u9645 ${n}\uFF09`}function Nm(e,t){if(Yk(t))return kc(e,t);let n=[];return Fm(t)?t.type!==void 0&&t.type!=="object"?{ok:!0,issues:n}:(Mm(e,t,"$",n),{ok:n.length===0,issues:n}):{ok:!0,issues:n}}function Yk(e){if(e===null||typeof e!="object")return!1;let t=e;return"_def"in t&&typeof t.parse=="function"&&typeof t.safeParse=="function"}function Mm(e,t,n,r){if(!Fm(e)){r.push({path:n,expected:"object",received:pn(e),message:`${n} \u5E94\u4E3A object\uFF0C\u5B9E\u9645\u4E3A ${pn(e)}`});return}for(let i of t.required??[])i in e||r.push({path:`${n}.${i}`,expected:"present",received:"missing",message:`${n}.${i} \u662F\u5FC5\u586B\u5B57\u6BB5`});let o=t.properties??{},s=t.additionalProperties;for(let[i,a]of Object.entries(e)){let l=o[i];if(l===void 0){s===!1&&r.push({path:`${n}.${i}`,expected:"\u672A\u5728 schema \u4E2D\u5B9A\u4E49",received:pn(a),message:`${n}.${i} \u4E0D\u5728\u5141\u8BB8\u5B57\u6BB5\u4E2D`});continue}Bm(a,l,`${n}.${i}`,r)}}function Bm(e,t,n,r){if(t.type!==void 0){let o=eS(e);if(!tS(o,t.type)){r.push({path:n,expected:t.type,received:pn(e),message:`${n} \u5E94\u4E3A ${t.type}\uFF0C\u5B9E\u9645\u4E3A ${o}`});return}}if(t.enum&&t.enum.length>0&&(Qk(e)?t.enum.includes(e)||r.push({path:n,expected:`enum[${t.enum.map(o=>JSON.stringify(o)).join(",")}]`,received:pn(e),message:`${n} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${JSON.stringify(e)}`}):r.push({path:n,expected:`enum[${t.enum.map(o=>JSON.stringify(o)).join(",")}]`,received:pn(e),message:`${n} \u5E94\u4E3A enum \u503C\u4E4B\u4E00\uFF0C\u5B9E\u9645\u4E3A ${pn(e)}`})),typeof e=="number"&&(t.minimum!==void 0&&e<t.minimum&&r.push({path:n,expected:`>= ${t.minimum}`,received:String(e),message:`${n} \u5E94 >= ${t.minimum}\uFF0C\u5B9E\u9645\u4E3A ${e}`}),t.maximum!==void 0&&e>t.maximum&&r.push({path:n,expected:`<= ${t.maximum}`,received:String(e),message:`${n} \u5E94 <= ${t.maximum}\uFF0C\u5B9E\u9645\u4E3A ${e}`})),typeof e=="string"&&(t.minLength!==void 0&&e.length<t.minLength&&r.push({path:n,expected:`length >= ${t.minLength}`,received:`length ${e.length}`,message:`${n} \u957F\u5EA6\u5E94 >= ${t.minLength}\uFF0C\u5B9E\u9645\u4E3A ${e.length}`}),t.maxLength!==void 0&&e.length>t.maxLength&&r.push({path:n,expected:`length <= ${t.maxLength}`,received:`length ${e.length}`,message:`${n} \u957F\u5EA6\u5E94 <= ${t.maxLength}\uFF0C\u5B9E\u9645\u4E3A ${e.length}`}),t.pattern!==void 0))try{new RegExp(t.pattern).test(e)||r.push({path:n,expected:`pattern ${t.pattern}`,received:pn(e),message:`${n} \u4E0D\u5339\u914D pattern ${t.pattern}`})}catch{}if(t.properties!==void 0&&Mm(e,t,n,r),t.items!==void 0&&Array.isArray(e))for(let o=0;o<e.length;o++)Bm(e[o],t.items,`${n}[${o}]`,r)}function Fm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Qk(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function eS(e){return e===null?"null":Array.isArray(e)?"array":typeof e=="object"?"object":typeof e=="number"?Number.isInteger(e)?"integer":"number":typeof e}function tS(e,t){return e===t||t==="integer"&&e==="number"||t==="number"&&e==="integer"}function pn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string"){let t=e.length>60?e.slice(0,57)+"...":e;return JSON.stringify(t)}return typeof e=="number"||typeof e=="boolean"?JSON.stringify(e):Array.isArray(e)?`array(len=${e.length})`:typeof e=="object"?`object{keys=${Object.keys(e).length}}`:typeof e}var ui=class{#e;#t;#r;#o;constructor(t){this.#e=t.registry,this.#t=t.gate,this.#r={cwd:t.baseCtx.cwd,signal:t.baseCtx.signal,writeRoots:t.baseCtx.writeRoots,...t.baseCtx.timeout!==void 0?{timeout:t.baseCtx.timeout}:{}},this.#o=t.maxParallel??8}async executeBatch(t){return t.length===0?{items:[],records:[]}:this.#n(t)&&t.length>1?this.#a(t):this.#u(t)}#n(t){return t.every(n=>{let r=this.#e.get(n.name);return r?Yn(r.kind):!0})}async#a(t){let n=[],r=[];for(let o=0;o<t.length;o+=this.#o){let s=t.slice(o,o+this.#o),i=await Promise.all(s.map(a=>this.#i(a)));for(let a of i)n.push(a.item),a.record.success||r.push(a.record)}return{items:n,records:r}}async#u(t){let n=[],r=[];for(let o of t){let s=await this.#i(o);if(n.push(s.item),!s.record.success&&(r.push(s.record),s.record.error==="GATE_DENIED"&&s.item.result.denial?.source==="user_prompt"))break}return{items:n,records:r}}async#i(t){let n=t.name,r=Date.now(),o=this.#e.get(n);if(!o){let u=`\u5DE5\u5177 "${n}" \u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u7981\u7528`;return{item:{name:n,callId:t.id,result:{success:!1,data:u,error:"TOOL_NOT_FOUND"}},record:{name:n,success:!1,error:"TOOL_NOT_FOUND",timestamp:r}}}let s=rr(t.arguments??"");if(!s.ok){if(s.reason==="PARTIAL"){let d=`\u5DE5\u5177 "${n}" \u53C2\u6570\u5C1A\u672A\u6536\u5168\uFF0C\u672C\u8F6E\u8DF3\u8FC7\uFF08\u6D41\u5F0F\u5206\u7247\u5BFC\u81F4\uFF09\uFF1A${s.hint}`;return{item:{name:n,callId:t.id,result:{success:!1,data:d,error:"PARTIAL_JSON"}},record:{name:n,success:!1,error:"PARTIAL_JSON",timestamp:r}}}let u=`\u5DE5\u5177 "${n}" \u53C2\u6570\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${s.error}
485
485
  \u539F\u6587: ${s.raw.slice(0,200)}`;return{item:{name:n,callId:t.id,result:{success:!1,data:u,error:"INVALID_JSON"}},record:{name:n,success:!1,error:"INVALID_JSON",timestamp:r}}}let i=s.args,a,l=o.schema??o.parameters;if(l){let u=Nm(i,l);u.ok||(a=u.issues)}if(!await this.#t.check(n,i)){let u=this.#t.lastDenial,d=u?`Permission to run tool denied by user (${u.reason})\u3002\u8BF7\u52FF\u5C1D\u8BD5\u7528\u5176\u4ED6\u65B9\u5F0F\u4FEE\u6539\u540C\u4E00\u4E2A\u6587\u4EF6\u6216\u7ED5\u8FC7\u6B64\u51B3\u5B9A\uFF1B\u5982\u9700\u7EE7\u7EED\uFF0C\u8BF7\u5148\u4E0E\u7528\u6237\u786E\u8BA4\u3002`:"Permission to run tool denied by user\u3002\u8BF7\u52FF\u5C1D\u8BD5\u7528\u5176\u4ED6\u65B9\u5F0F\u4FEE\u6539\u540C\u4E00\u4E2A\u6587\u4EF6\u6216\u7ED5\u8FC7\u6B64\u51B3\u5B9A\uFF1B\u5982\u9700\u7EE7\u7EED\uFF0C\u8BF7\u5148\u4E0E\u7528\u6237\u786E\u8BA4\u3002";return{item:{name:n,callId:t.id,result:{success:!1,data:d,error:"GATE_DENIED",...u?{denial:u}:{}}},record:{name:n,success:!1,error:"GATE_DENIED",timestamp:r}}}if(!Yn(o.kind)){let u=o.preview;if(typeof u=="function")try{await u(i,this.#r)}catch{}}try{let u=await this.#p(o,i);if(a&&a.length>0){let m=a.map(f=>` - ${f.message}`).join(`
486
486
  `),h=u.success?"[schema \u8B66\u544A]":"[schema \u95EE\u9898]";u={...u,data:`${u.data}
487
487
 
@@ -510,7 +510,7 @@ ${m}`,issues:a}}let d={name:n,success:u.success,error:u.error,timestamp:r,...a?{
510
510
  \u524D\u63D0\uFF1A\u5F53\u524D\u72B6\u6001\u5FC5\u987B\u662F running\u3002\u82E5\u8FD8\u662F pending\uFF0C\u5148\u8C03 todo_mark_running\u3002
511
511
  \u8C03\u7528\u540E\u8BE5 step \u72B6\u6001\u53D8\u4E3A failed\u3002\u60F3\u91CD\u8BD5\uFF1A\u8C03 todo_retry(id) \u91CD\u7F6E\u56DE pending\uFF0C\u518D mark_running \u2192 \u8DD1\u5DE5\u5177 \u2192 mark_done\u3002`,parameters:{type:"object",properties:{id:{type:"number",description:"todo \u7684 id"},reason:{type:"string",description:"\u5931\u8D25\u539F\u56E0\uFF08\u4E00\u53E5\u8BDD\uFF09"}},required:["id","reason"],additionalProperties:!1},async execute(t){if(typeof t?.id!="number")return{success:!1,data:"\u7F3A\u5C11 id \u53C2\u6570",error:"INVALID_ARGS"};if(typeof t?.reason!="string")return{success:!1,data:"\u7F3A\u5C11 reason \u53C2\u6570",error:"INVALID_ARGS"};let n=e.items.find(o=>o.id===t.id);return n?n.status!=="running"?{success:!1,data:`todo #${t.id} \u5F53\u524D\u72B6\u6001\u662F ${n.status}\uFF0C\u53EA\u6709 running \u53EF\u4EE5 mark_failed`,error:"TODO_INVALID_STATE"}:e.markFailed(t.id,t.reason)?{success:!0,data:`\u5DF2\u6807\u8BB0 todo #${t.id} \u5931\u8D25\uFF1A${t.reason}`,summary:`\u274C \u5931\u8D25 #${t.id}`}:{success:!1,data:`todo #${t.id} \u72B6\u6001\u8F6C\u6362\u5931\u8D25`,error:"TODO_INVALID"}:{success:!1,data:`todo #${t.id} \u4E0D\u5B58\u5728`,error:"TODO_NOT_FOUND"}}}}function iS(e){return{name:"todo_retry",kind:"other",description:`\u628A\u5931\u8D25\u7684 todo \u91CD\u7F6E\u56DE pending\uFF08\u6E05\u7A7A evidence\uFF09\uFF0C\u7136\u540E\u4F60\u53EF\u4EE5\u91CD\u65B0\u8D70 todo_mark_running \u2192 \u8DD1\u5DE5\u5177 \u2192 todo_mark_done \u7684\u6D41\u7A0B\u3002
512
512
  \u524D\u63D0\uFF1A\u5F53\u524D\u72B6\u6001\u5FC5\u987B\u662F failed\u3002done / skipped / running \u4E0D\u5141\u8BB8\u91CD\u8BD5\uFF08done \u4E0D\u53EF\u53CD\u6094\u3001running \u5E94\u5148 mark_failed\uFF09\u3002`,parameters:{type:"object",properties:{id:{type:"number",description:"todo \u7684 id"}},required:["id"],additionalProperties:!1},async execute(t){if(typeof t?.id!="number")return{success:!1,data:"\u7F3A\u5C11 id \u53C2\u6570",error:"INVALID_ARGS"};let n=e.items.find(o=>o.id===t.id);return n?n.status!=="failed"?{success:!1,data:`todo #${t.id} \u5F53\u524D\u72B6\u6001\u662F ${n.status}\uFF0C\u53EA\u6709 failed \u53EF\u4EE5\u91CD\u8BD5`,error:"TODO_INVALID_STATE"}:e.resetForRetry(t.id)?{success:!0,data:`\u5DF2\u91CD\u7F6E todo #${t.id} \u4E3A pending\uFF0C\u53EF\u91CD\u65B0\u8DD1`,summary:`\u{1F504} \u91CD\u8BD5 #${t.id}`}:{success:!1,data:`todo #${t.id} \u72B6\u6001\u8F6C\u6362\u5931\u8D25`,error:"TODO_INVALID"}:{success:!1,data:`todo #${t.id} \u4E0D\u5B58\u5728`,error:"TODO_NOT_FOUND"}}}}p();p();import{execFile as aS}from"child_process";import{promisify as lS}from"util";var hi=lS(aS),gi={windowsHide:!0};async function Sc(e){try{return await hi("git",["rev-parse","--is-inside-work-tree"],{cwd:e,...gi}),!0}catch{return!1}}async function Um(e){try{return await hi("git",["rev-parse","--verify","HEAD"],{cwd:e,...gi}),!0}catch{return!1}}async function cS(e){return(await hi("git",["status","--porcelain"],{cwd:e,...gi})).stdout.trim().length>0}async function Lt(e,t){try{let{stdout:n}=await hi("git",e,{cwd:t,...gi});return n}catch(n){let r=n instanceof Error?n.message:String(n);throw new Error(`git ${e.join(" ")} \u5931\u8D25: ${r}`)}}async function mi(e){return(await Lt(["stash","list","--format=%H"],e)).split(`
513
- `).map(n=>n.trim()).filter(Boolean)}async function Tc(e){let t=Date.now();if(!await Sc(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!1};if(!await Um(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!0};if(!await cS(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!0};let r=await mi(e);await Lt(["stash","push","-m",`dskcode-cp-${t}`,"-u"],e);let o=await mi(e);if(o.length===0)throw new Error("git stash push \u672A\u80FD\u521B\u5EFA stash entry");let s=o.find(i=>!r.includes(i))??o[0];return await Lt(["stash","apply",s],e),{stashSha:s,timestamp:t,cwd:e,isGitRepo:!0}}async function Cc(e){if(!e.isGitRepo)throw new Error("\u975E git \u4ED3\u5E93\uFF0C\u65E0\u6CD5\u6062\u590D\u6587\u4EF6\u72B6\u6001");if(!e.stashSha)throw new Error("\u68C0\u67E5\u70B9\u4E3A\u7A7A\uFF08\u5DE5\u4F5C\u533A\u539F\u672C\u5C31\u5E72\u51C0\uFF09\uFF0C\u65E0\u9700\u6062\u590D");let{cwd:t,stashSha:n}=e,r=await mi(t);if(!r.includes(n))throw new Error("\u68C0\u67E5\u70B9\u5DF2\u5931\u6548\uFF08stash entry \u5DF2\u88AB\u6D88\u8D39\u6216 GC\uFF09\uFF0C\u65E0\u6CD5\u6062\u590D");await Lt(["checkout","--","."],t),await Lt(["clean","-fd"],t),await Lt(["stash","apply",n],t);let o=r.indexOf(n);o>=0&&await Lt(["stash","drop",`stash@{${o}}`],t)}async function _c(e){if(!await Sc(e))throw new Error("\u975E git \u4ED3\u5E93\uFF0C\u65E0\u6CD5\u6062\u590D\u6587\u4EF6\u72B6\u6001");if(!await Um(e))throw new Error("\u4ED3\u5E93\u65E0 commit\uFF0C\u65E0\u6CD5\u6062\u590D");await Lt(["checkout","--","."],e),await Lt(["clean","-fd"],e)}async function yi(e){if(!e.isGitRepo||!e.stashSha)return;let{cwd:t,stashSha:n}=e,r;try{r=await mi(t)}catch{return}let o=r.indexOf(n);if(!(o<0))try{await Lt(["stash","drop",`stash@{${o}}`],t)}catch{}}p();p();import{mkdir as uS,readFile as Wm,writeFile as dS,readdir as pS,unlink as fS,rename as mS}from"fs/promises";import{join as yr}from"path";import{randomUUID as hS}from"crypto";function Hm(){let e=process.env.HOME??process.env.USERPROFILE??"~";return yr(e,".dskcode","sessions")}var jn=class{#e;constructor(t){this.#e=t??Hm()}get dir(){return this.#e}async save(t){await uS(this.#e,{recursive:!0});let n=yr(this.#e,`${t.id}.json`),r=yr(this.#e,`.${t.id}.json.tmp`);await dS(r,JSON.stringify(t,null,2),"utf-8"),await mS(r,n)}async load(t){let n=yr(this.#e,`${t}.json`);try{let r=await Wm(n,"utf-8");return JSON.parse(r)}catch(r){if(vc(r))return null;throw r}}async list(){let t;try{t=await pS(this.#e)}catch(r){if(vc(r))return[];throw r}let n=[];for(let r of t)if(!(!r.endsWith(".json")||r.startsWith(".")))try{let o=await Wm(yr(this.#e,r),"utf-8"),s=JSON.parse(o);n.push({id:s.id,title:s.title||"\uFF08\u65E0\u6807\u9898\uFF09",updatedAt:s.updatedAt,cwd:s.cwd,messageCount:s.messages?.length??0})}catch{}return n.sort((r,o)=>o.updatedAt-r.updatedAt)}async delete(t){let n=yr(this.#e,`${t}.json`);try{await fS(n)}catch(r){if(!vc(r))throw r}}async exists(t){return await this.load(t)!==null}static newId(){return hS()}};function vc(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}p();p();import{readFile as wS,stat as kS}from"fs/promises";import{open as SS}from"fs/promises";import{relative as TS}from"path";p();import{resolve as So,relative as qm,isAbsolute as gS}from"path";import{realpath as Vm}from"fs/promises";import{spawn as yS}from"child_process";import Km from"process";var Xm=3e4,bS=5e4,JD=10*1024*1024,bi=Km.platform==="win32";function br(e){return e.startsWith("@")?e.slice(1):e}function et(e,t){let n=br(e),r=gS(n)?n:So(t,n);return So(r)}async function zm(e){try{return await Vm(e)}catch{let t=So(e,"..");try{let n=await Vm(t);return So(n,qm(t,e))}catch{return So(e)}}}async function qt(e,t){if(e.length===0)return{ok:!0};let n=await zm(t);for(let r of e){let o=await zm(r),s=qm(o,n);if(!s.startsWith("..")&&s!==""&&!s.startsWith("/")&&!s.startsWith("\\"))return{ok:!0};if(n===o)return{ok:!0}}return{ok:!1,error:`\u8DEF\u5F84 "${t}" \u4E0D\u5728\u5141\u8BB8\u7684\u5199\u5165\u8303\u56F4\u5185 ${e.join(", ")}`}}function Ve(e,t=bS){return e.length<=t?e:`${e.slice(0,t)}
513
+ `).map(n=>n.trim()).filter(Boolean)}async function Tc(e){let t=Date.now();if(!await Sc(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!1};if(!await Um(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!0};if(!await cS(e))return{stashSha:"",timestamp:t,cwd:e,isGitRepo:!0};let r=await mi(e);await Lt(["stash","push","-m",`dskcode-cp-${t}`,"-u"],e);let o=await mi(e);if(o.length===0)throw new Error("git stash push \u672A\u80FD\u521B\u5EFA stash entry");let s=o.find(i=>!r.includes(i))??o[0];return await Lt(["stash","apply",s],e),{stashSha:s,timestamp:t,cwd:e,isGitRepo:!0}}async function Cc(e){if(!e.isGitRepo)throw new Error("\u975E git \u4ED3\u5E93\uFF0C\u65E0\u6CD5\u6062\u590D\u6587\u4EF6\u72B6\u6001");if(!e.stashSha)throw new Error("\u68C0\u67E5\u70B9\u4E3A\u7A7A\uFF08\u5DE5\u4F5C\u533A\u539F\u672C\u5C31\u5E72\u51C0\uFF09\uFF0C\u65E0\u9700\u6062\u590D");let{cwd:t,stashSha:n}=e,r=await mi(t);if(!r.includes(n))throw new Error("\u68C0\u67E5\u70B9\u5DF2\u5931\u6548\uFF08stash entry \u5DF2\u88AB\u6D88\u8D39\u6216 GC\uFF09\uFF0C\u65E0\u6CD5\u6062\u590D");await Lt(["checkout","--","."],t),await Lt(["clean","-fd"],t),await Lt(["stash","apply",n],t);let o=r.indexOf(n);o>=0&&await Lt(["stash","drop",`stash@{${o}}`],t)}async function _c(e){if(!await Sc(e))throw new Error("\u975E git \u4ED3\u5E93\uFF0C\u65E0\u6CD5\u6062\u590D\u6587\u4EF6\u72B6\u6001");if(!await Um(e))throw new Error("\u4ED3\u5E93\u65E0 commit\uFF0C\u65E0\u6CD5\u6062\u590D");await Lt(["checkout","--","."],e),await Lt(["clean","-fd"],e)}async function yi(e){if(!e.isGitRepo||!e.stashSha)return;let{cwd:t,stashSha:n}=e,r;try{r=await mi(t)}catch{return}let o=r.indexOf(n);if(!(o<0))try{await Lt(["stash","drop",`stash@{${o}}`],t)}catch{}}p();p();import{mkdir as uS,readFile as Wm,writeFile as dS,readdir as pS,unlink as fS,rename as mS}from"fs/promises";import{join as yr}from"path";import{randomUUID as hS}from"crypto";function Hm(){let e=process.env.HOME??process.env.USERPROFILE??"~";return yr(e,".dskcode","sessions")}var jn=class{#e;constructor(t){this.#e=t??Hm()}get dir(){return this.#e}async save(t){await uS(this.#e,{recursive:!0});let n=yr(this.#e,`${t.id}.json`),r=yr(this.#e,`.${t.id}.json.tmp`);await dS(r,JSON.stringify(t,null,2),"utf-8"),await mS(r,n)}async load(t){let n=yr(this.#e,`${t}.json`);try{let r=await Wm(n,"utf-8");return JSON.parse(r)}catch(r){if(vc(r))return null;throw r}}async list(){let t;try{t=await pS(this.#e)}catch(r){if(vc(r))return[];throw r}let n=[];for(let r of t)if(!(!r.endsWith(".json")||r.startsWith(".")))try{let o=await Wm(yr(this.#e,r),"utf-8"),s=JSON.parse(o);n.push({id:s.id,title:s.title||"\uFF08\u65E0\u6807\u9898\uFF09",updatedAt:s.updatedAt,cwd:s.cwd,messageCount:s.messages?.length??0})}catch{}return n.sort((r,o)=>o.updatedAt-r.updatedAt)}async delete(t){let n=yr(this.#e,`${t}.json`);try{await fS(n)}catch(r){if(!vc(r))throw r}}async exists(t){return await this.load(t)!==null}static newId(){return hS()}};function vc(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}p();p();import{readFile as wS,stat as kS}from"fs/promises";import{open as SS}from"fs/promises";import{relative as TS}from"path";p();import{resolve as So,relative as qm,isAbsolute as gS}from"path";import{realpath as Vm}from"fs/promises";import{spawn as yS}from"child_process";import Km from"process";var Xm=3e4,bS=5e4,YD=10*1024*1024,bi=Km.platform==="win32";function br(e){return e.startsWith("@")?e.slice(1):e}function et(e,t){let n=br(e),r=gS(n)?n:So(t,n);return So(r)}async function zm(e){try{return await Vm(e)}catch{let t=So(e,"..");try{let n=await Vm(t);return So(n,qm(t,e))}catch{return So(e)}}}async function qt(e,t){if(e.length===0)return{ok:!0};let n=await zm(t);for(let r of e){let o=await zm(r),s=qm(o,n);if(!s.startsWith("..")&&s!==""&&!s.startsWith("/")&&!s.startsWith("\\"))return{ok:!0};if(n===o)return{ok:!0}}return{ok:!1,error:`\u8DEF\u5F84 "${t}" \u4E0D\u5728\u5141\u8BB8\u7684\u5199\u5165\u8303\u56F4\u5185 ${e.join(", ")}`}}function Ve(e,t=bS){return e.length<=t?e:`${e.slice(0,t)}
514
514
 
515
515
  ... [\u8F93\u51FA\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF0C\u5171 ${String(e.length)} \u5B57\u7B26]`}function Rc(){return Xm}async function Ac(e,t,n,r=Xm,o,s){return new Promise(i=>{let a,l,c;s?(a=e,l=t,c=!1,bi&&a==="cmd"&&l[0]==="/c"&&(l=["/c",`chcp 65001 >nul && ${l[1]??""}`])):(c=!bi,a=bi?"cmd":e,l=bi?["/c",e,...t]:t);let u=yS(a,l,{cwd:n,shell:c,env:{...Km.env},stdio:["pipe","pipe","pipe"]}),d="",m="";u.stdout.on("data",f=>{d+=f.toString("utf8")}),u.stderr.on("data",f=>{m+=f.toString("utf8")});let h=setTimeout(()=>{u.kill("SIGTERM"),setTimeout(()=>{u.kill("SIGKILL")},5e3)},r);o&&(o.aborted&&u.kill("SIGTERM"),o.addEventListener("abort",()=>{u.kill("SIGTERM")},{once:!0})),u.on("close",f=>{clearTimeout(h),i({stdout:d,stderr:m,exitCode:f})}),u.on("error",f=>{clearTimeout(h),m+=`
516
516
  \u8FDB\u7A0B\u542F\u52A8\u5931\u8D25\uFF1A${f.message}`,i({stdout:d,stderr:m,exitCode:null})})})}p();import{writeFile as xS}from"fs/promises";function Jm(e){if(e.length===0)return`
@@ -580,7 +580,7 @@ ${B.result.diff.patch}`),this.#e.push({role:"tool",content:q,toolCallId:B.callId
580
580
  \u5982\u679C\u662F\u7B80\u5355\uFF0C\u5FFD\u7565\u672C\u63D0\u793A\u3002
581
581
  \uFF08\u672C\u63D0\u793A\u672C\u4F1A\u8BDD\u4EC5\u53D1\u4E00\u6B21\uFF0C\u540E\u7EED\u4E0D\u518D\u63D0\u9192\u3002\uFF09`}))}};p();p();var zc=[[0,255,65],[0,255,255],[189,147,249]],qc=[[255,245,180],[255,210,80],[255,150,50]],Kc=[[255,191,0],[210,140,60],[175,70,40]],Hn={idlePhaseStep:.06,idleInterval:200,streamingPhaseStep:.2,streamingInterval:200,cmdTipPhaseStep:.2,cmdTipInterval:200},wT=new Set([" ","~",".","\u3002","\uFF01","\u{1F447}"]);function kT(e,t){let n=t.length,r=e*(n-1),o=Math.min(Math.floor(r),n-2),s=r-o,i=t[o],a=t[o+1];if(!i||!a)return"#808080";let l=Math.round(i[0]+(a[0]-i[0])*s),c=Math.round(i[1]+(a[1]-i[1])*s),u=Math.round(i[2]+(a[2]-i[2])*s);return`#${l.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}`}function Vn(e,t,n){let r=e.length;return r===0?[]:e.split("").map((o,s)=>{if(wT.has(o))return"";let i=(s/(r-1)+t)%1;return kT(i,n)})}p();function gh(e){return e.map(t=>t.trim()).filter(t=>t.length>0).join(`
582
582
  `)}p();import{Box as ST,Text as TT}from"ink";import{useEffect as CT,useRef as _T,useState as vT}from"react";import{jsx as PT,jsxs as IT}from"react/jsx-runtime";var RT=[" \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584 \u2584\u2584"," \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2584\u2580\u2588\u2588\u2588\u2580\u2580","\u2580\u2588 \u2580\u2580\u2588\u2588\u2588\u2584 \u2588\u2588\u2588\u2588"," \u2580\u2588\u2584 \u2584 \u2580\u2588\u2588\u2588\u2588\u2588\u2580"," \u2580\u2580\u2580\u2588\u2588\u2588\u2588\u2588\u2584\u2580\u2580\u2580\u2580\u2580"],Xc=22,AT=120,ET="#6185f6";function yh({panelWidth:e}){let t=_T(e),[n,r]=vT(0);CT(()=>{let l=setInterval(()=>{t.current-=1,t.current<=-Xc&&(t.current=e),r(c=>c+1)},AT);return()=>clearInterval(l)},[e]);let o=t.current;if(o>=e)return null;let s=Math.max(0,-o),i=Math.max(0,o+Xc-e),a=Math.max(0,o);return PT(ST,{flexDirection:"column",alignItems:"flex-start",children:RT.map((l,c)=>IT(TT,{color:ET,bold:!0,children:[" ".repeat(a),l.slice(s,Xc-i)]},c))})}p();import{Box as wi,Text as tt,useInput as LT}from"ink";import{useState as $T}from"react";import{jsx as yt,jsxs as kr}from"react/jsx-runtime";var Eo=[{number:"1",value:"yes",label:"Yes \u4EC5\u672C\u6B21",color:"green"},{number:"2",value:"no",label:"No \u62D2\u7EDD",color:"red"},{number:"3",value:"always",label:"Always \u672C\u4F1A\u8BDD\u540C\u7C7B\u64CD\u4F5C\u81EA\u52A8\u653E\u884C",color:"cyan"}];function bh({pending:e,onResponse:t}){let[n,r]=$T(0);if(LT((s,i)=>{if(e){if(i.escape){t("no");return}if(i.return){let a=Eo[n];a&&t(a.value);return}if(i.leftArrow){r(a=>(a-1+Eo.length)%Eo.length);return}if(i.rightArrow){r(a=>(a+1)%Eo.length);return}if(s==="1"){t("yes");return}if(s==="2"){t("no");return}if(s==="3"){t("always");return}}},{isActive:!!e}),!e)return null;let{ctx:o}=e;return kr(wi,{flexDirection:"column",borderStyle:"round",borderColor:"yellow",paddingX:1,marginTop:1,children:[yt(tt,{bold:!0,color:"yellow",children:"\u{1F510} \u6743\u9650\u5BA1\u6279"}),kr(wi,{flexDirection:"column",marginLeft:2,marginTop:1,children:[kr(tt,{children:[yt(tt,{dimColor:!0,children:"\u5DE5\u5177\uFF1A"}),yt(tt,{bold:!0,children:o.toolName}),yt(tt,{dimColor:!0,children:" \uFF08\u5199\u64CD\u4F5C\u786E\u8BA4\uFF09"})]}),kr(tt,{children:[yt(tt,{dimColor:!0,children:"\u539F\u56E0\uFF1A"}),yt(tt,{children:o.reason})]}),o.toolName==="bash"&&kr(tt,{children:[yt(tt,{dimColor:!0,children:"\u547D\u4EE4\uFF1A"}),yt(tt,{color:"cyan",children:OT(o)})]})]}),yt(wi,{flexDirection:"row",marginTop:1,gap:2,children:Eo.map((s,i)=>kr(tt,{color:i===n?s.color:"gray",bold:i===n,inverse:i===n,children:[" ","[",s.number,"] ",s.label," "]},s.value))}),yt(wi,{marginTop:1,children:yt(tt,{dimColor:!0,children:"\u2190/\u2192 \u5207\u6362 \xB7 1/2/3 \u76F4\u63A5\u9009 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u62D2\u7EDD"})})]})}function OT(e){if(typeof e.args!="object"||e.args===null)return"(\u65E0\u53C2\u6570)";let n=e.args.command;return typeof n!="string"?"(\u975E\u547D\u4EE4)":n.length<=60?n:n.slice(0,57)+"..."}p();p();import{EventEmitter as FT}from"events";import{randomUUID as wh}from"crypto";import GT from"ws";p();import{gunzipSync as DT,gzipSync as Jc}from"zlib";var NT=1,MT=1,hn={FULL_REQUEST:1,AUDIO_ONLY:2,SERVER_RESPONSE:9,ERROR:15},zn={NO_SEQUENCE:0,POSITIVE_SEQUENCE:1,LAST_PACKET_NO_SEQ:2,NEGATIVE_SEQUENCE:3,HAS_EVENT:4},Zc={JSON:1},Yc={GZIP:1};function ki(e,t,n,r){let o=Buffer.alloc(4);o[0]=NT<<4|MT,o[1]=e<<4|t&15,o[2]=Zc.JSON<<4|Yc.GZIP,o[3]=0;let s=Buffer.alloc(4);s.writeInt32BE(n);let i=Buffer.alloc(4);return i.writeUInt32BE(r.length),Buffer.concat([o,s,i,r])}function Qc(e,t){let n=Buffer.from(JSON.stringify(e),"utf8"),r=Jc(n);return ki(hn.FULL_REQUEST,zn.POSITIVE_SEQUENCE,t,r)}function eu(e,t){return ki(hn.AUDIO_ONLY,zn.POSITIVE_SEQUENCE,t,Jc(e))}function tu(e){return ki(hn.AUDIO_ONLY,zn.NEGATIVE_SEQUENCE,-Math.abs(e),Jc(Buffer.alloc(0)))}function nu(e){let t={messageType:"unknown",seq:0,isLast:!1,event:0,code:0,body:null,raw:e};if(e.length<4)return t;let n=e[0],r=e[1],o=e[2],s=n&15,i=r>>4,a=r&15,l=o>>4,c=o&15,u=i===hn.SERVER_RESPONSE?"full_response":i===hn.AUDIO_ONLY?"audio_only":i===hn.ERROR?"error":"unknown",d=e.subarray(s*4),m=0;a&zn.POSITIVE_SEQUENCE&&(m=d.readInt32BE(0),d=d.subarray(4));let h=(a&zn.LAST_PACKET_NO_SEQ)!==0,f=0;a&zn.HAS_EVENT&&(f=d.readInt32BE(0),d=d.subarray(4));let g=0;i===hn.ERROR&&(g=d.readInt32BE(0),d=d.subarray(4)),d.length>=4&&(d=d.subarray(4));let w=BT(d,c,l);return{messageType:u,seq:m,isLast:h,event:f,code:g,body:w,raw:e}}function BT(e,t,n){if(e.length===0)return null;let r=e;if(t===Yc.GZIP)try{r=DT(e)}catch{return null}return n===Zc.JSON||r.length>0&&r[0]===123?xh(r):null}function xh(e){try{return JSON.parse(e.toString("utf8"))}catch{return null}}function ru(e){return{user:{uid:e.user.uid,platform:e.user.platform??"Linux",sdk_version:e.user.sdkVersion??"0.1.x"},audio:{format:e.audio.format,codec:e.audio.codec,rate:e.audio.rate,bits:e.audio.bits,channel:e.audio.channel},request:{model_name:e.request.modelName,enable_itn:e.request.enableItn,enable_punc:e.request.enablePunc,enable_ddc:e.request.enableDdc,show_utterances:e.request.showUtterances}}}var jT="wss://openspeech.bytedance.com/api/v3/sauc/bigmodel_async",UT="volc.bigasr.sauc.duration",WT=(e,t)=>Reflect.construct(GT,[e,t]),Si=class extends FT{config;url;resourceId;ws=null;seq=1;started=!1;ended=!1;opened=!1;constructor(t){super(),this.config=t,this.url=t.url??jT,this.resourceId=t.resourceId??UT}connect(){return new Promise((t,n)=>{if(this.ws){n(new Error("VolcAsrClient: \u91CD\u590D\u8C03\u7528 connect()"));return}let r={"X-Api-Resource-Id":this.resourceId,"X-Api-Request-Id":wh(),"X-Api-Access-Key":this.config.accessKey,"X-Api-App-Key":this.config.appId,"X-Api-Sequence":"-1"},o=this.config.wsFactory??WT,s;try{s=o(this.url,{headers:r})}catch(l){n(l instanceof Error?l:new Error(String(l)));return}this.ws=s;let i=()=>{if(!this.opened){this.opened=!0;try{this.sendStart(),this.emit("log","\u2705 \u63E1\u624B\u6210\u529F\uFF0C\u8D77\u59CB\u5305\u5DF2\u53D1"),this.emit("open"),t()}catch(l){n(l instanceof Error?l:new Error(String(l)))}}},a=l=>{this.ended||(this.opened?this.emit("error",-1,l.message):n(l))};s.on("open",i),s.on("error",a),s.on("message",l=>this.onMessage(l)),s.on("close",(l,c)=>this.onClose(l,c))})}sendAudio(t){if(!this.ws||!this.started||this.ended)return;let n=eu(t,this.seq++);this.ws.send(n)}end(){if(!this.ws||this.ended)return;this.ended=!0;let t=tu(this.seq);this.ws.send(t),setTimeout(()=>{try{this.ws?.close()}catch{}},1500)}abort(){if(this.ws){this.ended=!0;try{this.ws.close()}catch{}}}sendStart(){if(!this.ws)return;let t=ru({user:{uid:`dskcode-cli-${wh().slice(0,8)}`},audio:{format:this.config.format??"pcm",codec:this.config.codec??"raw",rate:this.config.sampleRate??16e3,bits:this.config.bits??16,channel:this.config.channel??1},request:{modelName:"bigmodel",enableItn:this.config.enableItn??!0,enablePunc:this.config.enablePunc??!0,enableDdc:this.config.enableDdc??!1,showUtterances:this.config.showUtterances??!0}}),n=Qc(t,this.seq++);this.ws.send(n),this.started=!0}onMessage(t){let n=typeof t=="string"?Buffer.from(t):t,r=nu(n);this.handleResponse(r)}handleResponse(t){if(t.messageType==="error"){let r=t.body?.error??`ASR error code=${t.code}`;this.emit("error",t.code,r);return}if(t.messageType!=="full_response")return;let n=t.body?.result;if(n)if(n.utterances&&n.utterances.length>0)for(let r of n.utterances)r.definite?this.emit("final",r.text):this.emit("partial",r.text);else n.text&&this.emit("partial",n.text)}onClose(t,n){this.ws=null,this.emit("close"),this.emit("log",`\u8FDE\u63A5\u5173\u95ED code=${t} reason=${n?.toString("utf8")||""}`)}};function ou(e){return new Si(e)}p();import{EventEmitter as KT}from"events";p();import{spawn as HT}from"child_process";import{platform as su}from"os";var iu=(e,t)=>HT(e,t,{stdio:["ignore","pipe","pipe"]}),VT={ffmpeg:["D:\\ffmpeg\\ffmpeg-8.1.2-essentials_build\\bin\\ffmpeg.exe","C:\\ffmpeg\\bin\\ffmpeg.exe","C:\\Program Files\\ffmpeg\\bin\\ffmpeg.exe","C:\\Program Files (x86)\\ffmpeg\\bin\\ffmpeg.exe","/opt/homebrew/bin/ffmpeg","/usr/local/bin/ffmpeg","/usr/bin/ffmpeg"],sox:["C:\\Program Files (x86)\\sox-14-4-2\\sox.exe","/opt/homebrew/bin/sox","/usr/local/bin/sox","/usr/bin/sox"],arecord:["/usr/bin/arecord","/usr/local/bin/arecord"]};function zT(e,t,n){return new Promise(r=>{let o;try{o=t(e,["-version"])}catch{r(!1);return}let s=setTimeout(()=>{try{o.kill()}catch{}r(!1)},n);o.on("close",i=>{clearTimeout(s),r(i===0)}),o.on("error",()=>{clearTimeout(s),r(!1)})})}var kh={name:"ffmpeg",binary:"ffmpeg",buildArgs:e=>{let t=su();return t==="win32"?["-f","dshow","-i",`audio=${e??"Microphone"}`,"-ar","16000","-ac","1","-f","s16le","-acodec","pcm_s16le","-loglevel","quiet","-"]:t==="darwin"?["-f","avfoundation","-i",`:${e??"0"}`,"-ar","16000","-ac","1","-f","s16le","-acodec","pcm_s16le","-loglevel","quiet","-"]:["-f","alsa","-i",e??"default","-ar","16000","-ac","1","-f","s16le","-acodec","pcm_s16le","-loglevel","quiet","-"]},listWindowsAudioDevices:async(e,t)=>new Promise(n=>{let r="",o;try{o=e(t,["-list_devices","true","-f","dshow","-i","dummy"])}catch{n(null);return}o.stderr?.on("data",s=>{r+=s.toString("utf8")}),o.on("close",()=>{let s=r.match(/"([^"]+)"\s*\(audio\)/);n(s&&s[1]?s[1]:null)}),o.on("error",()=>n(null)),setTimeout(()=>{try{o.kill()}catch{}let s=r.match(/"([^"]+)"\s*\(audio\)/);n(s&&s[1]?s[1]:null)},1e4)})},Sh={name:"sox",binary:"sox",buildArgs:e=>su()==="win32"||e!==void 0?["-q","-r","16000","-c","1","-t","waveaudio",e??"-d","-t","raw","-"]:["-q","-r","16000","-c","1","-t","waveaudio","-d","-t","raw","-"]},Th={name:"arecord",binary:"arecord",buildArgs:e=>["-q","-f","S16_LE","-r","16000","-c","1",e?["-D",e]:[],"-t","raw"].flat()};async function au(e,t){let n=e==="auto"?[kh,Sh,Th]:[kh,Sh,Th].filter(r=>r.name===e);for(let r of n){let o=await qT(r.binary,t);if(o)return{...r,binary:o}}throw new Error(`\u672A\u627E\u5230\u53EF\u7528\u7684\u5F55\u97F3\u9A71\u52A8\uFF08driver=${e}\uFF09\u3002\u8BF7\u5B89\u88C5 ffmpeg / sox / arecord \u4E4B\u4E00\u3002\u8BE6\u89C1 docs/\u8BED\u97F3\u8BC6\u522Bvoice\u547D\u4EE4\u63A5\u5165.md \xA712.1\u3002`)}async function qT(e,t){let n=VT[e]??[];for(let r of[e,...n])if(await zT(r,t,1500))return r;return null}async function Ch(e,t){return su()!=="win32"||!e.listWindowsAudioDevices?null:e.listWindowsAudioDevices(t,e.binary)}var XT=200,JT=60,ZT=16e3,YT=16,QT=1,eC=ZT*(YT/8)*QT,Ti=class extends KT{options;proc=null;driver=null;buf=[];bufSize=0;chunkBytes;started=!1;stopped=!1;maxDurationTimer=null;constructor(t={}){super(),this.options={chunkMs:t.chunkMs??XT,maxDurationSec:t.maxDurationSec??JT,driver:t.driver??"auto",deviceName:t.deviceName,spawner:t.spawner},this.chunkBytes=Math.floor(eC*this.options.chunkMs/1e3)}async start(){if(this.started)throw new Error("VoiceCapture: \u91CD\u590D\u8C03\u7528 start()");this.started=!0,this.stopped=!1;let t=this.options.spawner??iu;this.driver=await au(this.options.driver,t),this.emit("log",`\u4F7F\u7528\u5F55\u97F3\u9A71\u52A8: ${this.driver.name}`);let n=this.options.deviceName;if(!n){let s=await Ch(this.driver,t);s&&(n=s,this.emit("log",`\u68C0\u6D4B\u5230\u9EA6\u514B\u98CE\u8BBE\u5907: ${n}`))}let r=this.driver.buildArgs(n);this.emit("log",`\u542F\u52A8\u5B50\u8FDB\u7A0B: ${this.driver.binary} ${r.join(" ")}`);let o;try{o=t(this.driver.binary,r)}catch(s){throw this.started=!1,s instanceof Error?s:new Error(String(s))}this.proc=o,o.stdout?.on("data",s=>this.ingest(s)),o.on("error",s=>{this.emit("error",s)}),o.on("close",s=>{if(this.bufSize>0){let i=Buffer.concat(this.buf,this.bufSize);this.emit("data",i),this.buf=[],this.bufSize=0}if(this.started=!1,this.proc=null,!this.stopped&&s!==0&&s!==null){this.emit("error",new Error(`\u5F55\u97F3\u5B50\u8FDB\u7A0B\u5F02\u5E38\u9000\u51FA code=${s}\uFF08\u53EF\u80FD\u662F\u8BBE\u5907\u540D\u9519\u8BEF\u6216\u6743\u9650\u88AB\u62D2\uFF09`));return}this.emit("end")}),this.options.maxDurationSec>0&&(this.maxDurationTimer=setTimeout(()=>{this.emit("log",`\u5DF2\u8FBE ${this.options.maxDurationSec}s \u4E0A\u9650\uFF0C\u81EA\u52A8\u505C\u6B62`),this.stop()},this.options.maxDurationSec*1e3))}stop(){if(!(!this.proc||this.stopped)){this.stopped=!0,this.maxDurationTimer&&(clearTimeout(this.maxDurationTimer),this.maxDurationTimer=null);try{this.proc.kill()}catch(t){this.emit("error",t instanceof Error?t:new Error(`kill \u5B50\u8FDB\u7A0B\u5931\u8D25: ${String(t)}`))}}}abort(){if(this.maxDurationTimer&&(clearTimeout(this.maxDurationTimer),this.maxDurationTimer=null),this.proc)try{this.proc.kill()}catch{}this.started=!1}isRecording(){return this.started}ingest(t){for(this.buf.push(t),this.bufSize+=t.length;this.bufSize>=this.chunkBytes;){let n=Buffer.concat(this.buf),r=n.subarray(0,this.chunkBytes);this.buf=[n.subarray(this.chunkBytes)],this.bufSize=n.length-this.chunkBytes,this.emit("data",r)}}};function lu(e={}){return new Ti(e)}p();import{EventEmitter as tC}from"events";var Ci=class extends tC{config;phase="idle";asr=null;cap=null;connecting=!1;lastError=null;constructor(t){super(),this.config=t}async start(){if(this.phase!=="idle"&&this.phase!=="error"){this.emit("log",`\u5DF2\u7ECF\u5728 ${this.phase} \u72B6\u6001\uFF0C\u5FFD\u7565 start()`);return}this.connecting=!0,this.lastError=null,this.setPhase("connecting");let n=(this.config.asrFactory??(()=>nC(this.config.asr)))();this.asr=n,this.bindAsrEvents(n);try{await n.connect()}catch(s){this.lastError=`\u8FDE\u63A5 ASR \u5931\u8D25: ${_h(s)}`,this.emit("error",this.lastError),this.setPhase("error"),this.cleanup();return}let o=(this.config.recorderOptions?.captureFactory??rC)();this.cap=o,this.bindCapEvents(o);try{await o.start()}catch(s){this.lastError=`\u542F\u52A8\u5F55\u97F3\u5931\u8D25: ${_h(s)}`,this.emit("error",this.lastError),this.setPhase("error"),this.cleanup();return}this.connecting=!1,this.setPhase("recording")}stop(){if(this.phase!=="recording"&&this.phase!=="connecting"&&this.phase!=="finalizing"){this.emit("log",`\u5F53\u524D phase=${this.phase}\uFF0C\u5FFD\u7565 stop()`);return}if(this.phase==="finalizing"){this.abort();return}this.setPhase("finalizing"),this.cap&&this.cap.isRecording()&&this.cap.stop()}abort(){this.setPhase("error"),this.cleanup()}getPhase(){return this.phase}getLastError(){return this.lastError}setPhase(t){this.phase!==t&&(this.phase=t,this.emit("phase",t))}bindAsrEvents(t){t.on("partial",n=>this.emit("partial",n)),t.on("final",n=>this.emit("final",n)),t.on("error",(n,r)=>{this.lastError=`ASR \u9519\u8BEF: ${r}`,this.emit("error",this.lastError),this.setPhase("error"),this.cleanup()}),t.on("close",()=>{this.emit("log","ASR WebSocket \u5DF2\u5173\u95ED"),(this.phase==="recording"||this.phase==="finalizing")&&(this.setPhase("idle"),this.cleanup())}),t.on("log",n=>this.emit("log",`[asr] ${n}`))}bindCapEvents(t){t.on("data",n=>{this.asr&&this.phase==="recording"&&this.asr.sendAudio(n)}),t.on("error",n=>{this.lastError=`\u5F55\u97F3\u9519\u8BEF: ${n.message}`,this.emit("error",this.lastError),this.setPhase("error"),this.cleanup()}),t.on("end",()=>{if(this.emit("log","\u5F55\u97F3\u5B50\u8FDB\u7A0B\u5DF2\u7ED3\u675F"),this.asr)try{this.asr.end()}catch{}}),t.on("log",n=>this.emit("log",`[rec] ${n}`))}cleanup(){try{this.asr?.abort()}catch{}try{this.cap?.abort()}catch{}this.asr=null,this.cap=null}};function nC(e){return ou({appId:e.appId,accessKey:e.accessKey,resourceId:e.resourceId})}function rC(){return lu()}function _h(e){return e instanceof Error?e.message:String(e)}function cu(e){return new Ci(e)}import{Fragment as Eh,jsx as L,jsxs as W}from"react/jsx-runtime";var uu={thinking:{icon:"\u{1F9E0}",label:"\u601D\u8003\u4E2D",color:"#ff9800"},generating:{icon:"\u2728",label:"\u751F\u6210\u4E2D",color:"#00ff41"},calling_tools:{icon:"\u{1F6E0}",label:"\u8C03\u7528\u5DE5\u5177",color:"#f59e0b"},executing_tools:{icon:"\u26A1",label:"\u6267\u884C\u5DE5\u5177",color:"#00ffff"}};function aC(e){return e==="edit_file"||e==="write_file"||e==="multi_edit"||e==="delete_range"}function Rh(e){if(!e)return;let t=e.filter(n=>!n.name.startsWith("todo_"));return t.length>0?t:void 0}var fu=new Map;function $e(e,t){fu.set(e,t)}function Ih(){return fu}$e("/exit",{desc:"\u9000\u51FA\u5BF9\u8BDD",handler:()=>({kind:"exit"})});$e("/quit",{desc:"\u9000\u51FA\u5BF9\u8BDD",handler:()=>({kind:"exit"})});$e("/help",{desc:"\u663E\u793A\u5E2E\u52A9\u4FE1\u606F",handler:()=>{let e=Ih(),t=["\u53EF\u7528\u547D\u4EE4\uFF1A"];for(let[n,r]of e)t.push(` ${n.padEnd(16)}${r.desc}`);return{kind:"text",content:t.join(`
583
- `)}}});$e("/clear",{desc:"\u6E05\u7A7A\u5BF9\u8BDD\u5386\u53F2",handler:()=>({kind:"clear"})});$e("/version",{desc:"\u663E\u793A\u7248\u672C\u4FE1\u606F",handler:()=>({kind:"text",content:`dskcode v${ko}`})});$e("/model",{desc:"\u5207\u6362\u6A21\u578B",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /model \u8FDB\u5165\u9009\u62E9\u754C\u9762"})});$e("/thinking",{desc:"\u5207\u6362\u6DF1\u5EA6\u601D\u8003\u6A21\u5F0F",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /thinking \u5207\u6362"})});$e("/effort",{desc:"\u5207\u6362\u63A8\u7406\u7B49\u7EA7 High/Max",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /effort \u5207\u6362"})});$e("/game",{desc:"\u542F\u52A8\u6E38\u620F",handler:()=>({kind:"navigate",target:"game"})});$e("/stock",{desc:"\u67E5\u770B\u80A1\u7968\u884C\u60C5",handler:()=>({kind:"navigate",target:"stock"})});$e("/plan",{desc:"\u5207\u6362\u4E3A\u8BA1\u5212\u6A21\u5F0F\uFF08Shift+Tab\uFF09",handler:()=>({kind:"text",content:"\u8F93\u5165 /plan \u6216\u6309 Shift+Tab \u5207\u6362\u4E3A\u8BA1\u5212\u6A21\u5F0F"})});$e("/code",{desc:"\u5207\u6362\u56DE\u4EE3\u7801\u6A21\u5F0F\uFF08Shift+Tab\uFF09",handler:()=>({kind:"text",content:"\u8F93\u5165 /code \u6216\u6309 Shift+Tab \u5207\u6362\u56DE\u4EE3\u7801\u6A21\u5F0F"})});$e("/rewind",{desc:"\u56DE\u9000\u5230\u5386\u53F2\u68C0\u67E5\u70B9\uFF081 = \u6700\u65B0\uFF09",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /rewind \u67E5\u770B\u53EF\u56DE\u9000\u7684\u68C0\u67E5\u70B9\u5217\u8868\uFF0C\u6216 /rewind <\u5E8F\u53F7> \u76F4\u63A5\u56DE\u9000\uFF081 = \u6700\u65B0\uFF0C2 = \u4E0A\u4E00\u6B21\uFF0C\u4F9D\u6B64\u7C7B\u63A8\uFF09"})});$e("/compact",{desc:"\u538B\u7F29\u4E0A\u4E0B\u6587\uFF1A\u6458\u8981\u65E7\u56DE\u5408\u5E76\u4FDD\u7559\u6700\u8FD1 N \u8F6E",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /compact \u624B\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587\uFF08\u9700\u5F53\u524D\u4E0D\u5904\u4E8E\u751F\u6210\u4E2D\uFF09"})});$e("/voice",{desc:"\u8BED\u97F3\u8F93\u5165\uFF08F2 \u6216 /voice \u542F\u52A8\uFF0CESC \u53D6\u6D88\uFF09",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /voice \u6216\u6309 F2 \u542F\u52A8\u8BED\u97F3\u8BC6\u522B"})});$e("/permissions",{desc:"\u67E5\u770B\u5F53\u524D\u6743\u9650\u89C4\u5219\u4E0E\u4F1A\u8BDD grants\uFF08v0.6\uFF09",handler:()=>({kind:"permissions"})});var lC=["\u8BA9\u5B50\u5F39\u98DE\u4E00\u4F1A\u513F...","\u9A6C\u4E0A\u5C31\u597D...","\u6B63\u5728\u618B\u5927\u62DB...","\u7A0D\u7B49\u4E00\u4E0B\u4E0B~","\u7801\u5B57\u4E2D...","\u8111\u5B50\u8F6C\u5F97\u98DE\u5FEB..."],Ah=["\u60F3\u5E72\u5565\uFF1F\u76F4\u63A5\u8BF4~","\u6765\u5427\uFF0C\u5429\u5490\u70B9\u5565","\u968F\u65F6\u5F85\u547D...","\u6233\u8FD9\u91CC\u5F00\u804A...","\u7B49\u4F60\u5F00\u53E3...","\u5C3D\u7BA1\u4F7F\u5524~"];function du(e){return e[Math.floor(Math.random()*e.length)]}function mu({skillCount:e,skills:t=[],files:n=[],toolCount:r,verbose:o,apiKey:s,baseUrl:i,costTracker:a,model:l="deepseek-v4-flash",permissionsConfig:c,voiceConfig:u,configReloadEpoch:d,onLaunchGame:m,onLaunchStock:h}){let g=(typeof process.stdout.columns=="number"?process.stdout.columns:80)-2,w=Math.max(Math.floor(g/3),30),x=g-w-1,[T,v]=U(0),[_,S]=U([]),[D,H]=U(0),[E,I]=U(""),[B,Y]=U(null),q=le(null),[ae,ce]=U(null),[Q,j]=U(!1),[re,se]=U(null),[he,Rr]=U("idle"),[Li,$i]=U(""),Oo=le(null),[Ar,Oi]=U(null),[ie,Do]=U(!1),[Er,$t]=U(null),[gn,Di]=U(""),[yn,yg]=U(()=>du(Ah)),[Ni,Mi]=U([]),No=le(0),[Bi,Fi]=U([]),Mo=le(0),[Gi,ji]=U(""),[Ui,Wi]=U([]),[Bo,Hi]=U([]),[bg,Eu]=U(()=>new Map),[Iu,Pu]=U(void 0),[f_,Lu]=U(void 0),[$u,Ou]=U(void 0),[rt,Du]=U(l),[Nu,Mu]=U(void 0),[Vi,Fo]=U(void 0),[bn,Go]=U([]),[m_,h_]=U(""),[Bu,jo]=U(!0),Zt=le(null),Ir=le(-1),[Yt,Uo]=U("code"),[Kn,xg]=U(!0),[Pr,wg]=U("high"),[zi]=U("text"),[Lr,Wo]=U(void 0),Fu=vh(()=>_.reduce((C,k)=>k.assistantDetail?.cost?C+k.assistantDetail.cost:C,0),[_]),$r=_.length>0,kg=ie&&Ui.length>0,kt=Array.from(Ih()).filter(([C])=>C!=="/exit"&&C!=="/quit").map(([C,k])=>({name:C,desc:k.desc})),[Ho,Sg]=U(0),[qi,Ki]=U([]),Vo=le(0),[Or,Xi]=U(0),[Xn,zo]=U(0),[Gu,Ji]=U(0),[xn,qo]=U(!1),[Dr,Ko]=U(0),[wn,Tg]=U([]),[Zi,ju]=U(!1),[Nr,Xo]=U(!1),[Uu,Yi]=U("idle"),Qi=le(!1),St=le(null),[Qt,ea]=U(!1),[Jo,Zo]=U(0),en=["deepseek-v4-flash","deepseek-v4-pro"],[Wu,tn]=U({phase:"idle",progress:null}),Me=le(null),Jn=le(void 0),ue=le(null),ta=le(null),Hu=le([]),Yo=le(""),Qo=le([]),es=le([]),ts=le(new Map),[Cg,Vu]=U(null),na=le(null),ra=bt(C=>new Promise(k=>{na.current=k,Vu({ctx:C,resolve:k})}),[]),_g=bt(C=>{let k=na.current;na.current=null,Vu(null),k?.(C)},[]),oa=le(void 0),sa=le(void 0),ia=le(void 0),aa=le(void 0),ns=le(void 0);Ne(()=>{Xi(0),zo(0)},[E]),Ne(()=>()=>{St.current&&(clearTimeout(St.current),St.current=null),Me.current&&(clearTimeout(Me.current),Me.current=null),q.current&&(clearTimeout(q.current),q.current=null)},[]),Ne(()=>{if(B==null)return;let C=setTimeout(()=>Y(null),5e3);return q.current=C,()=>clearTimeout(C)},[B]),Ne(()=>{d===void 0||d===0||Y(Date.now())},[d]),Ne(()=>{let C=()=>{let P=ue.current;if(!P){Oi(null);return}try{let V=P.getContextStats();Oi({tokens:V.estimatedTokens,ratio:V.ratio,contextWindow:V.contextWindow})}catch{Oi(null)}};C();let k=setInterval(C,3e3);return()=>clearInterval(k)},[]),Ne(()=>{if(Zt.current&&(clearTimeout(Zt.current),Zt.current=null),bn.length===0){jo(!1);return}bn.some(k=>k.status==="pending"||k.status==="running"||k.status==="failed")?jo(!0):(Ir.current=Math.max(...bn.map(k=>k.id)),Zt.current=setTimeout(()=>{jo(!1),Zt.current=null},2e3))},[bn]);let la=bt(C=>{let k=C.match(/(?:^|\s)\/([^/]*)$/);if(!k)return[];let P=k[1].toLowerCase().trim();if(!P)return C.startsWith("/")?t.slice(0,3):[];let V=t.filter(N=>N.name.toLowerCase().includes(P)).slice(0,3);return V.some(N=>N.name.toLowerCase()===P)?[]:V},[t]),zu=bt(C=>bo(C,n)??[],[n]),rs=bt((C,k)=>{let P=bo(C,n);if(!P||P.length===0)return!1;let V=P[k];if(!V)return!1;let N=C.lastIndexOf("@");return N<0?!1:(I(C.slice(0,N)+"@"+V+" "),Ji(ne=>ne+1),zo(0),!0)},[n]);function vg(C){let k=[];for(let P of C.messages)P.role==="user"?k.push({role:"user",content:P.content}):P.role==="assistant"?k.push({role:"assistant",content:P.content,assistantDetail:{content:P.content,toolCalls:Rh(P.toolCalls)}}):P.role==="tool"&&k.push({role:"tool",content:P.content});S(k),H(P=>P+1)}let ca=bt(async(C,k)=>{let P=ue.current;if(P){ju(!0),Do(!0),$t("thinking"),Di("\u23EA \u6B63\u5728\u56DE\u9000\u5230\u68C0\u67E5\u70B9\u2026"),I("");try{let V=await P.rewind(C.index);if(V.ok){vg(P);let N=V.fileRestored?"\uFF0C\u5DE5\u4F5C\u533A\u6587\u4EF6\u5DF2\u6062\u590D":"\uFF08\u4EC5\u5BF9\u8BDD\u56DE\u9000\uFF0C\u672A\u6062\u590D\u6587\u4EF6\uFF09";S(ne=>[...ne,{role:"assistant",content:`\u23EA \u5DF2\u56DE\u9000\u5230\u68C0\u67E5\u70B9 #${k}${N}\u3002`}])}else S(N=>[...N,{role:"assistant",content:`\u26A0 \u56DE\u9000\u5931\u8D25\uFF1A${V.error}`}])}catch(V){let N=V instanceof Error?V.message:String(V);S(ne=>[...ne,{role:"assistant",content:`\u26A0 \u56DE\u9000\u5F02\u5E38\uFF1A${N}`}])}finally{ju(!1),Do(!1),$t(null),Di("")}}},[]),ua=bt(async()=>{if(!u||!u.resolved){let k=u?.missing?.join(", ")??"appId, accessKey";S(P=>[...P,{role:"assistant",content:`\u26A0 \u8BED\u97F3\u8BC6\u522B\u672A\u914D\u7F6E\uFF08\u7F3A ${k}\uFF09\u3002
583
+ `)}}});$e("/clear",{desc:"\u6E05\u7A7A\u5BF9\u8BDD\u5386\u53F2",handler:()=>({kind:"clear"})});$e("/version",{desc:"\u663E\u793A\u7248\u672C\u4FE1\u606F",handler:()=>({kind:"text",content:`dskcode v${ko}`})});$e("/model",{desc:"\u5207\u6362\u6A21\u578B",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /model \u8FDB\u5165\u9009\u62E9\u754C\u9762"})});$e("/thinking",{desc:"\u5207\u6362\u6DF1\u5EA6\u601D\u8003\u6A21\u5F0F",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /thinking \u5207\u6362"})});$e("/effort",{desc:"\u5207\u6362\u63A8\u7406\u7B49\u7EA7 High/Max",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /effort \u5207\u6362"})});$e("/game",{desc:"\u542F\u52A8\u6E38\u620F",handler:()=>({kind:"navigate",target:"game"})});$e("/stock",{desc:"\u67E5\u770B\u80A1\u7968\u884C\u60C5",handler:()=>({kind:"navigate",target:"stock"})});$e("/plan",{desc:"\u5207\u6362\u4E3A\u8BA1\u5212\u6A21\u5F0F\uFF08Shift+Tab\uFF09",handler:()=>({kind:"text",content:"\u8F93\u5165 /plan \u6216\u6309 Shift+Tab \u5207\u6362\u4E3A\u8BA1\u5212\u6A21\u5F0F"})});$e("/code",{desc:"\u5207\u6362\u56DE\u4EE3\u7801\u6A21\u5F0F\uFF08Shift+Tab\uFF09",handler:()=>({kind:"text",content:"\u8F93\u5165 /code \u6216\u6309 Shift+Tab \u5207\u6362\u56DE\u4EE3\u7801\u6A21\u5F0F"})});$e("/rewind",{desc:"\u56DE\u9000\u5230\u5386\u53F2\u68C0\u67E5\u70B9\uFF081 = \u6700\u65B0\uFF09",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /rewind \u67E5\u770B\u53EF\u56DE\u9000\u7684\u68C0\u67E5\u70B9\u5217\u8868\uFF0C\u6216 /rewind <\u5E8F\u53F7> \u76F4\u63A5\u56DE\u9000\uFF081 = \u6700\u65B0\uFF0C2 = \u4E0A\u4E00\u6B21\uFF0C\u4F9D\u6B64\u7C7B\u63A8\uFF09"})});$e("/compact",{desc:"\u538B\u7F29\u4E0A\u4E0B\u6587\uFF1A\u6458\u8981\u65E7\u56DE\u5408\u5E76\u4FDD\u7559\u6700\u8FD1 N \u8F6E",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /compact \u624B\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587\uFF08\u9700\u5F53\u524D\u4E0D\u5904\u4E8E\u751F\u6210\u4E2D\uFF09"})});$e("/voice",{desc:"\u8BED\u97F3\u8F93\u5165\uFF08F2 \u6216 /voice \u542F\u52A8\uFF0CESC \u53D6\u6D88\uFF09",handler:()=>({kind:"text",content:"\u8BF7\u76F4\u63A5\u8F93\u5165 /voice \u6216\u6309 F2 \u542F\u52A8\u8BED\u97F3\u8BC6\u522B"})});$e("/permissions",{desc:"\u67E5\u770B\u5F53\u524D\u6743\u9650\u89C4\u5219\u4E0E\u4F1A\u8BDD grants\uFF08v0.6\uFF09",handler:()=>({kind:"permissions"})});var lC=["\u8BA9\u5B50\u5F39\u98DE\u4E00\u4F1A\u513F...","\u9A6C\u4E0A\u5C31\u597D...","\u6B63\u5728\u618B\u5927\u62DB...","\u7A0D\u7B49\u4E00\u4E0B\u4E0B~","\u7801\u5B57\u4E2D...","\u8111\u5B50\u8F6C\u5F97\u98DE\u5FEB..."],Ah=["\u60F3\u5E72\u5565\uFF1F\u76F4\u63A5\u8BF4~","\u6765\u5427\uFF0C\u5429\u5490\u70B9\u5565","\u968F\u65F6\u5F85\u547D...","\u6233\u8FD9\u91CC\u5F00\u804A...","\u7B49\u4F60\u5F00\u53E3...","\u5C3D\u7BA1\u4F7F\u5524~"];function du(e){return e[Math.floor(Math.random()*e.length)]}function mu({skillCount:e,skills:t=[],files:n=[],toolCount:r,verbose:o,apiKey:s,baseUrl:i,costTracker:a,model:l="deepseek-v4-flash",permissionsConfig:c,voiceConfig:u,configReloadEpoch:d,onLaunchGame:m,onLaunchStock:h}){let g=(typeof process.stdout.columns=="number"?process.stdout.columns:80)-2,w=Math.max(Math.floor(g/3),30),x=g-w-1,[T,v]=U(0),[_,S]=U([]),[D,H]=U(0),[E,I]=U(""),[B,Y]=U(null),q=le(null),[ae,ce]=U(null),[Q,j]=U(!1),[re,se]=U(null),[he,Rr]=U("idle"),[Li,$i]=U(""),Oo=le(null),[Ar,Oi]=U(null),[ie,Do]=U(!1),[Er,$t]=U(null),[gn,Di]=U(""),[yn,yg]=U(()=>du(Ah)),[Ni,Mi]=U([]),No=le(0),[Bi,Fi]=U([]),Mo=le(0),[Gi,ji]=U(""),[Ui,Wi]=U([]),[Bo,Hi]=U([]),[bg,Eu]=U(()=>new Map),[Iu,Pu]=U(void 0),[h_,Lu]=U(void 0),[$u,Ou]=U(void 0),[rt,Du]=U(l),[Nu,Mu]=U(void 0),[Vi,Fo]=U(void 0),[bn,Go]=U([]),[g_,y_]=U(""),[Bu,jo]=U(!0),Zt=le(null),Ir=le(-1),[Yt,Uo]=U("code"),[Kn,xg]=U(!0),[Pr,wg]=U("high"),[zi]=U("text"),[Lr,Wo]=U(void 0),Fu=vh(()=>_.reduce((C,k)=>k.assistantDetail?.cost?C+k.assistantDetail.cost:C,0),[_]),$r=_.length>0,kg=ie&&Ui.length>0,kt=Array.from(Ih()).filter(([C])=>C!=="/exit"&&C!=="/quit").map(([C,k])=>({name:C,desc:k.desc})),[Ho,Sg]=U(0),[qi,Ki]=U([]),Vo=le(0),[Or,Xi]=U(0),[Xn,zo]=U(0),[Gu,Ji]=U(0),[xn,qo]=U(!1),[Dr,Ko]=U(0),[wn,Tg]=U([]),[Zi,ju]=U(!1),[Nr,Xo]=U(!1),[Uu,Yi]=U("idle"),Qi=le(!1),St=le(null),[Qt,ea]=U(!1),[Jo,Zo]=U(0),en=["deepseek-v4-flash","deepseek-v4-pro"],[Wu,tn]=U({phase:"idle",progress:null}),Me=le(null),Jn=le(void 0),ue=le(null),ta=le(null),Hu=le([]),Yo=le(""),Qo=le([]),es=le([]),ts=le(new Map),[Cg,Vu]=U(null),na=le(null),ra=bt(C=>new Promise(k=>{na.current=k,Vu({ctx:C,resolve:k})}),[]),_g=bt(C=>{let k=na.current;na.current=null,Vu(null),k?.(C)},[]),oa=le(void 0),sa=le(void 0),ia=le(void 0),aa=le(void 0),ns=le(void 0);Ne(()=>{Xi(0),zo(0)},[E]),Ne(()=>()=>{St.current&&(clearTimeout(St.current),St.current=null),Me.current&&(clearTimeout(Me.current),Me.current=null),q.current&&(clearTimeout(q.current),q.current=null)},[]),Ne(()=>{if(B==null)return;let C=setTimeout(()=>Y(null),5e3);return q.current=C,()=>clearTimeout(C)},[B]),Ne(()=>{d===void 0||d===0||Y(Date.now())},[d]),Ne(()=>{let C=()=>{let P=ue.current;if(!P){Oi(null);return}try{let V=P.getContextStats();Oi({tokens:V.estimatedTokens,ratio:V.ratio,contextWindow:V.contextWindow})}catch{Oi(null)}};C();let k=setInterval(C,3e3);return()=>clearInterval(k)},[]),Ne(()=>{if(Zt.current&&(clearTimeout(Zt.current),Zt.current=null),bn.length===0){jo(!1);return}bn.some(k=>k.status==="pending"||k.status==="running"||k.status==="failed")?jo(!0):(Ir.current=Math.max(...bn.map(k=>k.id)),Zt.current=setTimeout(()=>{jo(!1),Zt.current=null},2e3))},[bn]);let la=bt(C=>{let k=C.match(/(?:^|\s)\/([^/]*)$/);if(!k)return[];let P=k[1].toLowerCase().trim();if(!P)return C.startsWith("/")?t.slice(0,3):[];let V=t.filter(N=>N.name.toLowerCase().includes(P)).slice(0,3);return V.some(N=>N.name.toLowerCase()===P)?[]:V},[t]),zu=bt(C=>bo(C,n)??[],[n]),rs=bt((C,k)=>{let P=bo(C,n);if(!P||P.length===0)return!1;let V=P[k];if(!V)return!1;let N=C.lastIndexOf("@");return N<0?!1:(I(C.slice(0,N)+"@"+V+" "),Ji(ne=>ne+1),zo(0),!0)},[n]);function vg(C){let k=[];for(let P of C.messages)P.role==="user"?k.push({role:"user",content:P.content}):P.role==="assistant"?k.push({role:"assistant",content:P.content,assistantDetail:{content:P.content,toolCalls:Rh(P.toolCalls)}}):P.role==="tool"&&k.push({role:"tool",content:P.content});S(k),H(P=>P+1)}let ca=bt(async(C,k)=>{let P=ue.current;if(P){ju(!0),Do(!0),$t("thinking"),Di("\u23EA \u6B63\u5728\u56DE\u9000\u5230\u68C0\u67E5\u70B9\u2026"),I("");try{let V=await P.rewind(C.index);if(V.ok){vg(P);let N=V.fileRestored?"\uFF0C\u5DE5\u4F5C\u533A\u6587\u4EF6\u5DF2\u6062\u590D":"\uFF08\u4EC5\u5BF9\u8BDD\u56DE\u9000\uFF0C\u672A\u6062\u590D\u6587\u4EF6\uFF09";S(ne=>[...ne,{role:"assistant",content:`\u23EA \u5DF2\u56DE\u9000\u5230\u68C0\u67E5\u70B9 #${k}${N}\u3002`}])}else S(N=>[...N,{role:"assistant",content:`\u26A0 \u56DE\u9000\u5931\u8D25\uFF1A${V.error}`}])}catch(V){let N=V instanceof Error?V.message:String(V);S(ne=>[...ne,{role:"assistant",content:`\u26A0 \u56DE\u9000\u5F02\u5E38\uFF1A${N}`}])}finally{ju(!1),Do(!1),$t(null),Di("")}}},[]),ua=bt(async()=>{if(!u||!u.resolved){let k=u?.missing?.join(", ")??"appId, accessKey";S(P=>[...P,{role:"assistant",content:`\u26A0 \u8BED\u97F3\u8BC6\u522B\u672A\u914D\u7F6E\uFF08\u7F3A ${k}\uFF09\u3002
584
584
  \u8BF7\u5230\u706B\u5C71\u63A7\u5236\u53F0 https://console.volcengine.com/speech \u5F00\u901A\u201C\u8BED\u97F3\u8BC6\u522B-\u5927\u6A21\u578B\u7248\u201D\uFF0C
585
585
  \u7136\u540E\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF VOLC_ASR_APP_ID \u548C VOLC_ASR_ACCESS_KEY\uFF0C
586
586
  \u6216\u5728 ~/.dskcode/settings.json \u6DFB\u52A0 voice \u6BB5\u3002`}]);return}if(he!=="idle"&&he!=="error")return;$i("");let C=cu({asr:{appId:u.config.appId,accessKey:u.config.accessKey,resourceId:u.config.resourceId}});C.on("phase",k=>Rr(k)),C.on("partial",k=>$i(k)),C.on("final",k=>{I(P=>P?P+k:k),$i("")}),C.on("error",k=>{S(P=>[...P,{role:"assistant",content:`\u26A0 \u8BED\u97F3\u8BC6\u522B\u51FA\u9519: ${k}`}])}),C.on("log",k=>{o&&console.error(`[voice] ${k}`)}),Oo.current=C,await C.start()},[u,he,o]),da=bt(()=>{Oo.current?.stop()},[]),pa=bt(()=>{he==="recording"||he==="connecting"?da():(he==="idle"||he==="error")&&ua()},[he,ua,da]),{doubleCtrlC:Rg,handleCtrlC:qu}=Tn(()=>{if(Oo.current)try{Oo.current.abort()}catch{}let C=ue.current;C?C.flushLog().finally(()=>process.exit(0)):process.exit(0)});oC(bt((C,k)=>{if(Nr){k.ctrl&&C==="p"&&Xo(!1);return}if(xn){if(k.upArrow)Ko(N=>(N-1+wn.length)%wn.length);else if(k.downArrow)Ko(N=>(N+1)%wn.length);else if(k.return){let N=wn[Dr];qo(!1),N&&ca(N,Dr+1)}else k.escape&&(qo(!1),S(N=>[...N,{role:"assistant",content:"\u5DF2\u53D6\u6D88\u56DE\u9000\u3002"}]));return}if(Qt){if(k.upArrow)Zo(N=>(N-1+en.length)%en.length);else if(k.downArrow)Zo(N=>(N+1)%en.length);else if(k.return){let N=en[Jo];N===rt?S(ne=>[...ne,{role:"assistant",content:`\u5DF2\u7ECF\u5728\u4F7F\u7528 ${Sn[N].displayName}`}]):(Du(N),ue.current?.reset(),Zu(N).catch(()=>{}),S(ne=>[...ne,{role:"assistant",content:`\u6A21\u578B\u5DF2\u5207\u6362\u4E3A ${Sn[N].displayName}\uFF08${N}\uFF09`}])),ea(!1)}else k.escape&&ea(!1);return}let P=zu(E),V=P.length===0?la(E):[];if(P.length>0){if(k.upArrow){zo(N=>(N-1+P.length)%P.length);return}if(k.downArrow){zo(N=>(N+1)%P.length);return}if(k.tab){rs(E,Xn);return}}if(V.length>0){if(k.upArrow){Xi(N=>(N-1+V.length)%V.length);return}if(k.downArrow){Xi(N=>(N+1)%V.length);return}if(k.tab){let N=V[Or];if(N){let ne=E.lastIndexOf("/");ne>=0&&(I(E.slice(0,ne)+"/"+N.name+" "),Ji($=>$+1))}return}}if(Qt){k.upArrow||k.downArrow;return}if(k.ctrl&&C==="c"){ie?ta.current?.abort():qu();return}if(k.ctrl&&C==="p"&&!ie&&!xn&&!Qt){Xo(!0);return}if(k.escape&&(he==="recording"||he==="connecting"||he==="finalizing")){da();return}if(k.shift&&k.tab){if(!ie){let N=Yt==="plan"?"code":"plan";Uo(N),ue.current?.setMode(N),Wo(void 0),ue.current?.reset(),S(ne=>[...ne,{role:"assistant",content:N==="plan"?`\u{1F4CB} \u5DF2\u5207\u6362\u4E3A **\u8BA1\u5212\u6A21\u5F0F**\uFF08Shift+Tab\uFF09
@@ -601,11 +601,11 @@ ${B.result.diff.patch}`),this.#e.push({role:"tool",content:q,toolCallId:B.callId
601
601
  `)})()}):W(G,{flexDirection:"column",alignItems:"center",children:[L(F,{color:"#00ffff",bold:!0,children:"\u{1F4AC} \u5BF9\u8BDD\u8FDB\u884C\u4E2D"}),W(G,{marginTop:1,flexDirection:"column",alignItems:"center",children:[W(F,{color:"#00ff41",children:["\u{1F4DD} \u6D88\u606F ",_.length," \u6761"]}),Fu>0&&W(F,{color:"cyan",children:["\u{1F4B0} \u4F1A\u8BDD \xA5",Fu.toFixed(4)]}),Ar&&L(dC,{stats:Ar})]}),W(G,{marginTop:1,flexDirection:"column",alignItems:"center",children:[W(F,{color:"#808080",children:["\u{1F527} ",Sn[rt]?.displayName??rt]}),Kn&&W(F,{color:"#ff9800",children:["\u{1F9E0} ",Pr==="max"?"Max":"High"]})]}),ae!==null&&L(G,{marginTop:1,children:W(F,{color:"yellow",children:["\u{1F4B0} \xA5",ae.toFixed(2)]})})]}):W(G,{flexDirection:"column",alignItems:"center",children:[Aa.map((C,k)=>{let P=(k+T)%Fr.length;return L(F,{bold:!0,color:Fr[P],children:C},k)}),L(G,{marginTop:1,children:W(F,{color:"#808080",children:["\u{1F4E6} v",ko]})}),W(G,{marginTop:1,flexDirection:"column",alignItems:"center",children:[W(F,{color:"#00ff41",children:["\u2714 ",e," Skills"]}),W(F,{color:"#00ffff",children:["\u2139 ",r," \u5DE5\u5177"]}),W(F,{color:"#00ffff",children:["\u{1F527} ",Sn[rt]?.displayName??rt]}),Kn&&W(F,{color:"#ff9800",children:["\u{1F9E0} \u6DF1\u5EA6\u601D\u8003 ",Pr==="max"?"Max":"High"]}),Yt==="plan"&&L(F,{color:"#ff69b4",bold:!0,children:"\u{1F4CB} \u8BA1\u5212\u6A21\u5F0F"})]}),W(G,{marginTop:1,flexDirection:"column",alignItems:"center",children:[ae!==null?W(F,{color:"yellow",children:["\u{1F4B0} \u4F59\u989D \xA5",ae.toFixed(2)]}):Q?L(F,{color:"yellow",children:"\u23F3 \u67E5\u8BE2\u4F59\u989D..."}):null,re!==null&&W(F,{color:"cyan",children:["\u{1F4CA} \u4ECA\u65E5 \xA5",re.toFixed(2)]})]}),o&&L(F,{color:"#ff1493",children:"\u26A1 Verbose"})]})})}),Ag]}),Rg&&!ie&&L(G,{marginTop:1,children:L(F,{color:"#ff1493",bold:!0,children:" \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode"})}),ie&&L(G,{marginTop:1,children:L(F,{color:"yellow",dimColor:!0,children:" \u63D0\u793A\uFF1A\u6309 Ctrl+C \u53D6\u6D88\u5F53\u524D\u8BF7\u6C42"})})]})]})}var pu=12;function cC(e){return e>=.85?"danger":e>=.6?"warning":"safe"}function uC(e){switch(e){case"danger":return"#ff6347";case"warning":return"#ffcc00";case"safe":return"#00ff41"}}function dC({stats:e}){let t=cC(e.ratio),n=uC(t),r=Math.min(pu,Math.max(e.ratio>0?1:0,Math.round(e.ratio*pu))),o=pu-r;return W(F,{color:n,children:["\u{1F4DA} ",L(F,{color:n,children:"\u2588".repeat(r)}),L(F,{color:"#444444",children:"\u2591".repeat(o)})," ",(e.ratio*100).toFixed(1),"%"]})}p();import{Box as Xt,Text as qn,useInput as pC}from"ink";import{useState as fC,useCallback as mC}from"react";import{jsx as ze,jsxs as Ph}from"react/jsx-runtime";function _i({games:e,onSelect:t,onExit:n,onBackToChat:r}){let[o,s]=fC(0),i=r??n??(()=>process.exit(0)),{doubleCtrlC:a,handleCtrlC:l}=Tn(i);return pC(mC((c,u)=>{if(c==="c"&&u.ctrl){l();return}if(e.length!==0)if(u.upArrow||c==="k")s(d=>d>0?d-1:e.length-1);else if(u.downArrow||c==="j")s(d=>d<e.length-1?d+1:0);else if(u.return){let d=e[o];d&&t(d)}else(u.escape||c==="q")&&(r?r():n?.())},[e,o,t,n,r,l])),Ph(Xt,{flexDirection:"column",children:[ze(Xt,{marginBottom:1,children:ze(qn,{bold:!0,color:"#00ffff",children:"\u{1F3AE} \u6E38\u620F\u5217\u8868"})}),ze(Xt,{flexDirection:"column",children:e.map((c,u)=>{let d=u===o;return Ph(Xt,{flexDirection:"row",children:[ze(Xt,{width:3,flexShrink:0,children:d?ze(qn,{bold:!0,color:"#00ff41",children:"\u25B8 "}):ze(qn,{children:" "})}),ze(Xt,{width:20,flexShrink:0,children:ze(qn,{bold:!0,color:d?"#00ff41":"#ffffff",children:c.name})}),ze(Xt,{children:ze(qn,{color:"#888888",children:c.description})})]},c.id)})}),ze(Xt,{marginTop:1,children:ze(qn,{dimColor:!0,children:" \u2191/\u2193 \u9009\u62E9 Enter \u542F\u52A8 q \u8FD4\u56DE"})}),a&&ze(Xt,{marginTop:1,children:ze(qn,{color:"#ff1493",bold:!0,children:" \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode"})})]})}p();p();var hu=new Map;function vi(e){hu.set(e.id,e)}function Lh(e){return hu.get(e)}function Io(){return Array.from(hu.values())}p();import{Box as qe,Text as we,useInput as hC,render as gC}from"ink";import{useState as gu,useEffect as yC,useRef as $h,useCallback as yu}from"react";import{jsx as me,jsxs as Ke}from"react/jsx-runtime";var dt=40,Sr=18,Tr=9,Oh=[166,214,76,69],bu=[{rows:4,cols:8,bw:3,desc:"\u7ECF\u5178 4\xD78",pattern:()=>!0},{rows:3,cols:8,bw:3,desc:"\u8F7B\u677E 3 \u5C42",pattern:()=>!0},{rows:6,cols:8,bw:3,desc:"\u539A\u5899 6 \u5C42",pattern:()=>!0},{rows:4,cols:8,bw:3,desc:"\u68CB\u76D8\u683C",pattern:(e,t)=>(e+t)%2===0},{rows:4,cols:8,bw:3,desc:"\u91D1\u5B57\u5854",pattern:(e,t,n,r)=>e>=t&&e<r-t},{rows:4,cols:8,bw:3,desc:"\u4EA4\u9519\u6392\u5217",pattern:(e,t)=>t%2===0||e>=1&&e<=6},{rows:4,cols:8,bw:3,desc:"\u4E2D\u7A7A\u8FB9\u6846",pattern:(e,t,n,r)=>t===0||t===n-1||e===0||e===r-1},{rows:4,cols:10,bw:2,desc:"\u5BC6\u96C6 10 \u5217",pattern:()=>!0},{rows:7,cols:8,bw:3,desc:"\u9AD8\u5899 7 \u5C42",pattern:()=>!0},{rows:8,cols:8,bw:3,desc:"\u6EE1\u5C4F 8 \u5C42",pattern:()=>!0}];function xu(e){return bu[(e-1)%bu.length]}function bC(e){let t=xu(e),n=[],r=2,o=t.cols*t.bw+(t.cols-1)*r,s=Math.floor((dt-o)/2),i=t.bw+r;for(let a=0;a<t.rows;a++)for(let l=0;l<t.cols;l++)t.pattern(l,a,t.rows,t.cols)&&n.push({x:s+l*i,y:2+a*2,w:t.bw,alive:!0});return n}function Dh(e){let t=xu(e),n=t.cols*t.bw+(t.cols-1)*2,r=Math.floor((dt-n)/2);return{level:e,bricks:bC(e),paddleX:Math.floor(dt/2)-Math.floor(Tr/2),ball:{x:dt/2,y:Sr-3},ballDir:{x:1,y:-1},score:0,lives:3,gameOver:!1,win:!1,paused:!1}}function xC(e){if(e.paused||e.gameOver||e.win)return;if(e.ball.x+=e.ballDir.x,e.ball.y+=e.ballDir.y,e.ball.x<=0&&(e.ball.x=0,e.ballDir.x=1),e.ball.x>=dt-1&&(e.ball.x=dt-1,e.ballDir.x=-1),e.ball.y<=0&&(e.ball.y=0,e.ballDir.y=1),e.ball.y===Sr-1&&e.ball.x>=e.paddleX&&e.ball.x<=e.paddleX+Tr){e.ballDir.y=-1;let n=(e.ball.x-e.paddleX)/Tr;e.ballDir.x=n<.5?-1:1}e.ball.y>Sr&&(e.lives--,e.lives<=0?e.gameOver=!0:(e.ball={x:dt/2,y:Sr-3},e.ballDir={x:1,y:-1},e.paddleX=Math.floor(dt/2)-Math.floor(Tr/2)));let t=e.bricks.find(n=>n.alive?e.ball.x>=n.x&&e.ball.x<n.x+n.w&&e.ball.y>=n.y&&e.ball.y<n.y+1:!1);t&&(t.alive=!1,e.score+=10,e.ballDir.y=-e.ballDir.y),e.bricks.every(n=>!n.alive)&&(e.win=!0)}function wC(e){let t=[];function n(r,o){let s=Math.floor((o-2)/2);if(s>=0&&e.bricks.find(a=>a.y===o&&a.alive&&r>=a.x&&r<a.x+a.w))return s%Oh.length}for(let r=0;r<Sr;r++){let o="";for(let s=0;s<dt;s++){let i=e.ball.x===s&&e.ball.y===r,a=r===Sr-1&&s>=e.paddleX&&s<e.paddleX+Tr,l=n(s,r);i?o+="\x1B[97m\u25CF\x1B[0m":a?o+="\x1B[94m\u2584\x1B[0m":l!==void 0?o+=`\x1B[38;5;${Oh[l]}m\u2580\x1B[0m`:o+=" "}t.push(o)}return t.map(r=>`\u2502${r}\u2502`).join(`
602
602
  `)}function kC({onExit:e}){let[t,n]=gu(1),[r,o]=gu(!0),s=$h(Dh(t)),[i,a]=gu(0),l=$h(e);l.current=e,yC(()=>{if(r)return;let g=setInterval(()=>{xC(s.current),a(w=>w+1)},80);return()=>clearInterval(g)},[r]);let c=yu(g=>{let w=g??s.current.level;s.current=Dh(w),n(w),o(!1),a(0)},[]),u=yu(()=>{o(!0)},[]);hC(yu((g,w)=>{let x=s.current;if(r){g>="1"&&g<="9"?c(Number(g)):g==="0"?c(10):(w.escape||g==="q")&&l.current();return}w.leftArrow?(x.paddleX=Math.max(0,x.paddleX-1),a(T=>T+1)):w.rightArrow?(x.paddleX=Math.min(dt-Tr,x.paddleX+1),a(T=>T+1)):g==="p"||g===" "?x.paused=!x.paused:g==="r"?(x.gameOver||x.win)&&c():g==="l"?(x.gameOver||x.win)&&u():(g==="q"||w.escape)&&l.current()},[r,c,u]));let d=s.current,m=d.bricks.filter(g=>g.alive).length,h=wC(d),f=xu(d.level);return Ke(qe,{flexDirection:"column",children:[Ke(qe,{flexDirection:"row",children:[me(qe,{width:20,children:Ke(we,{children:["\u5173\u5361 ",d.level,": ",me(we,{color:"cyan",children:f.desc})]})}),me(qe,{width:12,children:Ke(we,{children:["\u5206\u6570: ",me(we,{color:"yellow",children:String(d.score).padStart(3,"0")})]})}),me(qe,{width:12,children:Ke(we,{children:["\u751F\u547D: ",me(we,{color:"red",children:"\u2665".repeat(Math.max(0,d.lives))})]})}),me(qe,{width:10,children:Ke(we,{children:["\u7816\u5757: ",me(we,{color:"cyan",children:m})]})}),me(qe,{children:Ke(we,{color:d.paused?"gray":"green",children:["[",d.paused?"\u6682\u505C":"\u8FD0\u884C\u4E2D","]"]})})]}),Ke(qe,{flexDirection:"column",children:[Ke(we,{children:["\u250C","\u2500".repeat(dt),"\u2510"]}),me(we,{children:r?" \x1B[90m\u9009\u62E9\u5173\u5361\u540E\u5F00\u59CB...\x1B[0m":h}),Ke(we,{children:["\u2514","\u2500".repeat(dt),"\u2518"]})]}),r&&Ke(qe,{marginTop:1,flexDirection:"column",children:[me(we,{bold:!0,color:"yellow",children:"\u9009\u62E9\u5173\u5361"}),me(qe,{flexDirection:"row",flexWrap:"wrap",children:bu.map((g,w)=>me(qe,{width:22,children:Ke(we,{children:[me(we,{color:t===w+1?"green":"white",children:w+1===10?"0":String(w+1)}),". ",g.desc," (",g.rows,"\xD7",g.cols,")"]})},w))}),me(qe,{marginTop:1,children:me(we,{dimColor:!0,children:"\u6309\u6570\u5B57\u9009\u5173 q \u9000\u51FA"})})]}),!r&&(d.gameOver||d.win)&&Ke(qe,{marginTop:1,children:[me(we,{bold:!0,color:d.gameOver?"red":"green",children:d.gameOver?"\u6E38\u620F\u7ED3\u675F\uFF01":"\u606D\u559C\u901A\u5173\uFF01"}),Ke(we,{children:[" \u5206\u6570: ",me(we,{color:"yellow",children:d.score})]})]}),!r&&me(qe,{marginTop:1,children:d.gameOver||d.win?me(we,{dimColor:!0,children:"\u2190 \u2192 \u79FB\u52A8 r \u91CD\u5F00 l \u9009\u5173 q \u9000\u51FA"}):me(we,{dimColor:!0,children:"\u2190 \u2192 \u79FB\u52A8 p \u6682\u505C q \u9000\u51FA"})})]})}var Nh={id:"brick-breaker",name:"Brick Breaker",description:"\u7ECF\u5178\u6253\u7816\u5757\u6E38\u620F\uFF0C10 \u4E2A\u5173\u5361\u53EF\u9009\uFF01",play:async()=>{await new Promise(e=>{let{unmount:t}=gC(me(kC,{onExit:()=>{t(),e()}}))})}};p();import{Box as Cr,Text as nt,useInput as SC,render as TC}from"ink";import{useState as Mh,useEffect as Bh,useRef as Fh,useCallback as CC}from"react";import{jsx as xt,jsxs as Jt}from"react/jsx-runtime";var pt=66,Wh=20,ku=6,_C=10,_r=["#00ffff","#ff00ff","#00ff41","#ff1493","#8b00ff"],Gh={0:[" \u2588\u2588\u2588\u2588\u2588\u2588 ","\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 "],1:[" \u2588\u2588 "," \u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "],2:[" \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "],3:[" \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "],4:["\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588 "],5:[" \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "],6:[" \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 "],7:[" \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588 "," \u2588\u2588 "," \u2588\u2588 "],8:[" \u2588\u2588\u2588\u2588\u2588\u2588 ","\u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 ","\u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 "],9:[" \u2588\u2588\u2588\u2588\u2588\u2588 ","\u2588\u2588 \u2588\u2588"," \u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588 "]};function vC(e){let t=["","","","",""];for(let r of e){let o=Gh[r]??Gh[0];for(let s=0;s<5;s++)t[s]+=" "+(o[s]??"")}let n=6;return t.map(r=>" ".repeat(n)+r)}function wu(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return`${t};${n};${r}`}var jh=["react","vue","next","node","axios","express","lodash","jquery","webpack","vite","babel","eslint","prettier","tailwind","bootstrap","sass","less","postcss","redux","pinia","vuex","router","nestjs","socket","graphql","rest","grpc","prisma","typeorm","html","css","jsx","tsx","dom","spa","ssr","csr","pwa","component","prop","hook","composable","directive","filter","mixin","template","render","virtual","diff","patch","hydration","responsive","flexbox","grid","animation","transition","api","route","middleware","controller","service","module","dto","entity","schema","migration","seeder","factory","auth","jwt","oauth","session","cookie","token","cors","cache","redis","mq","rabbit","kafka","nats","sql","mysql","pg","sqlite","mongo","redis","orm","table","index","query","join","union","group","order","where","having","limit","offset","insert","update","delete","docker","nginx","linux","bash","shell","yaml","toml","ci","cd","deploy","rollback","release","build","test","lint","format","stage","commit","branch","merge","rebase","array","stack","queue","tree","graph","list","map","set","sort","search","filter","reduce","map","async","await","promise","callback","closure","proxy","reflect","decorator","create","read","update","delete","crud","parse","stringify","encode","decode","transform","validate","format","parse","upload","download","export","import","backup","restore","string","number","boolean","object","array","tuple","enum","interface","type","class","function","method","property","public","private","static","readonly","optional","abstract","const","let","var","void","null","undef","never","any","config","logger","monitor","metric","alert","webhook","endpoint","payload","header","status","timeout","retry","fallback","circuit","breaker","throttle","debounce","scroll","resize","click","hover","focus","blur"];function RC(e){let t;do t=jh[Math.floor(Math.random()*jh.length)];while(e.has(t));return t}function Uh(){return{words:[],score:0,lives:3,speed:.3,spawnTimer:0,gameOver:!1,paused:!1,typed:"",target:null,combo:0,message:"",messageTimer:0,usedWords:new Set}}function Ri(e){let t=null;for(let n of e.words)(!t||n.col<t.col)&&(t=n);return t?.text??null}function AC(e){if(e.paused||e.gameOver)return;if(e.spawnTimer++,e.spawnTimer>=Math.max(20,50-Math.floor(e.speed*15))&&(e.spawnTimer=0,e.words.length<_C)){let r=new Set(e.usedWords);for(let a of e.words)r.add(a.text);let o=RC(r),s=new Set(e.words.map(a=>a.row)),i=-1;for(let a=ku;a<Wh;a++)if(!s.has(a)){i=a;break}i>=0&&(e.words.push({text:o,row:i,col:pt-1}),e.usedWords.add(o))}for(let r of e.words)r.col-=e.speed;let t=e.words.length;e.words=e.words.filter(r=>r.col>-r.text.length);let n=t-e.words.length;n>0&&(e.lives-=n,e.typed="",e.target=Ri(e),e.lives<=0&&(e.gameOver=!0,e.words=[])),e.target=Ri(e),e.messageTimer>0&&(e.messageTimer--,e.messageTimer<=0&&(e.message=""))}function EC(e,t,n,r){let o=[];for(let s=0;s<Wh;s++){let i="";if(s<ku){if(s<5){let a=(t[s]??"").padEnd(pt);i=`\x1B[38;2;${wu(n)}m${a}\x1B[0m`}else if(s===5){if(e.combo>=3){let a=`${e.combo}\u8FDE\u51FB!`,l=Math.floor((pt-a.length)/2),c=_r[e.combo%_r.length],u=" ".repeat(l)+a+" ".repeat(pt-l-a.length);i=`\x1B[38;2;${wu(c)}m${u}\x1B[0m`}else if(e.paused){let l=Math.floor((pt-2)/2);i=" ".repeat(l)+"\u6682\u505C",i=i.padEnd(pt)}}i=i.padEnd(pt)}else if(s===ku&&r){let a=Math.floor((pt-r.length)/2),l=" ".repeat(a)+r+" ".repeat(pt-a-r.length),c=_r[Math.floor(Math.random()*_r.length)];i=`\x1B[38;2;${wu(c)}m${l}\x1B[0m`}else for(let a=0;a<pt;a++){let l=e.words.find(c=>{let u=a-Math.floor(c.col);return u>=0&&u<c.text.length&&c.row===s});if(l){let c=a-Math.floor(l.col),u=l.text[c],d=l.text===e.target,m=e.target===l.text?e.typed.length:0,h=d&&c<m;d?i+=h?`\x1B[92m${u}\x1B[0m`:`\x1B[97m${u}\x1B[0m`:i+=`\x1B[90m${u}\x1B[0m`}else i+=" "}o.push(i)}return o}function IC({onExit:e}){let t=Fh(Uh()),[n,r]=Mh(0),[o,s]=Mh(0),i=Fh(e);i.current=e,Bh(()=>{let m=setInterval(()=>{s(h=>(h+1)%_r.length)},400);return()=>clearInterval(m)},[]),Bh(()=>{let m=setInterval(()=>{AC(t.current),r(h=>h+1)},60);return()=>clearInterval(m)},[]),SC(CC((m,h)=>{let f=t.current;if(f.gameOver){m==="r"?(t.current=Uh(),r(0)):(m==="q"||h.escape)&&i.current();return}if(m==="p"&&h.ctrl||m===" "){f.paused=!f.paused;return}if(m==="q"&&h.ctrl||h.escape){i.current();return}if(!f.paused&&m.length===1&&m>="a"&&m<="z"&&(f.target||(f.target=Ri(f)),f.target))if(f.target[f.typed.length]===m){if(f.typed+=m,f.typed===f.target){f.words=f.words.filter(S=>S.text!==f.target),f.combo++;let w=f.score,x=f.target.length,T=f.combo>=3?f.score:0;f.score+=x+T,f.speed=f.speed+.02;let v=Math.floor(w/500);Math.floor(f.score/500)>v&&(f.speed+=.15),f.score>=1e5&&w<1e5&&(f.message="\u606D\u559C\u901A\u5173! \u96BE\u5EA6\u6700\u5927\u5316!",f.messageTimer=100),f.typed="",f.target=Ri(f)}}else f.combo=0},[]));let a=t.current,l=_r[o],c=String(a.score).padStart(5,"0"),u=vC(c),d=EC(a,u,l,a.message);return Jt(Cr,{flexDirection:"column",paddingX:1,children:[xt(Cr,{flexDirection:"row",children:Jt(nt,{children:["\u751F\u547D ",xt(nt,{color:"red",children:"\u2665".repeat(Math.max(0,a.lives))})," ","\u901F\u5EA6 ",Jt(nt,{color:"cyan",children:["Lv.",Math.floor(a.speed*10)]})]})}),!a.gameOver&&a.target&&xt(Cr,{marginTop:1,children:Jt(nt,{children:["\u6253\u5B57: ",xt(nt,{color:"green",children:a.typed}),xt(nt,{color:"white",children:a.target.slice(a.typed.length)})]})}),Jt(Cr,{flexDirection:"column",marginTop:1,children:[Jt(nt,{children:["\u250C","\u2500".repeat(pt),"\u2510"]}),d.map((m,h)=>xt(nt,{children:`\u2502${m}\u2502`},h)),Jt(nt,{children:["\u2514","\u2500".repeat(pt),"\u2518"]})]}),a.gameOver&&Jt(Cr,{marginTop:1,children:[xt(nt,{bold:!0,color:"red",children:"\u6E38\u620F\u7ED3\u675F\uFF01"}),Jt(nt,{children:[" \u5F97\u5206: ",xt(nt,{color:"yellow",children:a.score})," r \u91CD\u5F00 q \u9000\u51FA"]})]}),xt(Cr,{marginTop:1,children:xt(nt,{dimColor:!0,children:"\u6253\u5B57\u6D88\u9664\u5355\u8BCD \u7A7A\u683C/Ctrl+P\u6682\u505C Ctrl+Q\u9000\u51FA"})})]})}var Hh={id:"coder-check",name:"Coder Check",description:"\u6781\u901F\u6253\u5B57\u6E38\u620F\uFF0C\u8F93\u5165\u5355\u8BCD\u6D88\u9664\u5B83\u4EEC\uFF01",play:async()=>{await new Promise(e=>{let{unmount:t}=TC(xt(IC,{onExit:()=>{t(),e()}}))})}};p();p();function PC(e,t){return e==="UP"&&t==="DOWN"||e==="DOWN"&&t==="UP"||e==="LEFT"&&t==="RIGHT"||e==="RIGHT"&&t==="LEFT"}function Su(e,t){return e.x===t.x&&e.y===t.y}function LC(e,t){switch(t){case"UP":return{x:e.x,y:e.y-1};case"DOWN":return{x:e.x,y:e.y+1};case"LEFT":return{x:e.x-1,y:e.y};case"RIGHT":return{x:e.x+1,y:e.y}}}function $C(e,t){return{x:(e.x%t.width+t.width)%t.width,y:(e.y%t.height+t.height)%t.height}}function Tu(e,t,n,r=[]){let o=new Set(e.map(a=>`${a.x},${a.y}`));for(let a of r)o.add(`${a.x},${a.y}`);let s=t.width*t.height;if(o.size>=s)return null;let i;do i={x:Math.floor(Math.random()*t.width),y:Math.floor(Math.random()*t.height)};while(o.has(`${i.x},${i.y}`));return{position:i,type:n,...n==="special"?{spawnedAt:Date.now()}:{}}}function Cu(e){let t=Math.floor(e.width/2),n=Math.floor(e.height/2),r=[{x:t,y:n},{x:t-1,y:n},{x:t-2,y:n}],o=Tu(r,e,"normal");return{snake:r,direction:"RIGHT",nextDirection:"RIGHT",food:o,specialFood:null,score:0,speedLevel:1,isGameOver:!1,isPaused:!1,wallWrap:Math.random()<.5,tickInterval:e.initialSpeed}}function zh(e,t){e.direction=e.nextDirection;let n=e.snake[0],r=LC(n,e.direction);if(r.x<0||r.x>=t.width||r.y<0||r.y>=t.height)if(e.wallWrap)r=$C(r,t);else{e.isGameOver=!0;return}let s=Su(r,e.food.position),i=e.specialFood!==null&&Su(r,e.specialFood.position),l=s||i?e.snake:e.snake.slice(0,-1);for(let c of l)if(Su(r,c)){e.isGameOver=!0;return}if(e.snake.unshift(r),s){e.score+=1,Vh(e,t);let c=e.specialFood?[e.specialFood.position]:[],u=Tu(e.snake,t,"normal",c);if(u)e.food=u;else{e.isGameOver=!0;return}e.specialFood===null&&Math.random()<.25&&(e.specialFood=Tu(e.snake,t,"special",[e.food.position]))}else i?(e.score+=3,Vh(e,t),e.specialFood=null):e.snake.pop();e.specialFood?.spawnedAt!==void 0&&Date.now()-e.specialFood.spawnedAt>5e3&&(e.specialFood=null)}function Vh(e,t){let n=Math.floor(e.score/t.scorePerLevel)+1;e.speedLevel=n,e.tickInterval=Math.max(t.minSpeed,t.initialSpeed-(n-1)*t.speedDecrement)}function qh(e,t){PC(t,e.direction)||(e.nextDirection=t)}p();import Ie from"chalk";var Kh=2,OC=" ",DC="\u2593",NC="\u2593",MC="\u25C6",BC="\u2605",Po="\x1B[",FC=`${Po}?25l`,GC=`${Po}?25h`,Xh=`${Po}H`;function Jh(){process.stdout.write(FC)}function Zh(){process.stdout.write(GC)}function Yh(){process.stdout.write(`${Po}2J${Xh}`)}function jC(e,t){switch(t){case"snake-head":return Ie.greenBright(e);case"snake-body":return Ie.green(e);case"normal-food":return Ie.red(e);case"special-food":return Ie.yellow(e);case"empty":return e}}function Qh(e,t){let n=UC(e,t);process.stdout.write(`${Po}2J${Xh}`+n.join(`
603
603
  `))}function UC(e,t){let{width:n,height:r}=t,o=[],s=Array.from({length:r},()=>Array(n).fill("empty"));for(let l=1;l<e.snake.length;l++){let c=e.snake[l];c.y>=0&&c.y<r&&c.x>=0&&c.x<n&&(s[c.y][c.x]="snake-body")}let i=e.snake[0];i.y>=0&&i.y<r&&i.x>=0&&i.x<n&&(s[i.y][i.x]="snake-head");let a=e.food.position;if(s[a.y][a.x]==="empty"&&(s[a.y][a.x]="normal-food"),e.specialFood){let l=e.specialFood.position;s[l.y][l.x]==="empty"&&(s[l.y][l.x]="special-food")}o.push(" "+Ie.gray("\u2554"+"\u2550\u2550".repeat(n)+"\u2557"));for(let l=0;l<r;l++){let c=" "+Ie.gray("\u2551");for(let u=0;u<n;u++){let d=s[l][u],m;switch(d){case"snake-head":m=NC.repeat(Kh);break;case"snake-body":m=DC.repeat(Kh);break;case"normal-food":m=MC+" ";break;case"special-food":m=BC+" ";break;default:m=OC}c+=jC(m,d)}c+=Ie.gray("\u2551"),o.push(c)}if(o.push(" "+Ie.gray("\u255A"+"\u2550\u2550".repeat(n)+"\u255D")),o.push(""),o.push(` ${Ie.cyan("\u5206\u6570")}: ${e.score} ${Ie.cyan("\u957F\u5EA6")}: ${e.snake.length} ${Ie.cyan("\u901F\u5EA6")}: Lv.${e.speedLevel} ${Ie.cyan("\u8FB9\u754C")}: ${e.wallWrap?"\u7A7F\u5899":"\u649E\u5899"}`),e.specialFood?.spawnedAt!==void 0){let l=Math.ceil((5e3-(Date.now()-e.specialFood.spawnedAt))/1e3);l>0&&o.push(` ${Ie.yellow(`\u2B50 \u7279\u6B8A\u98DF\u7269 ${l} \u79D2\u540E\u6D88\u5931`)}`)}return o.push(` ${Ie.gray("W/A/S/D \u6216 \u65B9\u5411\u952E\u79FB\u52A8 | P \u6682\u505C | M \u5207\u6362\u6A21\u5F0F | Q \u9000\u51FA")}`),e.isPaused&&(o.push(""),o.push(` ${Ie.yellow("\u23F8 \u5DF2\u6682\u505C \u2014 \u6309 P \u7EE7\u7EED")}`)),e.isGameOver&&(o.push(""),o.push(` ${Ie.red.bold("\u{1F480} \u6E38\u620F\u7ED3\u675F!")} ${Ie.cyan("\u6700\u7EC8\u5206\u6570: "+e.score)}`),o.push(` ${Ie.gray("\u6309 R \u91CD\u65B0\u5F00\u59CB | \u6309 Q \u9000\u51FA")}`)),o}p();import*as eg from"readline";var WC={up:"UP",w:"UP",W:"UP",down:"DOWN",s:"DOWN",S:"DOWN",left:"LEFT",a:"LEFT",A:"LEFT",right:"RIGHT",d:"RIGHT",D:"RIGHT"};function tg(e,t,n){eg.emitKeypressEvents(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0);let r=(o,s)=>{if(!s||!s.name)return;let{name:i,ctrl:a}=s;if(a&&(i==="c"||i==="d")){t();return}if(i==="q"){t();return}let l=e.state;if(l.isGameOver){i==="r"&&(e.state=n());return}if(i==="p"){l.isPaused=!l.isPaused;return}if(i==="m"){l.wallWrap=!l.wallWrap;return}let c=WC[i];c&&qh(l,c)};return process.stdin.on("keypress",r),()=>{process.stdin.removeListener("keypress",r),process.stdin.isTTY&&process.stdin.setRawMode(!1)}}var Ai={width:20,height:16,initialSpeed:180,minSpeed:60,speedDecrement:10,scorePerLevel:5},HC=200,VC={id:"snake",name:"Big Snake",description:"\u7ECF\u5178\u8D2A\u5403\u86C7\uFF0C\u53CC\u98DF\u7269\u7CFB\u7EDF\u3001\u96BE\u5EA6\u9012\u589E\u3001\u7A7F\u5899/\u649E\u5899\u6A21\u5F0F",play:async()=>{let e={state:Cu(Ai)};return new Promise(t=>{let n=tg(e,()=>{r=!0,clearTimeout(o),Zh(),n(),t()},()=>Cu(Ai));Yh(),Jh();let r=!1,o;function s(){if(r)return;let i=e.state;!i.isGameOver&&!i.isPaused&&zh(i,Ai),Qh(i,Ai);let a=i.isGameOver||i.isPaused?HC:i.tickInterval;o=setTimeout(s,a)}o=setTimeout(s,0)})}},ng=VC;function _u(){return vi(Nh),vi(Hh),vi(ng),Io()}import{render as mg}from"ink";import wt from"chalk";p();p();import{Box as J,Text as Z,useInput as zC}from"ink";import{useState as ft,useCallback as rg,useEffect as Lo,useMemo as qC}from"react";import vu from"asciichart";import KC from"os";import{join as XC}from"path";import{jsx as M,jsxs as Pe}from"react/jsx-runtime";var og=XC(KC.homedir(),".dskcode","settings.json");function JC(e){let t=e.replace(/\\/g,"/");return process.platform==="win32"?"file://"+t.replace(/^([a-zA-Z]:)/,"/$1"):"file://"+t}function ZC(e,t){return`\x1B]8;;${e}\x1B\\${t}\x1B]8;;\x1B\\`}var YC="https://web.ifzq.gtimg.cn/appstock/app/minute/query?code={code}&r=0.1";function sg(e){return e.startsWith("sh")||e.startsWith("sz")?e:/^60|^68|^51/.test(e)?"sh"+e:/^00|^30|^39/.test(e)?"sz"+e:"sh"+e}async function ig(e){let t=YC.replace("{code}",sg(e));try{let r=await(await fetch(t)).json();if(r.code!==0)return null;let o=sg(e),s=r.data?.[o];if(!s)return null;let i=s.data?.data??[],a=[];for(let d of i){let m=d.split(" ");if(m.length>=2){let h=parseFloat(m[1]);isNaN(h)||a.push(h)}}let l=o,c=s.qt?.[l],u=null;return c&&c.length>=35&&(u={code:e,name:c[1]??"",price:parseFloat(c[3]??"0"),changePercent:parseFloat(c[32]??"0"),changeAmount:parseFloat(c[31]??"0"),high:parseFloat(c[33]??"0"),low:parseFloat(c[34]??"0"),volume:parseInt(c[6]??"0",10),amount:parseFloat(c[37]??"0")*1e4}),{prices:a,quote:u,date:s.data?.date??""}}catch{return null}}var ag=new Map;function lg(e,t){ag.set(e,t)}var QC=[{code:"000001",name:"\u4E0A\u8BC1\u6307\u6570",price:3150,changePercent:.35,changeAmount:11.02,high:3160,low:3140,volume:28543e4,amount:156e10},{code:"601899",name:"\u7D2B\u91D1\u77FF\u4E1A",price:18.2,changePercent:1.85,changeAmount:.33,high:18.45,low:17.9,volume:59615384,amount:1085e7},{code:"399006",name:"\u521B\u4E1A\u677F\u6307",price:1820,changePercent:-.52,changeAmount:-9.5,high:1835,low:1815,volume:9865e4,amount:1824e7}];async function e_(e){let n=(await Promise.all(e.map(async r=>{let o=await ig(r);return o?.quote?(o.prices.length>0&&lg(r,o.prices),o.quote):null}))).filter(r=>r!==null);return n.length>0?n:QC}function Ei(e){return e>=100?e.toFixed(2):e.toFixed(3)}function t_(e){return e>=1e12?(e/1e12).toFixed(2)+"\u4E07\u4EBF":e>=1e8?(e/1e8).toFixed(2)+"\u4EBF":e>=1e4?(e/1e4).toFixed(1)+"\u4E07":e.toLocaleString()}function n_(e,t=60){return e.length<=t?e:e.slice(e.length-t)}function Ii({codes:e,onExit:t,onBackToChat:n}){let[r,o]=ft([]),[s,i]=ft(0),[a,l]=ft(!0),[c,u]=ft(""),[d,m]=ft(null),[h,f]=ft(null),[g,w]=ft(!1),[x,T]=ft(10),[v,_]=ft(5),[S,D]=ft(()=>new Date().toLocaleTimeString("zh-CN",{hour12:!1})),[H,E]=ft(!1),[I,B]=ft("default"),Y=qC(()=>I==="default"?r:[...r].toSorted((j,re)=>I==="desc"?re.changePercent-j.changePercent:j.changePercent-re.changePercent),[r,I]),{doubleCtrlC:q,handleCtrlC:ae}=Tn(t);Lo(()=>{let j=setInterval(()=>{D(new Date().toLocaleTimeString("zh-CN",{hour12:!1}))},1e3);return()=>clearInterval(j)},[]);let ce=rg(async()=>{l(!0);try{let j=await e_(e??[]);o(j),u(new Date().toLocaleTimeString())}catch{}l(!1)},[e]);if(Lo(()=>{ce()},[ce]),Lo(()=>{let j=setInterval(()=>{_(re=>re<=1?(ce(),5):re-1)},1e3);return()=>clearInterval(j)},[ce]),Lo(()=>{if(d){let j=()=>{ag.delete(d.code),ig(d.code).then(se=>{se&&se.prices.length>0&&(lg(d.code,se.prices),f(se.prices))})};j(),T(10);let re=setInterval(j,1e4);return()=>clearInterval(re)}f(null),w(!1)},[d]),Lo(()=>{if(!d)return;let j=setInterval(()=>{T(re=>re>0?re-1:10)},1e3);return()=>clearInterval(j)},[d]),zC(rg((j,re)=>{if(j==="c"&&re.ctrl){ae();return}if(d){(re.escape||j==="q"||j===" ")&&m(null);return}if(r.length!==0)if(re.upArrow||j==="k")i(se=>se>0?se-1:r.length-1);else if(re.downArrow||j==="j")i(se=>se<r.length-1?se+1:0);else if(re.return){let se=r[s];se&&m(se)}else re.escape||j==="q"?n?n():t():j==="r"?(_(5),ce()):j==="o"?B(se=>se==="default"?"desc":se==="desc"?"asc":"default"):j==="h"&&E(se=>!se)},[r,s,d,t,n,ce,ae,E])),d)return g?M(J,{paddingLeft:1,children:M(Z,{dimColor:!0,children:" \u27F3 \u52A0\u8F7D\u5206\u65F6\u6570\u636E..."})}):r_(d,()=>m(null),h??void 0,x,S);let Q=j=>H?{dimColor:!0}:{color:j};return Pe(J,{flexDirection:"column",children:[Pe(J,{marginBottom:1,justifyContent:"space-between",children:[M(Z,{bold:!0,...Q("#00ffff"),children:" \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7"}),Pe(Z,{dimColor:!0,children:[" \u{1F550} ",S]}),M(Z,{dimColor:!0,children:a?" \u27F3 \u5237\u65B0\u4E2D...":` ${v}s \u540E\u81EA\u52A8\u5237\u65B0`})]}),Pe(J,{children:[M(J,{width:3}),M(J,{width:9,children:M(Z,{dimColor:!0,children:"\u4EE3\u7801"})}),M(J,{width:16,children:M(Z,{dimColor:!0,children:"\u540D\u79F0"})}),M(J,{width:12,children:M(Z,{dimColor:!0,children:"\u6700\u65B0\u4EF7"})}),M(J,{width:12,children:Pe(Z,{dimColor:!0,children:["\u6DA8\u8DCC\u5E45",I==="desc"?" \u25BC":I==="asc"?" \u25B2":""]})}),M(J,{width:12,children:M(Z,{dimColor:!0,children:"\u6DA8\u8DCC\u989D"})}),M(J,{width:12,children:M(Z,{dimColor:!0,children:"\u6700\u9AD8"})}),M(J,{width:12,children:M(Z,{dimColor:!0,children:"\u6700\u4F4E"})}),M(J,{children:M(Z,{dimColor:!0,children:"\u6210\u4EA4\u989D"})})]}),M(J,{children:M(Z,{dimColor:!0,children:" "+"\u2500".repeat(100)})}),M(J,{flexDirection:"column",children:Y.map((j,re)=>{let se=re===s,he=j.changePercent>=0,Rr=he?"#ff1493":"#00ff41";return Pe(J,{children:[M(J,{width:3,flexShrink:0,children:se?M(Z,{bold:!0,...Q("#00ffff"),children:"\u25B8 "}):M(Z,{children:" "})}),M(J,{width:9,children:M(Z,{bold:!0,...Q(se?"#00ffff":"#ffffff"),children:j.code})}),M(J,{width:16,children:M(Z,{...Q(se?"#ffffff":"#cccccc"),children:j.name})}),M(J,{width:12,children:M(Z,{bold:!0,...Q(Rr),children:Ei(j.price)})}),M(J,{width:12,children:Pe(Z,{...Q(Rr),children:[he?"+":"",j.changePercent.toFixed(2),"%"]})}),M(J,{width:12,children:Pe(Z,{...Q(Rr),children:[he?"+":"",j.changeAmount.toFixed(3)]})}),M(J,{width:12,children:M(Z,{...Q("#cccccc"),children:Ei(j.high)})}),M(J,{width:12,children:M(Z,{...Q("#888888"),children:Ei(j.low)})}),M(J,{children:M(Z,{...Q("#888888"),children:t_(j.amount)})})]},j.code)})}),M(J,{marginTop:1,children:M(Z,{dimColor:!0,children:" \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 o \u6392\u5E8F h \u7F6E\u7070/\u6062\u590D q \u8FD4\u56DE"})}),Pe(J,{children:[M(Z,{dimColor:!0,children:` \u6700\u540E\u66F4\u65B0: ${c} \u7F16\u8F91\u81EA\u9009\u80A1: `}),M(Z,{...Q("#c792ea"),children:ZC(JC(og),og)})]}),q&&M(J,{marginTop:1,children:M(Z,{bold:!0,...Q("#ff1493"),children:" \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode"})})]})}function r_(e,t,n,r=10,o){let s=e.changePercent>=0,i=s?"#ff1493":"#00ff41",a=s?"\u25B2":"\u25BC",l=[];if(n&&n.length>0){let c=s?vu.red:vu.green,u=n_(n,60),d=vu.plot(u,{height:10,colors:[c]});d=d.replaceAll("\u256D","\u250C").replaceAll("\u256E","\u2510").replaceAll("\u2570","\u2514").replaceAll("\u256F","\u2518"),l=d.split(`
604
- `)}return Pe(J,{flexDirection:"column",paddingLeft:1,children:[Pe(J,{marginBottom:1,justifyContent:"space-between",children:[Pe(J,{children:[Pe(Z,{bold:!0,color:"#00ffff",children:[" \u{1F4CA} ",e.name," "]}),M(Z,{dimColor:!0,children:e.code}),o&&Pe(Z,{dimColor:!0,children:[" \u{1F550} ",o]})]}),M(Z,{dimColor:!0,children:`${r}s \u540E\u5237\u65B0`})]}),Pe(J,{children:[M(J,{width:16,children:M(Z,{bold:!0,color:"#888888",children:"\u5F53\u524D\u4EF7"})}),M(J,{children:Pe(Z,{bold:!0,color:i,children:[a," ",Ei(e.price)]})})]}),Pe(J,{children:[M(J,{width:16,children:M(Z,{color:"#888888",children:"\u6DA8\u8DCC\u5E45"})}),M(J,{children:Pe(Z,{color:i,children:[s?"+":"",e.changePercent.toFixed(2),"%"," ",s?"+":"",e.changeAmount.toFixed(3)]})})]}),l.length>0&&M(J,{marginTop:1,flexDirection:"column",children:l.map((c,u)=>M(J,{children:M(Z,{color:i,children:c||" "})},u))}),M(J,{marginTop:1,children:M(Z,{dimColor:!0,children:" Space/q \u8FD4\u56DE\u5217\u8868"})})]})}p();import{readdir as o_}from"fs/promises";import{join as cg,relative as s_}from"path";var i_=new Set(["node_modules",".git",".svn",".hg",".dskcode",".claude","dist","build",".next",".turbo",".nx","coverage",".cache",".nyc_output",".vscode",".idea","__pycache__",".venv","venv",".tox","target","vendor","bower_components","jspm_packages"]);async function ug(e,t,n=1/0){let r=t??e,o;try{o=await o_(r,{withFileTypes:!0})}catch{return[]}let s=[],i=[];for(let c of o){let u=c.name;i_.has(u)||u.startsWith(".")||(c.isDirectory()?i.push(u):c.isFile()&&s.push(s_(e,cg(r,u))))}let a=t===void 0?n:Math.max(0,n-1),l=a<=1?[]:await Promise.all(i.map(c=>ug(e,cg(r,c),a)));for(let c of l)s.push(...c);return s}async function dg(e){return ug(e)}import{jsx as vr}from"react/jsx-runtime";var d_=["chat","run","setup","init","completion","game","stock","config-ui"];function hg(){let e=new a_;return e.exitOverride(),e.name("dskcode").description("\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\u7EC8\u7AEF\u5DE5\u5177").version(ko,"-V, --version","\u663E\u793A\u7248\u672C\u53F7").option("--verbose","\u5F00\u542F\u8BE6\u7EC6\u65E5\u5FD7\u8F93\u51FA").option("--config <path>","\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").option("--dir <path>","\u6307\u5B9A\u5DE5\u4F5C\u5B50\u76EE\u5F55\uFF0C@ \u63D0\u793A\u4EC5\u663E\u793A\u8BE5\u76EE\u5F55\u4E0B\u7684\u6587\u4EF6").option("--no-config-ui","\u4E0D\u62C9\u8D77\u672C\u5730 ws server\uFF08\u9ED8\u8BA4\u4E0E chat \u5E76\u53D1\u62C9\u8D77\uFF09").option("--ws","\u8DF3\u8FC7 chat\uFF0C\u76F4\u63A5\u542F\u52A8\u672C\u5730 WebSocket \u670D\u52A1\uFF08\u9ED8\u8BA4 54006 \u7AEF\u53E3\uFF0C\u4F9B Chrome \u6269\u5C55\u8FDE\u63A5\uFF09"),e.helpInformation=()=>rd(e),e.hook("preAction",async(t,n)=>{let r=await nd.call(t);n.dskcodeCtx=r}),e.command("chat").description("\u542F\u52A8\u4EA4\u4E92\u5F0F\u5BF9\u8BDD\u4F1A\u8BDD(\u65E0\u53C2\u8FD0\u884C `dskcode` \u7B49\u4EF7\u4E8E\u6B64\u547D\u4EE4)").action(async function(){await pg(this)}),e.action(async function(){let t=this;if(t.opts().ws){let{startConfigUi:r}=await import("./config-ui-JE4ZQLPC.js");await r({});return}await pg(t)}),e.command("run").description("\u6267\u884C\u4E00\u6B21\u6027\u4EFB\u52A1").argument("[prompt...]","\u4EFB\u52A1\u63CF\u8FF0").option("--model <name>","\u6307\u5B9A\u4F7F\u7528\u7684\u6A21\u578B").action(async function(t){console.log("dskcode run \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C07\u7AE0\uFF09")}),e.command("setup").description("\u8FD0\u884C\u914D\u7F6E\u5411\u5BFC").option("--export","\u4EE5 JSON \u683C\u5F0F\u5BFC\u51FA\u914D\u7F6E").option("--test","\u6D4B\u8BD5 API Key \u8FDE\u901A\u6027").action(async function(){console.log("dskcode setup \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C14\u7AE0\uFF09")}),e.command("init").description("\u5728\u5F53\u524D\u9879\u76EE\u4E0B\u751F\u6210\u9879\u76EE\u8BB0\u5FC6\u6587\u4EF6\uFF08AGENTS.md\uFF09").action(async function(){console.log("dskcode init \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C11\u7AE0\uFF09")}),e.command("completion").description("\u8F93\u51FA shell \u81EA\u52A8\u8865\u5168\u914D\u7F6E\u8BF4\u660E\uFF08bash/zsh\uFF09").argument("[shell]","shell \u7C7B\u578B",/^(bash|zsh)$/i).action(async function(t){if(!t){console.log("\u8BF7\u6307\u5B9A shell \u7C7B\u578B\uFF1Adskcode completion bash \u6216 dskcode completion zsh");return}console.log(t==="bash"?`# dskcode bash \u81EA\u52A8\u8865\u5168
604
+ `)}return Pe(J,{flexDirection:"column",paddingLeft:1,children:[Pe(J,{marginBottom:1,justifyContent:"space-between",children:[Pe(J,{children:[Pe(Z,{bold:!0,color:"#00ffff",children:[" \u{1F4CA} ",e.name," "]}),M(Z,{dimColor:!0,children:e.code}),o&&Pe(Z,{dimColor:!0,children:[" \u{1F550} ",o]})]}),M(Z,{dimColor:!0,children:`${r}s \u540E\u5237\u65B0`})]}),Pe(J,{children:[M(J,{width:16,children:M(Z,{bold:!0,color:"#888888",children:"\u5F53\u524D\u4EF7"})}),M(J,{children:Pe(Z,{bold:!0,color:i,children:[a," ",Ei(e.price)]})})]}),Pe(J,{children:[M(J,{width:16,children:M(Z,{color:"#888888",children:"\u6DA8\u8DCC\u5E45"})}),M(J,{children:Pe(Z,{color:i,children:[s?"+":"",e.changePercent.toFixed(2),"%"," ",s?"+":"",e.changeAmount.toFixed(3)]})})]}),l.length>0&&M(J,{marginTop:1,flexDirection:"column",children:l.map((c,u)=>M(J,{children:M(Z,{color:i,children:c||" "})},u))}),M(J,{marginTop:1,children:M(Z,{dimColor:!0,children:" Space/q \u8FD4\u56DE\u5217\u8868"})})]})}p();import{readdir as o_,realpath as s_}from"fs/promises";import{join as cg,relative as i_}from"path";var a_=new Set(["node_modules",".git",".svn",".hg",".dskcode",".claude","dist","build",".next",".turbo",".nx","coverage",".cache",".nyc_output",".vscode",".idea","__pycache__",".venv","venv",".tox","target","vendor","bower_components","jspm_packages"]);async function ug(e,t,n=1/0,r){let o=t??e,s=r??new Set;try{let d=await s_(o);if(s.has(d))return[];s.add(d)}catch{}let i;try{i=await o_(o,{withFileTypes:!0})}catch{return[]}let a=[],l=[];for(let d of i){let m=d.name;a_.has(m)||m.startsWith(".")||(d.isDirectory()?l.push(m):d.isFile()&&a.push(i_(e,cg(o,m))))}let c=t===void 0?n:Math.max(0,n-1),u=c<=1?[]:await Promise.all(l.map(d=>ug(e,cg(o,d),c,s)));for(let d of u)a.push(...d);return a}var l_=8;async function dg(e){return ug(e,void 0,l_)}import{jsx as vr}from"react/jsx-runtime";var f_=["chat","run","setup","init","completion","game","stock","config-ui"];function hg(){let e=new c_;return e.exitOverride(),e.name("dskcode").description("\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\u7EC8\u7AEF\u5DE5\u5177").version(ko,"-V, --version","\u663E\u793A\u7248\u672C\u53F7").option("--verbose","\u5F00\u542F\u8BE6\u7EC6\u65E5\u5FD7\u8F93\u51FA").option("--config <path>","\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").option("--dir <path>","\u6307\u5B9A\u5DE5\u4F5C\u5B50\u76EE\u5F55\uFF0C@ \u63D0\u793A\u4EC5\u663E\u793A\u8BE5\u76EE\u5F55\u4E0B\u7684\u6587\u4EF6").option("--no-config-ui","\u4E0D\u62C9\u8D77\u672C\u5730 ws server\uFF08\u9ED8\u8BA4\u4E0E chat \u5E76\u53D1\u62C9\u8D77\uFF09").option("--ws","\u8DF3\u8FC7 chat\uFF0C\u76F4\u63A5\u542F\u52A8\u672C\u5730 WebSocket \u670D\u52A1\uFF08\u9ED8\u8BA4 54006 \u7AEF\u53E3\uFF0C\u4F9B Chrome \u6269\u5C55\u8FDE\u63A5\uFF09"),e.helpInformation=()=>rd(e),e.hook("preAction",async(t,n)=>{let r=await nd.call(t);n.dskcodeCtx=r}),e.command("chat").description("\u542F\u52A8\u4EA4\u4E92\u5F0F\u5BF9\u8BDD\u4F1A\u8BDD(\u65E0\u53C2\u8FD0\u884C `dskcode` \u7B49\u4EF7\u4E8E\u6B64\u547D\u4EE4)").action(async function(){await pg(this)}),e.action(async function(){let t=this;if(t.opts().ws){let{startConfigUi:r}=await import("./config-ui-JE4ZQLPC.js");await r({});return}await pg(t)}),e.command("run").description("\u6267\u884C\u4E00\u6B21\u6027\u4EFB\u52A1").argument("[prompt...]","\u4EFB\u52A1\u63CF\u8FF0").option("--model <name>","\u6307\u5B9A\u4F7F\u7528\u7684\u6A21\u578B").action(async function(t){console.log("dskcode run \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C07\u7AE0\uFF09")}),e.command("setup").description("\u8FD0\u884C\u914D\u7F6E\u5411\u5BFC").option("--export","\u4EE5 JSON \u683C\u5F0F\u5BFC\u51FA\u914D\u7F6E").option("--test","\u6D4B\u8BD5 API Key \u8FDE\u901A\u6027").action(async function(){console.log("dskcode setup \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C14\u7AE0\uFF09")}),e.command("init").description("\u5728\u5F53\u524D\u9879\u76EE\u4E0B\u751F\u6210\u9879\u76EE\u8BB0\u5FC6\u6587\u4EF6\uFF08AGENTS.md\uFF09").action(async function(){console.log("dskcode init \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C11\u7AE0\uFF09")}),e.command("completion").description("\u8F93\u51FA shell \u81EA\u52A8\u8865\u5168\u914D\u7F6E\u8BF4\u660E\uFF08bash/zsh\uFF09").argument("[shell]","shell \u7C7B\u578B",/^(bash|zsh)$/i).action(async function(t){if(!t){console.log("\u8BF7\u6307\u5B9A shell \u7C7B\u578B\uFF1Adskcode completion bash \u6216 dskcode completion zsh");return}console.log(t==="bash"?`# dskcode bash \u81EA\u52A8\u8865\u5168
605
605
  _dskcode_completion() {
606
606
  local cur=\${COMP_WORDS[COMP_CWORD]}
607
607
  if [[ \${COMP_CWORD} -eq 1 ]]; then
608
- COMPREPLY=( $(compgen -W "${d_.join(" ")}" -- "\${cur}") )
608
+ COMPREPLY=( $(compgen -W "${f_.join(" ")}" -- "\${cur}") )
609
609
  return 0
610
610
  fi
611
611
  COMPREPLY=( $(compgen -W "--verbose --config --model" -- "\${cur}") )
@@ -624,15 +624,15 @@ _dskcode_completion() {
624
624
  )
625
625
  _describe 'dskcode commands' commands
626
626
  }
627
- compdef _dskcode_completion dskcode`)}),e.command("stock").description("\u67E5\u770B\u81EA\u9009\u80A1\u5B9E\u65F6\u884C\u60C5").argument("[codes...]","\u80A1\u7968\u4EE3\u7801\uFF08\u7A7A\u683C\u5206\u9694\uFF09\uFF0C\u5982 513090 600519").action(async function(t){let n=this.dskcodeCtx,r=process.env.HOME??process.env.USERPROFILE??"~",o=fg(r,".dskcode","settings.json"),s=!1;try{let c=await u_(o,"utf-8"),d=JSON.parse(c).stock;s=Array.isArray(d?.symbols)&&d.symbols.length>0}catch{}if(!s){let u=await ya([{code:"sh000001"},{code:"sz399300"},{code:"sh601899"}]);console.log(`${wt.green("\u2714")} \u5DF2\u751F\u6210\u81EA\u9009\u80A1\u914D\u7F6E: ${wt.dim(u)}`),console.log(`${wt.dim(" \u63D0\u793A: \u53EF\u7F16\u8F91\u4E0A\u8FF0\u6587\u4EF6\u81EA\u5B9A\u4E49\u81EA\u9009\u80A1\u5217\u8868")}
627
+ compdef _dskcode_completion dskcode`)}),e.command("stock").description("\u67E5\u770B\u81EA\u9009\u80A1\u5B9E\u65F6\u884C\u60C5").argument("[codes...]","\u80A1\u7968\u4EE3\u7801\uFF08\u7A7A\u683C\u5206\u9694\uFF09\uFF0C\u5982 513090 600519").action(async function(t){let n=this.dskcodeCtx,r=process.env.HOME??process.env.USERPROFILE??"~",o=fg(r,".dskcode","settings.json"),s=!1;try{let c=await p_(o,"utf-8"),d=JSON.parse(c).stock;s=Array.isArray(d?.symbols)&&d.symbols.length>0}catch{}if(!s){let u=await ya([{code:"sh000001"},{code:"sz399300"},{code:"sh601899"}]);console.log(`${wt.green("\u2714")} \u5DF2\u751F\u6210\u81EA\u9009\u80A1\u914D\u7F6E: ${wt.dim(u)}`),console.log(`${wt.dim(" \u63D0\u793A: \u53EF\u7F16\u8F91\u4E0A\u8FF0\u6587\u4EF6\u81EA\u5B9A\u4E49\u81EA\u9009\u80A1\u5217\u8868")}
628
628
  `)}let i=await Ot(),a=t&&t.length>0?t:i.config.stock?.symbols?.map(c=>c.code)??["sh000001","sz399006","sh601688"];await Br(vr(Ii,{codes:a,onExit:()=>process.exit(0)})).waitUntilExit}),_u(),e.command("game").description("\u542F\u52A8\u5185\u7F6E\u5C0F\u6E38\u620F").argument("[name]","\u6E38\u620F\u540D\u79F0\uFF0C\u4E0D\u6307\u5B9A\u5219\u663E\u793A\u4EA4\u4E92\u5F0F\u6E38\u620F\u5217\u8868").action(async function(t){if(t){let n=Lh(t);n||(console.error(`\u672A\u627E\u5230\u6E38\u620F "${t}"\u3002\u4F7F\u7528 dskcode game \u67E5\u770B\u53EF\u7528\u6E38\u620F\u5217\u8868\u3002`),process.exit(1)),console.log(`\u6B63\u5728\u542F\u52A8: ${n.name} \u2014 ${n.description}
629
629
  `),await n.play()}else{let n=Io();if(n.length===0){console.log("\u6682\u65E0\u53EF\u7528\u6E38\u620F\u3002");return}let r=await new Promise(o=>{let{unmount:s}=mg(vr(_i,{games:n,onSelect:i=>{s(),o(i)},onExit:()=>{s(),o(null)}}),{exitOnCtrlC:!1})});r&&(console.log(`
630
630
  \u542F\u52A8\u6E38\u620F: ${wt.green(r.name)}
631
631
  `),await r.play())}}),e.command("config-ui").description("\u542F\u52A8\u672C\u5730 WebSocket \u670D\u52A1\uFF0C\u5141\u8BB8 Chrome \u6269\u5C55\u7F16\u8F91 settings.json (\u9ED8\u8BA4\u7AEF\u53E3 54006)").option("--host <host>","\u76D1\u542C host\uFF0C\u9ED8\u8BA4 127.0.0.1\uFF08\u5FC5\u987B\u4FDD\u7559 loopback\uFF09","127.0.0.1").option("--port <port>","\u76D1\u542C\u7AEF\u53E3\uFF0C\u9ED8\u8BA4 54006 (\u4E0E Chrome \u6269\u5C55\u540C\u6B65)",t=>Number.parseInt(t,10),54006).action(async function(){let t=this.opts(),{startConfigUi:n}=await import("./config-ui-JE4ZQLPC.js");await n({host:t.host??"127.0.0.1",port:t.port??54006})}),e}async function pg(e){let t="opts"in e?e.opts():{},n=t.dir??process.cwd();process.stdin.isTTY||(console.error("dskcode chat \u9700\u8981\u4EA4\u4E92\u5F0F\u7EC8\u7AEF\u3002\u5982\u9700\u6267\u884C\u4E00\u6B21\u6027\u4EFB\u52A1\uFF0C\u8BF7\u4F7F\u7528 dskcode run\u3002"),process.exit(1));let r=e.dskcodeCtx;if(r&&!sd(r.config.providers)){let u=await id();u||process.exit(1);let d=await ga(u);console.log(` ${wt.green("\u2714")} API Key \u5DF2\u4FDD\u5B58\u5230 ${wt.dim(d)}
632
632
  `);let m=await Ot();r={...r,config:m.config}}await ud(process.cwd());let o=await ba();if(o){let u=await Ot();r={...r,config:u.config},console.log(" \u2714 \u5DF2\u751F\u6210\u6743\u9650\u914D\u7F6E: "+o),console.log(" \u63D0\u793A: \u53EF\u7F16\u8F91\u4E0A\u8FF0\u6587\u4EF6\u6DFB\u52A0 permissions \u89C4\u5219")}let s=ls(r?.config.voice);if(s.resolved)(s.source.appId==="env"||s.source.accessKey==="env")&&console.log(` ${wt.dim("\u2139 \u8BED\u97F3\u51ED\u636E\u4ECE\u73AF\u5883\u53D8\u91CF\u8BFB\u53D6\uFF08\u672A\u6301\u4E45\u5316\u5230 settings.json\uFF09")}`);else{let u=await ad();if(!u)console.log(" "+wt.yellow("\u26A0 \u672A\u914D\u7F6E\u8BED\u97F3\u8BC6\u522B\u51ED\u636E\uFF0C/voice \u547D\u4EE4\u4E0D\u53EF\u7528\uFF08\u5176\u4F59\u529F\u80FD\u6B63\u5E38\uFF09"));else{let d=process.env.HOME??process.env.USERPROFILE??"~",m=fg(d,".dskcode","settings.json");await Ta(m,u.appId,u.accessKey),console.log(` ${wt.green("\u2714")} \u8BED\u97F3\u51ED\u636E\u5DF2\u4FDD\u5B58\u5230 ${wt.dim(m)}
633
- `);let h=await Ot();r=r?{...r,config:h.config}:{config:h.config,verbose:!1},s=ls(h.config.voice)}}let i=new Fe({budgetLimit:r?.config.budgetLimit??0,tokenBudgetLimit:r?.config.tokenBudgetLimit??0}),l=process.env.DSKCODE_CONFIG_UI==="0"?!1:t.configUi??!0,c=null;if(l){let{startConfigServerBackground:u}=await import("./config-ui-JE4ZQLPC.js");c=await u({})}Pi(r,i,n,s,c)}async function Pi(e,t,n=process.cwd(),r,o=null){let[s,i,a,l]=await Promise.all([cd(),Ra(process.cwd()),dd(process.cwd()),dg(n)]),c=s+i,u=e?.config.providers.find(f=>f.name===(e?.config.defaultProvider??"deepseek")),d=u?.model??"deepseek-v4-flash";function m(f){let[g,w]=c_(0),x=o;return l_(()=>x?x.onConfigChanged(v=>{Ot().then(_=>{e&&(e.config=_.config),w(S=>S+1),console.error(wt.cyan(`
633
+ `);let h=await Ot();r=r?{...r,config:h.config}:{config:h.config,verbose:!1},s=ls(h.config.voice)}}let i=new Fe({budgetLimit:r?.config.budgetLimit??0,tokenBudgetLimit:r?.config.tokenBudgetLimit??0}),l=process.env.DSKCODE_CONFIG_UI==="0"?!1:t.configUi??!0,c=null;if(l){let{startConfigServerBackground:u}=await import("./config-ui-JE4ZQLPC.js");c=await u({})}Pi(r,i,n,s,c)}async function Pi(e,t,n=process.cwd(),r,o=null){let[s,i,a,l]=await Promise.all([cd(),Ra(process.cwd()),dd(process.cwd()),dg(n)]),c=s+i,u=e?.config.providers.find(f=>f.name===(e?.config.defaultProvider??"deepseek")),d=u?.model??"deepseek-v4-flash";function m(f){let[g,w]=d_(0),x=o;return u_(()=>x?x.onConfigChanged(v=>{Ot().then(_=>{e&&(e.config=_.config),w(S=>S+1),console.error(wt.cyan(`
634
634
  \u27F3 dskcode \u8FD0\u884C\u65F6\u8BBE\u7F6E\u5DF2\u91CD\u65B0\u52A0\u8F7D (source: ${v.source})
635
635
  `))}).catch(_=>{console.error(` \u26A0 \u91CD\u65B0\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25: ${_.message}`)})}):void 0,[x]),vr(mu,{...f,configReloadEpoch:g})}let h=Br(vr(m,{skillCount:c,skills:a,files:l,toolCount:e?.config.tools.length??0,verbose:e?.verbose??!1,apiKey:u?.apiKey,baseUrl:u?.baseUrl??"https://api.deepseek.com",costTracker:t,model:d,permissionsConfig:e?.config.permissions,voiceConfig:r,onLaunchGame:()=>{h.unmount(),setImmediate(()=>{_u();let f=Io(),{unmount:g}=mg(vr(_i,{games:f,onSelect:async w=>{g(),await w.play(),Pi(e,t,n,r,o)},onBackToChat:()=>{g(),setImmediate(()=>Pi(e,t,n,r,o))}}),{exitOnCtrlC:!1})})},onLaunchStock:()=>{h.unmount(),setImmediate(()=>{let f=e?.config.stock?.symbols?.map(w=>w.code)??["sh000001","sz399006","sh601688"],g=Br(vr(Ii,{codes:f,onBackToChat:()=>{g.unmount(),setImmediate(()=>Pi(e,t,n,r))},onExit:()=>process.exit(0)}))})}}))}p();var $o={SUCCESS:0,GENERAL_ERROR:1,CONFIG_ERROR:2,SIGINT:130};var Ru=0,Au=null;async function gg(e){try{await Promise.all([Fe.flushAll(),gt.flushAll()])}catch{}process.exit(e)}process.on("SIGINT",()=>{if(Ru++,Ru>=2){gg($o.SIGINT);return}process.stdout.write(`
636
636
  \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode
637
- `),Au&&clearTimeout(Au),Au=setTimeout(()=>{Ru=0},1500)});process.on("SIGTERM",()=>{gg($o.SIGINT)});var p_=hg();try{await p_.parseAsync(process.argv),await Promise.all([Fe.flushAll(),gt.flushAll()])}catch(e){let t=e;(t.code==="commander.helpDisplayed"||t.code==="commander.version")&&(await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit(t.exitCode??$o.SUCCESS)),typeof t.exitCode=="number"&&(await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit(t.exitCode)),console.error(String(e)),await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit($o.GENERAL_ERROR)}
637
+ `),Au&&clearTimeout(Au),Au=setTimeout(()=>{Ru=0},1500)});process.on("SIGTERM",()=>{gg($o.SIGINT)});var m_=hg();try{await m_.parseAsync(process.argv),await Promise.all([Fe.flushAll(),gt.flushAll()])}catch(e){let t=e;(t.code==="commander.helpDisplayed"||t.code==="commander.version")&&(await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit(t.exitCode??$o.SUCCESS)),typeof t.exitCode=="number"&&(await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit(t.exitCode)),console.error(String(e)),await Promise.all([Fe.flushAll(),gt.flushAll()]),process.exit($o.GENERAL_ERROR)}
638
638
  //# sourceMappingURL=index.js.map