hwjcode-personal 1.1.123 → 1.1.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/hwjcode.js +4 -10
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/hwjcode.js
CHANGED
|
@@ -2186,7 +2186,7 @@ ${e.format(r)}`.trim())}};Wpr.exports=tst});var ast=He((bDi,Apr)=>{"use strict";
|
|
|
2186
2186
|
${s}`;break;case"retry":j2r(s)&&(r[i]=s);break;case"id":q2r(s)&&(r[i]=s);break;case"event":s.length>0&&(r[i]=s);break}}processEvent(e){e.retry&&j2r(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&&q2r(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};K2r.exports={EventSourceStream:hot}});var oGr=He((uOi,sGr)=>{"use strict";var{pipeline:HIn}=Ct("node:stream"),{fetching:XIn}=Fse(),{makeRequest:kIn}=NU(),{webidl:p2}=Rp(),{EventSourceStream:SIn}=$2r(),{parseMIMEType:LIn}=lZ(),{createFastMessageEvent:JIn}=bWe(),{isNetworkError:eGr}=Zse(),{kEnumerableProperty:nS}=hs(),{environmentSettingsObject:tGr}=U1(),rGr=!1,aGr=3e3,Yse=0,nGr=1,Vse=2,BIn="anonymous",TIn="use-credentials",VU=class a extends EventTarget{#e={open:null,error:null,message:null};#t;#r=!1;#a=Yse;#i=null;#n=null;#c;#o;constructor(e,r={}){super(),p2.util.markAsUncloneable(this);let n="EventSource constructor";p2.argumentLengthCheck(arguments,1,n),rGr||(rGr=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=p2.converters.USVString(e),r=p2.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#c=r.node.dispatcher||r.dispatcher,this.#o={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=tGr,s;try{s=new URL(e,i.settingsObject.baseUrl),this.#o.origin=s.origin}catch(d){throw new DOMException(d,"SyntaxError")}this.#t=s.href;let t=BIn;r.withCredentials===!0&&(t=TIn,this.#r=!0);let o={redirect:"follow",keepalive:!0,mode:"cors",credentials:t==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};o.client=tGr.settingsObject,o.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],o.cache="no-store",o.initiator="other",o.urlList=[new URL(this.#t)],this.#i=kIn(o),this.#s()}get readyState(){return this.#a}get url(){return this.#t}get withCredentials(){return this.#r}#s(){if(this.#a===Vse)return;this.#a=Yse;let e={request:this.#i,dispatcher:this.#c},r=n=>{if(!eGr(n))return this.#I()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(eGr(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#I();return}let i=n.headersList.get("content-type",!0),s=i!==null?LIn(i):"failure",t=s!=="failure"&&s.essence==="text/event-stream";if(n.status!==200||t===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#a=nGr,this.dispatchEvent(new Event("open")),this.#o.origin=n.urlList[n.urlList.length-1].origin;let o=new SIn({eventSourceSettings:this.#o,push:d=>{this.dispatchEvent(JIn(d.type,d.options))}});HIn(n.body.stream,o,d=>{d?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#n=XIn(e)}#I(){this.#a!==Vse&&(this.#a=Yse,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#a===Yse&&(this.#o.lastEventId.length&&this.#i.headersList.set("last-event-id",this.#o.lastEventId,!0),this.#s())},this.#o.reconnectionTime)?.unref())}close(){p2.brandCheck(this,a),this.#a!==Vse&&(this.#a=Vse,this.#n.abort(),this.#i=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=p2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=p2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=p2.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},iGr={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:Yse,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:nGr,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:Vse,writable:!1}};Object.defineProperties(VU,iGr);Object.defineProperties(VU.prototype,iGr);Object.defineProperties(VU.prototype,{close:nS,onerror:nS,onmessage:nS,onopen:nS,readyState:nS,url:nS,withCredentials:nS});p2.converters.EventSourceInitDict=p2.dictionaryConverter([{key:"withCredentials",converter:p2.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:p2.converters.any},{key:"node",converter:p2.dictionaryConverter([{key:"reconnectionTime",converter:p2.converters["unsigned long"],defaultValue:()=>aGr},{key:"dispatcher",converter:p2.converters.any}]),defaultValue:()=>({})}]);sGr.exports={EventSource:VU,defaultReconnectionTime:aGr}});var xWe=He((dOi,Wn)=>{"use strict";var DIn=yV(),cGr=Vie(),OIn=H6(),MIn=l0r(),UIn=I0r(),zIn=S6(),_In=iit(),PIn=tit(),jIn=q0r(),qIn=amr(),KIn=smr(),uGr=zi(),EWe=hs(),{InvalidArgumentError:AWe}=uGr,QU=Bmr(),$In=W6(),ehn=Oit(),{MockCallHistory:thn,MockCallHistoryLog:rhn}=zit(),ahn=rst(),nhn=qit(),ihn=Jpr(),shn=Rit(),ohn=FNe(),{getGlobalDispatcher:dGr,setGlobalDispatcher:lhn}=JNe(),chn=GU(),uhn=ust();Object.assign(cGr.prototype,QU);Wn.exports.Dispatcher=cGr;Wn.exports.Client=DIn;Wn.exports.Pool=OIn;Wn.exports.BalancedPool=MIn;Wn.exports.RoundRobinPool=UIn;Wn.exports.Agent=zIn;Wn.exports.ProxyAgent=_In;Wn.exports.Socks5ProxyAgent=PIn;Wn.exports.EnvHttpProxyAgent=jIn;Wn.exports.RetryAgent=qIn;Wn.exports.H2CClient=KIn;Wn.exports.RetryHandler=ohn;Wn.exports.DecoratorHandler=chn;Wn.exports.RedirectHandler=uhn;Wn.exports.interceptors={redirect:qpr(),responseError:$pr(),retry:tbr(),dump:abr(),dns:obr(),cache:Wbr(),decompress:Ebr(),deduplicate:Qbr()};Wn.exports.cacheStores={MemoryCacheStore:gst()};var dhn=kbr();Wn.exports.cacheStores.SqliteCacheStore=dhn;Wn.exports.buildConnector=$In;Wn.exports.errors=uGr;Wn.exports.util={parseHeaders:EWe.parseHeaders,headerNameToString:EWe.headerNameToString};function Qse(a){return(e,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new AWe("invalid url");if(r!=null&&typeof r!="object")throw new AWe("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new AWe("invalid opts.path");let t=r.path;r.path.startsWith("/")||(t=`/${t}`),e=new URL(EWe.parseOrigin(e).origin+t)}else r||(r=typeof e=="object"?e:{}),e=EWe.parseURL(e);let{agent:i,dispatcher:s=dGr()}=r;if(i)throw new AWe("unsupported opts.agent. Did you mean opts.client?");return a.call(s,{...r,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}Wn.exports.setGlobalDispatcher=lhn;Wn.exports.getGlobalDispatcher=dGr;var Ihn=Fse().fetch,lGr=typeof __filename<"u"?__filename:void 0;function IGr(a,e){if(!a||typeof a!="object")return;let r=typeof a.stack=="string"?a.stack:"",n=e.replace(/\\/g,"/");if(r&&(r.includes(e)||r.includes(n)))return;let i={};if(Error.captureStackTrace(i,IGr),!i.stack)return;let s=i.stack.split(`
|
|
2187
2187
|
`).slice(1).join(`
|
|
2188
2188
|
`);a.stack=r?`${r}
|
|
2189
|
-
${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return Ihn(e,r).catch(n=>{throw lGr?IGr(n,lGr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=j6().Headers;Wn.exports.Response=Zse().Response;Wn.exports.Request=NU().Request;Wn.exports.FormData=K3e().FormData;var{setGlobalOrigin:hhn,getGlobalOrigin:mhn}=Jat();Wn.exports.setGlobalOrigin=hhn;Wn.exports.getGlobalOrigin=mhn;var{CacheStorage:phn}=zfr(),{kConstruct:bhn}=Nc();Wn.exports.caches=new phn(bhn);var{deleteCookie:fhn,getCookies:Ghn,getSetCookies:ghn,setCookie:vhn,parseCookie:yhn}=s2r();Wn.exports.deleteCookie=fhn;Wn.exports.getCookies=Ghn;Wn.exports.getSetCookies=ghn;Wn.exports.setCookie=vhn;Wn.exports.parseCookie=yhn;var{parseMIMEType:Zhn,serializeAMimeType:Nhn}=lZ();Wn.exports.parseMIMEType=Zhn;Wn.exports.serializeAMimeType=Nhn;var{CloseEvent:Whn,ErrorEvent:Fhn,MessageEvent:whn}=bWe(),{WebSocket:Rhn,ping:Ahn}=L2r();Wn.exports.WebSocket=Rhn;Wn.exports.CloseEvent=Whn;Wn.exports.ErrorEvent=Fhn;Wn.exports.MessageEvent=whn;Wn.exports.ping=Ahn;Wn.exports.WebSocketStream=z2r().WebSocketStream;Wn.exports.WebSocketError=lot().WebSocketError;Wn.exports.request=Qse(QU.request);Wn.exports.stream=Qse(QU.stream);Wn.exports.pipeline=Qse(QU.pipeline);Wn.exports.connect=Qse(QU.connect);Wn.exports.upgrade=Qse(QU.upgrade);Wn.exports.MockClient=ehn;Wn.exports.MockCallHistory=thn;Wn.exports.MockCallHistoryLog=rhn;Wn.exports.MockPool=nhn;Wn.exports.MockAgent=ahn;Wn.exports.SnapshotAgent=ihn;Wn.exports.mockErrors=shn;var{EventSource:Ehn}=oGr();Wn.exports.EventSource=Ehn;function xhn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=xhn});function uW(a){let e=a??"1.1.
|
|
2189
|
+
${s}`:i.stack}Wn.exports.fetch=function(e,r=void 0){return Ihn(e,r).catch(n=>{throw lGr?IGr(n,lGr):n&&typeof n=="object"&&Error.captureStackTrace(n,Wn.exports.fetch),n})};Wn.exports.Headers=j6().Headers;Wn.exports.Response=Zse().Response;Wn.exports.Request=NU().Request;Wn.exports.FormData=K3e().FormData;var{setGlobalOrigin:hhn,getGlobalOrigin:mhn}=Jat();Wn.exports.setGlobalOrigin=hhn;Wn.exports.getGlobalOrigin=mhn;var{CacheStorage:phn}=zfr(),{kConstruct:bhn}=Nc();Wn.exports.caches=new phn(bhn);var{deleteCookie:fhn,getCookies:Ghn,getSetCookies:ghn,setCookie:vhn,parseCookie:yhn}=s2r();Wn.exports.deleteCookie=fhn;Wn.exports.getCookies=Ghn;Wn.exports.getSetCookies=ghn;Wn.exports.setCookie=vhn;Wn.exports.parseCookie=yhn;var{parseMIMEType:Zhn,serializeAMimeType:Nhn}=lZ();Wn.exports.parseMIMEType=Zhn;Wn.exports.serializeAMimeType=Nhn;var{CloseEvent:Whn,ErrorEvent:Fhn,MessageEvent:whn}=bWe(),{WebSocket:Rhn,ping:Ahn}=L2r();Wn.exports.WebSocket=Rhn;Wn.exports.CloseEvent=Whn;Wn.exports.ErrorEvent=Fhn;Wn.exports.MessageEvent=whn;Wn.exports.ping=Ahn;Wn.exports.WebSocketStream=z2r().WebSocketStream;Wn.exports.WebSocketError=lot().WebSocketError;Wn.exports.request=Qse(QU.request);Wn.exports.stream=Qse(QU.stream);Wn.exports.pipeline=Qse(QU.pipeline);Wn.exports.connect=Qse(QU.connect);Wn.exports.upgrade=Qse(QU.upgrade);Wn.exports.MockClient=ehn;Wn.exports.MockCallHistory=thn;Wn.exports.MockCallHistoryLog=rhn;Wn.exports.MockPool=nhn;Wn.exports.MockAgent=ahn;Wn.exports.SnapshotAgent=ihn;Wn.exports.mockErrors=shn;var{EventSource:Ehn}=oGr();Wn.exports.EventSource=Ehn;function xhn(){globalThis.fetch=Wn.exports.fetch,globalThis.Headers=Wn.exports.Headers,globalThis.Response=Wn.exports.Response,globalThis.Request=Wn.exports.Request,globalThis.FormData=Wn.exports.FormData,globalThis.WebSocket=Wn.exports.WebSocket,globalThis.CloseEvent=Wn.exports.CloseEvent,globalThis.ErrorEvent=Wn.exports.ErrorEvent,globalThis.MessageEvent=Wn.exports.MessageEvent,globalThis.EventSource=Wn.exports.EventSource}Wn.exports.install=xhn});function uW(a){let e=a??"1.1.124"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${CWe}/VSCode/${i} (${r}; ${n})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${CWe}/Desktop/${i} (${r}; ${n})`}return`${CWe}/CLI/${e} (${r}; ${n})`}var CWe,iS=_e(()=>{"use strict";CWe="HwjCode"});import*as tv from"node:path";import*as Si from"node:fs";import*as hGr from"node:os";import*as mGr from"node:zlib";import{spawn as YWe,spawnSync as Chn}from"node:child_process";function fGr(a){if(Si.existsSync(a)){for(let e of Si.readdirSync(a)){let r=tv.join(a,e);Si.statSync(r).isDirectory()?fGr(r):Si.unlinkSync(r)}Si.rmdirSync(a)}}var pGr,bGr,bI,GGr=_e(()=>{"use strict";pGr=Qt(xWe(),1),bGr=Qt(Tqe(),1);iS();nm();bI=class{static get lspDir(){return tv.join(hGr.homedir(),Qo,"lsp")}static findOnPath(e){let r=process.platform==="win32"?"where.exe":"which",i=(Chn(r,[e],{shell:!1,encoding:"utf8",windowsHide:!0}).stdout||"").toString().trim();if(!i)return null;for(let s of i.split(/\r?\n/).map(t=>t.trim()).filter(Boolean))if(Si.existsSync(s))return s;return null}static async cleanBinaryCache(e){let r=tv.join(this.lspDir,e);Si.existsSync(r)&&(console.log(`[LSP] Cleaning corrupted binary cache for ${e} at ${r}`),fGr(r),console.log("[LSP] Cache cleaned successfully"))}static async ensureBinary(e,r,n){let i=n?.maxRetries??1,s=null;for(let t=0;t<=i;t++)try{let o=tv.join(this.lspDir,e);return Si.existsSync(o)||Si.mkdirSync(o,{recursive:!0}),await r(o)}catch(o){s=o,t<i&&(console.log(`[LSP] Attempt ${t+1} failed: ${s.message}`),console.log(`[LSP] Cleaning cache and retrying (${i-t} retries left)...`),await this.cleanBinaryCache(e))}throw s||new Error(`Failed to ensure binary for ${e}`)}static async npmInstaller(e,r){return async n=>{let i=tv.join(n,"node_modules",".bin",r+(process.platform==="win32"?".cmd":""));return Si.existsSync(i)||(console.log(`[LSP] Installing ${e.join(", ")} via npm...`),Si.existsSync(tv.join(n,"package.json"))||Si.writeFileSync(tv.join(n,"package.json"),JSON.stringify({name:`deepv-lsp-${r}`,version:"1.0.0",private:!0})),await new Promise((s,t)=>{let o=process.platform==="win32",d=["install",...e,"--no-save"];(o?YWe("cmd.exe",["/c","npm",...d],{cwd:n,shell:!1,stdio:"inherit"}):YWe("npm",d,{cwd:n,shell:!1,stdio:"inherit"})).on("close",u=>{u===0?s():t(new Error(`npm install failed with code ${u}`))})})),i}}static async goInstaller(e,r,n="latest"){return async i=>{let s=process.platform,t=tv.join(i,r+(s==="win32"?".exe":""));if(Si.existsSync(t))return t;let o=this.findOnPath("go");if(!o)throw new Error(`[LSP] Go toolchain not found in PATH (required to install ${r}). Please install Go from https://go.dev/dl/ and ensure "go" is available in your PATH, or configure a preinstalled gopls via PATH/DEEPV_GOPLS_PATH.`);if(console.log(`[LSP] Installing ${r} via go install (${e}@${n})...`),await new Promise((d,I)=>{let u=YWe(o,["install",`${e}@${n}`],{cwd:i,shell:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"],env:{...process.env,GOBIN:i}}),h="";u.stdout?.on("data",c=>{process.stdout.write(c)}),u.stderr?.on("data",c=>{let m=c.toString();h+=m,h.length>16384&&(h=h.slice(h.length-16384)),process.stderr.write(c)}),u.on("close",c=>{if(c===0)d();else{let m=h.trim();I(new Error(`[LSP] go install failed with code ${c}`+(m?`
|
|
2190
2190
|
${m}`:"")))}}),u.on("error",c=>{I(new Error(`[LSP] Failed to spawn go (${o}): ${c.message}. Please ensure Go is installed and available in PATH.`))})}),!Si.existsSync(t))throw new Error(`[LSP] ${r} installation completed but binary not found at ${t}. This usually means Go did not honor GOBIN or the install failed silently.`);return t}}static async githubInstaller(e,r,n){return async i=>{let s=process.platform,t=process.arch,o=n(s,t),d=r+(s==="win32"?".exe":""),I=tv.join(i,d);if(Si.existsSync(I))return I;console.log(`[LSP] Downloading ${r} from GitHub ${e}/${r}...`);let u=process.env.GITHUB_TOKEN||process.env.GITHUB_PAT,h={"User-Agent":uW()};u&&(h.Authorization=`Bearer ${u}`);let c=`https://api.github.com/repos/${e}/${r}/releases/latest`,Z=await(await(0,pGr.request)(c,{headers:h})).body.json(),y=Z.assets.find(A=>typeof o=="string"?A.name===o:o.test(A.name));if(!y){let A=`${s}-${t}`,p=[];r==="rust-analyzer"&&(A==="win32-x64"?p.push(/rust-analyzer.*x86_64.*windows.*\.zip/i,/rust-analyzer.*x64.*windows.*\.zip/i,/rust-analyzer.*msvc.*\.zip/i):A==="win32-arm64"?p.push(/rust-analyzer.*aarch64.*windows.*\.zip/i):A==="darwin-x64"?p.push(/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,/rust-analyzer.*x86_64.*macos.*\.gz/i):A==="darwin-arm64"?p.push(/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,/rust-analyzer.*aarch64.*macos.*\.gz/i):A==="linux-x64"?p.push(/rust-analyzer.*x86_64.*linux.*\.gz/i,/rust-analyzer.*x86_64.*gnu.*\.gz/i):A==="linux-arm64"&&p.push(/rust-analyzer.*aarch64.*linux.*\.gz/i,/rust-analyzer.*aarch64.*gnu.*\.gz/i)),p.length>0&&(y=Z.assets.find(v=>p.some(W=>W.test(v.name))))}if(!y){let A=Z.assets.map(p=>p.name).join(", ");throw new Error(`Could not find a suitable binary for ${s}-${t} in ${e}/${r} releases. Available: ${A}`)}console.log(`[LSP] Downloading: ${y.name}`),console.log(`[LSP] File size: ${(y.size/1024/1024).toFixed(1)}MB`);let N=tv.join(i,y.name),g=Date.now(),E=0;if(await new Promise((A,p)=>{let v=process.platform==="win32"?"curl.exe":"curl",W=YWe(v,["-L","--fail","-o",N,y.browser_download_url]),R="",f=setInterval(()=>{if(Si.existsSync(N)){let b=Si.statSync(N).size,G=(b/(y.size||1)*100).toFixed(1),F=(b/1024/1024).toFixed(1),C=(y.size/1024/1024).toFixed(1);console.log(`[LSP] \u2B07\uFE0F ${y.name}: ${F}MB / ${C}MB (${G}%)`),E=b,g=Date.now()}},2e3);W.stderr.on("data",b=>{R+=b.toString()}),W.on("close",b=>{clearInterval(f),b===0?A():(Si.existsSync(N)&&Si.unlinkSync(N),p(new Error(`[LSP] curl failed with code ${b}: ${R}`)))}),W.on("error",b=>{clearInterval(f),Si.existsSync(N)&&Si.unlinkSync(N),p(new Error(`[LSP] Failed to spawn curl: ${b.message}. curl may not be installed or available in PATH. Please install curl and add it to your system PATH.`))})}),!Si.existsSync(N))throw new Error(`[LSP] Downloaded file not found at ${N}. curl may have failed silently.`);let w=Si.statSync(N).size;if(w===0)throw Si.unlinkSync(N),new Error(`[LSP] Downloaded file is empty (0 bytes) for ${y.name}. The download URL may be invalid or temporarily unavailable. Please retry.`);if(console.log(`[LSP] Downloaded ${w} bytes (expected: ${y.size} bytes)`),y.name.endsWith(".gz")){console.log(`[LSP] Decompressing ${y.name}...`);let A=Si.readFileSync(N);try{let p=mGr.gunzipSync(A);if(p.length===0)throw new Error("Decompressed data is empty");Si.writeFileSync(I,p)}catch(p){Si.unlinkSync(N);let v=p instanceof Error?p.message:String(p);throw new Error(`[LSP] Failed to decompress ${y.name}: ${v}. The file may be corrupted. Please retry.`)}Si.unlinkSync(N)}else if(y.name.endsWith(".zip")){console.log(`[LSP] Extracting ${y.name}...`);let A=Si.readFileSync(N);if(A.length<4)throw Si.unlinkSync(N),new Error(`[LSP] ZIP file is too small (${A.length} bytes) for ${y.name}. The download is corrupted. Please retry or check your network connection.`);if(A[0]!==80||A[1]!==75||A[2]!==3||A[3]!==4)throw Si.unlinkSync(N),new Error(`[LSP] ZIP file header is corrupted for ${y.name}. The download may have been interrupted. Please retry.`);let p;try{p=await bGr.default.loadAsync(A)}catch(b){Si.unlinkSync(N);let G=b instanceof Error?b.message:String(b);throw new Error(`[LSP] Failed to parse ZIP file ${y.name}: ${G}. The file may be corrupted. Please retry the download.`)}let v=d.toLowerCase(),R=Object.values(p.files).filter(b=>!b.dir).filter(b=>tv.posix.basename(b.name).toLowerCase()===v).sort((b,G)=>b.name.length-G.name.length)[0];if(!R)throw new Error(`Zip archive did not contain expected executable "${d}" for ${e}/${r}.`);let f=await R.async("nodebuffer");Si.writeFileSync(I,f),Si.unlinkSync(N)}else Si.renameSync(N,I);if(s!=="win32"&&Si.chmodSync(I,493),console.log(`[LSP] Binary installed at: ${I}`),console.log(`[LSP] Binary exists: ${Si.existsSync(I)}`),Si.existsSync(I)){let A=Si.statSync(I);console.log(`[LSP] Binary stats: size=${A.size}, mode=${(A.mode&parseInt("777",8)).toString(8)}`)}return I}}}});import*as F0 from"node:path";import*as fZ from"node:fs";import{spawn as QV}from"node:child_process";function HU(a,e,r){let i=process.platform==="win32"&&a.toLowerCase().endsWith(".cmd"),s={cwd:r.cwd,shell:!1,stdio:["pipe","pipe","pipe"]};if(i&&fZ.existsSync(a)){let o=fZ.readFileSync(a,"utf8").match(/%dp0%([^"]*\.m?js)/i);if(o){let d=F0.dirname(a),I=o[1].replace(/\\/g,F0.sep);I.startsWith(F0.sep)&&(I="."+I);let u=F0.resolve(d,I);if(fZ.existsSync(u))return QV(process.execPath,[u,...e],s)}return QV("cmd.exe",["/c",a,...e],s)}return QV(a,e,s)}var Hse,Yhn,Vhn,Qhn,Hhn,Xhn,khn,Shn,Lhn,Jhn,gGr,vGr=_e(()=>{"use strict";GGr();Hse=(a,e)=>async r=>{let n=F0.normalize(F0.dirname(F0.resolve(r))),i=F0.normalize(F0.resolve(e)),s=(t,o)=>{let d=t.toLowerCase(),I=o.toLowerCase();return d.startsWith(I)||d===I};for(;s(n,i);){for(let o of a)if(fZ.existsSync(F0.join(n,o)))return n;let t=F0.normalize(F0.dirname(n));if(t===n)break;n=t}return i},Yhn=a=>({id:"typescript-language-server",displayName:"TypeScript/JavaScript Language Server",extensions:[".ts",".tsx",".js",".jsx"],root:Hse(["package.json","tsconfig.json","jsconfig.json"],a),async spawn(e){let r=await bI.ensureBinary("typescript-language-server",await bI.npmInstaller(["typescript-language-server","typescript"],"typescript-language-server")),n=F0.join(F0.dirname(r),"..","..","typescript","lib","tsserver.js"),i=["--stdio"];return fZ.existsSync(n)&&i.push("--tsserver-path",n),{process:HU(r,i,{cwd:e})}}}),Vhn=a=>({id:"pyright",displayName:"Python Language Server",extensions:[".py"],root:Hse(["pyproject.toml","setup.py","requirements.txt","package.json"],a),async spawn(e){let r=await bI.ensureBinary("pyright",await bI.npmInstaller(["pyright"],"pyright-langserver"));return{process:HU(r,["--stdio"],{cwd:e})}}}),Qhn=a=>({id:"rust-analyzer",displayName:"Rust Language Server",extensions:[".rs"],root:Hse(["Cargo.toml"],a),async spawn(e){let r=process.platform,n=process.arch;console.log(`[LSP] Detecting platform for rust-analyzer: platform=${r}, arch=${n}`);let i=await bI.githubInstaller("rust-lang","rust-analyzer",(o,d)=>{let I={"win32-x64":/rust-analyzer.*x86_64.*windows.*\.zip/i,"win32-arm64":/rust-analyzer.*aarch64.*windows.*\.zip/i,"darwin-x64":/rust-analyzer.*x86_64.*apple-darwin.*\.gz/i,"darwin-arm64":/rust-analyzer.*aarch64.*apple-darwin.*\.gz/i,"linux-x64":/rust-analyzer.*x86_64.*linux.*\.gz/i,"linux-arm64":/rust-analyzer.*aarch64.*linux.*\.gz/i},u=`${o}-${d}`,h=I[u]||/rust-analyzer-.*/;return console.log(`[LSP] Asset matcher for ${u}: ${h instanceof RegExp?h.source:h}`),h}),s=await bI.ensureBinary("rust-analyzer",i,{maxRetries:1});if(console.log(`[LSP] RustAnalyzer binary path: ${s}`),console.log(`[LSP] RustAnalyzer binary exists: ${fZ.existsSync(s)}`),fZ.existsSync(s)){let o=fZ.statSync(s);console.log(`[LSP] RustAnalyzer binary stats: size=${o.size}, isFile=${o.isFile()}, mode=${(o.mode&parseInt("777",8)).toString(8)}`)}console.log(`[LSP] RustAnalyzer spawning with cwd=${e}, args=[], shell=undefined`);let t=QV(s,[],{cwd:e});return console.log(`[LSP] RustAnalyzer spawn returned: pid=${t.pid}`),t.on("error",o=>{console.error("[LSP] RustAnalyzer process error:",{code:o.code,errno:o.errno,syscall:o.syscall,path:o.path,message:o.message})}),t.on("exit",(o,d)=>{console.log(`[LSP] RustAnalyzer process exited: code=${o}, signal=${d}`)}),{process:t}}}),Hhn=a=>({id:"gopls",displayName:"Go Language Server",extensions:[".go"],root:Hse(["go.mod","go.sum"],a),async spawn(e){let r=process.env.DEEPV_GOPLS_PATH;if(r&&fZ.existsSync(r))return{process:QV(r,[],{cwd:e})};let n=bI.findOnPath("gopls");if(n)return{process:QV(n,[],{cwd:e})};let i=await bI.ensureBinary("gopls",await bI.goInstaller("golang.org/x/tools/gopls","gopls"),{maxRetries:1});return{process:QV(i,[],{cwd:e})}}}),Xhn=a=>({id:"clangd",displayName:"C/C++ Language Server",extensions:[".c",".cpp",".h",".hpp",".cc"],root:Hse(["compile_commands.json","CMakeLists.txt",".git"],a),async spawn(e){let r=await bI.githubInstaller("clangd","clangd",(i,s)=>{let t=i==="win32"?"windows":i==="darwin"?"mac":"linux";return new RegExp(`clangd-${t}-.*\\.zip`)}),n=await bI.ensureBinary("clangd",r,{maxRetries:1});return{process:QV(n,[],{cwd:e})}}}),khn=a=>({id:"vscode-langservers-extracted",displayName:"HTML/CSS/JSON/ESLint Language Server",extensions:[".html",".css",".json",".jsonc"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("vscode-langservers-extracted",await bI.npmInstaller(["vscode-langservers-extracted"],"vscode-html-language-server"));return{process:HU(r,["--stdio"],{cwd:e})}}}),Shn=a=>({id:"sql-language-server",displayName:"SQL Language Server",extensions:[".sql"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("sql-language-server",await bI.npmInstaller(["sql-language-server"],"sql-language-server"));return{process:HU(r,["up","--method","stdio"],{cwd:e})}}}),Lhn=a=>({id:"dockerfile-language-server-nodejs",displayName:"Dockerfile Language Server",extensions:["Dockerfile",".dockerfile"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("dockerfile-language-server-nodejs",await bI.npmInstaller(["dockerfile-language-server-nodejs"],"docker-langserver"));return{process:HU(r,["--stdio"],{cwd:e})}}}),Jhn=a=>({id:"yaml-language-server",displayName:"YAML Language Server",extensions:[".yaml",".yml"],root:async()=>a,async spawn(e){let r=await bI.ensureBinary("yaml-language-server",await bI.npmInstaller(["yaml-language-server"],"yaml-language-server"));return{process:HU(r,["--stdio"],{cwd:e})}}}),gGr=a=>[Yhn(a),Vhn(a),Qhn(a),Hhn(a),Xhn(a),khn(a),Shn(a),Lhn(a),Jhn(a)]});import*as tE from"node:path";import*as QWe from"node:fs";import{pathToFileURL as Bhn}from"node:url";var VWe,yGr=_e(()=>{"use strict";Bur();vGr();VWe=class{clients=new Map;servers;projectRoot;openedFiles=new Set;fileVersions=new Map;fileContents=new Map;freshClients=new Set;constructor(e){this.projectRoot=e,this.servers=gGr(e)}async getClientsForFile(e){let r=tE.extname(e).toLowerCase(),n=this.servers.filter(s=>s.extensions.includes(r)),i=[];for(let s of n){let t=await s.root(e),o=`${s.id}:${t}`;if(this.clients.has(o))i.push(this.clients.get(o));else try{console.log(`[LSP] Starting ${s.id} for root ${t}`);let{process:d}=await s.spawn(t);console.log(`[LSP] Process spawned: pid=${d.pid}, stdio=${JSON.stringify(d.stdio)}`);let I=await Lur({serverID:s.id,server:{process:d},root:t});this.clients.set(o,I),this.freshClients.add(I.serverID),i.push(I)}catch(d){let I=d instanceof Error?{message:d.message,stack:d.stack,code:d.code,errno:d.errno,syscall:d.syscall,path:d.path}:String(d);console.error(`[LSP] Failed to start ${s.id}:`,I);let u=d;(u.errno===-4094||u.code==="UNKNOWN")&&console.error(`[LSP] Binary file may be corrupted (errno=${u.errno}). Suggest deleting ${s.id} cache and reinitializing.`)}}return i}async syncDocument(e,r){let n=this.getUri(r),i=`${e.serverID}:${n}`,s=QWe.readFileSync(r,"utf8");if(!this.openedFiles.has(i))this.fileVersions.set(i,1),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didOpen",{textDocument:{uri:n,languageId:this.getLanguageId(r),version:1,text:s}}),this.openedFiles.add(i),await new Promise(t=>setTimeout(t,3e3));else{if(this.fileContents.get(i)===s)return;let o=(this.fileVersions.get(i)||1)+1;this.fileVersions.set(i,o),this.fileContents.set(i,s),await e.connection.sendNotification("textDocument/didChange",{textDocument:{uri:n,version:o},contentChanges:[{text:s}]})}}getLanguageId(e){switch(tE.extname(e).toLowerCase()){case".ts":case".tsx":return"typescript";case".js":case".jsx":return"javascript";case".go":return"go";case".py":return"python";case".rs":return"rust";default:return"plaintext"}}getUri(e){return Bhn(tE.resolve(e)).href.replace(/^file:\/\/\/([A-Z])[:%3A]+\//i,(n,i)=>`file:///${i.toLowerCase()}%3A/`)}async shutdown(){for(let e of this.clients.values())await Jur(e);this.clients.clear(),this.openedFiles.clear()}async run(e,r,n){let i=process.env.DEEPV_LSP_DEBUG==="1"||process.env.DEEPV_LSP_DEBUG==="true",s=Number(process.env.DEEPV_LSP_REQUEST_TIMEOUT_MS),t=n?.timeoutMs??(Number.isFinite(s)&&s>0?s:15e3),o=n?.operationName??"request",d=tE.normalize(e),I=await this.getClientsForFile(d),u=await Promise.all(I.map(async c=>{await this.syncDocument(c,d),this.freshClients.has(c.serverID)&&this.freshClients.delete(c.serverID);try{return await Promise.race([r(c),new Promise((Z,y)=>{let N=setTimeout(()=>{clearTimeout(N),y(new Error(`[LSP][${c.serverID}] ${o} timed out after ${t}ms`))},t)})])}catch(m){if(i)console.error(`[LSP][${c.serverID}] Request failed:`,m);else{let Z=m instanceof Error?m.message:String(m);Z.includes("timed out after")?console.warn(Z):console.error(`[LSP][${c.serverID}] Request failed:`,Z)}return null}})),h=[];for(let c of u)c!==null&&h.push(c);return h}async getHover(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/hover",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/hover"})}async getDefinition(e,r,n){return this.run(e,i=>i.connection.sendRequest("textDocument/definition",{textDocument:{uri:this.getUri(e)},position:{line:r,character:n}}),{operationName:"textDocument/definition"})}async getReferences(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n},context:{includeDeclaration:!0}},t=await i.connection.sendRequest("textDocument/references",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No references found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/references",s)),t},{operationName:"textDocument/references"})}async getImplementation(e,r,n){return this.run(e,async i=>{let s={textDocument:{uri:this.getUri(e)},position:{line:r,character:n}},t=await i.connection.sendRequest("textDocument/implementation",s);return(!t||t.length===0)&&(console.log(`[LSP][${i.serverID}] No implementation found, retrying in 3s...`),await new Promise(o=>setTimeout(o,3e3)),t=await i.connection.sendRequest("textDocument/implementation",s)),t},{operationName:"textDocument/implementation"})}async getDocumentSymbols(e){return this.run(e,r=>r.connection.sendRequest("textDocument/documentSymbol",{textDocument:{uri:this.getUri(e)}}),{operationName:"textDocument/documentSymbol"})}async getWorkspaceSymbols(e){if(this.clients.size===0){console.log("[LSP] No active clients for workspace symbols, probing project...");let n=QWe.readdirSync(this.projectRoot,{recursive:!0}),i=[{ext:".ts",id:"typescript-language-server"},{ext:".py",id:"pyright"},{ext:".go",id:"gopls"},{ext:".rs",id:"rust-analyzer"},{ext:".js",id:"typescript-language-server"}];for(let s of i){let t=n.find(o=>o.endsWith(s.ext)&&!o.includes("node_modules")&&!o.includes("dist"));if(t){console.log(`[LSP] Detected ${s.ext} project, activating ${s.id}...`);let o=tE.join(this.projectRoot,t),d=await this.getClientsForFile(o);for(let I of d)await this.syncDocument(I,o);console.log(`[LSP] Waiting 5s for ${s.id} indexing...`),await new Promise(I=>setTimeout(I,5e3));break}}}let r=[];console.log(`[LSP] Searching workspace symbols for "${e}" across ${this.clients.size} clients...`);for(let n of this.clients.values())try{let i=await n.connection.sendRequest("workspace/symbol",{query:e});(!i||i.length===0)&&(console.log(`[LSP][${n.serverID}] No symbols yet, retrying in 3s...`),await new Promise(s=>setTimeout(s,3e3)),i=await n.connection.sendRequest("workspace/symbol",{query:e})),console.log(`[LSP][${n.serverID}] Found ${i?.length||0} symbols`),i&&r.push(i)}catch(i){console.error(`[LSP][${n.serverID}] Workspace symbols failed:`,i)}return r}async getDiagnostics(e){return[]}}});function ZGr(a){return mot||(mot=new VWe(a)),mot}var mot,NGr=_e(()=>{"use strict";yGr();mot=null});import*as XU from"node:path";import{fileURLToPath as Thn}from"node:url";var Tb,pot=_e(()=>{"use strict";Es();NGr();fi();pc();Tb=class a extends ka{config;static Name="lsp";constructor(e){super(a.Name,"LSP Tool","Perform Language Server Protocol operations like Go to Definition, Find References, Hover, etc. Useful for code navigation and understanding.",Ga.LightBulb,{properties:{operation:{type:Pt.STRING,enum:["goToDefinition","findReferences","hover","documentSymbol","workspaceSymbol","goToImplementation"],description:"The LSP operation to perform."},filePath:{type:Pt.STRING,description:"The absolute path to the file. Required for file-specific operations."},line:{type:Pt.NUMBER,description:"The 1-based line number. Required for position-specific operations."},character:{type:Pt.NUMBER,description:"The 1-based character offset. Required for position-specific operations."},query:{type:Pt.STRING,description:"Search query. Required for workspaceSymbol."}},required:["operation"],type:Pt.OBJECT}),this.config=e}validateToolParams(e){let r=ai.validate(this.schema.parameters,e,a.Name);return r||(e.operation!=="workspaceSymbol"&&(!e.filePath||!XU.isAbsolute(e.filePath))?"filePath must be an absolute path for this operation.":["goToDefinition","findReferences","hover","goToImplementation"].includes(e.operation)&&(!e.line||!e.character||e.line<1||e.character<1)?"line and character must be 1-based (>= 1) for this operation.":e.operation==="workspaceSymbol"&&!e.query?"query is required for workspaceSymbol.":null)}async execute(e){let r=ZGr(this.config.getTargetDir()),n=null,i=e.filePath?XU.resolve(e.filePath):void 0;try{switch(e.operation){case"goToDefinition":n=await r.getDefinition(i,e.line-1,e.character-1);break;case"findReferences":n=await r.getReferences(i,e.line-1,e.character-1);break;case"hover":n=await r.getHover(i,e.line-1,e.character-1);break;case"documentSymbol":n=await r.getDocumentSymbols(i);break;case"workspaceSymbol":n=await r.getWorkspaceSymbols(e.query||"");break;case"goToImplementation":n=await r.getImplementation(i,e.line-1,e.character-1);break;default:throw new Error(`Unknown operation: ${e.operation}`)}let s=n;Array.isArray(n)&&(e.operation==="hover"?s=n.find(d=>d&&d.contents)||null:e.operation==="goToDefinition"?(s=n.flat().filter(Boolean),s.length===0?s=null:s.length===1&&(s=s[0])):(s=n.flat().filter(Boolean),s.length===0&&Array.isArray(n)&&(s=[])));let t=this.formatLspResult(s,e.operation,this.config.getTargetDir());return{llmContent:`Operation ${e.operation} result:
|
|
2191
2191
|
${t}`,returnDisplay:t}}catch(s){let t=s instanceof Error?s.message:String(s);return{llmContent:`Error executing LSP operation ${e.operation}: ${t}`,returnDisplay:`Error: ${t}`}}}formatLspResult(e,r,n){if(!e)return"No result found.";let i=(s,t)=>{let o=s;s.startsWith("file://")&&(o=Thn(s));let d=XU.relative(n,o),I=t.start.line+1,u=t.start.character+1,h=t.end.line+1,c=t.end.character+1;return I===h?`${d}:${I}:${u}-${c}`:`${d}:${I}:${u} - ${h}:${c}`};if(Array.isArray(e)){if(e.length===0)return"No results.";let s=e[0];return s.uri||s.targetUri?e.map(t=>{let o=t.uri||t.targetUri,d=t.range||t.targetSelectionRange;return`\u2022 ${i(o,d)}`}).join(`
|
|
2192
2192
|
`):s.name&&s.kind!==void 0?e.map(t=>{let d={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String"}[t.kind]||`Kind(${t.kind})`,I="";if(t.location)I=i(t.location.uri,t.location.range);else if(t.range){let u=t.range;I=`${u.start.line+1}:${u.start.character+1}`}return`\u2022 [${d}] ${t.name} (${I})`}).join(`
|
|
@@ -4040,11 +4040,11 @@ ${g}
|
|
|
4040
4040
|
|
|
4041
4041
|
Dangerous commands cannot be auto-executed in YOLO mode. Please run this command in interactive mode for confirmation.`);console.error(`
|
|
4042
4042
|
${"=".repeat(80)}`),console.error("\u{1F6AB} DANGEROUS COMMAND EXECUTION PREVENTED"),console.error(`${"=".repeat(80)}`),console.error(`Rule: ${N}`),console.error(`Warning: ${g}`),console.error(`${"=".repeat(80)}
|
|
4043
|
-
`);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let y=VX(e.name,e.callId,h);return{callId:e.callId,responseParts:y,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var t4r=_e(()=>{"use strict";O2e();Gte();i$();});import{randomUUID as eRn}from"crypto";function AW(){return xle||(xle=eRn()),xle}function r4r(a){xle=a}function a4r(){xle=void 0}var xle,n4r,dht=_e(()=>{"use strict";n4r=AW()});import*as Dc from"fs";import*as EW from"path";import*as BS from"os";function tRn(a){xW.configure(a)}function rRn(a){xW.setUserInfo(a)}function aRn(a){xW.setCliVersion(a)}async function nRn(){return await xW.getUserHeaders()}function iRn(){return xW.getStatus()}var Cle,Oc,xW,Yle=_e(()=>{"use strict";Xct();dht();iS();nm();Cle=259200,Oc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return uW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=EW.join(BS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=EW.join(BS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=EW.join(BS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=EW.join(BS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=EW.join(BS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=EW.join(BS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.123",this.config={proxyServerUrl:Hct()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Dc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Dc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Dc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=EW.dirname(this.userInfoFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Dc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Dc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=EW.dirname(this.jwtTokenFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Dc.existsSync(this.usageStatsFilePath)){let e=Dc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=EW.dirname(this.usageStatsFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Cle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Cle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Cle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":AW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":AW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Dc.existsSync(this.userInfoFilePath)&&Dc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},xW=Oc.getInstance()});function sRn(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function Vle(a={}){let e=(a.baseUrl??xW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new CW("Proxy server URL is not configured");if(sRn(e))return[];let r=`${e}/web-api/models`,n=await xW.getUserHeaders(),i=a.timeoutMs??oRn,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new CW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new CW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&YDe(c))throw new l_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new CW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new CW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new CW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new CW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var oRn,CW,l_,i4r=_e(()=>{"use strict";Yle();yu();oRn=15e3,CW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},l_=class extends CW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Iht,s4r=_e(()=>{"use strict";Iht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as C5 from"node:fs";import*as d9 from"node:path";import*as o4r from"node:os";function hht(){return d9.join(o4r.homedir(),Qo,"trusted-project-hooks.json")}function cRe(){try{let a=hht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function l4r(a){let e=hht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function c_(a){let e=d9.resolve(a),{trustedPaths:r}=cRe();return r.includes(e)}function mht(a){let e=d9.resolve(a),r=cRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),l4r(r))}function pht(a){let e=d9.resolve(a),r=cRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&l4r({trustedPaths:n})}function lRn(){return cRe().trustedPaths}var c4r=_e(()=>{"use strict";nm();});function u4r(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(by(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function d4r(a){if(a==null)return"";if(typeof a=="string")return bht(a)??a;if(by(a))return a.error.message||"";if(lb(a)||a instanceof Error)return bht(a.message)??a.message;try{return String(a)}catch{return""}}function bht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function TS(a){let e=u4r(a),r=d4r(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var I4r=_e(()=>{"use strict";SH();});function p4r(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return cRn.includes(n)}function uRn(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function b4r(a){let e=uRn(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function uRe(a){return r1(a)}function Qle(a,e={}){if(!uRe(a))return null;let r=e.locale??"zh",n=b4r(a),i=p4r(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${m4r}`:`Sign in at ${h4r} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${m4r})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${h4r} \u5145\u503C\u3002`;return`${s}${t}`}var h4r,m4r,cRn,f4r=_e(()=>{"use strict";SH();h4r="https://hwjcode.bot/",m4r="https://applink.feishu.cn/T981u6WkPNNZ",cRn=["cmcm.com","orionstar.com"]});function dRe(a){let e=fw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function dRn(a,e=!1){let r=dRe(a);console.log(`
|
|
4043
|
+
`);let w=Date.now()-s;return console.warn(`[ToolCall] Blocked dangerous command: ${e.name}, duration: ${w}ms`),t(!1,E.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:E.message}}}],resultDisplay:E.message,error:E}}let u=await i.execute(e.args,d),h=u.llmContent,c=u.returnDisplay,m=Date.now()-s;console.debug(`[ToolCall] Success: ${e.name}, duration: ${m}ms`);let Z=typeof h=="string"?h.length:JSON.stringify(h).length;t(!0,Z);let y=VX(e.name,e.callId,h);return{callId:e.callId,responseParts:y,resultDisplay:c,error:void 0}}catch(d){let I=d instanceof Error?d:new Error(String(d)),u=Date.now()-s;return console.warn(`[ToolCall] Failed: ${e.name}, error: ${I.message}, duration: ${u}ms`),t(!1,I.message.length),{callId:e.callId,responseParts:[{functionResponse:{id:e.callId,name:e.name,response:{error:I.message}}}],resultDisplay:I.message,error:I}}}var t4r=_e(()=>{"use strict";O2e();Gte();i$();});import{randomUUID as eRn}from"crypto";function AW(){return xle||(xle=eRn()),xle}function r4r(a){xle=a}function a4r(){xle=void 0}var xle,n4r,dht=_e(()=>{"use strict";n4r=AW()});import*as Dc from"fs";import*as EW from"path";import*as BS from"os";function tRn(a){xW.configure(a)}function rRn(a){xW.setUserInfo(a)}function aRn(a){xW.setCliVersion(a)}async function nRn(){return await xW.getUserHeaders()}function iRn(){return xW.getStatus()}var Cle,Oc,xW,Yle=_e(()=>{"use strict";Xct();dht();iS();nm();Cle=259200,Oc=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return uW(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),s=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${s}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${s}\u5206\u949F${t}\u79D2`:s>0?`${s}\u5206\u949F${t}\u79D2`:`${t}\u79D2`}formatAbsoluteTime(e){return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}constructor(){"https://api-code.deepvlab.ai"?.includes("localhost")?(this.userInfoFilePath=EW.join(BS.homedir(),Qo,"user-info-dev.json"),this.jwtTokenFilePath=EW.join(BS.homedir(),Qo,"jwt-token-dev.json"),this.usageStatsFilePath=EW.join(BS.homedir(),Qo,"usage-stats-dev.json")):(this.userInfoFilePath=EW.join(BS.homedir(),Qo,"user-info.json"),this.jwtTokenFilePath=EW.join(BS.homedir(),Qo,"jwt-token.json"),this.usageStatsFilePath=EW.join(BS.homedir(),Qo,"usage-stats.json")),this.cliVersion="1.1.124",this.config={proxyServerUrl:Hct()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId===null&&(this.periodicStatusCheckIntervalId=setInterval(()=>{this.runPeriodicTokenCheck()},600*1e3))}async runPeriodicTokenCheck(){if(!this.userInfo&&!this.jwtTokenData)return;(!this.jwtTokenData||this.isTokenExpired())&&this.reloadFromDisk();let e=!!this.jwtTokenData&&!this.isTokenExpired();if(this.userInfo&&!e){if(this.jwtTokenData?.refreshToken)try{await this.refreshAccessToken(),console.log("[Login Check] \u2705 Periodic status check - expired access credential renewed via refresh credential");return}catch(r){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",r instanceof Error?r.message:String(r));return}}console.log("[Login Check] \u26A0\uFE0F Periodic status check - Credential expired and cannot be renewed, signing out to return to login"),this.clear(),this.triggerLoginSuccessCallbacks();return}if(this.jwtTokenData){let r=Date.now(),n=this.jwtTokenData.expiresAt-r,i=this.formatTimeRemaining(n),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return a.instance||(a.instance=new a),a.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{Dc.chmodSync(e,384)}catch(r){console.warn("[Login Check] Failed to chmod credential file:",r)}}loadUserInfo(){try{if(Dc.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=Dc.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,s]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${s}`}}else this.userInfo=null}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=EW.dirname(this.userInfoFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),this.chmodOwnerOnly(this.userInfoFilePath),console.log("[Login Check] User info saved to local file")}catch(e){console.error("[Login Check] Failed to save user info:",e)}}loadJwtToken(){try{if(Dc.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=Dc.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e),this.isTokenExpired()?this.jwtTokenData?.refreshToken||(this.jwtTokenData=null):this.isTokenNearExpiry(300)&&console.log("\u26A0\uFE0F Access credential expiring soon, auto-renewal in progress")}else console.log("[Login Check] No stored access credential found, authentication required"),this.jwtTokenData=null}catch(e){console.warn("[Login Check] Failed to load access credential from local file:",e),this.jwtTokenData=null}}saveJwtToken(){try{if(!this.jwtTokenData)return;let e=EW.dirname(this.jwtTokenFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),this.chmodOwnerOnly(this.jwtTokenFilePath),console.log("[Login Check] Access credential data saved to local file")}catch(e){console.error("[Login Check] Failed to save access credential:",e)}}loadUsageStats(){try{if(Dc.existsSync(this.usageStatsFilePath)){let e=Dc.readFileSync(this.usageStatsFilePath,"utf8");this.usageStats=JSON.parse(e)}}catch(e){console.warn("[Login Check] Failed to load usage stats from local file:",e),this.usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()}}}saveUsageStats(){try{let e=EW.dirname(this.usageStatsFilePath);Dc.existsSync(e)||Dc.mkdirSync(e,{recursive:!0,mode:448}),Dc.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),this.chmodOwnerOnly(this.usageStatsFilePath),console.log("[Login Check] Usage stats saved to local file")}catch(e){console.error("[Login Check] Failed to save usage stats:",e)}}updateUsageStats(e){e<=0||(this.usageStats.totalCreditsConsumed+=e,this.usageStats.lastUpdated=new Date().toISOString(),this.saveUsageStats(),console.log(`[Usage Stats] Updated total credits consumed: ${this.usageStats.totalCreditsConsumed} (+${e})`))}getUsageStats(){return{...this.usageStats}}checkStartupTokenStatus(){return this.jwtTokenData?{hasToken:!0,isExpired:Date.now()>=this.jwtTokenData.expiresAt,expiresAt:this.jwtTokenData.expiresAt,hasRefreshToken:!!this.jwtTokenData.refreshToken}:{hasToken:!1,isExpired:!0,expiresAt:null,hasRefreshToken:!1}}configure(e){this.config={...this.config,...e},e.userInfo&&(this.userInfo=e.userInfo,this.saveUserInfo(),console.log(`[Login Check] User info configured: ${e.userInfo.name}`)),e.proxyServerUrl&&console.log(`[Login Check] Proxy server URL: ${e.proxyServerUrl}`),e.cliVersion&&(this.cliVersion=e.cliVersion,console.log(`[Login Check] CLI version set: ${e.cliVersion}`))}setUserInfo(e){this.userInfo=e,this.saveUserInfo(),console.log(`[Login Check] User info updated: ${e.name} (${e.email||e.openId||"N/A"})`),this.startPeriodicStatusCheck(),this.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Cle*1e3),d=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${d}`)}reloadFromDisk(){this.loadUserInfo(),this.loadJwtToken()}async getAccessToken(){if(this.jwtTokenData||this.reloadFromDisk(),!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Cle*1e3,s=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Cle){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let d=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${d}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Cle*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${s} (until ${t}), next renewal: ${o}${i?" (refresh credential updated)":" (reusing existing refresh credential)"}`),this.jwtTokenData.accessToken}catch(e){throw console.error("[Login Check] Credential refresh error:",e),e}}clearTokens(){this.jwtTokenData=null;try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=this.getCliVersion(),n=this.getUserAgent(),i={"Content-Type":"application/json","X-Client-Version":r,"User-Agent":n,"X-Session-ID":AW()};return e&&(i["X-DVCode-Scene"]=e),i}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent();return{"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":AW()}}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Dc.existsSync(this.userInfoFilePath)&&Dc.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Dc.existsSync(this.jwtTokenFilePath)&&Dc.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},xW=Oc.getInstance()});function sRn(a){try{let e=new URL(a).hostname;return e==="localhost"||e==="127.0.0.1"||e==="::1"}catch{return!1}}async function Vle(a={}){let e=(a.baseUrl??xW.getProxyServerUrl()??"").trim().replace(/\/+$/,"");if(!e)throw new CW("Proxy server URL is not configured");if(sRn(e))return[];let r=`${e}/web-api/models`,n=await xW.getUserHeaders(),i=a.timeoutMs??oRn,s=new AbortController,t=setTimeout(()=>s.abort(new Error(`Timed out after ${i}ms`)),i),o=[s.signal];a.signal&&o.push(a.signal);let d=o.length===1?o[0]:AbortSignal.any?.(o)??o[0];try{let I;try{I=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",...n,"User-Agent":a.userAgent??"DeepCode"},signal:d})}catch(c){if(s.signal.aborted)throw new CW(`Request to ${r} timed out after ${i}ms`,void 0,c);let m=c instanceof Error?c.message:String(c);throw new CW(`Network error contacting ${r}: ${m}`,void 0,c)}if(!I.ok){let c="";try{c=await I.text()}catch{}if(I.status===401&&YDe(c))throw new l_;let m=c?c.length>200?c.slice(0,200)+"\u2026":c:I.statusText||"no body";throw new CW(`Proxy /web-api/models returned HTTP ${I.status}: ${m}`,I.status)}let u;try{u=await I.json()}catch(c){throw new CW("Proxy /web-api/models returned a body that is not valid JSON",I.status,c)}if(!u?.success)throw new CW(u?.message||"Proxy /web-api/models response was unsuccessful",I.status);if(!Array.isArray(u.data))throw new CW('Proxy /web-api/models response is missing the expected "data" array',I.status);let h=u.data.filter(c=>!!c&&typeof c.name=="string").map(c=>({name:c.name,displayName:typeof c.displayName=="string"&&c.displayName?c.displayName:c.name,creditsPerRequest:typeof c.creditsPerRequest=="number"?c.creditsPerRequest:0,available:c.available!==!1,maxToken:typeof c.maxToken=="number"?c.maxToken:0,highVolumeThreshold:typeof c.highVolumeThreshold=="number"?c.highVolumeThreshold:0,highVolumeCredits:typeof c.highVolumeCredits=="number"?c.highVolumeCredits:0}));return h.sort((c,m)=>c.displayName.localeCompare(m.displayName)),h}finally{clearTimeout(t)}}var oRn,CW,l_,i4r=_e(()=>{"use strict";Yle();yu();oRn=15e3,CW=class extends Error{status;cause;constructor(e,r,n){super(e),this.status=r,this.cause=n,this.name="CloudModelsFetchError"}},l_=class extends CW{constructor(e="Authentication required - please re-authenticate"){super(e,401),this.name="CloudModelsAuthError"}}});var Iht,s4r=_e(()=>{"use strict";Iht=class{onToolStatusChanged(e,r,n,i){}onOutputUpdate(e,r,n){}getPreferredEditor(e){}getStatusUpdateCallback(){}onPreToolExecution(e,r,n,i){}onAllToolsComplete(e,r){}onToolCallsUpdate(e,r){}}});import*as C5 from"node:fs";import*as d9 from"node:path";import*as o4r from"node:os";function hht(){return d9.join(o4r.homedir(),Qo,"trusted-project-hooks.json")}function cRe(){try{let a=hht();if(!C5.existsSync(a))return{trustedPaths:[]};let e=C5.readFileSync(a,"utf-8"),r=JSON.parse(e);return Array.isArray(r.trustedPaths)?{trustedPaths:r.trustedPaths}:{trustedPaths:[]}}catch{return{trustedPaths:[]}}}function l4r(a){let e=hht(),r=d9.dirname(e);C5.mkdirSync(r,{recursive:!0});let n=`${e}.${process.pid}.tmp`;C5.writeFileSync(n,JSON.stringify(a,null,2),"utf8"),C5.renameSync(n,e)}function c_(a){let e=d9.resolve(a),{trustedPaths:r}=cRe();return r.includes(e)}function mht(a){let e=d9.resolve(a),r=cRe();r.trustedPaths.includes(e)||(r.trustedPaths.push(e),l4r(r))}function pht(a){let e=d9.resolve(a),r=cRe(),n=r.trustedPaths.filter(i=>i!==e);n.length!==r.trustedPaths.length&&l4r({trustedPaths:n})}function lRn(){return cRe().trustedPaths}var c4r=_e(()=>{"use strict";nm();});function u4r(a){if(a==null)return;if(typeof a=="object"){let n=a;if(typeof n.status=="number")return n.status;if(typeof n.statusCode=="number")return n.statusCode;let i=n.response;if(i&&typeof i.status=="number")return i.status}if(by(a)&&typeof a.error.code=="number")return a.error.code;let e=typeof a=="string"?a:typeof a=="object"&&a!==null&&"message"in a?String(a.message??""):"",r=[/API request failed \((\d{3})\)/,/Stream API error \((\d{3})\)/,/\(Status:\s*(\d{3})\)/i,/\bHTTP\s+(\d{3})\b/i,/\bstatus[\s:=]+(\d{3})\b/i];for(let n of r){let i=e.match(n);if(i){let s=parseInt(i[1],10);if(s>=100&&s<600)return s}}}function d4r(a){if(a==null)return"";if(typeof a=="string")return bht(a)??a;if(by(a))return a.error.message||"";if(lb(a)||a instanceof Error)return bht(a.message)??a.message;try{return String(a)}catch{return""}}function bht(a){if(!a)return;let e=a.indexOf("{");if(e===-1)return;let r=a.substring(e);try{let n=JSON.parse(r);if(n&&typeof n=="object"){let i=n;if(i.error&&typeof i.error=="object"&&typeof i.error.message=="string"){let s=i.error.message;if(s.trim())return`${a.substring(0,e).trim()} ${s}`.trim()}if(typeof i.message=="string"&&i.message.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.message}`:i.message}if(typeof i.error=="string"&&i.error.trim()){let s=a.substring(0,e).trim();return s?`${s} ${i.error}`:i.error}}}catch{}}function TS(a){let e=u4r(a),r=d4r(a).trim();if(e!==void 0)return r?`[HTTP ${e}] ${r}`:`[HTTP ${e}]`}var I4r=_e(()=>{"use strict";SH();});function p4r(a){if(!a)return!1;let e=a.trim().toLowerCase(),r=e.lastIndexOf("@");if(r<=0)return!1;let n=e.slice(r+1);return cRn.includes(n)}function uRn(a){if(typeof a=="string")return a;if(a instanceof Error)return a.message;if(a&&typeof a=="object"){let e=a;if(typeof e.message=="string")return e.message;try{return JSON.stringify(e.response?.data??e)}catch{return String(a)}}return String(a)}function b4r(a){let e=uRn(a).match(/available[\s:]*([0-9]+(?:\.[0-9]+)?)/i);return e?e[1]:null}function uRe(a){return r1(a)}function Qle(a,e={}){if(!uRe(a))return null;let r=e.locale??"zh",n=b4r(a),i=p4r(e.email);if(r==="en"){let o=n!==null?`Your credit balance is insufficient (current balance: ${n}).`:"Your credit balance is insufficient.",d=i?`As a Cheetah employee, request an "HwjCode quota" via the Feishu approval form: ${m4r}`:`Sign in at ${h4r} to recharge.`;return`${o} ${d}`}let s=n!==null?`\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3,\u5F53\u524D\u4F59\u989D:${n}\u3002`:"\u60A8\u7684\u53EF\u7528\u79EF\u5206\u4F59\u989D\u4E0D\u8DB3\u3002",t=i?`\u60A8\u662F\u730E\u8C79\u5458\u5DE5,\u8BF7\u524D\u5F80\u98DE\u4E66\u5BA1\u6279(${m4r})\u7533\u8BF7"HwjCode \u914D\u989D"\u3002`:`\u8BF7\u767B\u5F55 ${h4r} \u5145\u503C\u3002`;return`${s}${t}`}var h4r,m4r,cRn,f4r=_e(()=>{"use strict";SH();h4r="https://hwjcode.bot/",m4r="https://applink.feishu.cn/T981u6WkPNNZ",cRn=["cmcm.com","orionstar.com"]});function dRe(a){let e=fw(a),r=[],n=[],i=e.toolCallReliability==="low"||e.needsFormatTolerance,s=e.needsFormatTolerance||e.proneToIncompleteStream||e.enableMalformedRetry;return e.toolCallReliability==="low"&&(r.push("Consider using sequential tool calls instead of concurrent ones"),r.push("Enable debug logging to monitor tool call success rates")),e.needsFormatTolerance&&(r.push("Tolerant parameter validation is enabled for this model"),r.push("Consider upgrading to a more capable model for production use")),e.proneToIncompleteStream&&(r.push("Streaming responses may be incomplete - validation and retry enabled"),n.push("Function calls may require automatic fixing during streaming")),e.maxConcurrentTools<3&&n.push(`Concurrent tool calls limited to ${e.maxConcurrentTools} for stability`),e.enableMalformedRetry&&r.push("Automatic retry enabled for malformed function calls"),e.enableProgressiveDegradation&&r.push("Progressive degradation enabled - will reduce complexity on failures"),{modelName:a,capabilities:e,recommendations:r,warnings:n,isSmallModel:i,needsSpecialHandling:s}}function dRn(a,e=!1){let r=dRe(a);console.log(`
|
|
4044
4044
|
\u{1F50D} Model Diagnostics: ${a}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
|
|
4045
4045
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(n=>console.log(` \u2022 ${n}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
4046
4046
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(n=>console.log(` \u2022 ${n}`))),e&&(console.log(`
|
|
4047
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function IRn(a){let e=dRe(a);return e.isSmallModel||e.needsSpecialHandling}function hRn(a){let e=dRe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var G4r=_e(()=>{"use strict";pte();});import*as HZ from"fs";import*as IRe from"path";var mRn,Hle,g4r=_e(()=>{"use strict";Zd();mRn="healthy-use-reminder.json",Hle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=zf(e);this.stateFilePath=IRe.join(r,mRn)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=IRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var fht,Ght,pRn,bRn,fRn,v4r=_e(()=>{"use strict";fht="--- Content from referenced files ---",Ght="--- End of content ---",pRn=2e3,bRn=2e3,fRn=20});function Z4r(...a){return GRn(...a)}function N4r(...a){return gRn(...a)}function y4r(a,e){return a in e}function ght(){let a={get(i,s){if(s==="write")return Z4r;if(y4r(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return N4r;if(y4r(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var GRn,gRn,W4r=_e(()=>{"use strict";GRn=process.stdout.write.bind(process.stdout),gRn=process.stderr.write.bind(process.stderr)});import{readFile as vRn}from"node:fs/promises";import{fileURLToPath as yRn}from"node:url";import vht from"node:path";function ZRn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return vht.dirname(yRn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Xle||(Xle=(async()=>"1.1.123")(),Xle)}function NRn(){Xle=void 0}var Xle,yht=_e(()=>{"use strict";});function WRn(a="latest"){let e=a?.trim().toLowerCase();return F4r.includes(e)?e:w4r}var F4r,w4r,R4r=_e(()=>{"use strict";F4r=["stable","latest"],w4r="stable"});import{EventEmitter as FRn}from"node:events";var kle,Zht,Nht,A4r=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(kle||(kle={}));Zht=class{emitter=new FRn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Nht=new Zht});function hRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function wRn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function Wht(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??hRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?hRe(r.content):[],i=wRn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...hRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...hRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var E4r=_e(()=>{"use strict";});var DS,x4r,Sle,C4r=_e(()=>{"use strict";DS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},x4r="latest",Sle=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw DS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw DS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===x4r){let s=await this.listSessions();if(s.length===0)throw DS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new DS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function RRn(a,e,r){return new mRe(a,e,r)}var mRe,pRe,bRe,Y4r=_e(()=>{"use strict";lte();iS();mRe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":uW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new pRe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new bRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},pRe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},bRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function ARn(a){return Lle.getInstance(a)}function ERn(a){let e=Lle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Lle,V4r=_e(()=>{"use strict";Yle();Lle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Oc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Oc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as fRe from"fs";import*as R2 from"path";function xRn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Jle,Fht,Q4r=_e(()=>{"use strict";Jle=xRn(),Fht=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(R2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(R2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(R2.join(this.customBasePath,"auth","login","templates",e))),Jle&&r.push(R2.join(Jle,e)),Jle){let s=Jle;for(let t=0;t<10;t++)r.push(R2.join(s,"bundled","auth","login","templates",e)),r.push(R2.join(s,"bundled",e)),r.push(R2.join(s,"bundle","login","templates",e)),r.push(R2.join(s,"auth","login","templates",e)),s=R2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(R2.join(s,"bundle","login","templates",e)),r.push(R2.join(s,"dist","bundled","auth","login","templates",e)),r.push(R2.join(s,"bundled","auth","login","templates",e)),r.push(R2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(fRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Jle||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=fRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
4047
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function IRn(a){let e=dRe(a);return e.isSmallModel||e.needsSpecialHandling}function hRn(a){let e=dRe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var G4r=_e(()=>{"use strict";pte();});import*as HZ from"fs";import*as IRe from"path";var mRn,Hle,g4r=_e(()=>{"use strict";Zd();mRn="healthy-use-reminder.json",Hle=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=zf(e);this.stateFilePath=IRe.join(r,mRn)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let s=2700*1e3;return Date.now()-i.lastReminderShownAt>=s}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=IRe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var fht,Ght,pRn,bRn,fRn,v4r=_e(()=>{"use strict";fht="--- Content from referenced files ---",Ght="--- End of content ---",pRn=2e3,bRn=2e3,fRn=20});function Z4r(...a){return GRn(...a)}function N4r(...a){return gRn(...a)}function y4r(a,e){return a in e}function ght(){let a={get(i,s){if(s==="write")return Z4r;if(y4r(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,s){if(s==="write")return N4r;if(y4r(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var GRn,gRn,W4r=_e(()=>{"use strict";GRn=process.stdout.write.bind(process.stdout),gRn=process.stderr.write.bind(process.stderr)});import{readFile as vRn}from"node:fs/promises";import{fileURLToPath as yRn}from"node:url";import vht from"node:path";function ZRn(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return vht.dirname(yRn(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function Y5(){return Xle||(Xle=(async()=>"1.1.124")(),Xle)}function NRn(){Xle=void 0}var Xle,yht=_e(()=>{"use strict";});function WRn(a="latest"){let e=a?.trim().toLowerCase();return F4r.includes(e)?e:w4r}var F4r,w4r,R4r=_e(()=>{"use strict";F4r=["stable","latest"],w4r="stable"});import{EventEmitter as FRn}from"node:events";var kle,Zht,Nht,A4r=_e(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})(kle||(kle={}));Zht=class{emitter=new FRn;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Nht=new Zht});function hRe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function wRn(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function Wht(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??hRe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?hRe(r.content):[],i=wRn(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let s of r.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...hRe(r.content)),i)for(let s of r.toolCalls)n.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let s=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?s.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?s.push(...hRe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var E4r=_e(()=>{"use strict";});var DS,x4r,Sle,C4r=_e(()=>{"use strict";DS=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},x4r="latest",Sle=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw DS.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let s=Number.parseInt(r,10);if(Number.isInteger(s)&&s.toString()===r&&s>0&&s<=n.length)return n[s-1];throw DS.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===x4r){let s=await this.listSessions();if(s.length===0)throw DS.noSessionsFound();n=s[s.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new DS(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function RRn(a,e,r){return new mRe(a,e,r)}var mRe,pRe,bRe,Y4r=_e(()=>{"use strict";lte();iS();mRe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),s=await fetch(n,i);return s.status===401&&this.tokenManager&&(s=await this.handleUnauthorized(n,i)),s}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":uW(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:C4("warn","\u26A0\uFE0F No access token available")}catch(n){C4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(C4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{C4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){C4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},s=fetch(e,i);return this.processRequestQueue(n),await s}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(C4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new pRe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:s})=>{s().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new bRe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},pRe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},bRe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function ARn(a){return Lle.getInstance(a)}function ERn(a){let e=Lle.getInstance(a);return()=>e.handleAuthenticationRequired()}var Lle,V4r=_e(()=>{"use strict";Yle();Lle=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Oc.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Oc.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});import*as fRe from"fs";import*as R2 from"path";function xRn(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Jle,Fht,Q4r=_e(()=>{"use strict";Jle=xRn(),Fht=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(R2.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(R2.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(R2.join(this.customBasePath,"auth","login","templates",e))),Jle&&r.push(R2.join(Jle,e)),Jle){let s=Jle;for(let t=0;t<10;t++)r.push(R2.join(s,"bundled","auth","login","templates",e)),r.push(R2.join(s,"bundled",e)),r.push(R2.join(s,"bundle","login","templates",e)),r.push(R2.join(s,"auth","login","templates",e)),s=R2.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();r.push(R2.join(s,"bundle","login","templates",e)),r.push(R2.join(s,"dist","bundled","auth","login","templates",e)),r.push(R2.join(s,"bundled","auth","login","templates",e)),r.push(R2.join(s,"auth","login","templates",e))}catch{}let n=null;for(let s of r)try{if(fRe.existsSync(s)){n=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Jle||"(unavailable - cross-platform build)"}`),console.warn(` Custom base path: ${this.customBasePath||"(not set)"}`),typeof process<"u"&&process.cwd)try{console.warn(` Process cwd: ${process.cwd()}`)}catch{console.warn(" Process cwd: unavailable")}return console.log(`\u2139\uFE0F [AuthTemplates] Using fallback template for ${e}`),this.generateBasicAuthSelectTemplate()}let i=fRe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
4048
4048
|
<!DOCTYPE html>
|
|
4049
4049
|
<html>
|
|
4050
4050
|
<head>
|
|
@@ -5478,7 +5478,7 @@ ${c}`),n?i.reset(c):c}function IVn(a,e,r,n={}){if(!uVr){uVr=!0;let s="Passing li
|
|
|
5478
5478
|
|
|
5479
5479
|
${e}
|
|
5480
5480
|
`:""}`}set message(e){this.#r=e}#n(e){if(!this.#t)return;let r=this.#e,n=bVn(r,this.#t.message);if(n)return(0,gVr.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#a??=this.#n(!0),this.#a}get rawCodeFrame(){return this.#i??=this.#n(!1),this.#i}},bVn=(a,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:s}=r.groups;return i&&s?{line:Number(i),column:Number(s)}:Qmt(a,Number(n),{oneBased:!0})},fVn=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${pVn(n)})`)});var xce=He((ibs,yVr)=>{"use strict";var GVn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{};yVr.exports=GVn});var Cce=He((sbs,ZVr)=>{"use strict";var gVn="2.0.0",vVn=Number.MAX_SAFE_INTEGER||9007199254740991,yVn=16,ZVn=250,NVn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ZVr.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:yVn,MAX_SAFE_BUILD_LENGTH:ZVn,MAX_SAFE_INTEGER:vVn,RELEASE_TYPES:NVn,SEMVER_SPEC_VERSION:gVn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var tP=He((z5,NVr)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:kmt,MAX_SAFE_BUILD_LENGTH:WVn,MAX_LENGTH:FVn}=Cce(),wVn=xce();z5=NVr.exports={};var RVn=z5.re=[],AVn=z5.safeRe=[],An=z5.src=[],EVn=z5.safeSrc=[],En=z5.t={},xVn=0,Smt="[a-zA-Z0-9-]",CVn=[["\\s",1],["\\d",FVn],[Smt,WVn]],YVn=a=>{for(let[e,r]of CVn)a=a.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return a},Gs=(a,e,r)=>{let n=YVn(e),i=xVn++;wVn(a,i,e),En[a]=i,An[i]=e,EVn[i]=n,RVn[i]=new RegExp(e,r?"g":void 0),AVn[i]=new RegExp(n,r?"g":void 0)};Gs("NUMERICIDENTIFIER","0|[1-9]\\d*");Gs("NUMERICIDENTIFIERLOOSE","\\d+");Gs("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Smt}*`);Gs("MAINVERSION",`(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})\\.(${An[En.NUMERICIDENTIFIER]})`);Gs("MAINVERSIONLOOSE",`(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})\\.(${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASEIDENTIFIER",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIER]})`);Gs("PRERELEASEIDENTIFIERLOOSE",`(?:${An[En.NONNUMERICIDENTIFIER]}|${An[En.NUMERICIDENTIFIERLOOSE]})`);Gs("PRERELEASE",`(?:-(${An[En.PRERELEASEIDENTIFIER]}(?:\\.${An[En.PRERELEASEIDENTIFIER]})*))`);Gs("PRERELEASELOOSE",`(?:-?(${An[En.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${An[En.PRERELEASEIDENTIFIERLOOSE]})*))`);Gs("BUILDIDENTIFIER",`${Smt}+`);Gs("BUILD",`(?:\\+(${An[En.BUILDIDENTIFIER]}(?:\\.${An[En.BUILDIDENTIFIER]})*))`);Gs("FULLPLAIN",`v?${An[En.MAINVERSION]}${An[En.PRERELEASE]}?${An[En.BUILD]}?`);Gs("FULL",`^${An[En.FULLPLAIN]}$`);Gs("LOOSEPLAIN",`[v=\\s]*${An[En.MAINVERSIONLOOSE]}${An[En.PRERELEASELOOSE]}?${An[En.BUILD]}?`);Gs("LOOSE",`^${An[En.LOOSEPLAIN]}$`);Gs("GTLT","((?:<|>)?=?)");Gs("XRANGEIDENTIFIERLOOSE",`${An[En.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Gs("XRANGEIDENTIFIER",`${An[En.NUMERICIDENTIFIER]}|x|X|\\*`);Gs("XRANGEPLAIN",`[v=\\s]*(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:\\.(${An[En.XRANGEIDENTIFIER]})(?:${An[En.PRERELEASE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGEPLAINLOOSE",`[v=\\s]*(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:\\.(${An[En.XRANGEIDENTIFIERLOOSE]})(?:${An[En.PRERELEASELOOSE]})?${An[En.BUILD]}?)?)?`);Gs("XRANGE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAIN]}$`);Gs("XRANGELOOSE",`^${An[En.GTLT]}\\s*${An[En.XRANGEPLAINLOOSE]}$`);Gs("COERCEPLAIN",`(^|[^\\d])(\\d{1,${kmt}})(?:\\.(\\d{1,${kmt}}))?(?:\\.(\\d{1,${kmt}}))?`);Gs("COERCE",`${An[En.COERCEPLAIN]}(?:$|[^\\d])`);Gs("COERCEFULL",An[En.COERCEPLAIN]+`(?:${An[En.PRERELEASE]})?(?:${An[En.BUILD]})?(?:$|[^\\d])`);Gs("COERCERTL",An[En.COERCE],!0);Gs("COERCERTLFULL",An[En.COERCEFULL],!0);Gs("LONETILDE","(?:~>?)");Gs("TILDETRIM",`(\\s*)${An[En.LONETILDE]}\\s+`,!0);z5.tildeTrimReplace="$1~";Gs("TILDE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAIN]}$`);Gs("TILDELOOSE",`^${An[En.LONETILDE]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("LONECARET","(?:\\^)");Gs("CARETTRIM",`(\\s*)${An[En.LONECARET]}\\s+`,!0);z5.caretTrimReplace="$1^";Gs("CARET",`^${An[En.LONECARET]}${An[En.XRANGEPLAIN]}$`);Gs("CARETLOOSE",`^${An[En.LONECARET]}${An[En.XRANGEPLAINLOOSE]}$`);Gs("COMPARATORLOOSE",`^${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]})$|^$`);Gs("COMPARATOR",`^${An[En.GTLT]}\\s*(${An[En.FULLPLAIN]})$|^$`);Gs("COMPARATORTRIM",`(\\s*)${An[En.GTLT]}\\s*(${An[En.LOOSEPLAIN]}|${An[En.XRANGEPLAIN]})`,!0);z5.comparatorTrimReplace="$1$2$3";Gs("HYPHENRANGE",`^\\s*(${An[En.XRANGEPLAIN]})\\s+-\\s+(${An[En.XRANGEPLAIN]})\\s*$`);Gs("HYPHENRANGELOOSE",`^\\s*(${An[En.XRANGEPLAINLOOSE]})\\s+-\\s+(${An[En.XRANGEPLAINLOOSE]})\\s*$`);Gs("STAR","(<|>)?=?\\s*\\*");Gs("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Gs("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var nAe=He((obs,WVr)=>{"use strict";var VVn=Object.freeze({loose:!0}),QVn=Object.freeze({}),HVn=a=>a?typeof a!="object"?VVn:a:QVn;WVr.exports=HVn});var Lmt=He((lbs,RVr)=>{"use strict";var FVr=/^[0-9]+$/,wVr=(a,e)=>{if(typeof a=="number"&&typeof e=="number")return a===e?0:a<e?-1:1;let r=FVr.test(a),n=FVr.test(e);return r&&n&&(a=+a,e=+e),a===e?0:r&&!n?-1:n&&!r?1:a<e?-1:1},XVn=(a,e)=>wVr(e,a);RVr.exports={compareIdentifiers:wVr,rcompareIdentifiers:XVn}});var tf=He((cbs,EVr)=>{"use strict";var iAe=xce(),{MAX_LENGTH:AVr,MAX_SAFE_INTEGER:sAe}=Cce(),{safeRe:oAe,t:lAe}=tP(),kVn=nAe(),{compareIdentifiers:Jmt}=Lmt(),Bmt=class a{constructor(e,r){if(r=kVn(r),e instanceof a){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>AVr)throw new TypeError(`version is longer than ${AVr} characters`);iAe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?oAe[lAe.LOOSE]:oAe[lAe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>sAe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>sAe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>sAe||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<sAe)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(iAe("SemVer.compare",this.version,this.options,e),!(e instanceof a)){if(typeof e=="string"&&e===this.version)return 0;e=new a(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof a||(e=new a(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(iAe("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Jmt(n,i)}while(++r)}compareBuild(e){e instanceof a||(e=new a(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(iAe("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Jmt(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?oAe[lAe.PRERELEASELOOSE]:oAe[lAe.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Jmt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};EVr.exports=Bmt});var cL=He((ubs,CVr)=>{"use strict";var xVr=tf(),SVn=(a,e,r=!1)=>{if(a instanceof xVr)return a;try{return new xVr(a,e)}catch(n){if(!r)return null;throw n}};CVr.exports=SVn});var Tmt=He((dbs,YVr)=>{"use strict";var LVn=cL(),JVn=(a,e)=>{let r=LVn(a,e);return r?r.version:null};YVr.exports=JVn});var Dmt=He((Ibs,VVr)=>{"use strict";var BVn=cL(),TVn=(a,e)=>{let r=BVn(a.trim().replace(/^[=v]+/,""),e);return r?r.version:null};VVr.exports=TVn});var Omt=He((hbs,DVn)=>{DVn.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var QVr=He((mbs,OVn)=>{OVn.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var HVr=He((pbs,MVn)=>{MVn.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var kVr=He((bbs,XVr)=>{"use strict";var UVn=[].concat(Omt()).concat(QVr()),zVn=HVr();XVr.exports=function(a){var e=0;function r(){return e<a.length}function n(Z){if(Z instanceof RegExp){var y=a.slice(e),N=y.match(Z);if(N)return e+=N[0].length,N[0]}else if(a.indexOf(Z,e)===e)return e+=Z.length,Z}function i(){n(/[ ]*/)}function s(){for(var Z,y=["WITH","AND","OR","(",")",":","+"],N=0;N<y.length&&(Z=n(y[N]),!Z);N++);if(Z==="+"&&e>1&&a[e-2]===" ")throw new Error("Space before `+`");return Z&&{type:"OPERATOR",string:Z}}function t(){return n(/[A-Za-z0-9-.]+/)}function o(){var Z=t();if(!Z)throw new Error("Expected idstring at offset "+e);return Z}function d(){if(n("DocumentRef-")){var Z=o();return{type:"DOCUMENTREF",string:Z}}}function I(){if(n("LicenseRef-")){var Z=o();return{type:"LICENSEREF",string:Z}}}function u(){var Z=e,y=t();if(UVn.indexOf(y)!==-1)return{type:"LICENSE",string:y};if(zVn.indexOf(y)!==-1)return{type:"EXCEPTION",string:y};e=Z}function h(){return s()||d()||I()||u()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+a[e]+"` at offset "+e);c.push(m)}return c}});var LVr=He((fbs,SVr)=>{"use strict";SVr.exports=function(a){var e=0;function r(){return e<a.length}function n(){return r()?a[e]:null}function i(){if(!r())throw new Error;e++}function s(y){var N=n();if(N&&N.type==="OPERATOR"&&y===N.string)return i(),N.string}function t(){if(s("WITH")){var y=n();if(y&&y.type==="EXCEPTION")return i(),y.string;throw new Error("Expected exception after `WITH`")}}function o(){var y=e,N="",g=n();if(g.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+g.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(g=n(),g.type==="LICENSEREF")return i(),N+="LicenseRef-"+g.string,{license:N};e=y}function d(){var y=n();if(y&&y.type==="LICENSE"){i();var N={license:y.string};s("+")&&(N.plus=!0);var g=t();return g&&(N.exception=g),N}}function I(){var y=s("(");if(y){var N=m();if(!s(")"))throw new Error("Expected `)`");return N}}function u(){return I()||o()||d()}function h(y,N){return function g(){var E=N();if(E){if(!s(y))return E;var w=g();if(!w)throw new Error("Expected expression");return{left:E,conjunction:y.toLowerCase(),right:w}}}}var c=h("AND",u),m=h("OR",c),Z=m();if(!Z||r())throw new Error("Syntax error");return Z}});var Mmt=He((Gbs,JVr)=>{"use strict";var _Vn=kVr(),PVn=LVr();JVr.exports=function(a){return PVn(_Vn(a))}});var PVr=He((gbs,_Vr)=>{var jVn=Mmt(),qVn=Omt();function cAe(a){try{return jVn(a),!0}catch{return!1}}function zVr(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var BVr=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(zVr),KVn=0,$Vn=1,TVr=[function(a){return a.toUpperCase()},function(a){return a.trim()},function(a){return a.replace(/\./g,"")},function(a){return a.replace(/\s+/g,"")},function(a){return a.replace(/\s+/g,"-")},function(a){return a.replace("v","-")},function(a){return a.replace(/,?\s*(\d)/,"-$1")},function(a){return a.replace(/,?\s*(\d)/,"-$1.0")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(a){return a[0].toUpperCase()+a.slice(1)},function(a){return a.replace("/","-")},function(a){return a.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(a){return a.indexOf("3.0")!==-1?a+"-or-later":a+"-only"},function(a){return a+"only"},function(a){return a.replace(/(\d)$/,"-$1.0")},function(a){return a.replace(/(-| )?(\d)$/,"-$2-Clause")},function(a){return a.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(a){return a.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(a){return a.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(a){return a.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(a){return a.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(a){return a.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(a){return"CC-"+a},function(a){return"CC-"+a+"-4.0"},function(a){return a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(a){return"CC-"+a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],Umt=qVn.map(function(a){var e=/^(.*)-\d+\.\d+$/.exec(a);return e?[e[0],e[1]]:[a,null]}).reduce(function(a,e){var r=e[1];return a[r]=a[r]||[],a[r].push(e[0]),a},{}),e9n=Object.keys(Umt).map(function(e){return[e,Umt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});Umt=void 0;var DVr=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(e9n).sort(zVr),t9n=0,r9n=1,OVr=function(a){for(var e=0;e<TVr.length;e++){var r=TVr[e](a).trim();if(r!==a&&cAe(r))return r}return null},MVr=function(a){for(var e=a.toUpperCase(),r=0;r<DVr.length;r++){var n=DVr[r];if(e.indexOf(n[t9n])>-1)return n[r9n]}return null},UVr=function(a,e){for(var r=0;r<BVr.length;r++){var n=BVr[r],i=n[KVn];if(a.indexOf(i)>-1){var s=a.replace(i,n[$Vn]),t=e(s);if(t!==null)return t}}return null};_Vr.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(o){return r?a9n(o):o}var i=typeof a=="string"&&a.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(a=a.trim(),cAe(a))return n(a);var s=a.replace(/\+$/,"").trim();if(cAe(s))return n(s);var t=OVr(a);return t!==null||(t=UVr(a,function(o){return cAe(o)?o:OVr(o)}),t!==null)||(t=MVr(a),t!==null)||(t=UVr(a,MVr),t!==null)?n(t):null};function a9n(a){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(a)!==-1?a+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(a)!==-1?a.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(a)!==-1?a+"-or-later":a}});var $Vr=He((vbs,KVr)=>{var n9n=Mmt(),i9n=PVr(),jVr='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',s9n=/^SEE LICEN[CS]E IN (.+)$/;function qVr(a,e){return e.slice(0,a.length)===a}function zmt(a){if(a.hasOwnProperty("license")){var e=a.license;return qVr("LicenseRef",e)||qVr("DocumentRef",e)}else return zmt(a.left)||zmt(a.right)}KVr.exports=function(a){var e;try{e=n9n(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=s9n.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[jVr]};if(a.trim().length!==0){var i=i9n(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return zmt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[jVr]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var n9r=He(dAe=>{"use strict";Object.defineProperty(dAe,"__esModule",{value:!0});dAe.LRUCache=void 0;var rP=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t9r=new Set,_mt=typeof process=="object"&&process?process:{},r9r=(a,e,r,n)=>{typeof _mt.emitWarning=="function"?_mt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},uAe=globalThis.AbortController,e9r=globalThis.AbortSignal;if(typeof uAe>"u"){e9r=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},uAe=class{constructor(){e()}signal=new e9r;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let a=_mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,r9r("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var o9n=a=>!t9r.has(a),Nbs=Symbol("type"),Q9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),a9r=a=>Q9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?aP:null:null,aP=class extends Array{constructor(e){super(e),this.fill(0)}},Pmt=class a{heap;length;static#e=!1;static create(e){let r=a9r(e);if(!r)return[];a.#e=!0;let n=new a(e,r);return a.#e=!1,n}constructor(e,r){if(!a.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},jmt=class a{#e;#t;#r;#a;#i;#n;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#I;#d;#h;#l;#p;#b;#G;#m;#N;#y;#W;#F;#v;#g;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#W,sizes:e.#N,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#p},get tail(){return e.#b},free:e.#G,isBackgroundFetch:r=>e.#Z(r),backgroundFetch:(r,n,i,s)=>e.#C(r,n,i,s),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#E(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#c}get fetchMethod(){return this.#i}get memoMethod(){return this.#n}get dispose(){return this.#r}get disposeAfter(){return this.#a}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:t,updateAgeOnHas:o,allowStale:d,dispose:I,disposeAfter:u,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:Z=0,sizeCalculation:y,fetchMethod:N,memoMethod:g,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:p,ignoreFetchAbort:v}=e;if(r!==0&&!Q9(r))throw new TypeError("max option must be a nonnegative integer");let W=r?a9r(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=Z||this.#t,this.sizeCalculation=y,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#n=g,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=N,this.#v=!!N,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new W(r),this.#l=new W(r),this.#p=0,this.#b=0,this.#G=Pmt.create(r),this.#c=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof u=="function"?(this.#a=u,this.#m=[]):(this.#a=void 0,this.#m=void 0),this.#F=!!this.#r,this.#g=!!this.#a,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!p,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#t!==0&&!Q9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Q9(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!o,this.ttlResolution=Q9(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!Q9(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#w()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let R="LRU_CACHE_UNBOUNDED";o9n(R)&&(t9r.add(R),r9r("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",R,a))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#w(){let e=new aP(this.#e),r=new aP(this.#e);this.#W=e,this.#y=r,this.#H=(s,t,o=rP.now())=>{if(r[s]=t!==0?o:0,e[s]=t,t!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#E(s)&&this.#k(this.#I[s],"expire")},t+1);d.unref&&d.unref()}},this.#A=s=>{r[s]=e[s]!==0?rP.now():0},this.#u=(s,t)=>{if(e[t]){let o=e[t],d=r[t];if(!o||!d)return;s.ttl=o,s.start=d,s.now=n||i();let I=s.now-d;s.remainingTTL=o-I}};let n=0,i=()=>{let s=rP.now();if(this.ttlResolution>0){n=s;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return s};this.getRemainingTTL=s=>{let t=this.#s.get(s);if(t===void 0)return 0;let o=e[t],d=r[t];if(!o||!d)return 1/0;let I=(n||i())-d;return o-I},this.#E=s=>{let t=r[s],o=e[s];return!!o&&!!t&&(n||i())-t>o}}#A=()=>{};#u=()=>{};#H=()=>{};#E=()=>!1;#x(){let e=new aP(this.#e);this.#o=0,this.#N=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#R=(r,n,i,s)=>{if(this.#Z(n))return 0;if(!Q9(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!Q9(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#o>s;)this.#J(!0)}this.#o+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,n)=>{};#R=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#b;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#p));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let r=this.#p;!(!this.#X(r)||((e||!this.#E(r))&&(yield r),r===this.#b));)r=this.#h[r]}#X(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#Z(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*keys(){for(let e of this.#L()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#Z(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#Z(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#I[n],this))return this.get(this.#I[n],r)}}forEach(e,r=this){for(let n of this.#L()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}rforEach(e,r=this){for(let n of this.#V()){let i=this.#d[n],s=this.#Z(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#I[n],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#E(r)&&(this.#k(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#d[r],i=this.#Z(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#W&&this.#y){let t=this.#W[r],o=this.#y[r];if(t&&o){let d=t-(rP.now()-o);s.ttl=d,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let n=this.#I[r],i=this.#d[r],s=this.#Z(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let t={value:s};if(this.#W&&this.#y){t.ttl=this.#W[r];let o=rP.now()-this.#y[r];t.start=Math.floor(Date.now()-o)}this.#N&&(t.size=this.#N[r]),e.unshift([n,t])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=rP.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:d}=n,{noUpdateTTL:I=this.noUpdateTTL}=n,u=this.#R(e,r,n.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let h=this.#c===0?void 0:this.#s.get(e);if(h===void 0)h=this.#c===0?this.#b:this.#G.length!==0?this.#G.pop():this.#c===this.#e?this.#J(!1):this.#c,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#b]=h,this.#l[h]=this.#b,this.#b=h,this.#c++,this.#S(h,u,d),d&&(d.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#v&&this.#Z(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#F&&this.#r?.(m,e,"set"),this.#g&&this.#m?.push([m,e,"set"]))}else t||(this.#F&&this.#r?.(c,e,"set"),this.#g&&this.#m?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,u,d),this.#d[h]=r,d){d.set="replace";let m=c&&this.#Z(c)?c.__staleWhileFetching:c;m!==void 0&&(d.oldValue=m)}}else d&&(d.set="update")}if(i!==0&&!this.#W&&this.#w(),this.#W&&(I||this.#H(h,i,s),d&&this.#u(d,h)),!t&&this.#g&&this.#m){let c=this.#m,m;for(;m=c?.shift();)this.#a?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#p];if(this.#J(!0),this.#Z(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#g&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#a?.(...r)}}}#J(e){let r=this.#p,n=this.#I[r],i=this.#d[r];return this.#v&&this.#Z(i)?i.__abortController.abort(new Error("evicted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(i,n,"evict"),this.#g&&this.#m?.push([i,n,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#G.push(r)),this.#c===1?(this.#p=this.#b=0,this.#G.length=0):this.#p=this.#h[r],this.#s.delete(n),this.#c--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#s.get(e);if(s!==void 0){let t=this.#d[s];if(this.#Z(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#E(s))i&&(i.has="stale",this.#u(i,s));else return n&&this.#A(s),i&&(i.has="hit",this.#u(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!n&&this.#E(i))return;let s=this.#d[i];return this.#Z(s)?s.__staleWhileFetching:s}#C(e,r,n,i){let s=r===void 0?void 0:this.#d[r];if(this.#Z(s))return s;let t=new uAe,{signal:o}=n;o?.addEventListener("abort",()=>t.abort(o.reason),{signal:t.signal});let d={signal:t.signal,options:n,context:i},I=(y,N=!1)=>{let{aborted:g}=t.signal,E=n.ignoreFetchAbort&&y!==void 0;if(n.status&&(g&&!N?(n.status.fetchAborted=!0,n.status.fetchError=t.signal.reason,E&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),g&&!E&&!N)return h(t.signal.reason);let w=m;return this.#d[r]===m&&(y===void 0?w.__staleWhileFetching?this.#d[r]=w.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,y,d.options))),y},u=y=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=y),h(y)),h=y=>{let{aborted:N}=t.signal,g=N&&n.allowStaleOnFetchAbort,E=g||n.allowStaleOnFetchRejection,w=E||n.noDeleteOnFetchRejection,A=m;if(this.#d[r]===m&&(!w||A.__staleWhileFetching===void 0?this.#k(e,"fetch"):g||(this.#d[r]=A.__staleWhileFetching)),E)return n.status&&A.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),A.__staleWhileFetching;if(A.__returned===A)throw y},c=(y,N)=>{let g=this.#i?.(e,s,d);g&&g instanceof Promise&&g.then(E=>y(E===void 0?void 0:E),N),t.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(y(void 0),n.allowStaleOnFetchAbort&&(y=E=>I(E,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(c).then(I,u),Z=Object.assign(m,{__abortController:t,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,Z,{...d.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=Z,Z}#Z(e){if(!this.#v)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof uAe}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:d=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:y,forceRefresh:N=!1,status:g,signal:E}=r;if(!this.#v)return g&&(g.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:g});let w={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:t,noDisposeOnSet:o,size:d,sizeCalculation:I,noUpdateTTL:u,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:Z,ignoreFetchAbort:m,status:g,signal:E},A=this.#s.get(e);if(A===void 0){g&&(g.fetch="miss");let p=this.#C(e,A,w,y);return p.__returned=p}else{let p=this.#d[A];if(this.#Z(p)){let b=n&&p.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",b&&(g.returnedStale=!0)),b?p.__staleWhileFetching:p.__returned=p}let v=this.#E(A);if(!N&&!v)return g&&(g.fetch="hit"),this.#D(A),i&&this.#A(A),g&&this.#u(g,A),p;let W=this.#C(e,A,w,y),f=W.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=v?"stale":"refresh",f&&v&&(g.returnedStale=!0)),f?W.__staleWhileFetching:W.__returned=W}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#n;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...t}=r,o=this.get(e,t);if(!s&&o!==void 0)return o;let d=n(e,o,{options:t,context:i});return this.set(e,d,t),d}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:t}=r,o=this.#s.get(e);if(o!==void 0){let d=this.#d[o],I=this.#Z(d);return t&&this.#u(t,o),this.#E(o)?(t&&(t.get="stale"),I?(t&&n&&d.__staleWhileFetching!==void 0&&(t.returnedStale=!0),n?d.__staleWhileFetching:void 0):(s||this.#k(e,"expire"),t&&n&&(t.returnedStale=!0),n?d:void 0)):(t&&(t.get="hit"),I?d.__staleWhileFetching:(this.#D(o),i&&this.#A(o),d))}else t&&(t.get="miss")}#T(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#p?this.#p=this.#h[e]:this.#T(this.#l[e],this.#h[e]),this.#T(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let n=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(n=!0,this.#c===1)this.#f(r);else{this.#Y(i);let s=this.#d[i];if(this.#Z(s)?s.__abortController.abort(new Error("deleted")):(this.#F||this.#g)&&(this.#F&&this.#r?.(s,e,r),this.#g&&this.#m?.push([s,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#b)this.#b=this.#l[i];else if(i===this.#p)this.#p=this.#h[i];else{let t=this.#l[i];this.#h[t]=this.#h[i];let o=this.#h[i];this.#l[o]=this.#l[i]}this.#c--,this.#G.push(i)}}if(this.#g&&this.#m?.length){let i=this.#m,s;for(;s=i?.shift();)this.#a?.(...s)}return n}clear(){return this.#f("delete")}#f(e){for(let r of this.#V({allowStale:!0})){let n=this.#d[r];if(this.#Z(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#F&&this.#r?.(n,i,e),this.#g&&this.#m?.push([n,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#W&&this.#y&&(this.#W.fill(0),this.#y.fill(0)),this.#N&&this.#N.fill(0),this.#p=0,this.#b=0,this.#G.length=0,this.#o=0,this.#c=0,this.#g&&this.#m){let r=this.#m,n;for(;n=r?.shift();)this.#a?.(...n)}}};dAe.LRUCache=jmt});var o9r=He((Fbs,s9r)=>{"use strict";var Ql=(...a)=>a.every(e=>e)?a.join(""):"",zh=a=>a?encodeURIComponent(a):"",i9r=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),l9n={sshtemplate:({domain:a,user:e,project:r,committish:n})=>`git@${a}:${e}/${r}.git${Ql("#",n)}`,sshurltemplate:({domain:a,user:e,project:r,committish:n})=>`git+ssh://git@${a}/${e}/${r}.git${Ql("#",n)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i,path:s})=>`https://${a}/${e}/${r}${Ql("/",i,"/",zh(n||"HEAD"),"/",s)}`,browsetemplate:({domain:a,user:e,project:r,committish:n,treepath:i})=>`https://${a}/${e}/${r}${Ql("/",i,"/",zh(n))}`,browsetreetemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Ql("#",o(t||""))}`,browseblobtemplate:({domain:a,user:e,project:r,committish:n,blobpath:i,path:s,fragment:t,hashformat:o})=>`https://${a}/${e}/${r}/${i}/${zh(n||"HEAD")}/${s}${Ql("#",o(t||""))}`,docstemplate:({domain:a,user:e,project:r,treepath:n,committish:i})=>`https://${a}/${e}/${r}${Ql("/",n,"/",zh(i))}#readme`,httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ql(a,"@")}${e}/${r}/${n}.git${Ql("#",i)}`,filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/raw/${zh(n||"HEAD")}/${i}`,shortcuttemplate:({type:a,user:e,project:r,committish:n})=>`${a}:${e}/${r}${Ql("#",n)}`,pathtemplate:({user:a,project:e,committish:r})=>`${a}/${e}${Ql("#",r)}`,bugstemplate:({domain:a,user:e,project:r})=>`https://${a}/${e}/${r}/issues`,hashformat:i9r},H9={};H9.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:a,user:e,project:r,committish:n,path:i})=>`https://${Ql(a,"@")}raw.githubusercontent.com/${e}/${r}/${zh(n||"HEAD")}/${i}`,gittemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git://${Ql(a,"@")}${e}/${r}/${n}.git${Ql("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://codeload.${a}/${e}/${r}/tar.gz/${zh(n||"HEAD")}`,extract:a=>{let[,e,r,n,i]=a.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=a.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};H9.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:s,editpath:t})=>`https://${a}/${e}/${r}${Ql("/",i,"/",zh(n||"HEAD"),"/",s,t)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/get/${zh(n||"HEAD")}.tar.gz`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};H9.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ql(a,"@")}${e}/${r}/${n}.git${Ql("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/repository/archive.tar.gz?ref=${zh(n||"HEAD")}`,extract:a=>{let e=a.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:a.hash.slice(1)}}};H9.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:a,project:e,committish:r})=>`git@${a}:${e}.git${Ql("#",r)}`,sshurltemplate:({domain:a,project:e,committish:r})=>`git+ssh://git@${a}/${e}.git${Ql("#",r)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i})=>`https://${a}/${e}/${r}${Ql("/",zh(n))}/${i}`,browsetemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ql("/",zh(r))}`,browsetreetemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ql("/",zh(r))}${Ql("#",i(n))}`,browseblobtemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ql("/",zh(r))}${Ql("#",i(n))}`,docstemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ql("/",zh(r))}`,httpstemplate:({domain:a,project:e,committish:r})=>`git+https://${a}/${e}.git${Ql("#",r)}`,filetemplate:({user:a,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${a}/${e}/raw${Ql("/",zh(r))}/${n}`,shortcuttemplate:({type:a,project:e,committish:r})=>`${a}:${e}${Ql("#",r)}`,pathtemplate:({project:a,committish:e})=>`${a}${Ql("#",e)}`,bugstemplate:({domain:a,project:e})=>`https://${a}/${e}`,gittemplate:({domain:a,project:e,committish:r})=>`git://${a}/${e}.git${Ql("#",r)}`,tarballtemplate:({project:a,committish:e})=>`https://codeload.github.com/gist/${a}/tar.gz/${zh(e||"HEAD")}`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:a.hash.slice(1)}}},hashformat:function(a){return a&&"file-"+i9r(a)}};H9.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/blob/${zh(n)||"HEAD"}/${i}`,httpstemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}.git${Ql("#",n)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/archive/${zh(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};for(let[a,e]of Object.entries(H9))H9[a]=Object.assign({},l9n,e);s9r.exports=H9});var Kmt=He((wbs,c9r)=>{var c9n=Ct("url"),qmt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},l9r=a=>{try{return new c9n.URL(a)}catch{}},u9n=(a,e)=>{let r=a.indexOf(":"),n=a.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return a;let i=a.indexOf("@");return i>-1?i>r?`git+ssh://${a}`:a:a.indexOf("//")===r+1?a:`${a.slice(0,r+1)}//${a.slice(r+1)}`},d9n=a=>{let e=qmt(a,"@","#"),r=qmt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),qmt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};c9r.exports=(a,e)=>{let r=e?u9n(a,e):a;return l9r(r)||l9r(d9n(r))}});var d9r=He((Rbs,u9r)=>{"use strict";var I9n=Kmt(),h9n=a=>{let e=a.indexOf("#"),r=a.indexOf("/"),n=a.indexOf("/",r+1),i=a.indexOf(":"),s=/\s/.exec(a),t=a.indexOf("@"),o=!s||e>-1&&s.index>e,d=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,u=n===-1||e>-1&&n>e,h=r>0,c=e>-1?a[e-1]!=="/":!a.endsWith("/"),m=!a.startsWith(".");return o&&h&&c&&m&&d&&I&&u};u9r.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=h9n(a)?`github:${a}`:a,s=I9n(i,n);if(!s)return;let t=r.byShortcut[s.protocol],o=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],d=t||o;if(!d)return;let I=r[t||o],u=null;n[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let h=null,c=null,m=null,Z=null;try{if(t){let y=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,N=y.indexOf("@");N>-1&&(y=y.slice(N+1));let g=y.lastIndexOf("/");g>-1?(c=decodeURIComponent(y.slice(0,g)),c||(c=null),m=decodeURIComponent(y.slice(g+1))):m=decodeURIComponent(y),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(h=decodeURIComponent(s.hash.slice(1))),Z="shortcut"}else{if(!I.protocols.includes(s.protocol))return;let y=I.extract(s);if(!y)return;c=y.user&&decodeURIComponent(y.user),m=decodeURIComponent(y.project),h=decodeURIComponent(y.committish),Z=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(y){if(y instanceof URIError)return;throw y}return[d,c,u,m,h,Z,e]}});var h9r=He((Abs,I9r)=>{"use strict";var{LRUCache:m9n}=n9r(),p9n=o9r(),b9n=d9r(),f9n=Kmt(),$mt=new m9n({max:1e3}),IAe=class a{constructor(e,r,n,i,s,t,o={}){Object.assign(this,a.#e[e],{type:e,user:r,auth:n,project:i,committish:s,default:t,opts:o})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){a.#e[e]=r,a.#e.byDomain[r.domain]=e,a.#e.byShortcut[`${e}:`]=e,a.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!$mt.has(n)){let i=b9n(e,r,{gitHosts:a.#e,protocols:a.#t});$mt.set(n,i?new a(...i):void 0)}return $mt.get(n)}static parseUrl(e){return f9n(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let i=e(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[a,e]of Object.entries(p9n))IAe.addHost(a,e);I9r.exports=IAe});var p9r=He((Ebs,m9r)=>{m9r.exports=G9n;function G9n(a){if(!a||a==="ERROR: No README data found!")return;a=a.trim().split(`
|
|
5481
|
-
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var b9r=He((xbs,g9n)=>{g9n.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var v9r=He((Cbs,g9r)=>{var v9n=Tmt(),y9n=Dmt(),Z9n=$Vr(),hAe=h9r(),N9n=Ct("node:module"),W9n=["dependencies","devDependencies","optionalDependencies"],F9n=p9r(),ept=Ct("url"),X9=b9r(),f9r=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");g9r.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=hAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){V9n(a,this.warn),C9n(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=hAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!v9n(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=y9n(a.version,r),!0},fixPeople:function(a){G9r(a,E9n),G9r(a,x9n)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),A9n(a.name,r,e.allowLegacyCase),N9n.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=F9n(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=hAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")f9r(a.bugs)?a.bugs={email:a.bugs}:ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Q9n(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&f9r(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=hAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;ept.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Z9n(e).validForNewPackages)return this.warn("invalidLicense")}};function w9n(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function R9n(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function A9n(a,e,r){if(a.charAt(0)==="."||!(w9n(a)||R9n(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function G9r(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function E9n(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function x9n(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function C9n(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Y9n(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function V9n(a,e){W9n.forEach(function(r){a[r]&&(a[r]=Y9n(a[r],r,e))})}function Q9n(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var y9r=He((Ybs,H9n)=>{H9n.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var W9r=He((Vbs,N9r)=>{var Z9r=Ct("util"),tpt=y9r();N9r.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return X9n.apply(null,a);var r=tpt[e]?tpt[e]:e+": '%s'";return a.unshift(r),Z9r.format.apply(null,a)};function X9n(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Z9r.format(tpt.typo,a,e)}});var A9r=He((Qbs,R9r)=>{R9r.exports=F9r;var rpt=v9r();F9r.fixer=rpt;var k9n=W9r(),S9n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],L9n=["dependencies","people","typos"],apt=S9n.map(function(a){return w9r(a)+"Field"});apt=apt.concat(L9n);function F9r(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),rpt.warn=function(){e(k9n.apply(null,arguments))},apt.forEach(function(n){rpt["fix"+w9r(n)](a,r)}),a._id=a.name+"@"+a.version}function w9r(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var E9r=_e(()=>{});import{fileURLToPath as J9n}from"node:url";function x9r(a){return a instanceof URL?J9n(a):a}var C9r=_e(()=>{E9r()});import B9n from"node:fs/promises";import T9n from"node:path";async function V9r({cwd:a,normalize:e=!0}={}){let r=await B9n.readFile(D9n(a),"utf8");return O9n(r,e)}var Y9r,D9n,O9n,Q9r=_e(()=>{vVr();Y9r=Qt(A9r(),1);C9r();D9n=a=>T9n.resolve(x9r(a)??".","package.json"),O9n=(a,e)=>{let r=typeof a=="string"?Xmt(a):a;return e&&(0,Y9r.default)(r),r}});import M9n from"node:path";async function H9r(a){let e=await UYr("package.json",a);if(e)return{packageJson:await V9r({...a,cwd:M9n.dirname(e)}),path:e}}var X9r=_e(()=>{zYr();Q9r()});import{fileURLToPath as U9n}from"url";import z9n from"path";async function iP(){if(nP)return nP;let a=await H9r({cwd:P9n});if(!a){let e="hwjcode-cli",r="1.1.123";return e&&r?(nP={name:e,version:r},nP):void 0}return nP=a.packageJson,nP}var _9n,P9n,nP,mAe=_e(()=>{"use strict";X9r();_9n=U9n(import.meta.url),P9n=z9n.dirname(_9n)});var k9r={};Xs(k9r,{getCliVersion:()=>DW});async function DW(){let a=await iP();return"1.1.123"}var uL=_e(()=>{"use strict";mAe();});import dL from"node:process";var S9r,L9r=_e(()=>{"use strict";uL();Ei();Os();ma();S9r={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=dL.platform,r="no sandbox";dL.env.SANDBOX&&dL.env.SANDBOX!=="sandbox-exec"?r=dL.env.SANDBOX:dL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${dL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=dL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var J9r,B9r=_e(()=>{"use strict";Ei();ma();J9r={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var T9r,D9r=_e(()=>{"use strict";Ei();ma();T9r={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var O9r,M9r=_e(()=>{"use strict";Os();Ei();ma();O9r={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function j9n(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
|
|
5481
|
+
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var b9r=He((xbs,g9n)=>{g9n.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var v9r=He((Cbs,g9r)=>{var v9n=Tmt(),y9n=Dmt(),Z9n=$Vr(),hAe=h9r(),N9n=Ct("node:module"),W9n=["dependencies","devDependencies","optionalDependencies"],F9n=p9r(),ept=Ct("url"),X9=b9r(),f9r=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");g9r.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=hAe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(X9.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,X9.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):X9.script[e]&&!a.scripts[X9.script[e]]&&this.warn("typo",e,X9.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){V9n(a,this.warn),C9n(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=hAe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!v9n(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=y9n(a.version,r),!0},fixPeople:function(a){G9r(a,E9n),G9r(a,x9n)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),A9n(a.name,r,e.allowLegacyCase),N9n.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=F9n(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=hAe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")f9r(a.bugs)?a.bugs={email:a.bugs}:ept.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Q9n(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&ept.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&f9r(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=hAe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;ept.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Z9n(e).validForNewPackages)return this.warn("invalidLicense")}};function w9n(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function R9n(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function A9n(a,e,r){if(a.charAt(0)==="."||!(w9n(a)||R9n(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function G9r(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function E9n(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,s=i?" <"+i+">":"";return e+s+n}function x9n(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function C9n(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Y9n(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var s=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[s]=t}),n}function V9n(a,e){W9n.forEach(function(r){a[r]&&(a[r]=Y9n(a[r],r,e))})}function Q9n(a,e){a&&Object.keys(a).forEach(function(r){X9.bugs[r]&&(e("typo",r,X9.bugs[r],"bugs"),a[X9.bugs[r]]=a[r],delete a[r])})}});var y9r=He((Ybs,H9n)=>{H9n.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var W9r=He((Vbs,N9r)=>{var Z9r=Ct("util"),tpt=y9r();N9r.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return X9n.apply(null,a);var r=tpt[e]?tpt[e]:e+": '%s'";return a.unshift(r),Z9r.format.apply(null,a)};function X9n(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Z9r.format(tpt.typo,a,e)}});var A9r=He((Qbs,R9r)=>{R9r.exports=F9r;var rpt=v9r();F9r.fixer=rpt;var k9n=W9r(),S9n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],L9n=["dependencies","people","typos"],apt=S9n.map(function(a){return w9r(a)+"Field"});apt=apt.concat(L9n);function F9r(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),rpt.warn=function(){e(k9n.apply(null,arguments))},apt.forEach(function(n){rpt["fix"+w9r(n)](a,r)}),a._id=a.name+"@"+a.version}function w9r(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var E9r=_e(()=>{});import{fileURLToPath as J9n}from"node:url";function x9r(a){return a instanceof URL?J9n(a):a}var C9r=_e(()=>{E9r()});import B9n from"node:fs/promises";import T9n from"node:path";async function V9r({cwd:a,normalize:e=!0}={}){let r=await B9n.readFile(D9n(a),"utf8");return O9n(r,e)}var Y9r,D9n,O9n,Q9r=_e(()=>{vVr();Y9r=Qt(A9r(),1);C9r();D9n=a=>T9n.resolve(x9r(a)??".","package.json"),O9n=(a,e)=>{let r=typeof a=="string"?Xmt(a):a;return e&&(0,Y9r.default)(r),r}});import M9n from"node:path";async function H9r(a){let e=await UYr("package.json",a);if(e)return{packageJson:await V9r({...a,cwd:M9n.dirname(e)}),path:e}}var X9r=_e(()=>{zYr();Q9r()});import{fileURLToPath as U9n}from"url";import z9n from"path";async function iP(){if(nP)return nP;let a=await H9r({cwd:P9n});if(!a){let e="hwjcode-cli",r="1.1.124";return e&&r?(nP={name:e,version:r},nP):void 0}return nP=a.packageJson,nP}var _9n,P9n,nP,mAe=_e(()=>{"use strict";X9r();_9n=U9n(import.meta.url),P9n=z9n.dirname(_9n)});var k9r={};Xs(k9r,{getCliVersion:()=>DW});async function DW(){let a=await iP();return"1.1.124"}var uL=_e(()=>{"use strict";mAe();});import dL from"node:process";var S9r,L9r=_e(()=>{"use strict";uL();Ei();Os();ma();S9r={name:"about",description:we("command.about.description"),kind:"built-in",action:async a=>{let e=dL.platform,r="no sandbox";dL.env.SANDBOX&&dL.env.SANDBOX!=="sandbox-exec"?r=dL.env.SANDBOX:dL.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${dL.env.SEATBELT_PROFILE||"unknown"})`);let n=a.services.config?.getModel()||"Unknown",i=await DW(),s=a.services.settings.merged.selectedAuthType||"",t=dL.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:t};a.ui.addItem(o,Date.now())}}});var J9r,B9r=_e(()=>{"use strict";Ei();ma();J9r={name:"auth",description:we("command.auth.description"),kind:"built-in",action:(a,e)=>({type:"dialog",dialog:"auth"})}});var T9r,D9r=_e(()=>{"use strict";Ei();ma();T9r={name:"clear",description:we("command.clear.description"),kind:"built-in",action:async(a,e)=>{a.ui.setDebugMessage("Clearing terminal screen."),a.ui.clear()}}});var O9r,M9r=_e(()=>{"use strict";Os();Ei();ma();O9r={name:"compress",altNames:["summarize","compact"],description:we("command.compress.description"),kind:"built-in",action:async a=>{let{ui:e}=a,r=a.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(r?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:we("command.compress.starting")},Date.now());let n={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(n);let i=`compress-${Date.now()}`,s=await r?.tryCompressChat(i,new AbortController().signal,!0);s?e.addItem({type:"compression",compression:{isPending:!1,originalTokenCount:s.originalTokenCount,newTokenCount:s.newTokenCount}},Date.now()):e.addItem({type:"error",text:"Failed to compress chat history."},Date.now())}catch(i){e.addItem({type:"error",text:`Failed to compress chat history: ${i instanceof Error?i.message:String(i)}`},Date.now())}finally{e.setPendingItem(null)}}}});async function j9n(a){let{config:e,settings:r}=a.services;if(!e||!r)return{type:"message",messageType:"error",content:we("error.config.not.loaded")};let n=r.merged.vimMode||!1,i=e.getAgentStyle(),s=e.getApprovalMode(),t=e.getHealthyUseEnabled(),o=r.merged.preferredLanguage||we("config.value.default"),d=u=>{switch(u){case"codex":return"\u26A1";case"cursor":return"\u2197\uFE0F";case"augment":return"\u{1F680}";case"claude-code":return"\u2733\uFE0F";case"antigravity":return"\u{1F308}";case"windsurf":return"\u{1F30A}";default:return"\u{1D4E5}"}};return{type:"message",messageType:"info",content:`\u2699\uFE0F ${we("command.config.description")}
|
|
5482
5482
|
|
|
5483
5483
|
${we("command.config.available.options")}:
|
|
5484
5484
|
|
|
@@ -7601,12 +7601,6 @@ Press Enter to continue...`),await new Promise(X=>{process.stdin.once("data",()=
|
|
|
7601
7601
|
* skills`, SKILL.md frontmatter rules, hot-reload) is knowledge the model
|
|
7602
7602
|
* shouldn't have to guess. This tool owns the write AND teaches the format.
|
|
7603
7603
|
*/
|
|
7604
|
-
/**
|
|
7605
|
-
* @license
|
|
7606
|
-
* Copyright 2026 HwjCode team
|
|
7607
|
-
* https://github.com/OrionStarAI/EasyCode
|
|
7608
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
7609
|
-
*/
|
|
7610
7604
|
/**
|
|
7611
7605
|
* @license
|
|
7612
7606
|
* Copyright 2026 HwjCode team
|
package/bundle/package.json
CHANGED