easycode-ai 1.1.72 → 1.1.73
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/build-info.json +4 -4
- package/bundle/easycode-tui.js +49 -49
- package/bundle/easycode.js +4 -4
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -733,7 +733,7 @@ ${I}`)}return t}),lxe=SZa(Rfr);wxe=class extends Wxe{create(e,n){var a;let{api_v
|
|
|
733
733
|
`):[]}};Lq.NEWLINE_CHARS=new Set([`
|
|
734
734
|
`,"\r"]);Lq.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Exe={off:0,error:200,warn:300,info:400,debug:500},vfr=(r,e,n)=>{if(r){if(vZa(Exe,r))return r;bG(n).warn(`${e} was set to ${JSON.stringify(r)}, expected one of ${JSON.stringify(Object.keys(Exe))}`)}};BZa={error:zIe,warn:zIe,info:zIe,debug:zIe},yfr=new WeakMap;yB=r=>(r.options&&(r.options=Object.assign({},r.options),delete r.options.headers),r.headers&&(r.headers=Object.fromEntries((r.headers instanceof Headers?[...r.headers]:Object.entries(r.headers)).map(([e,n])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in r&&(r.retryOfRequestLogID&&(r.retryOf=r.retryOfRequestLogID),delete r.retryOfRequestLogID),r);kdt=class r{constructor(e,n,a){this.iterator=e,this.controller=n,this.client=a}static fromSSEResponse(e,n,a){let i=!1,s=a?bG(a):console;function t(){return Hq(this,arguments,function*(){var u,h,d,I;if(i)throw new fv("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,p=NB(OZa(e,n)),f;f=yield kd(p.next()),u=f.done,!u;m=!0){I=f.value,m=!1;let N=I;if(!c)if(N.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield kd(JSON.parse(N.data))}catch(v){throw s.error("Could not parse message into JSON:",N.data),s.error("From chunk:",N.raw),v}}}catch(N){h={error:N}}finally{try{!m&&!u&&(d=p.return)&&(yield kd(d.call(p)))}finally{if(h)throw h.error}}c=!0}catch(N){if(xdt(N))return yield kd(void 0);throw N}finally{c||n.abort()}})}return new r(t,n,a)}static fromReadableStream(e,n,a){let i=!1;function s(){return Hq(this,arguments,function*(){var u,h,d,I;let c=new Lq,m=wfr(e);try{for(var p=!0,f=NB(m),N;N=yield kd(f.next()),u=N.done,!u;p=!0){I=N.value,p=!1;let v=I;for(let R of c.decode(v))yield yield kd(R)}}catch(v){h={error:v}}finally{try{!p&&!u&&(d=f.return)&&(yield kd(d.call(f)))}finally{if(h)throw h.error}}for(let v of c.flush())yield yield kd(v)})}function t(){return Hq(this,arguments,function*(){var u,h,d,I;if(i)throw new fv("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,p=NB(s()),f;f=yield kd(p.next()),u=f.done,!u;m=!0){I=f.value,m=!1;let N=I;c||N&&(yield yield kd(JSON.parse(N)))}}catch(N){h={error:N}}finally{try{!m&&!u&&(d=p.return)&&(yield kd(d.call(p)))}finally{if(h)throw h.error}}c=!0}catch(N){if(xdt(N))return yield kd(void 0);throw N}finally{c||n.abort()}})}return new r(t,n,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],n=[],a=this.iterator(),i=s=>({next:()=>{if(s.length===0){let t=a.next();e.push(t),n.push(t)}return s.shift()}});return[new r(()=>i(e),this.controller,this.client),new r(()=>i(n),this.controller,this.client)]}toReadableStream(){let e=this,n;return Wfr({async start(){n=e[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:s}=await n.next();if(s)return a.close();let t=Sdt(JSON.stringify(i)+`
|
|
735
735
|
`);a.enqueue(t)}catch(i){a.error(i)}},async cancel(){var a;await((a=n.return)===null||a===void 0?void 0:a.call(n))}})}};Hdt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
|
|
736
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[n,a,i]=DZa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),n==="event"?this.event=i:n==="data"&&this.data.push(i),null}};Qdt=class r extends Promise{constructor(e,n,a=MZa){super(i=>{i(null)}),this.responsePromise=n,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new r(this.client,this.responsePromise,async(n,a)=>e(await this.parseResponse(n,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:n}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,n){return this.parse().then(e,n)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Afr=Symbol("brand.privateNullableHeaders");UIe=r=>{let e=new Headers,n=new Set;for(let a of r){let i=new Set;for(let[s,t]of UZa(a)){let o=s.toLowerCase();i.has(o)||(e.delete(s),i.add(o)),t===null?(e.delete(s),n.add(o)):(e.append(s,t),n.delete(o))}}return{[Afr]:!0,values:e,nulls:n}};Adt=r=>{var e,n,a,i,s,t;if(typeof globalThis.process<"u")return(a=(n=(e=globalThis.process.env)===null||e===void 0?void 0:e[r])===null||n===void 0?void 0:n.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,r))===null||t===void 0?void 0:t.trim()};Rxe=class r{constructor(e){var n,a,i,s,t,o,u,{baseURL:h=Adt("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(n=Adt("GEMINI_API_KEY"))!==null&&n!==void 0?n:null,apiVersion:I="v1beta"}=e,c=Ixe(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:I},c),{baseURL:h||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:r.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let p="warn";this.logLevel=p,this.logLevel=(t=(s=vfr(m.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:vfr(Adt("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:p,this.fetchOptions=m.fetchOptions,this.maxRetries=(o=m.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:RZa(),this.encoder=CZa,this._options=m,this.apiKey=d,this.apiVersion=I,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:n}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!n.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let n=UIe([e.headers]);if(!(n.values.has("authorization")||n.values.has("x-goog-api-key"))){if(this.apiKey)return UIe([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return UIe([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([n,a])=>typeof a<"u").map(([n,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(n)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(n)}=`;throw new fv(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${kq}`}defaultIdempotencyKey(){return`stainless-node-retry-${mZa()}`}makeStatusError(e,n,a,i){return bv.generate(e,n,a,i)}buildURL(e,n,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=fZa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return GZa(t)||(n=Object.assign(Object.assign({},t),n)),typeof n=="object"&&n&&!Array.isArray(n)&&(s.search=this.stringifyQuery(n)),s.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let n=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${n}`}}async prepareRequest(e,{url:n,options:a}){}get(e,n){return this.methodRequest("get",e,n)}post(e,n){return this.methodRequest("post",e,n)}patch(e,n){return this.methodRequest("patch",e,n)}put(e,n){return this.methodRequest("put",e,n)}delete(e,n){return this.methodRequest("delete",e,n)}methodRequest(e,n,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:n},i)))}request(e,n=null){return new Qdt(this,this.makeRequest(e,n,void 0))}async makeRequest(e,n,a){var i,s,t;let o=await e,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;n==null&&(n=u),await this.prepareOptions(o);let{req:h,url:d,timeout:I}=await this.buildRequest(o,{retryCount:u-n});await this.prepareRequest(h,{url:d,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,p=Date.now();if(bG(this).debug(`[${c}] sending request`,yB({retryOfRequestLogID:a,method:o.method,url:d,options:o,headers:h.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new PIe;let f=new AbortController,N=await this.fetchWithTimeout(d,h,I,f).catch(Cdt),v=Date.now();if(N instanceof globalThis.Error){let w=`retrying, ${n} attempts remaining`;if(!((t=o.signal)===null||t===void 0)&&t.aborted)throw new PIe;let E=xdt(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(n)return bG(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${w}`),bG(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${w})`,yB({retryOfRequestLogID:a,url:d,durationMs:v-p,message:N.message})),this.retryRequest(o,n,a??c);throw bG(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),bG(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,yB({retryOfRequestLogID:a,url:d,durationMs:v-p,message:N.message})),E?new pxe:new Sq({cause:N})}let R=`[${c}${m}] ${h.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${v-p}ms`;if(!N.ok){let w=await this.shouldRetry(N);if(n&&w){let g=`retrying, ${n} attempts remaining`;return await xZa(N.body),bG(this).info(`${R} - ${g}`),bG(this).debug(`[${c}] response error (${g})`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),this.retryRequest(o,n,a??c,N.headers)}let E=w?"error; no more retries left":"error; not retryable";bG(this).info(`${R} - ${E}`);let b=await N.text().catch(g=>Cdt(g).message),Z=NZa(b),W=Z?void 0:b;throw bG(this).debug(`[${c}] response error (${E})`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,message:W,durationMs:Date.now()-p})),this.makeStatusError(N.status,Z,W,N.headers)}return bG(this).info(R),bG(this).debug(`[${c}] response start`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),{response:N,options:o,controller:f,requestLogID:c,retryOfRequestLogID:a,startTime:p}}async fetchWithTimeout(e,n,a,i){let s=n||{},{signal:t,method:o}=s,u=Ixe(s,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let h=setTimeout(()=>i.abort(),a),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,I=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);o&&(I.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,I)}finally{clearTimeout(h)}}async shouldRetry(e){let n=e.headers.get("x-should-retry");return n==="true"?!0:n==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,n,a,i){var s;let t,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);Number.isNaN(h)||(t=h)}let u=i?.get("retry-after");if(u&&!t){let h=parseFloat(u);Number.isNaN(h)?t=Date.parse(u)-Date.now():t=h*1e3}if(!(t&&0<=t&&t<60*1e3)){let h=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(n,h)}return await ZZa(t),this.makeRequest(e,n-1,a)}calculateDefaultRetryTimeoutMillis(e,n){let s=n-e,t=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return t*o*1e3}async buildRequest(e,{retryCount:n=0}={}){var a,i,s;let t=Object.assign({},e),{method:o,path:u,query:h,defaultBaseURL:d}=t,I=this.buildURL(u,h,d);"timeout"in t&&yZa("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),p=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:n});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:p},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=t.fetchOptions)!==null&&s!==void 0?s:{}),url:I,timeout:t.timeout}}async buildHeaders({options:e,method:n,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),o=UIe([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),EZa()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:n}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=UIe([n]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:AZa(e)}:this.encoder({body:e,headers:a})}};Rxe.DEFAULT_TIMEOUT=6e4;Jp=class extends Rxe{constructor(){super(...arguments),this.interactions=new Fxe(this)}};xfr=Jp;Jp.GeminiNextGenAPIClient=xfr;Jp.GeminiNextGenAPIClientError=fv;Jp.APIError=bv;Jp.APIConnectionError=Sq;Jp.APIConnectionTimeoutError=pxe;Jp.APIUserAbortError=PIe;Jp.NotFoundError=Gxe;Jp.ConflictError=vxe;Jp.RateLimitError=Nxe;Jp.BadRequestError=fxe;Jp.AuthenticationError=bxe;Jp.InternalServerError=Zxe;Jp.PermissionDeniedError=gxe;Jp.UnprocessableEntityError=yxe;Jp.toFile=QZa;Jp.Interactions=Fxe;wdo=1024*1024*8;});function zZa(r,e){return{...r,...e}}function Cfr(r){let{prompt_id:e,...n}=r;return n}function RX(r){return Array.isArray(r)?r.map(e=>Cfr(e)):r}var Axe=Xe(()=>{"use strict";Pn();});var Yfr={};xs(Yfr,{DEFAULT_PROXY_CONFIG:()=>qZa,getActiveProxyServerUrl:()=>Rx,getAvailableProxyServers:()=>PZa,getProxyServerInfo:()=>jZa,getProxyServers:()=>jIe,hasAvailableProxyServer:()=>Ldt});function jIe(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function Rx(){let e=jIe().find(n=>n.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function PZa(){return jIe().filter(e=>e.status==="active")}function Ldt(){return jIe().some(e=>e.status==="active")}function jZa(r){return jIe().find(n=>n.url===r)}var qZa,Tq=Xe(()=>{"use strict";qZa={serverUrl:Rx(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as KZa}from"crypto";function YN(){return qIe||(qIe=KZa()),qIe}function Vfr(r){qIe=r}function kfr(){qIe=void 0}var qIe,Hfr,xxe=Xe(()=>{"use strict";Hfr=YN()});function gh(r){let e=r??"1.1.72"??"unknown",n=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${Cxe}/VSCode/${i} (${n}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${Cxe}/Desktop/${i} (${n}; ${a})`}return`${Cxe}/CLI/${e} (${n}; ${a})`}var Cxe,AX=Xe(()=>{"use strict";Cxe="EasyCode"});import*as fu from"fs";import*as LE from"path";import*as ZB from"os";function $Za(r){ko.configure(r)}function e3a(r){ko.setUserInfo(r)}function t3a(r){ko.setCliVersion(r)}async function r3a(){return await ko.getUserHeaders()}function n3a(){return ko.getStatus()}var Yxe,Is,ko,TE=Xe(()=>{"use strict";Tq();xxe();AX();Yxe=259200,Is=class r{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 gh(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let n=Math.floor(e/1e3),a=Math.floor(n/(24*3600)),i=Math.floor(n%(24*3600)/3600),s=Math.floor(n%3600/60),t=n%60;return a>0?`${a}\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=LE.join(ZB.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LE.join(ZB.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LE.join(ZB.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LE.join(ZB.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LE.join(ZB.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LE.join(ZB.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.72",this.config={proxyServerUrl:Rx()},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(n){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",n instanceof Error?n.message:String(n));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 n=Date.now(),a=this.jwtTokenData.expiresAt-n,i=this.formatTimeRemaining(a),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Yxe*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return r.instance||(r.instance=new r),r.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{fu.chmodSync(e,384)}catch(n){console.warn("[Login Check] Failed to chmod credential file:",n)}}loadUserInfo(){try{if(fu.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=fu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e)}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=LE.dirname(this.userInfoFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(fu.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=fu.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=LE.dirname(this.jwtTokenFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(fu.existsSync(this.usageStatsFilePath)){let e=fu.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=LE.dirname(this.usageStatsFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(n){console.error("[ProxyAuthManager] Error in login success callback:",n)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let n=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:n+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Yxe*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${u}`)}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(),n=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(n);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(i){return console.error("[Login Check] Credential renewal failed:",i),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Yxe){if(!this.jwtTokenData)return!0;let n=this.jwtTokenData.expiresAt-Date.now(),a=n<=e*1e3;if(a){let i=this.formatTimeRemaining(n);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}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 u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let n=await e.json();if(!n.success||!n.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!n.data.refreshToken;this.jwtTokenData={accessToken:n.data.accessToken,refreshToken:n.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:n.data.expiresIn||900,expiresAt:a+(n.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((n.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Yxe*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{fu.existsSync(this.jwtTokenFilePath)&&fu.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 n=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),s={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":YN()};return n&&(s.Authorization=`Bearer ${n}`),e&&(s["X-DVCode-Scene"]=e),s}getUserHeadersSync(){let e=this.getCliVersion(),n=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":n,"X-Session-ID":YN()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}getCachedJwtTokenData(){return this.jwtTokenData}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}stopPeriodicStatusCheck(){this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null)}clear(){this.userInfo=null,this.jwtTokenData=null,this.stopPeriodicStatusCheck();try{fu.existsSync(this.userInfoFilePath)&&fu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{fu.existsSync(this.jwtTokenFilePath)&&fu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},ko=Is.getInstance()});import{promises as WB}from"node:fs";import KIe from"node:path";import a3a from"os";var VN,Vxe,Kr,gv=Xe(()=>{"use strict";(function(r){r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.WARN=2]="WARN",r[r.ERROR=3]="ERROR"})(VN||(VN={}));Vxe=class{config;logBuffer=[];constructor(e={}){if(this.config={level:VN.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let n=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=KIe.join(a3a.homedir(),".easycode-user","logs",`deepv-${n}.log`)}}formatMessage(e,n,...a){let i=new Date().toISOString(),s=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${n} ${s}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await WB.mkdir(KIe.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await WB.appendFile(this.config.filePath,e+`
|
|
736
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[n,a,i]=DZa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),n==="event"?this.event=i:n==="data"&&this.data.push(i),null}};Qdt=class r extends Promise{constructor(e,n,a=MZa){super(i=>{i(null)}),this.responsePromise=n,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new r(this.client,this.responsePromise,async(n,a)=>e(await this.parseResponse(n,a),a))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:n}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,n){return this.parse().then(e,n)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Afr=Symbol("brand.privateNullableHeaders");UIe=r=>{let e=new Headers,n=new Set;for(let a of r){let i=new Set;for(let[s,t]of UZa(a)){let o=s.toLowerCase();i.has(o)||(e.delete(s),i.add(o)),t===null?(e.delete(s),n.add(o)):(e.append(s,t),n.delete(o))}}return{[Afr]:!0,values:e,nulls:n}};Adt=r=>{var e,n,a,i,s,t;if(typeof globalThis.process<"u")return(a=(n=(e=globalThis.process.env)===null||e===void 0?void 0:e[r])===null||n===void 0?void 0:n.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(t=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,r))===null||t===void 0?void 0:t.trim()};Rxe=class r{constructor(e){var n,a,i,s,t,o,u,{baseURL:h=Adt("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(n=Adt("GEMINI_API_KEY"))!==null&&n!==void 0?n:null,apiVersion:I="v1beta"}=e,c=Ixe(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:I},c),{baseURL:h||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(a=m.timeout)!==null&&a!==void 0?a:r.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let p="warn";this.logLevel=p,this.logLevel=(t=(s=vfr(m.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:vfr(Adt("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:p,this.fetchOptions=m.fetchOptions,this.maxRetries=(o=m.maxRetries)!==null&&o!==void 0?o:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:RZa(),this.encoder=CZa,this._options=m,this.apiKey=d,this.apiVersion=I,this.clientAdapter=m.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:n}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!n.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){let n=UIe([e.headers]);if(!(n.values.has("authorization")||n.values.has("x-goog-api-key"))){if(this.apiKey)return UIe([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return UIe([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([n,a])=>typeof a<"u").map(([n,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(n)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(n)}=`;throw new fv(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${kq}`}defaultIdempotencyKey(){return`stainless-node-retry-${mZa()}`}makeStatusError(e,n,a,i){return bv.generate(e,n,a,i)}buildURL(e,n,a){let i=!this.baseURLOverridden()&&a||this.baseURL,s=fZa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return GZa(t)||(n=Object.assign(Object.assign({},t),n)),typeof n=="object"&&n&&!Array.isArray(n)&&(s.search=this.stringifyQuery(n)),s.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let n=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${n}`}}async prepareRequest(e,{url:n,options:a}){}get(e,n){return this.methodRequest("get",e,n)}post(e,n){return this.methodRequest("post",e,n)}patch(e,n){return this.methodRequest("patch",e,n)}put(e,n){return this.methodRequest("put",e,n)}delete(e,n){return this.methodRequest("delete",e,n)}methodRequest(e,n,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:n},i)))}request(e,n=null){return new Qdt(this,this.makeRequest(e,n,void 0))}async makeRequest(e,n,a){var i,s,t;let o=await e,u=(i=o.maxRetries)!==null&&i!==void 0?i:this.maxRetries;n==null&&(n=u),await this.prepareOptions(o);let{req:h,url:d,timeout:I}=await this.buildRequest(o,{retryCount:u-n});await this.prepareRequest(h,{url:d,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=a===void 0?"":`, retryOf: ${a}`,p=Date.now();if(bG(this).debug(`[${c}] sending request`,yB({retryOfRequestLogID:a,method:o.method,url:d,options:o,headers:h.headers})),!((s=o.signal)===null||s===void 0)&&s.aborted)throw new PIe;let f=new AbortController,N=await this.fetchWithTimeout(d,h,I,f).catch(Cdt),v=Date.now();if(N instanceof globalThis.Error){let w=`retrying, ${n} attempts remaining`;if(!((t=o.signal)===null||t===void 0)&&t.aborted)throw new PIe;let E=xdt(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(n)return bG(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${w}`),bG(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${w})`,yB({retryOfRequestLogID:a,url:d,durationMs:v-p,message:N.message})),this.retryRequest(o,n,a??c);throw bG(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),bG(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,yB({retryOfRequestLogID:a,url:d,durationMs:v-p,message:N.message})),E?new pxe:new Sq({cause:N})}let R=`[${c}${m}] ${h.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${v-p}ms`;if(!N.ok){let w=await this.shouldRetry(N);if(n&&w){let g=`retrying, ${n} attempts remaining`;return await xZa(N.body),bG(this).info(`${R} - ${g}`),bG(this).debug(`[${c}] response error (${g})`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),this.retryRequest(o,n,a??c,N.headers)}let E=w?"error; no more retries left":"error; not retryable";bG(this).info(`${R} - ${E}`);let b=await N.text().catch(g=>Cdt(g).message),Z=NZa(b),W=Z?void 0:b;throw bG(this).debug(`[${c}] response error (${E})`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,message:W,durationMs:Date.now()-p})),this.makeStatusError(N.status,Z,W,N.headers)}return bG(this).info(R),bG(this).debug(`[${c}] response start`,yB({retryOfRequestLogID:a,url:N.url,status:N.status,headers:N.headers,durationMs:v-p})),{response:N,options:o,controller:f,requestLogID:c,retryOfRequestLogID:a,startTime:p}}async fetchWithTimeout(e,n,a,i){let s=n||{},{signal:t,method:o}=s,u=Ixe(s,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let h=setTimeout(()=>i.abort(),a),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,I=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);o&&(I.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,I)}finally{clearTimeout(h)}}async shouldRetry(e){let n=e.headers.get("x-should-retry");return n==="true"?!0:n==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,n,a,i){var s;let t,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);Number.isNaN(h)||(t=h)}let u=i?.get("retry-after");if(u&&!t){let h=parseFloat(u);Number.isNaN(h)?t=Date.parse(u)-Date.now():t=h*1e3}if(!(t&&0<=t&&t<60*1e3)){let h=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(n,h)}return await ZZa(t),this.makeRequest(e,n-1,a)}calculateDefaultRetryTimeoutMillis(e,n){let s=n-e,t=Math.min(.5*Math.pow(2,s),8),o=1-Math.random()*.25;return t*o*1e3}async buildRequest(e,{retryCount:n=0}={}){var a,i,s;let t=Object.assign({},e),{method:o,path:u,query:h,defaultBaseURL:d}=t,I=this.buildURL(u,h,d);"timeout"in t&&yZa("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),p=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:n});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:o,headers:p},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=t.fetchOptions)!==null&&s!==void 0?s:{}),url:I,timeout:t.timeout}}async buildHeaders({options:e,method:n,bodyHeaders:a,retryCount:i}){let s={};this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),o=UIe([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),EZa()),this._options.defaultHeaders,a,e.headers,t]);return this.validateHeaders(o),o.values}buildBody({options:{body:e,headers:n}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=UIe([n]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:AZa(e)}:this.encoder({body:e,headers:a})}};Rxe.DEFAULT_TIMEOUT=6e4;Jp=class extends Rxe{constructor(){super(...arguments),this.interactions=new Fxe(this)}};xfr=Jp;Jp.GeminiNextGenAPIClient=xfr;Jp.GeminiNextGenAPIClientError=fv;Jp.APIError=bv;Jp.APIConnectionError=Sq;Jp.APIConnectionTimeoutError=pxe;Jp.APIUserAbortError=PIe;Jp.NotFoundError=Gxe;Jp.ConflictError=vxe;Jp.RateLimitError=Nxe;Jp.BadRequestError=fxe;Jp.AuthenticationError=bxe;Jp.InternalServerError=Zxe;Jp.PermissionDeniedError=gxe;Jp.UnprocessableEntityError=yxe;Jp.toFile=QZa;Jp.Interactions=Fxe;wdo=1024*1024*8;});function zZa(r,e){return{...r,...e}}function Cfr(r){let{prompt_id:e,...n}=r;return n}function RX(r){return Array.isArray(r)?r.map(e=>Cfr(e)):r}var Axe=Xe(()=>{"use strict";Pn();});var Yfr={};xs(Yfr,{DEFAULT_PROXY_CONFIG:()=>qZa,getActiveProxyServerUrl:()=>Rx,getAvailableProxyServers:()=>PZa,getProxyServerInfo:()=>jZa,getProxyServers:()=>jIe,hasAvailableProxyServer:()=>Ldt});function jIe(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function Rx(){let e=jIe().find(n=>n.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function PZa(){return jIe().filter(e=>e.status==="active")}function Ldt(){return jIe().some(e=>e.status==="active")}function jZa(r){return jIe().find(n=>n.url===r)}var qZa,Tq=Xe(()=>{"use strict";qZa={serverUrl:Rx(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as KZa}from"crypto";function YN(){return qIe||(qIe=KZa()),qIe}function Vfr(r){qIe=r}function kfr(){qIe=void 0}var qIe,Hfr,xxe=Xe(()=>{"use strict";Hfr=YN()});function gh(r){let e=r??"1.1.73"??"unknown",n=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${Cxe}/VSCode/${i} (${n}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${Cxe}/Desktop/${i} (${n}; ${a})`}return`${Cxe}/CLI/${e} (${n}; ${a})`}var Cxe,AX=Xe(()=>{"use strict";Cxe="EasyCode"});import*as fu from"fs";import*as LE from"path";import*as ZB from"os";function $Za(r){ko.configure(r)}function e3a(r){ko.setUserInfo(r)}function t3a(r){ko.setCliVersion(r)}async function r3a(){return await ko.getUserHeaders()}function n3a(){return ko.getStatus()}var Yxe,Is,ko,TE=Xe(()=>{"use strict";Tq();xxe();AX();Yxe=259200,Is=class r{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 gh(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let n=Math.floor(e/1e3),a=Math.floor(n/(24*3600)),i=Math.floor(n%(24*3600)/3600),s=Math.floor(n%3600/60),t=n%60;return a>0?`${a}\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=LE.join(ZB.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LE.join(ZB.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LE.join(ZB.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LE.join(ZB.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LE.join(ZB.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LE.join(ZB.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.73",this.config={proxyServerUrl:Rx()},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(n){if(this.jwtTokenData?.refreshToken){console.warn("[Login Check] \u26A0\uFE0F Periodic status check - credential refresh failed transiently, keeping session and retrying next cycle:",n instanceof Error?n.message:String(n));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 n=Date.now(),a=this.jwtTokenData.expiresAt-n,i=this.formatTimeRemaining(a),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Yxe*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${i} (until ${s}), next renewal: ${t}`)}}static getInstance(){return r.instance||(r.instance=new r),r.instance}chmodOwnerOnly(e){if(process.platform!=="win32")try{fu.chmodSync(e,384)}catch(n){console.warn("[Login Check] Failed to chmod credential file:",n)}}loadUserInfo(){try{if(fu.existsSync(this.userInfoFilePath)){this.chmodOwnerOnly(this.userInfoFilePath);let e=fu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e)}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=LE.dirname(this.userInfoFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(fu.existsSync(this.jwtTokenFilePath)){this.chmodOwnerOnly(this.jwtTokenFilePath);let e=fu.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=LE.dirname(this.jwtTokenFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(fu.existsSync(this.usageStatsFilePath)){let e=fu.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=LE.dirname(this.usageStatsFilePath);fu.existsSync(e)||fu.mkdirSync(e,{recursive:!0,mode:448}),fu.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(n){console.error("[ProxyAuthManager] Error in login success callback:",n)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let n=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:n+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),s=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-Yxe*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${s}), next renewal: ${t}${u}`)}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(),n=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(n);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(i){return console.error("[Login Check] Credential renewal failed:",i),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Yxe){if(!this.jwtTokenData)return!0;let n=this.jwtTokenData.expiresAt-Date.now(),a=n<=e*1e3;if(a){let i=this.formatTimeRemaining(n);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}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 u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let n=await e.json();if(!n.success||!n.data?.accessToken)throw new Error("Invalid refresh response from server");let a=Date.now(),i=!!n.data.refreshToken;this.jwtTokenData={accessToken:n.data.accessToken,refreshToken:n.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:n.data.expiresIn||900,expiresAt:a+(n.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let s=this.formatTimeRemaining((n.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Yxe*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{fu.existsSync(this.jwtTokenFilePath)&&fu.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 n=await this.getAccessToken(),a=this.getCliVersion(),i=this.getUserAgent(),s={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":YN()};return n&&(s.Authorization=`Bearer ${n}`),e&&(s["X-DVCode-Scene"]=e),s}getUserHeadersSync(){let e=this.getCliVersion(),n=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":n,"X-Session-ID":YN()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}getUserInfo(){return this.userInfo}getCachedJwtTokenData(){return this.jwtTokenData}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}stopPeriodicStatusCheck(){this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null)}clear(){this.userInfo=null,this.jwtTokenData=null,this.stopPeriodicStatusCheck();try{fu.existsSync(this.userInfoFilePath)&&fu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{fu.existsSync(this.jwtTokenFilePath)&&fu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},ko=Is.getInstance()});import{promises as WB}from"node:fs";import KIe from"node:path";import a3a from"os";var VN,Vxe,Kr,gv=Xe(()=>{"use strict";(function(r){r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.WARN=2]="WARN",r[r.ERROR=3]="ERROR"})(VN||(VN={}));Vxe=class{config;logBuffer=[];constructor(e={}){if(this.config={level:VN.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let n=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=KIe.join(a3a.homedir(),".easycode-user","logs",`deepv-${n}.log`)}}formatMessage(e,n,...a){let i=new Date().toISOString(),s=a.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${n} ${s}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await WB.mkdir(KIe.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await WB.appendFile(this.config.filePath,e+`
|
|
737
737
|
`,"utf-8")}catch(n){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",n)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await WB.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await WB.rename(this.config.filePath,i),await this.cleanOldLogs()}}catch(e){e.code!=="ENOENT"&&console.error("\u65E5\u5FD7\u8F6E\u8F6C\u5931\u8D25:",e)}}async cleanOldLogs(){if(this.config.filePath)try{let e=KIe.dirname(this.config.filePath),a=(await WB.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:KIe.join(e,t),time:WB.stat(KIe.join(e,t)).then(o=>o.mtime)})),i=await Promise.all(a.map(async t=>({...t,time:await t.time})));i.sort((t,o)=>o.time.getTime()-t.time.getTime());let s=i.slice(this.config.maxFiles||5);for(let t of s)await WB.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,n,a,...i){if(e<this.config.level)return;let s=this.formatMessage(n,a,...i);this.config.enableConsole&&(e>=VN.ERROR?console.error:e>=VN.WARN?console.warn:e>=VN.INFO?console.log:console.debug)(s),this.config.enableFile&&this.writeToFile(s)}debug(e,...n){this.log(VN.DEBUG,"DEBUG",e,...n)}info(e,...n){this.log(VN.INFO,"INFO",e,...n)}warn(e,...n){this.log(VN.WARN,"WARN",e,...n)}error(e,...n){this.log(VN.ERROR,"ERROR",e,...n)}logApiRequest(e,n){this.debug("API\u8BF7\u6C42",{endpoint:e,timestamp:new Date().toISOString(),requestSize:JSON.stringify(n).length,...process.env.FILE_DEBUG==="1"?{requestData:n}:{}})}logApiResponse(e,n){this.debug("API\u54CD\u5E94",{endpoint:e,timestamp:new Date().toISOString(),responseSize:JSON.stringify(n).length,...process.env.FILE_DEBUG==="1"?{responseData:n}:{}})}},Kr=new Vxe({level:process.env.FILE_DEBUG==="1"?VN.DEBUG:VN.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Pc(r){return r instanceof Error&&"code"in r}function Qr(r){if(r instanceof Error)return r.message;try{return String(r)}catch{return"Failed to get error details"}}function Tdt(r){if(r&&typeof r=="object"&&"response"in r){let n=i3a(r);if(n.error&&n.error.message&&n.error.code)switch(n.error.code){case 400:return new Hxe(n.error.message);case 401:return new Gh(n.error.message);case 403:return new kxe(n.error.message);default:}}return r}function i3a(r){return typeof r.response?.data=="string"?JSON.parse(r.response?.data):r.response?.data}function wB(r){if(!r)return!1;try{let e=JSON.parse(r);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var kxe,Gh,Hxe,fc=Xe(()=>{"use strict";kxe=class extends Error{},Gh=class extends Error{},Hxe=class extends Error{}});var pW,Jm,Jq,Bg,xX=Xe(()=>{"use strict";pW="auto",Jm="auto",Jq="auto",Bg="deepseek-flash"});var la,Qfr,Sh,Gv=Xe(()=>{"use strict";xX();(function(r){r.CHAT_CONVERSATION="chat_conversation",r.WEB_FETCH="web_fetch",r.WEB_SEARCH="web_search",r.CONTENT_SUMMARY="content_summary",r.JSON_GENERATION="json_generation",r.COMPRESSION="compression",r.SUB_AGENT="sub_agent",r.CODE_ASSIST="code_assist",r.EDIT_CORRECTION="edit_correction",r.IMAGE_READER="image_reader",r.GOAL_EVALUATION="goal_evaluation"})(la||(la={}));Qfr={[la.CHAT_CONVERSATION]:"auto",[la.WEB_FETCH]:"gemini-2.5-flash",[la.WEB_SEARCH]:"gemini-2.5-flash",[la.CODE_ASSIST]:"auto",[la.CONTENT_SUMMARY]:Bg,[la.EDIT_CORRECTION]:Bg,[la.JSON_GENERATION]:"gemini-2.5-flash",[la.COMPRESSION]:Bg,[la.SUB_AGENT]:"auto",[la.IMAGE_READER]:"gemini-2.5-flash",[la.GOAL_EVALUATION]:Bg},Sh=class{static getModelForScene(e){if(e)return Qfr[e]}static isClaudeModel(e){return e.includes("claude")||e.includes("anthropic")}static isGeminiModel(e){return e.includes("gemini")&&!this.isClaudeModel(e)}static getSceneDisplayName(e){return{[la.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[la.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[la.WEB_SEARCH]:"Web\u641C\u7D22",[la.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[la.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[la.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[la.JSON_GENERATION]:"JSON\u751F\u6210",[la.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[la.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[la.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[la.GOAL_EVALUATION]:"\u76EE\u6807\u8FBE\u6210\u8BC4\u4F30"}[e]||e}}});function vv(r){return typeof r=="object"&&r!==null&&"error"in r&&typeof r.error=="object"&&"message"in r.error}function D0(r){return typeof r=="object"&&r!==null&&"message"in r&&typeof r.message=="string"}function JE(r){let e=n=>n.includes("Quota exceeded for quota metric 'Gemini")&&n.includes("Pro Requests'");if(typeof r=="string")return e(r);if(D0(r))return e(r.message);if(vv(r))return e(r.error.message);if(r&&typeof r=="object"&&"response"in r){let n=r;if(n.response&&n.response.data){if(typeof n.response.data=="string")return e(n.response.data);if(typeof n.response.data=="object"&&n.response.data!==null&&"error"in n.response.data){let a=n.response.data;return e(a.error?.message||"")}}}return!1}function BE(r){return typeof r=="string"?r.includes("Quota exceeded for quota metric"):D0(r)?r.message.includes("Quota exceeded for quota metric"):vv(r)?r.error.message.includes("Quota exceeded for quota metric"):!1}function $Ie(r){let e=(i,s)=>{if(!i||typeof i!="object")return null;let t=i.error;if(!t||typeof t!="object")return null;let o=t,u=typeof o.code=="string"&&o.code.includes("quota_limit_exceeded"),h=o.type==="rate_limit_error"&&s===400;return(u||h)&&typeof o.message=="string"&&o.message.trim()?o.message:null};if(r&&typeof r=="object"&&"response"in r){let i=r.response;if(i){let s=e(i.data,i.status);if(s)return s}}let n=r instanceof Error||r&&typeof r=="object"&&typeof r.message=="string"?r.message:typeof r=="string"?r:"",a=n.match(/\((\d{3})\):/);if(a&&(n.includes("rate_limit_error")||n.includes("quota_limit_exceeded"))){let i=n.match(/\{[\s\S]*\}$/);if(i)try{let s=e(JSON.parse(i[0]),Number(a[1]));if(s)return s}catch{}}return e(r)}function gG(r){if($Ie(r))return!0;if(r&&typeof r=="object"&&"response"in r){let e=r;if(e.response?.status===402&&e.response.data){let n=e.response.data;if(n&&typeof n.error=="string"&&(n.error==="Quota limit exceeded"||n.error==="No quota configuration")&&typeof n.message=="string")return!0}if(e.response?.status===500&&e.response.data){let n=e.response.data;if(n&&typeof n.message=="string"&&n.message.includes("quota exceeded"))return!0}}if(r instanceof Error&&r.message&&(r.message.includes("API request failed (402):")&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"'))||r.message.includes("API request failed (500):")&&r.message.includes("quota exceeded")||r.message.includes("Stream API error (500):")&&r.message.includes("quota exceeded")))return!0;if(typeof r=="object"&&r!==null){let e=r;if(e.message&&typeof e.message=="string"&&(e.message.includes("API request failed (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||e.message.includes("API error (402):")&&(e.message.includes('"error":"Quota limit exceeded"')||e.message.includes('"error":"No quota configuration"'))||(e.message.includes("API request failed (500):")||e.message.includes("Stream API error (500):"))&&e.message.includes("quota exceeded"))||(e.error==="Quota limit exceeded"||e.error==="No quota configuration")&&typeof e.message=="string"||e.status===500&&typeof e.message=="string"&&e.message.includes("quota exceeded"))return!0}return typeof r=="string"?r.includes("Quota limit exceeded")||r.includes("No quota configuration")||r.includes("Daily token limit would be exceeded")||r.includes("Daily request limit exceeded")||r.includes("Daily cost limit would be exceeded")||r.includes("500")&&r.includes("quota exceeded"):!1}function eme(r){let e=$Ie(r);if(e)return e;let n=null;if(r&&typeof r=="object"&&"response"in r){let a=r;if(a.response?.status===402&&a.response.data)n=a.response.data;else if(a.response?.status===500&&a.response.data){let i=a.response.data;i&&typeof i.message=="string"&&i.message.includes("quota exceeded")&&(n=i)}}else if(typeof r=="object"&&r!==null){let a=r;if(a.message&&typeof a.message=="string"&&(a.message.includes("API request failed (402):")||a.message.includes("API request failed (500):")||a.message.includes("Stream API error (500):"))&&(a.message.includes('"error":"Quota limit exceeded"')||a.message.includes('"error":"No quota configuration"')||a.message.includes("quota exceeded")))try{let i=a.message.match(/\{.*\}$/);i&&(n=JSON.parse(i[0]))}catch{}n||(n=r)}if(!n&&r instanceof Error&&r.message&&(r.message.includes("API request failed (402):")||r.message.includes("API request failed (500):")||r.message.includes("Stream API error (500):"))&&(r.message.includes('"error":"Quota limit exceeded"')||r.message.includes('"error":"No quota configuration"')||r.message.includes("quota exceeded")))try{let a=r.message.match(/\{.*\}$/);a&&(n=JSON.parse(a[0]))}catch{}return n?n.message&&n.message.includes("quota exceeded")?s3a(n):o3a(n):null}function s3a(r){let n=(()=>{try{let c=process.env,m=c.LC_ALL||c.LC_CTYPE||c.LANG||"";return m.toLowerCase().includes("zh")||m.toLowerCase().includes("chinese")}catch{return!1}})(),a="",i="",s="",t="",o=r.message||"",u=o.match(/Role:\s*([^,]+)/);u&&(a=u[1].trim());let h=o.match(/Limit:\s*([^,]+)/);h&&(i=h[1].trim());let d=o.match(/Used:\s*([^,]+)/);d&&(s=d[1].trim());let I=o.match(/Cycle:\s*([^,]+)/);if(I&&(t=I[1].trim()),n){let c=`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
738
738
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
739
739
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -6290,7 +6290,7 @@ If you extracted the public API surface of the code, pass public_exports and doc
|
|
|
6290
6290
|
|
|
6291
6291
|
Call this before telling the user the document is finished, and whenever you need to decide what to work on next.
|
|
6292
6292
|
|
|
6293
|
-
The counts come from the ledger, not from your own impression of the work. If it reports unconfirmed assumptions, the document is not done, regardless of how complete the prose looks.`,sU=class r extends xr{config;static Name="docgov_status";constructor(e){super(r.Name,"DocGovStatus",M0s,Fr.FileSearch,{type:Gt.OBJECT,properties:{},required:[]}),this.config=e}validateToolParams(e){return Qn.validate(this.schema.parameters,e,r.Name)}getDescription(){return"Reading documentation governance status"}async execute(e,n){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=oc(this.config);if(!i)return{llmContent:"Error: this directory has no unfinished knowledge commission before running status."+ed,returnDisplay:"No unfinished docgov commission."};let s=i.state,{ledger:t,instance:o,projectDir:u}=s,h=t.stats(),d=t.getAssumptions(),I=t.pendingQuestions(),c=t.getClaimsByTrust("unknown"),m=[`Project: ${o.projectName} (schema: ${o.schemaId})`,`Audience: ${o.goal.audience}`,"Agent build:
|
|
6293
|
+
The counts come from the ledger, not from your own impression of the work. If it reports unconfirmed assumptions, the document is not done, regardless of how complete the prose looks.`,sU=class r extends xr{config;static Name="docgov_status";constructor(e){super(r.Name,"DocGovStatus",M0s,Fr.FileSearch,{type:Gt.OBJECT,properties:{},required:[]}),this.config=e}validateToolParams(e){return Qn.validate(this.schema.parameters,e,r.Name)}getDescription(){return"Reading documentation governance status"}async execute(e,n){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:`Parameter validation failed: ${a}`};let i=oc(this.config);if(!i)return{llmContent:"Error: this directory has no unfinished knowledge commission before running status."+ed,returnDisplay:"No unfinished docgov commission."};let s=i.state,{ledger:t,instance:o,projectDir:u}=s,h=t.stats(),d=t.getAssumptions(),I=t.pendingQuestions(),c=t.getClaimsByTrust("unknown"),m=[`Project: ${o.projectName} (schema: ${o.schemaId})`,`Audience: ${o.goal.audience}`,"Agent build: 75e11104-dirty HEAD 2026-09-15T06:08:24.184Z",""],p=gi(u);if(p?.scenario){let b=S5(p.scenario),Z=cu(p.stageChain??[]),W=Z[Z.length-1];m.push(`\u573A\u666F / Scenario: ${b.label}\uFF08${p.scenario}\uFF09`,W?`\u5DF2\u5F00\u9636\u6BB5 / Stages opened: ${Z.map(A=>`${d_t[A.stage]}(${A.approvalRef})`).join(" \u2192 ")}`:"\u5C1A\u672A\u5F00\u542F\u4EFB\u4F55\u9636\u6BB5\u2014\u2014\u4E0B\u4E00\u6B65 docgov_level stage=compilation\uFF0Capproval_ref \u5F15\u7528\u7528\u6237\u7684\u5F00\u5DE5\u786E\u8BA4\u3002"),p.materiality&&m.push(`\u505C\u6B62\u7EBF\uFF1A${p.materiality}`),W&&m.push((W.completedAt?`\u5F53\u524D\u9636\u6BB5\u3010${d_t[W.stage]}\u3011\u5DF2\u901A\u8FC7\uFF08${W.approvalRef}\uFF0C${W.completedAt}\uFF09\u3002`:`\u5F53\u524D\u9636\u6BB5\u3010${d_t[W.stage]}\u3011\u7684\u5B8C\u6210\u7531 goal \u88C1\u5224\u5224\u5B9A\uFF1A\u6536\u5C3E\u65F6\u8C03 goal_achieved\uFF0C\u5B83\u4F1A\u8BFB\u8FD9\u6BB5\u5BF9\u8BDD\u5386\u53F2\u9010\u6761\u6838\u4F60\u7684\u8FBE\u6807\u7279\u5F81\u3002`)+"\u505A\u5B8C\u672C\u7EA7\u5C31\u505C\uFF0C\u662F\u5426\u52A0\u6DF1\u7531\u7528\u6237\u51B3\u5B9A\u3002"),m.push("")}m.push("Trust breakdown:",` verified ${h.verified}${U0s(h.verifiedBy)}`,` confirmed ${h.confirmed} (answered by the user)`,` assumed ${h.assumed} (unconfirmed guesses, block release)`,` recheck ${h.unknown} (provenance went stale)`);let f=o.requirements.filter(b=>t.getClaimsByRequirement(b.id).length===0);if(f.length>0&&m.push("","Requirements with no claims yet:",...f.map(b=>` ${b.id} ${b.what}`)),d.length>0){m.push("","Unconfirmed assumptions:");for(let b of d.slice(0,20)){let Z=b.evidence[0]?.note?` (${b.evidence[0].note})`:"";m.push(` ${b.id} ${b.text}${Z}`)}d.length>20&&m.push(` ... and ${d.length-20} more`)}let N=t.getClaimsByTrust("confirmed").map(b=>({claim:b,attribution:t.getClaimAttribution(b.id).filter(Z=>Z.answeredBy)})).filter(b=>b.attribution.length>0);if(N.length>0){m.push("","Confirmation attribution:");for(let{claim:b,attribution:Z}of N.slice(0,10)){let W=Z.map(G=>`${G.ref} by ${G.answeredBy}${G.answeredAt?` @ ${G.answeredAt.slice(0,10)}`:""}`).join(", "),A=b.asOf?` [as of ${b.asOf}]`:"";m.push(` ${b.id} ${b.text}${A} \u2190 ${W}`);let g=o.requirements.find(G=>G.id===b.requirementId)?.owner;g&&!Z.some(G=>G.answeredBy?.toLowerCase().includes(g.toLowerCase()))&&m.push(` \u26A0 \u786E\u8BA4\u4EBA\u4E0E\u8BE5\u8981\u6C42\u58F0\u660E\u7684 owner\uFF08${g}\uFF09\u4E0D\u7B26\uFF0C\u5EFA\u8BAE\u7531 owner \u590D\u6838`)}N.length>10&&m.push(` ... and ${N.length-10} more`)}if(c.length>0&&m.push("","Claims needing recheck (their source changed or was superseded):",...c.slice(0,10).map(b=>` ${b.id} ${b.text}`)),I.length>0){m.push("","Questions still waiting for the user:");for(let b of I.slice(0,10))m.push(` ${b.id} ${b.question??""}`)}let v=t.openConflicts();v.length>0&&m.push("","Open conflicts (\u4E92\u65A5\u4E3B\u5F20\uFF0C\u963B\u585E\u5B9A\u7A3F\uFF1B\u786E\u8BA4\u4E00\u8FB9\u5373\u53EF\u81EA\u52A8\u88C1\u51B3):",...v.slice(0,10).map(b=>` ${b.id} ${b.detail}`));let R=ije(this.config);if(R.pending.length>0){m.push("","Mid-turn interruptions still queued:");for(let b of R.pending.slice(0,10))m.push(` [${b.kind}] ${b.text}`)}if(R.absorbed.length>0){m.push("","Soft guidance already absorbed:");for(let b of R.absorbed.slice(-5))m.push(` \xB7 ${b}`)}let w=H2({requirements:o.rigor?.load_bearing,criteria:(gi(u)?.criteria??[]).map(b=>b.id)});if(d.length>0||c.length>0){let b=[...d,...c],Z=b.filter(g=>Q2(g,w)),W=b.filter(g=>!Q2(g,w)&&xH(g)),A=b.length-W.length-Z.length;m.push("","\u507F\u8FD8\u8DEF\u5F84 / Path to publish:",` ${Z.length} \u627F\u91CD\u4E3B\u5F20\uFF08\u89C4\u5B9A\u6027/\u627F\u8BFA\u6027/\u627F\u91CD\u8981\u6C42\uFF09\u2192 \u987B\u7528\u6237\u62CD\u677F\uFF0C\u8FD9\u662F\u552F\u4E00\u76F4\u63A5\u95EE\u4EBA\u7684\u7C7B\u522B`,` ${W.length} \u63CF\u8FF0\u6027\u4E14\u6709\u53EF\u6838\u67E5\u51FA\u5904 \u2192 \u8DD1 docgov_validate \u81EA\u52A8\u5B9A\u6848\uFF0C\u65E0\u9700\u63D0\u95EE`,` ${A} \u65E0\u53EF\u6838\u67E5\u51FA\u5904 \u2192 \u8865\u51FA\u5904\u91CD\u5F55\uFF0C\u6216\u4F5C\u4E3A\u6B8B\u4F59\u98CE\u9669\u968F\u9644\u4EA4\u4ED8`)}m.push("");let E=lF(t,H2({requirements:o.rigor?.load_bearing}));return E.allowed?m.push(`\u53EF\u53D1\u5E03 / PUBLISHABLE: ${E.note}`):m.push(`\u4E0D\u53EF\u53D1\u5E03 / NOT publishable: ${E.note}`,"Describe the document as a draft with the blockers above; non-load-bearing assumptions ship as a residual-risk appendix and do not block."),{llmContent:m.join(`
|
|
6294
6294
|
`),returnDisplay:`verified ${h.verified} \xB7 confirmed ${h.confirmed} \xB7 assumed ${h.assumed}`,summary:`docgov status: ${h.assumed} assumed, ${I.length} open questions`}}}});import*as Ig from"node:fs";import*as AI from"node:path";var z0s,P0s,j0s,VYn,oU,mje=Xe(()=>{"use strict";Pn();pa();ss();Bf();hg();uF();DC();qd();z0s=`Export the governed knowledge base together with per-claim trust metadata for downstream retrieval (RAG) systems. Produces manifest.json, claims.jsonl (one claim per line with trust, provenance, authority, attribution and validity anchor) and copies of the canonical sections.
|
|
6295
6295
|
|
|
6296
6296
|
Draft mode exports everything including unconfirmed assumptions, each row carrying its trust level so downstream indexes can filter. Release mode is gated: it refuses to export while any assumption, stale claim or open conflict remains.
|
|
@@ -6886,7 +6886,7 @@ ${a}
|
|
|
6886
6886
|
\u{1F50D} Model Diagnostics: ${r}`),console.log(`\u{1F4CA} Reliability: ${n.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${n.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${n.capabilities.maxConcurrentTools}`),n.warnings.length>0&&(console.log(`
|
|
6887
6887
|
\u26A0\uFE0F Warnings:`),n.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&n.recommendations.length>0&&(console.log(`
|
|
6888
6888
|
\u{1F4A1} Recommendations:`),n.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
|
|
6889
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(n.capabilities,null,2)))}function zNs(r){let e=aKe(r);return e.isSmallModel||e.needsSpecialHandling}function PNs(r){let e=aKe(r);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 bSn=Xe(()=>{"use strict";g2e();});var AMt,xMt,jNs,qNs,KNs,gSn=Xe(()=>{"use strict";AMt="--- Content from referenced files ---",xMt="--- End of content ---",jNs=2e3,qNs=2e3,KNs=20});function vSn(...r){return $Ns(...r)}function ySn(...r){return eZs(...r)}function GSn(r,e){return r in e}function CMt(){let r={get(i,s){if(s==="write")return vSn;if(GSn(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,r),n={get(i,s){if(s==="write")return ySn;if(GSn(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,n);return{stdout:e,stderr:a}}var $Ns,eZs,NSn=Xe(()=>{"use strict";$Ns=process.stdout.write.bind(process.stdout),eZs=process.stderr.write.bind(process.stderr)});import{readFile as tZs}from"node:fs/promises";import{fileURLToPath as rZs}from"node:url";import YMt from"node:path";function nZs(){let r=globalThis.import?.meta??void 0;try{let n=typeof import.meta<"u"?import.meta.url:void 0;if(n)return YMt.dirname(rZs(n))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function z5(){return A3e||(A3e=(async()=>"1.1.
|
|
6889
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(n.capabilities,null,2)))}function zNs(r){let e=aKe(r);return e.isSmallModel||e.needsSpecialHandling}function PNs(r){let e=aKe(r);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 bSn=Xe(()=>{"use strict";g2e();});var AMt,xMt,jNs,qNs,KNs,gSn=Xe(()=>{"use strict";AMt="--- Content from referenced files ---",xMt="--- End of content ---",jNs=2e3,qNs=2e3,KNs=20});function vSn(...r){return $Ns(...r)}function ySn(...r){return eZs(...r)}function GSn(r,e){return r in e}function CMt(){let r={get(i,s){if(s==="write")return vSn;if(GSn(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,r),n={get(i,s){if(s==="write")return ySn;if(GSn(s,i)){let t=i[s];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,n);return{stdout:e,stderr:a}}var $Ns,eZs,NSn=Xe(()=>{"use strict";$Ns=process.stdout.write.bind(process.stdout),eZs=process.stderr.write.bind(process.stderr)});import{readFile as tZs}from"node:fs/promises";import{fileURLToPath as rZs}from"node:url";import YMt from"node:path";function nZs(){let r=globalThis.import?.meta??void 0;try{let n=typeof import.meta<"u"?import.meta.url:void 0;if(n)return YMt.dirname(rZs(n))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function z5(){return A3e||(A3e=(async()=>"1.1.73")(),A3e)}function aZs(){A3e=void 0}var A3e,VMt=Xe(()=>{"use strict";});import{EventEmitter as iZs}from"node:events";var x3e,kMt,HMt,ZSn=Xe(()=>{"use strict";(function(r){r.ApprovalModeChanged="approval_mode_changed"})(x3e||(x3e={}));kMt=class{emitter=new iZs;on(e,n){return this.emitter.on(e,n),()=>this.emitter.off(e,n)}off(e,n){this.emitter.off(e,n)}emit(e,n){this.emitter.emit(e,n)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},HMt=new kMt});function iKe(r){return Array.isArray(r)?r.map(e=>typeof e=="string"?{text:e}:e):typeof r=="string"?[{text:r}]:[r]}function sZs(r){return r.map(e=>typeof e.text=="string"?e.text:"").join("")}function QMt(r){if(!r||r.length===0)return[];let e=[];for(let n of r){if(n.role&&(n.parts||n.content!==void 0)){let a=n.parts??iKe(n.content);e.push({role:n.role,parts:a});continue}if(!(n.type==="info"||n.type==="error"||n.type==="warning")){if(n.type==="user"){let a=n.content!==void 0?iKe(n.content):[],i=sZs(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(n.type==="gemini"){let a=[];if(n.thoughts&&n.thoughts.length>0)for(let s of n.thoughts){let t=s.subject?`**${s.subject}** ${s.description}`:s.description;a.push({text:t,thought:!0})}let i=!!n.toolCalls&&n.toolCalls.length>0;if(n.content!==void 0&&a.push(...iKe(n.content)),i)for(let s of n.toolCalls)a.push({functionCall:{name:s.name,args:s.args,...s.id?{id:s.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),i){let s=[];for(let t of n.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(...iKe(t.result)):s.push(t.result));s.length>0&&e.push({role:"user",parts:s})}}}}return e}var WSn=Xe(()=>{"use strict";});var LU,wSn,C3e,FSn=Xe(()=>{"use strict";LU=class r extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new r("No persisted sessions found.")}static invalidSessionIdentifier(e,n){return new r(`Session '${e}' was not found under ${n}.`)}},wSn="latest",C3e=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(n=>({id:n.sessionId,startTime:n.createdAt,title:n.title,messageCount:n.messageCount})).sort((n,a)=>new Date(n.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let n=e.trim(),a=await this.listSessions();if(a.length===0)throw LU.noSessionsFound();let i=a.find(t=>t.id===n);if(i)return i;let s=Number.parseInt(n,10);if(Number.isInteger(s)&&s.toString()===n&&s>0&&s<=a.length)return a[s-1];throw LU.invalidSessionIdentifier(n,"sessions/")}async resolveSession(e){let n=e.trim(),a;if(n===wSn){let s=await this.listSessions();if(s.length===0)throw LU.noSessionsFound();a=s[s.length-1]}else a=await this.findSession(n);let i=await this.manager.loadSession(a.id);if(!i)throw new LU(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,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 oKe(r){let n={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${r||7863}/callback?plat=deepvlab`};return new sKe(n)}var sKe,XMt=Xe(()=>{"use strict";sKe=class{config;constructor(e){this.config=e}buildAuthUrl(){let e=`${this.config.authUrl}?redirect_to=${encodeURIComponent(this.config.redirectUri)}&redirect_mode=same_window`;return console.log("\u{1F517} DeepVlab\u8BA4\u8BC1URL:",e),e}handleCallback(e){console.log("\u{1F504} [DeepVlab Auth] \u5904\u7406DeepVlab\u8BA4\u8BC1\u56DE\u8C03"),console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03URL:",e.toString());let n=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",n);let a=e.searchParams.get("token"),i=e.searchParams.get("user_id"),s=e.searchParams.get("error");return s?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",s),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${s}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as lKe from"fs";import*as A1 from"path";function oZs(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Y3e,lZs,cZs,MT,SMt=Xe(()=>{"use strict";Y3e=oZs(),lZs={titleI18nKey:"auth.feishu.success.title",documentTitle:"Feishu Authentication Successful",heading:"Feishu Login Successful",displayName:"Feishu"},cZs={titleI18nKey:"auth.deepvlab.success.title",documentTitle:"DeepVlab Authentication Successful",heading:"DeepVlab Login Successful",displayName:"DeepVlab"},MT=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.generateSuccessTemplate(lZs)}static getDeepvlabSuccessPage(){return this.generateSuccessTemplate(cZs)}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let n=[];if(this.customBasePath&&(n.push(A1.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),n.push(A1.join(this.customBasePath,"bundled","auth","login","templates",e)),n.push(A1.join(this.customBasePath,"auth","login","templates",e))),Y3e&&n.push(A1.join(Y3e,e)),Y3e){let s=Y3e;for(let t=0;t<10;t++)n.push(A1.join(s,"bundled","auth","login","templates",e)),n.push(A1.join(s,"bundled",e)),n.push(A1.join(s,"bundle","login","templates",e)),n.push(A1.join(s,"auth","login","templates",e)),s=A1.dirname(s)}if(typeof process<"u"&&process.cwd)try{let s=process.cwd();n.push(A1.join(s,"bundle","login","templates",e)),n.push(A1.join(s,"dist","bundled","auth","login","templates",e)),n.push(A1.join(s,"bundled","auth","login","templates",e)),n.push(A1.join(s,"auth","login","templates",e))}catch{}let a=null;for(let s of n)try{if(lKe.existsSync(s)){a=s,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${s}`);break}}catch{continue}if(!a){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${n.length} paths. First 5:`),n.slice(0,5).forEach((s,t)=>console.warn(` ${t+1}. ${s}`)),console.warn(` Current dirname: ${Y3e||"(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=lKe.readFileSync(a,"utf-8");return this.cache.set(e,i),i}catch(n){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,n),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
6890
6890
|
<!DOCTYPE html>
|
|
6891
6891
|
<html>
|
|
6892
6892
|
<head>
|
|
@@ -8162,7 +8162,7 @@ ${c}`),a?i.reset(c):c}function SRs(r,e,n,a={}){if(!rBn){rBn=!0;let s="Passing li
|
|
|
8162
8162
|
|
|
8163
8163
|
${e}
|
|
8164
8164
|
`:""}`}set message(e){this.#r=e}#a(e){if(!this.#t)return;let n=this.#e,a=BRs(n,this.#t.message);if(a)return(0,dBn.codeFrameColumns)(n,{start:a},{highlightCode:e})}get codeFrame(){return this.#n??=this.#a(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#a(!1),this.#i}},BRs=(r,e)=>{let n=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!n)return;let{index:a,line:i,column:s}=n.groups;return i&&s?{line:Number(i),column:Number(s)}:zzt(r,Number(a),{oneBased:!0})},ORs=r=>r.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,n,a)=>`"${a}"(${JRs(a)})`)});var vWe=ve((vVl,IBn)=>{"use strict";var _Rs=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};IBn.exports=_Rs});var yWe=ve((yVl,mBn)=>{"use strict";var DRs="2.0.0",MRs=Number.MAX_SAFE_INTEGER||9007199254740991,URs=16,zRs=250,PRs=["major","premajor","minor","preminor","patch","prepatch","prerelease"];mBn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:URs,MAX_SAFE_BUILD_LENGTH:zRs,MAX_SAFE_INTEGER:MRs,RELEASE_TYPES:PRs,SEMVER_SPEC_VERSION:DRs,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var jce=ve((pY,pBn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:qzt,MAX_SAFE_BUILD_LENGTH:jRs,MAX_LENGTH:qRs}=yWe(),KRs=vWe();pY=pBn.exports={};var $Rs=pY.re=[],e5s=pY.safeRe=[],Sa=pY.src=[],t5s=pY.safeSrc=[],La=pY.t={},r5s=0,Kzt="[a-zA-Z0-9-]",n5s=[["\\s",1],["\\d",qRs],[Kzt,jRs]],a5s=r=>{for(let[e,n]of n5s)r=r.split(`${e}*`).join(`${e}{0,${n}}`).split(`${e}+`).join(`${e}{1,${n}}`);return r},ks=(r,e,n)=>{let a=a5s(e),i=r5s++;KRs(r,i,e),La[r]=i,Sa[i]=e,t5s[i]=a,$Rs[i]=new RegExp(e,n?"g":void 0),e5s[i]=new RegExp(a,n?"g":void 0)};ks("NUMERICIDENTIFIER","0|[1-9]\\d*");ks("NUMERICIDENTIFIERLOOSE","\\d+");ks("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Kzt}*`);ks("MAINVERSION",`(${Sa[La.NUMERICIDENTIFIER]})\\.(${Sa[La.NUMERICIDENTIFIER]})\\.(${Sa[La.NUMERICIDENTIFIER]})`);ks("MAINVERSIONLOOSE",`(${Sa[La.NUMERICIDENTIFIERLOOSE]})\\.(${Sa[La.NUMERICIDENTIFIERLOOSE]})\\.(${Sa[La.NUMERICIDENTIFIERLOOSE]})`);ks("PRERELEASEIDENTIFIER",`(?:${Sa[La.NONNUMERICIDENTIFIER]}|${Sa[La.NUMERICIDENTIFIER]})`);ks("PRERELEASEIDENTIFIERLOOSE",`(?:${Sa[La.NONNUMERICIDENTIFIER]}|${Sa[La.NUMERICIDENTIFIERLOOSE]})`);ks("PRERELEASE",`(?:-(${Sa[La.PRERELEASEIDENTIFIER]}(?:\\.${Sa[La.PRERELEASEIDENTIFIER]})*))`);ks("PRERELEASELOOSE",`(?:-?(${Sa[La.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Sa[La.PRERELEASEIDENTIFIERLOOSE]})*))`);ks("BUILDIDENTIFIER",`${Kzt}+`);ks("BUILD",`(?:\\+(${Sa[La.BUILDIDENTIFIER]}(?:\\.${Sa[La.BUILDIDENTIFIER]})*))`);ks("FULLPLAIN",`v?${Sa[La.MAINVERSION]}${Sa[La.PRERELEASE]}?${Sa[La.BUILD]}?`);ks("FULL",`^${Sa[La.FULLPLAIN]}$`);ks("LOOSEPLAIN",`[v=\\s]*${Sa[La.MAINVERSIONLOOSE]}${Sa[La.PRERELEASELOOSE]}?${Sa[La.BUILD]}?`);ks("LOOSE",`^${Sa[La.LOOSEPLAIN]}$`);ks("GTLT","((?:<|>)?=?)");ks("XRANGEIDENTIFIERLOOSE",`${Sa[La.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ks("XRANGEIDENTIFIER",`${Sa[La.NUMERICIDENTIFIER]}|x|X|\\*`);ks("XRANGEPLAIN",`[v=\\s]*(${Sa[La.XRANGEIDENTIFIER]})(?:\\.(${Sa[La.XRANGEIDENTIFIER]})(?:\\.(${Sa[La.XRANGEIDENTIFIER]})(?:${Sa[La.PRERELEASE]})?${Sa[La.BUILD]}?)?)?`);ks("XRANGEPLAINLOOSE",`[v=\\s]*(${Sa[La.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Sa[La.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Sa[La.XRANGEIDENTIFIERLOOSE]})(?:${Sa[La.PRERELEASELOOSE]})?${Sa[La.BUILD]}?)?)?`);ks("XRANGE",`^${Sa[La.GTLT]}\\s*${Sa[La.XRANGEPLAIN]}$`);ks("XRANGELOOSE",`^${Sa[La.GTLT]}\\s*${Sa[La.XRANGEPLAINLOOSE]}$`);ks("COERCEPLAIN",`(^|[^\\d])(\\d{1,${qzt}})(?:\\.(\\d{1,${qzt}}))?(?:\\.(\\d{1,${qzt}}))?`);ks("COERCE",`${Sa[La.COERCEPLAIN]}(?:$|[^\\d])`);ks("COERCEFULL",Sa[La.COERCEPLAIN]+`(?:${Sa[La.PRERELEASE]})?(?:${Sa[La.BUILD]})?(?:$|[^\\d])`);ks("COERCERTL",Sa[La.COERCE],!0);ks("COERCERTLFULL",Sa[La.COERCEFULL],!0);ks("LONETILDE","(?:~>?)");ks("TILDETRIM",`(\\s*)${Sa[La.LONETILDE]}\\s+`,!0);pY.tildeTrimReplace="$1~";ks("TILDE",`^${Sa[La.LONETILDE]}${Sa[La.XRANGEPLAIN]}$`);ks("TILDELOOSE",`^${Sa[La.LONETILDE]}${Sa[La.XRANGEPLAINLOOSE]}$`);ks("LONECARET","(?:\\^)");ks("CARETTRIM",`(\\s*)${Sa[La.LONECARET]}\\s+`,!0);pY.caretTrimReplace="$1^";ks("CARET",`^${Sa[La.LONECARET]}${Sa[La.XRANGEPLAIN]}$`);ks("CARETLOOSE",`^${Sa[La.LONECARET]}${Sa[La.XRANGEPLAINLOOSE]}$`);ks("COMPARATORLOOSE",`^${Sa[La.GTLT]}\\s*(${Sa[La.LOOSEPLAIN]})$|^$`);ks("COMPARATOR",`^${Sa[La.GTLT]}\\s*(${Sa[La.FULLPLAIN]})$|^$`);ks("COMPARATORTRIM",`(\\s*)${Sa[La.GTLT]}\\s*(${Sa[La.LOOSEPLAIN]}|${Sa[La.XRANGEPLAIN]})`,!0);pY.comparatorTrimReplace="$1$2$3";ks("HYPHENRANGE",`^\\s*(${Sa[La.XRANGEPLAIN]})\\s+-\\s+(${Sa[La.XRANGEPLAIN]})\\s*$`);ks("HYPHENRANGELOOSE",`^\\s*(${Sa[La.XRANGEPLAINLOOSE]})\\s+-\\s+(${Sa[La.XRANGEPLAINLOOSE]})\\s*$`);ks("STAR","(<|>)?=?\\s*\\*");ks("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ks("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var eet=ve((NVl,fBn)=>{"use strict";var i5s=Object.freeze({loose:!0}),s5s=Object.freeze({}),o5s=r=>r?typeof r!="object"?i5s:r:s5s;fBn.exports=o5s});var $zt=ve((ZVl,GBn)=>{"use strict";var bBn=/^[0-9]+$/,gBn=(r,e)=>{if(typeof r=="number"&&typeof e=="number")return r===e?0:r<e?-1:1;let n=bBn.test(r),a=bBn.test(e);return n&&a&&(r=+r,e=+e),r===e?0:n&&!a?-1:a&&!n?1:r<e?-1:1},l5s=(r,e)=>gBn(e,r);GBn.exports={compareIdentifiers:gBn,rcompareIdentifiers:l5s}});var U2=ve((WVl,yBn)=>{"use strict";var tet=vWe(),{MAX_LENGTH:vBn,MAX_SAFE_INTEGER:net}=yWe(),{safeRe:aet,t:iet}=jce(),c5s=eet(),{compareIdentifiers:ePt}=$zt(),tPt=class r{constructor(e,n){if(n=c5s(n),e instanceof r){if(e.loose===!!n.loose&&e.includePrerelease===!!n.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>vBn)throw new TypeError(`version is longer than ${vBn} characters`);tet("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let a=e.trim().match(n.loose?aet[iet.LOOSE]:aet[iet.FULL]);if(!a)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>net||this.major<0)throw new TypeError("Invalid major version");if(this.minor>net||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>net||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<net)return s}return i}):this.prerelease=[],this.build=a[5]?a[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(tet("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(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 r||(e=new r(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 n=0;do{let a=this.prerelease[n],i=e.prerelease[n];if(tet("prerelease compare",n,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return ePt(a,i)}while(++n)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let n=0;do{let a=this.build[n],i=e.build[n];if(tet("build compare",n,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return ePt(a,i)}while(++n)}inc(e,n,a){if(e.startsWith("pre")){if(!n&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let i=`-${n}`.match(this.options.loose?aet[iet.PRERELEASELOOSE]:aet[iet.PRERELEASE]);if(!i||i[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,a),this.inc("pre",n,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,a),this.inc("pre",n,a);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(a)?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(n===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(n){let s=[n,i];a===!1&&(s=[n]),ePt(this.prerelease[0],n)===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}};yBn.exports=tPt});var az=ve((wVl,ZBn)=>{"use strict";var NBn=U2(),u5s=(r,e,n=!1)=>{if(r instanceof NBn)return r;try{return new NBn(r,e)}catch(a){if(!n)return null;throw a}};ZBn.exports=u5s});var rPt=ve((FVl,WBn)=>{"use strict";var d5s=az(),h5s=(r,e)=>{let n=d5s(r,e);return n?n.version:null};WBn.exports=h5s});var nPt=ve((EVl,wBn)=>{"use strict";var I5s=az(),m5s=(r,e)=>{let n=I5s(r.trim().replace(/^[=v]+/,""),e);return n?n.version:null};wBn.exports=m5s});var aPt=ve((RVl,p5s)=>{p5s.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 FBn=ve((AVl,f5s)=>{f5s.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 EBn=ve((xVl,b5s)=>{b5s.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 ABn=ve((CVl,RBn)=>{"use strict";var g5s=[].concat(aPt()).concat(FBn()),G5s=EBn();RBn.exports=function(r){var e=0;function n(){return e<r.length}function a(p){if(p instanceof RegExp){var f=r.slice(e),N=f.match(p);if(N)return e+=N[0].length,N[0]}else if(r.indexOf(p,e)===e)return e+=p.length,p}function i(){a(/[ ]*/)}function s(){for(var p,f=["WITH","AND","OR","(",")",":","+"],N=0;N<f.length&&(p=a(f[N]),!p);N++);if(p==="+"&&e>1&&r[e-2]===" ")throw new Error("Space before `+`");return p&&{type:"OPERATOR",string:p}}function t(){return a(/[A-Za-z0-9-.]+/)}function o(){var p=t();if(!p)throw new Error("Expected idstring at offset "+e);return p}function u(){if(a("DocumentRef-")){var p=o();return{type:"DOCUMENTREF",string:p}}}function h(){if(a("LicenseRef-")){var p=o();return{type:"LICENSEREF",string:p}}}function d(){var p=e,f=t();if(g5s.indexOf(f)!==-1)return{type:"LICENSE",string:f};if(G5s.indexOf(f)!==-1)return{type:"EXCEPTION",string:f};e=p}function I(){return s()||u()||h()||d()}for(var c=[];n()&&(i(),!!n());){var m=I();if(!m)throw new Error("Unexpected `"+r[e]+"` at offset "+e);c.push(m)}return c}});var CBn=ve((YVl,xBn)=>{"use strict";xBn.exports=function(r){var e=0;function n(){return e<r.length}function a(){return n()?r[e]:null}function i(){if(!n())throw new Error;e++}function s(f){var N=a();if(N&&N.type==="OPERATOR"&&f===N.string)return i(),N.string}function t(){if(s("WITH")){var f=a();if(f&&f.type==="EXCEPTION")return i(),f.string;throw new Error("Expected exception after `WITH`")}}function o(){var f=e,N="",v=a();if(v.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+v.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(v=a(),v.type==="LICENSEREF")return i(),N+="LicenseRef-"+v.string,{license:N};e=f}function u(){var f=a();if(f&&f.type==="LICENSE"){i();var N={license:f.string};s("+")&&(N.plus=!0);var v=t();return v&&(N.exception=v),N}}function h(){var f=s("(");if(f){var N=m();if(!s(")"))throw new Error("Expected `)`");return N}}function d(){return h()||o()||u()}function I(f,N){return function v(){var R=N();if(R){if(!s(f))return R;var w=v();if(!w)throw new Error("Expected expression");return{left:R,conjunction:f.toLowerCase(),right:w}}}}var c=I("AND",d),m=I("OR",c),p=m();if(!p||n())throw new Error("Syntax error");return p}});var iPt=ve((VVl,YBn)=>{"use strict";var v5s=ABn(),y5s=CBn();YBn.exports=function(r){return y5s(v5s(r))}});var JBn=ve((kVl,TBn)=>{var N5s=iPt(),Z5s=aPt();function set(r){try{return N5s(r),!0}catch{return!1}}function LBn(r,e){var n=e[0].length-r[0].length;return n!==0?n:r[0].toUpperCase().localeCompare(e[0].toUpperCase())}var VBn=[["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(LBn),W5s=0,w5s=1,kBn=[function(r){return r.toUpperCase()},function(r){return r.trim()},function(r){return r.replace(/\./g,"")},function(r){return r.replace(/\s+/g,"")},function(r){return r.replace(/\s+/g,"-")},function(r){return r.replace("v","-")},function(r){return r.replace(/,?\s*(\d)/,"-$1")},function(r){return r.replace(/,?\s*(\d)/,"-$1.0")},function(r){return r.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(r){return r.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(r){return r[0].toUpperCase()+r.slice(1)},function(r){return r.replace("/","-")},function(r){return r.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(r){return r.indexOf("3.0")!==-1?r+"-or-later":r+"-only"},function(r){return r+"only"},function(r){return r.replace(/(\d)$/,"-$1.0")},function(r){return r.replace(/(-| )?(\d)$/,"-$2-Clause")},function(r){return r.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(r){return r.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(r){return r.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(r){return r.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(r){return r.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(r){return r.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(r){return"CC-"+r},function(r){return"CC-"+r+"-4.0"},function(r){return r.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(r){return"CC-"+r.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],sPt=Z5s.map(function(r){var e=/^(.*)-\d+\.\d+$/.exec(r);return e?[e[0],e[1]]:[r,null]}).reduce(function(r,e){var n=e[1];return r[n]=r[n]||[],r[n].push(e[0]),r},{}),F5s=Object.keys(sPt).map(function(e){return[e,sPt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});sPt=void 0;var HBn=[["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(F5s).sort(LBn),E5s=0,R5s=1,QBn=function(r){for(var e=0;e<kBn.length;e++){var n=kBn[e](r).trim();if(n!==r&&set(n))return n}return null},XBn=function(r){for(var e=r.toUpperCase(),n=0;n<HBn.length;n++){var a=HBn[n];if(e.indexOf(a[E5s])>-1)return a[R5s]}return null},SBn=function(r,e){for(var n=0;n<VBn.length;n++){var a=VBn[n],i=a[W5s];if(r.indexOf(i)>-1){var s=r.replace(i,a[w5s]),t=e(s);if(t!==null)return t}}return null};TBn.exports=function(r,e){e=e||{};var n=e.upgrade===void 0?!0:!!e.upgrade;function a(o){return n?A5s(o):o}var i=typeof r=="string"&&r.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(r=r.trim(),set(r))return a(r);var s=r.replace(/\+$/,"").trim();if(set(s))return a(s);var t=QBn(r);return t!==null||(t=SBn(r,function(o){return set(o)?o:QBn(o)}),t!==null)||(t=XBn(r),t!==null)||(t=SBn(r,XBn),t!==null)?a(t):null};function A5s(r){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(r)!==-1?r+"-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(r)!==-1?r.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(r)!==-1?r+"-or-later":r}});var DBn=ve((HVl,_Bn)=>{var x5s=iPt(),C5s=JBn(),BBn='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',Y5s=/^SEE LICEN[CS]E IN (.+)$/;function OBn(r,e){return e.slice(0,r.length)===r}function oPt(r){if(r.hasOwnProperty("license")){var e=r.license;return OBn("LicenseRef",e)||OBn("DocumentRef",e)}else return oPt(r.left)||oPt(r.right)}_Bn.exports=function(r){var e;try{e=x5s(r)}catch{var n;if(r==="UNLICENSED"||r==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(n=Y5s.exec(r))return{validForOldPackages:!0,validForNewPackages:!0,inFile:n[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[BBn]};if(r.trim().length!==0){var i=C5s(r);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return oPt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[BBn]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var jBn=ve(cet=>{"use strict";Object.defineProperty(cet,"__esModule",{value:!0});cet.LRUCache=void 0;var qce=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,UBn=new Set,lPt=typeof process=="object"&&process?process:{},zBn=(r,e,n,a)=>{typeof lPt.emitWarning=="function"?lPt.emitWarning(r,e,n,a):console.error(`[${n}] ${e}: ${r}`)},oet=globalThis.AbortController,MBn=globalThis.AbortSignal;if(typeof oet>"u"){MBn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},oet=class{constructor(){e()}signal=new MBn;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let r=lPt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{r&&(r=!1,zBn("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 V5s=r=>!UBn.has(r),SVl=Symbol("type"),gJ=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),PBn=r=>gJ(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Kce:null:null,Kce=class extends Array{constructor(e){super(e),this.fill(0)}},cPt=class r{heap;length;static#e=!1;static create(e){let n=PBn(e);if(!n)return[];r.#e=!0;let a=new r(e,n);return r.#e=!1,a}constructor(e,n){if(!r.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},uPt=class r{#e;#t;#r;#n;#i;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#o;#s;#h;#d;#I;#l;#p;#f;#g;#m;#Z;#y;#W;#w;#v;#G;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#W,sizes:e.#Z,keyMap:e.#s,keyList:e.#h,valList:e.#d,next:e.#I,prev:e.#l,get head(){return e.#p},get tail(){return e.#f},free:e.#g,isBackgroundFetch:n=>e.#N(n),backgroundFetch:(n,a,i,s)=>e.#C(n,a,i,s),moveToTail:n=>e.#O(n),indexes:n=>e.#L(n),rindexes:n=>e.#V(n),isStale:n=>e.#A(n)}}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.#a}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:n=0,ttl:a,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:t,updateAgeOnHas:o,allowStale:u,dispose:h,disposeAfter:d,noDisposeOnSet:I,noUpdateTTL:c,maxSize:m=0,maxEntrySize:p=0,sizeCalculation:f,fetchMethod:N,memoMethod:v,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:b,ignoreFetchAbort:Z}=e;if(n!==0&&!gJ(n))throw new TypeError("max option must be a nonnegative integer");let W=n?PBn(n):Array;if(!W)throw new Error("invalid max value: "+n);if(this.#e=n,this.#t=m,this.maxEntrySize=p||this.#t,this.sizeCalculation=f,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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#a=v,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.#h=new Array(n).fill(void 0),this.#d=new Array(n).fill(void 0),this.#I=new W(n),this.#l=new W(n),this.#p=0,this.#f=0,this.#g=cPt.create(n),this.#c=0,this.#o=0,typeof h=="function"&&(this.#r=h),typeof d=="function"?(this.#n=d,this.#m=[]):(this.#n=void 0,this.#m=void 0),this.#w=!!this.#r,this.#G=!!this.#n,this.noDisposeOnSet=!!I,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!Z,this.maxEntrySize!==0){if(this.#t!==0&&!gJ(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!gJ(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!o,this.ttlResolution=gJ(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!gJ(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#F()}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 A="LRU_CACHE_UNBOUNDED";V5s(A)&&(UBn.add(A),zBn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",A,r))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#F(){let e=new Kce(this.#e),n=new Kce(this.#e);this.#W=e,this.#y=n,this.#H=(s,t,o=qce.now())=>{if(n[s]=t!==0?o:0,e[s]=t,t!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#A(s)&&this.#X(this.#h[s],"expire")},t+1);u.unref&&u.unref()}},this.#R=s=>{n[s]=e[s]!==0?qce.now():0},this.#u=(s,t)=>{if(e[t]){let o=e[t],u=n[t];if(!o||!u)return;s.ttl=o,s.start=u,s.now=a||i();let h=s.now-u;s.remainingTTL=o-h}};let a=0,i=()=>{let s=qce.now();if(this.ttlResolution>0){a=s;let t=setTimeout(()=>a=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],u=n[t];if(!o||!u)return 1/0;let h=(a||i())-u;return o-h},this.#A=s=>{let t=n[s],o=e[s];return!!o&&!!t&&(a||i())-t>o}}#R=()=>{};#u=()=>{};#H=()=>{};#A=()=>!1;#x(){let e=new Kce(this.#e);this.#o=0,this.#Z=e,this.#Y=n=>{this.#o-=e[n],e[n]=0},this.#E=(n,a,i,s)=>{if(this.#N(a))return 0;if(!gJ(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(a,n),!gJ(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=(n,a,i)=>{if(e[n]=a,this.#t){let s=this.#t-e[n];for(;this.#o>s;)this.#T(!0)}this.#o+=e[n],i&&(i.entrySize=a,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,n,a)=>{};#E=(e,n,a,i)=>{if(a||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 n=this.#f;!(!this.#Q(n)||((e||!this.#A(n))&&(yield n),n===this.#p));)n=this.#l[n]}*#V({allowStale:e=this.allowStale}={}){if(this.#c)for(let n=this.#p;!(!this.#Q(n)||((e||!this.#A(n))&&(yield n),n===this.#f));)n=this.#I[n]}#Q(e){return e!==void 0&&this.#s.get(this.#h[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#h[e]!==void 0&&!this.#N(this.#d[e])&&(yield[this.#h[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#h[e]!==void 0&&!this.#N(this.#d[e])&&(yield[this.#h[e],this.#d[e]])}*keys(){for(let e of this.#L()){let n=this.#h[e];n!==void 0&&!this.#N(this.#d[e])&&(yield n)}}*rkeys(){for(let e of this.#V()){let n=this.#h[e];n!==void 0&&!this.#N(this.#d[e])&&(yield n)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#N(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#N(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,n={}){for(let a of this.#L()){let i=this.#d[a],s=this.#N(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#h[a],this))return this.get(this.#h[a],n)}}forEach(e,n=this){for(let a of this.#L()){let i=this.#d[a],s=this.#N(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#h[a],this)}}rforEach(e,n=this){for(let a of this.#V()){let i=this.#d[a],s=this.#N(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(n,s,this.#h[a],this)}}purgeStale(){let e=!1;for(let n of this.#V({allowStale:!0}))this.#A(n)&&(this.#X(this.#h[n],"expire"),e=!0);return e}info(e){let n=this.#s.get(e);if(n===void 0)return;let a=this.#d[n],i=this.#N(a)?a.__staleWhileFetching:a;if(i===void 0)return;let s={value:i};if(this.#W&&this.#y){let t=this.#W[n],o=this.#y[n];if(t&&o){let u=t-(qce.now()-o);s.ttl=u,s.start=Date.now()}}return this.#Z&&(s.size=this.#Z[n]),s}dump(){let e=[];for(let n of this.#L({allowStale:!0})){let a=this.#h[n],i=this.#d[n],s=this.#N(i)?i.__staleWhileFetching:i;if(s===void 0||a===void 0)continue;let t={value:s};if(this.#W&&this.#y){t.ttl=this.#W[n];let o=qce.now()-this.#y[n];t.start=Math.floor(Date.now()-o)}this.#Z&&(t.size=this.#Z[n]),e.unshift([a,t])}return e}load(e){this.clear();for(let[n,a]of e){if(a.start){let i=Date.now()-a.start;a.start=qce.now()-i}this.set(n,a.value,a)}}set(e,n,a={}){if(n===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:u}=a,{noUpdateTTL:h=this.noUpdateTTL}=a,d=this.#E(e,n,a.size||0,o);if(this.maxEntrySize&&d>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#X(e,"set"),this;let I=this.#c===0?void 0:this.#s.get(e);if(I===void 0)I=this.#c===0?this.#f:this.#g.length!==0?this.#g.pop():this.#c===this.#e?this.#T(!1):this.#c,this.#h[I]=e,this.#d[I]=n,this.#s.set(e,I),this.#I[this.#f]=I,this.#l[I]=this.#f,this.#f=I,this.#c++,this.#S(I,d,u),u&&(u.set="add"),h=!1;else{this.#O(I);let c=this.#d[I];if(n!==c){if(this.#v&&this.#N(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#w&&this.#r?.(m,e,"set"),this.#G&&this.#m?.push([m,e,"set"]))}else t||(this.#w&&this.#r?.(c,e,"set"),this.#G&&this.#m?.push([c,e,"set"]));if(this.#Y(I),this.#S(I,d,u),this.#d[I]=n,u){u.set="replace";let m=c&&this.#N(c)?c.__staleWhileFetching:c;m!==void 0&&(u.oldValue=m)}}else u&&(u.set="update")}if(i!==0&&!this.#W&&this.#F(),this.#W&&(h||this.#H(I,i,s),u&&this.#u(u,I)),!t&&this.#G&&this.#m){let c=this.#m,m;for(;m=c?.shift();)this.#n?.(...m)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#p];if(this.#T(!0),this.#N(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#G&&this.#m){let e=this.#m,n;for(;n=e?.shift();)this.#n?.(...n)}}}#T(e){let n=this.#p,a=this.#h[n],i=this.#d[n];return this.#v&&this.#N(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#G)&&(this.#w&&this.#r?.(i,a,"evict"),this.#G&&this.#m?.push([i,a,"evict"])),this.#Y(n),e&&(this.#h[n]=void 0,this.#d[n]=void 0,this.#g.push(n)),this.#c===1?(this.#p=this.#f=0,this.#g.length=0):this.#p=this.#I[n],this.#s.delete(a),this.#c--,n}has(e,n={}){let{updateAgeOnHas:a=this.updateAgeOnHas,status:i}=n,s=this.#s.get(e);if(s!==void 0){let t=this.#d[s];if(this.#N(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#u(i,s));else return a&&this.#R(s),i&&(i.has="hit",this.#u(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,n={}){let{allowStale:a=this.allowStale}=n,i=this.#s.get(e);if(i===void 0||!a&&this.#A(i))return;let s=this.#d[i];return this.#N(s)?s.__staleWhileFetching:s}#C(e,n,a,i){let s=n===void 0?void 0:this.#d[n];if(this.#N(s))return s;let t=new oet,{signal:o}=a;o?.addEventListener("abort",()=>t.abort(o.reason),{signal:t.signal});let u={signal:t.signal,options:a,context:i},h=(f,N=!1)=>{let{aborted:v}=t.signal,R=a.ignoreFetchAbort&&f!==void 0;if(a.status&&(v&&!N?(a.status.fetchAborted=!0,a.status.fetchError=t.signal.reason,R&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),v&&!R&&!N)return I(t.signal.reason);let w=m;return this.#d[n]===m&&(f===void 0?w.__staleWhileFetching?this.#d[n]=w.__staleWhileFetching:this.#X(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,f,u.options))),f},d=f=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=f),I(f)),I=f=>{let{aborted:N}=t.signal,v=N&&a.allowStaleOnFetchAbort,R=v||a.allowStaleOnFetchRejection,w=R||a.noDeleteOnFetchRejection,E=m;if(this.#d[n]===m&&(!w||E.__staleWhileFetching===void 0?this.#X(e,"fetch"):v||(this.#d[n]=E.__staleWhileFetching)),R)return a.status&&E.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw f},c=(f,N)=>{let v=this.#i?.(e,s,u);v&&v instanceof Promise&&v.then(R=>f(R===void 0?void 0:R),N),t.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(f(void 0),a.allowStaleOnFetchAbort&&(f=R=>h(R,!0)))})};a.status&&(a.status.fetchDispatched=!0);let m=new Promise(c).then(h,d),p=Object.assign(m,{__abortController:t,__staleWhileFetching:s,__returned:void 0});return n===void 0?(this.set(e,p,{...u.options,status:void 0}),n=this.#s.get(e)):this.#d[n]=p,p}#N(e){if(!this.#v)return!1;let n=e;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof oet}async fetch(e,n={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:u=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:I=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:f,forceRefresh:N=!1,status:v,signal:R}=n;if(!this.#v)return v&&(v.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:v});let w={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:t,noDisposeOnSet:o,size:u,sizeCalculation:h,noUpdateTTL:d,noDeleteOnFetchRejection:I,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:p,ignoreFetchAbort:m,status:v,signal:R},E=this.#s.get(e);if(E===void 0){v&&(v.fetch="miss");let b=this.#C(e,E,w,f);return b.__returned=b}else{let b=this.#d[E];if(this.#N(b)){let G=a&&b.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",G&&(v.returnedStale=!0)),G?b.__staleWhileFetching:b.__returned=b}let Z=this.#A(E);if(!N&&!Z)return v&&(v.fetch="hit"),this.#O(E),i&&this.#R(E),v&&this.#u(v,E),b;let W=this.#C(e,E,w,f),g=W.__staleWhileFetching!==void 0&&a;return v&&(v.fetch=Z?"stale":"refresh",g&&Z&&(v.returnedStale=!0)),g?W.__staleWhileFetching:W.__returned=W}}async forceFetch(e,n={}){let a=await this.fetch(e,n);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(e,n={}){let a=this.#a;if(!a)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...t}=n,o=this.get(e,t);if(!s&&o!==void 0)return o;let u=a(e,o,{options:t,context:i});return this.set(e,u,t),u}get(e,n={}){let{allowStale:a=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:t}=n,o=this.#s.get(e);if(o!==void 0){let u=this.#d[o],h=this.#N(u);return t&&this.#u(t,o),this.#A(o)?(t&&(t.get="stale"),h?(t&&a&&u.__staleWhileFetching!==void 0&&(t.returnedStale=!0),a?u.__staleWhileFetching:void 0):(s||this.#X(e,"expire"),t&&a&&(t.returnedStale=!0),a?u:void 0)):(t&&(t.get="hit"),h?u.__staleWhileFetching:(this.#O(o),i&&this.#R(o),u))}else t&&(t.get="miss")}#B(e,n){this.#l[n]=e,this.#I[e]=n}#O(e){e!==this.#f&&(e===this.#p?this.#p=this.#I[e]:this.#B(this.#l[e],this.#I[e]),this.#B(this.#f,e),this.#f=e)}delete(e){return this.#X(e,"delete")}#X(e,n){let a=!1;if(this.#c!==0){let i=this.#s.get(e);if(i!==void 0)if(a=!0,this.#c===1)this.#b(n);else{this.#Y(i);let s=this.#d[i];if(this.#N(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#G)&&(this.#w&&this.#r?.(s,e,n),this.#G&&this.#m?.push([s,e,n])),this.#s.delete(e),this.#h[i]=void 0,this.#d[i]=void 0,i===this.#f)this.#f=this.#l[i];else if(i===this.#p)this.#p=this.#I[i];else{let t=this.#l[i];this.#I[t]=this.#I[i];let o=this.#I[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.#n?.(...s)}return a}clear(){return this.#b("delete")}#b(e){for(let n of this.#V({allowStale:!0})){let a=this.#d[n];if(this.#N(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#h[n];this.#w&&this.#r?.(a,i,e),this.#G&&this.#m?.push([a,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#h.fill(void 0),this.#W&&this.#y&&(this.#W.fill(0),this.#y.fill(0)),this.#Z&&this.#Z.fill(0),this.#p=0,this.#f=0,this.#g.length=0,this.#o=0,this.#c=0,this.#G&&this.#m){let n=this.#m,a;for(;a=n?.shift();)this.#n?.(...a)}}};cet.LRUCache=uPt});var $Bn=ve((TVl,KBn)=>{"use strict";var Ic=(...r)=>r.every(e=>e)?r.join(""):"",Np=r=>r?encodeURIComponent(r):"",qBn=r=>r.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),k5s={sshtemplate:({domain:r,user:e,project:n,committish:a})=>`git@${r}:${e}/${n}.git${Ic("#",a)}`,sshurltemplate:({domain:r,user:e,project:n,committish:a})=>`git+ssh://git@${r}/${e}/${n}.git${Ic("#",a)}`,edittemplate:({domain:r,user:e,project:n,committish:a,editpath:i,path:s})=>`https://${r}/${e}/${n}${Ic("/",i,"/",Np(a||"HEAD"),"/",s)}`,browsetemplate:({domain:r,user:e,project:n,committish:a,treepath:i})=>`https://${r}/${e}/${n}${Ic("/",i,"/",Np(a))}`,browsetreetemplate:({domain:r,user:e,project:n,committish:a,treepath:i,path:s,fragment:t,hashformat:o})=>`https://${r}/${e}/${n}/${i}/${Np(a||"HEAD")}/${s}${Ic("#",o(t||""))}`,browseblobtemplate:({domain:r,user:e,project:n,committish:a,blobpath:i,path:s,fragment:t,hashformat:o})=>`https://${r}/${e}/${n}/${i}/${Np(a||"HEAD")}/${s}${Ic("#",o(t||""))}`,docstemplate:({domain:r,user:e,project:n,treepath:a,committish:i})=>`https://${r}/${e}/${n}${Ic("/",a,"/",Np(i))}#readme`,httpstemplate:({auth:r,domain:e,user:n,project:a,committish:i})=>`git+https://${Ic(r,"@")}${e}/${n}/${a}.git${Ic("#",i)}`,filetemplate:({domain:r,user:e,project:n,committish:a,path:i})=>`https://${r}/${e}/${n}/raw/${Np(a||"HEAD")}/${i}`,shortcuttemplate:({type:r,user:e,project:n,committish:a})=>`${r}:${e}/${n}${Ic("#",a)}`,pathtemplate:({user:r,project:e,committish:n})=>`${r}/${e}${Ic("#",n)}`,bugstemplate:({domain:r,user:e,project:n})=>`https://${r}/${e}/${n}/issues`,hashformat:qBn},GJ={};GJ.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:r,user:e,project:n,committish:a,path:i})=>`https://${Ic(r,"@")}raw.githubusercontent.com/${e}/${n}/${Np(a||"HEAD")}/${i}`,gittemplate:({auth:r,domain:e,user:n,project:a,committish:i})=>`git://${Ic(r,"@")}${e}/${n}/${a}.git${Ic("#",i)}`,tarballtemplate:({domain:r,user:e,project:n,committish:a})=>`https://codeload.${r}/${e}/${n}/tar.gz/${Np(a||"HEAD")}`,extract:r=>{let[,e,n,a,i]=r.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=r.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!e||!n)))return{user:e,project:n,committish:i}}};GJ.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:r,user:e,project:n,committish:a,treepath:i,path:s,editpath:t})=>`https://${r}/${e}/${n}${Ic("/",i,"/",Np(a||"HEAD"),"/",s,t)}`,tarballtemplate:({domain:r,user:e,project:n,committish:a})=>`https://${r}/${e}/${n}/get/${Np(a||"HEAD")}.tar.gz`,extract:r=>{let[,e,n,a]=r.pathname.split("/",4);if(!["get"].includes(a)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!e||!n)))return{user:e,project:n,committish:r.hash.slice(1)}}};GJ.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:r,domain:e,user:n,project:a,committish:i})=>`git+https://${Ic(r,"@")}${e}/${n}/${a}.git${Ic("#",i)}`,tarballtemplate:({domain:r,user:e,project:n,committish:a})=>`https://${r}/${e}/${n}/repository/archive.tar.gz?ref=${Np(a||"HEAD")}`,extract:r=>{let e=r.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let n=e.split("/"),a=n.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=n.join("/");if(!(!i||!a))return{user:i,project:a,committish:r.hash.slice(1)}}};GJ.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:r,project:e,committish:n})=>`git@${r}:${e}.git${Ic("#",n)}`,sshurltemplate:({domain:r,project:e,committish:n})=>`git+ssh://git@${r}/${e}.git${Ic("#",n)}`,edittemplate:({domain:r,user:e,project:n,committish:a,editpath:i})=>`https://${r}/${e}/${n}${Ic("/",Np(a))}/${i}`,browsetemplate:({domain:r,project:e,committish:n})=>`https://${r}/${e}${Ic("/",Np(n))}`,browsetreetemplate:({domain:r,project:e,committish:n,path:a,hashformat:i})=>`https://${r}/${e}${Ic("/",Np(n))}${Ic("#",i(a))}`,browseblobtemplate:({domain:r,project:e,committish:n,path:a,hashformat:i})=>`https://${r}/${e}${Ic("/",Np(n))}${Ic("#",i(a))}`,docstemplate:({domain:r,project:e,committish:n})=>`https://${r}/${e}${Ic("/",Np(n))}`,httpstemplate:({domain:r,project:e,committish:n})=>`git+https://${r}/${e}.git${Ic("#",n)}`,filetemplate:({user:r,project:e,committish:n,path:a})=>`https://gist.githubusercontent.com/${r}/${e}/raw${Ic("/",Np(n))}/${a}`,shortcuttemplate:({type:r,project:e,committish:n})=>`${r}:${e}${Ic("#",n)}`,pathtemplate:({project:r,committish:e})=>`${r}${Ic("#",e)}`,bugstemplate:({domain:r,project:e})=>`https://${r}/${e}`,gittemplate:({domain:r,project:e,committish:n})=>`git://${r}/${e}.git${Ic("#",n)}`,tarballtemplate:({project:r,committish:e})=>`https://codeload.github.com/gist/${r}/tar.gz/${Np(e||"HEAD")}`,extract:r=>{let[,e,n,a]=r.pathname.split("/",4);if(a!=="raw"){if(!n){if(!e)return;n=e,e=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:e,project:n,committish:r.hash.slice(1)}}},hashformat:function(r){return r&&"file-"+qBn(r)}};GJ.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:r,user:e,project:n,committish:a,path:i})=>`https://${r}/${e}/${n}/blob/${Np(a)||"HEAD"}/${i}`,httpstemplate:({domain:r,user:e,project:n,committish:a})=>`https://${r}/${e}/${n}.git${Ic("#",a)}`,tarballtemplate:({domain:r,user:e,project:n,committish:a})=>`https://${r}/${e}/${n}/archive/${Np(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:r=>{let[,e,n,a]=r.pathname.split("/",4);if(!["archive"].includes(a)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),!(!e||!n)))return{user:e,project:n,committish:r.hash.slice(1)}}};for(let[r,e]of Object.entries(GJ))GJ[r]=Object.assign({},k5s,e);KBn.exports=GJ});var hPt=ve((JVl,tOn)=>{var H5s=Wt("url"),dPt=(r,e,n)=>{let a=r.indexOf(n);return r.lastIndexOf(e,a>-1?a:1/0)},eOn=r=>{try{return new H5s.URL(r)}catch{}},Q5s=(r,e)=>{let n=r.indexOf(":"),a=r.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(e,a))return r;let i=r.indexOf("@");return i>-1?i>n?`git+ssh://${r}`:r:r.indexOf("//")===n+1?r:`${r.slice(0,n+1)}//${r.slice(n+1)}`},X5s=r=>{let e=dPt(r,"@","#"),n=dPt(r,":","#");return n>e&&(r=r.slice(0,n)+"/"+r.slice(n+1)),dPt(r,":","#")===-1&&r.indexOf("//")===-1&&(r=`git+ssh://${r}`),r};tOn.exports=(r,e)=>{let n=e?Q5s(r,e):r;return eOn(n)||eOn(X5s(n))}});var nOn=ve((BVl,rOn)=>{"use strict";var S5s=hPt(),L5s=r=>{let e=r.indexOf("#"),n=r.indexOf("/"),a=r.indexOf("/",n+1),i=r.indexOf(":"),s=/\s/.exec(r),t=r.indexOf("@"),o=!s||e>-1&&s.index>e,u=t===-1||e>-1&&t>e,h=i===-1||e>-1&&i>e,d=a===-1||e>-1&&a>e,I=n>0,c=e>-1?r[e-1]!=="/":!r.endsWith("/"),m=!r.startsWith(".");return o&&I&&c&&m&&u&&h&&d};rOn.exports=(r,e,{gitHosts:n,protocols:a})=>{if(!r)return;let i=L5s(r)?`github:${r}`:r,s=S5s(i,a);if(!s)return;let t=n.byShortcut[s.protocol],o=n.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],u=t||o;if(!u)return;let h=n[t||o],d=null;a[s.protocol]?.auth&&(s.username||s.password)&&(d=`${s.username}${s.password?":"+s.password:""}`);let I=null,c=null,m=null,p=null;try{if(t){let f=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,N=f.indexOf("@");N>-1&&(f=f.slice(N+1));let v=f.lastIndexOf("/");v>-1?(c=decodeURIComponent(f.slice(0,v)),c||(c=null),m=decodeURIComponent(f.slice(v+1))):m=decodeURIComponent(f),m.endsWith(".git")&&(m=m.slice(0,-4)),s.hash&&(I=decodeURIComponent(s.hash.slice(1))),p="shortcut"}else{if(!h.protocols.includes(s.protocol))return;let f=h.extract(s);if(!f)return;c=f.user&&decodeURIComponent(f.user),m=decodeURIComponent(f.project),I=decodeURIComponent(f.committish),p=a[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(f){if(f instanceof URIError)return;throw f}return[u,c,d,m,I,p,e]}});var iOn=ve((OVl,aOn)=>{"use strict";var{LRUCache:T5s}=jBn(),J5s=$Bn(),B5s=nOn(),O5s=hPt(),IPt=new T5s({max:1e3}),uet=class r{constructor(e,n,a,i,s,t,o={}){Object.assign(this,r.#e[e],{type:e,user:n,auth:a,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,n){r.#e[e]=n,r.#e.byDomain[n.domain]=e,r.#e.byShortcut[`${e}:`]=e,r.#t[`${e}:`]={name:e}}static fromUrl(e,n){if(typeof e!="string")return;let a=e+JSON.stringify(n||{});if(!IPt.has(a)){let i=B5s(e,n,{gitHosts:r.#e,protocols:r.#t});IPt.set(a,i?new r(...i):void 0)}return IPt.get(a)}static parseUrl(e){return O5s(e)}#r(e,n){if(typeof e!="function")return null;let a={...this,...this.opts,...n};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=e(a);return a.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,...n){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof n[0]!="string"?this.#r(this.browsetreetemplate,{...n[0],path:e}):this.#r(this.browsetreetemplate,{...n[1],fragment:n[0],path:e})}browseFile(e,...n){return typeof n[0]!="string"?this.#r(this.browseblobtemplate,{...n[0],path:e}):this.#r(this.browseblobtemplate,{...n[1],fragment:n[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,n){return this.#r(this.filetemplate,{...n,path:e})}edit(e,n){return this.#r(this.edittemplate,{...n,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[r,e]of Object.entries(J5s))uet.addHost(r,e);aOn.exports=uet});var oOn=ve((_Vl,sOn)=>{sOn.exports=_5s;function _5s(r){if(!r||r==="ERROR: No README data found!")return;r=r.trim().split(`
|
|
8165
|
-
`);let e=0;for(;r[e]&&r[e].trim().match(/^(#|$)/);)e++;let n=r.length,a=e+1;for(;a<n&&r[a].trim();)a++;return r.slice(e,a).join(" ").trim()}});var lOn=ve((DVl,D5s)=>{D5s.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 hOn=ve((MVl,dOn)=>{var M5s=rPt(),U5s=nPt(),z5s=DBn(),det=iOn(),P5s=Wt("node:module"),j5s=["dependencies","devDependencies","optionalDependencies"],q5s=oOn(),mPt=Wt("url"),vJ=lOn(),cOn=r=>r.includes("@")&&r.indexOf("@")<r.lastIndexOf(".");dOn.exports={warn:function(){},fixRepositoryField:function(r){if(r.repositories&&(this.warn("repositories"),r.repository=r.repositories[0]),!r.repository)return this.warn("missingRepository");typeof r.repository=="string"&&(r.repository={type:"git",url:r.repository});var e=r.repository.url||"";if(e){var n=det.fromUrl(e);n&&(e=r.repository.url=n.getDefaultRepresentation()==="shortcut"?n.https():n.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(r){Object.keys(vJ.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(r,e)&&this.warn("typo",e,vJ.topLevel[e])},this)},fixScriptsField:function(r){if(r.scripts){if(typeof r.scripts!="object"){this.warn("nonObjectScripts"),delete r.scripts;return}Object.keys(r.scripts).forEach(function(e){typeof r.scripts[e]!="string"?(this.warn("nonStringScript"),delete r.scripts[e]):vJ.script[e]&&!r.scripts[vJ.script[e]]&&this.warn("typo",e,vJ.script[e],"scripts")},this)}},fixFilesField:function(r){var e=r.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete r.files):r.files&&(r.files=r.files.filter(function(n){return!n||typeof n!="string"?(this.warn("invalidFilename",n),!1):!0},this))},fixBinField:function(r){if(r.bin&&typeof r.bin=="string"){var e={},n;(n=r.name.match(/^@[^/]+[/](.*)$/))?e[n[1]]=r.bin:e[r.name]=r.bin,r.bin=e}},fixManField:function(r){r.man&&typeof r.man=="string"&&(r.man=[r.man])},fixBundleDependenciesField:function(r){var e="bundledDependencies",n="bundleDependencies";r[e]&&!r[n]&&(r[n]=r[e],delete r[e]),r[n]&&!Array.isArray(r[n])?(this.warn("nonArrayBundleDependencies"),delete r[n]):r[n]&&(r[n]=r[n].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(r.dependencies||(r.dependencies={}),Object.prototype.hasOwnProperty.call(r.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),r.dependencies[a]="*"),!0)},this))},fixDependencies:function(r){iAs(r,this.warn),nAs(r,this.warn),this.fixBundleDependenciesField(r),["dependencies","devDependencies"].forEach(function(e){if(e in r){if(!r[e]||typeof r[e]!="object"){this.warn("nonObjectDependencies",e),delete r[e];return}Object.keys(r[e]).forEach(function(n){var a=r[e][n];typeof a!="string"&&(this.warn("nonStringDependency",n,JSON.stringify(a)),delete r[e][n]);var i=det.fromUrl(r[e][n]);i&&(r[e][n]=i.toString())},this)}},this)},fixModulesField:function(r){r.modules&&(this.warn("deprecatedModules"),delete r.modules)},fixKeywordsField:function(r){typeof r.keywords=="string"&&(r.keywords=r.keywords.split(/,\s+/)),r.keywords&&!Array.isArray(r.keywords)?(delete r.keywords,this.warn("nonArrayKeywords")):r.keywords&&(r.keywords=r.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(r,e){var n=!e;if(!r.version)return r.version="",!0;if(!M5s(r.version,n))throw new Error('Invalid version: "'+r.version+'"');return r.version=U5s(r.version,n),!0},fixPeople:function(r){uOn(r,tAs),uOn(r,rAs)},fixNameField:function(r,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var n=e.strict;if(!r.name&&!n){r.name="";return}if(typeof r.name!="string")throw new Error("name field must be a string.");n||(r.name=r.name.trim()),eAs(r.name,n,e.allowLegacyCase),P5s.builtinModules.includes(r.name)&&this.warn("conflictingName",r.name)},fixDescriptionField:function(r){r.description&&typeof r.description!="string"&&(this.warn("nonStringDescription"),delete r.description),r.readme&&!r.description&&(r.description=q5s(r.readme)),r.description===void 0&&delete r.description,r.description||this.warn("missingDescription")},fixReadmeField:function(r){r.readme||(this.warn("missingReadme"),r.readme="ERROR: No README data found!")},fixBugsField:function(r){if(!r.bugs&&r.repository&&r.repository.url){var e=det.fromUrl(r.repository.url);e&&e.bugs()&&(r.bugs={url:e.bugs()})}else if(r.bugs){if(typeof r.bugs=="string")cOn(r.bugs)?r.bugs={email:r.bugs}:mPt.parse(r.bugs).protocol?r.bugs={url:r.bugs}:this.warn("nonEmailUrlBugsString");else{sAs(r.bugs,this.warn);var n=r.bugs;r.bugs={},n.url&&(typeof n.url=="string"&&mPt.parse(n.url).protocol?r.bugs.url=n.url:this.warn("nonUrlBugsUrlField")),n.email&&(typeof n.email=="string"&&cOn(n.email)?r.bugs.email=n.email:this.warn("nonEmailBugsEmailField"))}!r.bugs.email&&!r.bugs.url&&(delete r.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(r){if(!r.homepage&&r.repository&&r.repository.url){var e=det.fromUrl(r.repository.url);e&&e.docs()&&(r.homepage=e.docs())}if(r.homepage){if(typeof r.homepage!="string")return this.warn("nonUrlHomepage"),delete r.homepage;mPt.parse(r.homepage).protocol||(r.homepage="http://"+r.homepage)}},fixLicenseField:function(r){let e=r.license||r.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!z5s(e).validForNewPackages)return this.warn("invalidLicense")}};function K5s(r){if(r.charAt(0)!=="@")return!1;var e=r.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function $5s(r){return!r.match(/[/@\s+%:]/)&&r===encodeURIComponent(r)}function eAs(r,e,n){if(r.charAt(0)==="."||!(K5s(r)||$5s(r))||e&&!n&&r!==r.toLowerCase()||r.toLowerCase()==="node_modules"||r.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(r))}function uOn(r,e){return r.author&&(r.author=e(r.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(r[n])&&(r[n]=r[n].map(e))}),r}function tAs(r){if(typeof r=="string")return r;var e=r.name||"",n=r.url||r.web,a=n?" ("+n+")":"",i=r.email||r.mail,s=i?" <"+i+">":"";return e+s+a}function rAs(r){if(typeof r!="string")return r;var e=r.match(/^([^(<]+)/),n=r.match(/\(([^()]+)\)/),a=r.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),n&&(i.url=n[1]),i}function nAs(r){var e=r.optionalDependencies;if(e){var n=r.dependencies||{};Object.keys(e).forEach(function(a){n[a]=e[a]}),r.dependencies=n}}function aAs(r,e,n){if(!r)return{};if(typeof r=="string"&&(r=r.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(r))return r;n("deprecatedArrayDependencies",e);var a={};return r.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(/^@/,""),a[s]=t}),a}function iAs(r,e){j5s.forEach(function(n){r[n]&&(r[n]=aAs(r[n],n,e))})}function sAs(r,e){r&&Object.keys(r).forEach(function(n){vJ.bugs[n]&&(e("typo",n,vJ.bugs[n],"bugs"),r[vJ.bugs[n]]=r[n],delete r[n])})}});var IOn=ve((UVl,oAs)=>{oAs.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 fOn=ve((zVl,pOn)=>{var mOn=Wt("util"),pPt=IOn();pOn.exports=function(){var r=Array.prototype.slice.call(arguments,0),e=r.shift();if(e==="typo")return lAs.apply(null,r);var n=pPt[e]?pPt[e]:e+": '%s'";return r.unshift(n),mOn.format.apply(null,r)};function lAs(r,e,n){return n&&(r=n+"['"+r+"']",e=n+"['"+e+"']"),mOn.format(pPt.typo,r,e)}});var vOn=ve((PVl,GOn)=>{GOn.exports=bOn;var fPt=hOn();bOn.fixer=fPt;var cAs=fOn(),uAs=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],dAs=["dependencies","people","typos"],bPt=uAs.map(function(r){return gOn(r)+"Field"});bPt=bPt.concat(dAs);function bOn(r,e,n){e===!0&&(e=null,n=!0),n||(n=!1),(!e||r.private)&&(e=function(){}),r.scripts&&r.scripts.install==="node-gyp rebuild"&&!r.scripts.preinstall&&(r.gypfile=!0),fPt.warn=function(){e(cAs.apply(null,arguments))},bPt.forEach(function(a){fPt["fix"+gOn(a)](r,n)}),r._id=r.name+"@"+r.version}function gOn(r){return r.charAt(0).toUpperCase()+r.slice(1)}});var yOn=Xe(()=>{});import{fileURLToPath as hAs}from"node:url";function NOn(r){return r instanceof URL?hAs(r):r}var ZOn=Xe(()=>{yOn()});import IAs from"node:fs/promises";import mAs from"node:path";async function wOn({cwd:r,normalize:e=!0}={}){let n=await IAs.readFile(pAs(r),"utf8");return fAs(n,e)}var WOn,pAs,fAs,FOn=Xe(()=>{hBn();WOn=Vt(vOn(),1);ZOn();pAs=r=>mAs.resolve(NOn(r)??".","package.json"),fAs=(r,e)=>{let n=typeof r=="string"?jzt(r):r;return e&&(0,WOn.default)(n),n}});import bAs from"node:path";async function EOn(r){let e=await S8n("package.json",r);if(e)return{packageJson:await wOn({...r,cwd:bAs.dirname(e)}),path:e}}var ROn=Xe(()=>{L8n();FOn()});import{fileURLToPath as gAs}from"url";import GAs from"path";async function het(){if($ce)return $ce;let r=await EOn({cwd:yAs});if(!r){let e="easycode-cli",n="1.1.72";return e&&n?($ce={name:e,version:n},$ce):void 0}return $ce=r.packageJson,$ce}var vAs,yAs,$ce,gPt=Xe(()=>{"use strict";ROn();vAs=gAs(import.meta.url),yAs=GAs.dirname(vAs)});var AOn={};xs(AOn,{getCliVersion:()=>$H});async function $H(){let r=await het();return"1.1.72"}var eue=Xe(()=>{"use strict";gPt();});import iz from"node:process";var xOn,COn=Xe(()=>{"use strict";eue();Ni();Ls();hn();xOn={name:"about",description:Re("command.about.description"),kind:"built-in",action:async r=>{let e=iz.platform,n="no sandbox";iz.env.SANDBOX&&iz.env.SANDBOX!=="sandbox-exec"?n=iz.env.SANDBOX:iz.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${iz.env.SEATBELT_PROFILE||"unknown"})`);let a=r.services.config?.getModel()||"Unknown",i=await $H(),s=r.services.settings.merged.selectedAuthType||"",t=iz.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:n,modelVersion:a,selectedAuthType:s,gcpProject:t};r.ui.addItem(o,Date.now())}}});var YOn,VOn=Xe(()=>{"use strict";Ni();hn();YOn={name:"auth",altNames:["login"],description:Re("command.auth.description"),kind:"built-in",action:(r,e)=>({type:"dialog",dialog:"auth"})}});var kOn,HOn=Xe(()=>{"use strict";Ni();$r();hn();kOn={name:"logout",description:Re("command.logout.description"),kind:"built-in",action:(r,e)=>{let n=Is.getInstance();return n.isConfigured()?(n.clear(),{type:"message",messageType:"info",content:Re("command.logout.success")}):{type:"message",messageType:"info",content:Re("command.logout.not_logged_in")}}}});var QOn,XOn=Xe(()=>{"use strict";Ni();hn();QOn={name:"clear",description:Re("command.clear.description"),kind:"built-in",action:async(r,e)=>{r.ui.setDebugMessage("Clearing terminal screen."),r.ui.clear()}}});var SOn,LOn=Xe(()=>{"use strict";Ls();Ni();hn();SOn={name:"compress",altNames:["summarize","compact"],description:Re("command.compress.description"),kind:"built-in",action:async r=>{let{ui:e}=r,n=r.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(n?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:Re("command.compress.starting")},Date.now());let a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,s=await n?.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 NAs(r){let{config:e,settings:n}=r.services;if(!e||!n)return{type:"message",messageType:"error",content:Re("error.config.not.loaded")};let a=n.merged.vimMode||!1,i=e.getApprovalMode(),s=n.merged.preferredLanguage||Re("config.value.default");return{type:"message",messageType:"info",content:`\u2699\uFE0F ${Re("command.config.description")}
|
|
8165
|
+
`);let e=0;for(;r[e]&&r[e].trim().match(/^(#|$)/);)e++;let n=r.length,a=e+1;for(;a<n&&r[a].trim();)a++;return r.slice(e,a).join(" ").trim()}});var lOn=ve((DVl,D5s)=>{D5s.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 hOn=ve((MVl,dOn)=>{var M5s=rPt(),U5s=nPt(),z5s=DBn(),det=iOn(),P5s=Wt("node:module"),j5s=["dependencies","devDependencies","optionalDependencies"],q5s=oOn(),mPt=Wt("url"),vJ=lOn(),cOn=r=>r.includes("@")&&r.indexOf("@")<r.lastIndexOf(".");dOn.exports={warn:function(){},fixRepositoryField:function(r){if(r.repositories&&(this.warn("repositories"),r.repository=r.repositories[0]),!r.repository)return this.warn("missingRepository");typeof r.repository=="string"&&(r.repository={type:"git",url:r.repository});var e=r.repository.url||"";if(e){var n=det.fromUrl(e);n&&(e=r.repository.url=n.getDefaultRepresentation()==="shortcut"?n.https():n.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(r){Object.keys(vJ.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(r,e)&&this.warn("typo",e,vJ.topLevel[e])},this)},fixScriptsField:function(r){if(r.scripts){if(typeof r.scripts!="object"){this.warn("nonObjectScripts"),delete r.scripts;return}Object.keys(r.scripts).forEach(function(e){typeof r.scripts[e]!="string"?(this.warn("nonStringScript"),delete r.scripts[e]):vJ.script[e]&&!r.scripts[vJ.script[e]]&&this.warn("typo",e,vJ.script[e],"scripts")},this)}},fixFilesField:function(r){var e=r.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete r.files):r.files&&(r.files=r.files.filter(function(n){return!n||typeof n!="string"?(this.warn("invalidFilename",n),!1):!0},this))},fixBinField:function(r){if(r.bin&&typeof r.bin=="string"){var e={},n;(n=r.name.match(/^@[^/]+[/](.*)$/))?e[n[1]]=r.bin:e[r.name]=r.bin,r.bin=e}},fixManField:function(r){r.man&&typeof r.man=="string"&&(r.man=[r.man])},fixBundleDependenciesField:function(r){var e="bundledDependencies",n="bundleDependencies";r[e]&&!r[n]&&(r[n]=r[e],delete r[e]),r[n]&&!Array.isArray(r[n])?(this.warn("nonArrayBundleDependencies"),delete r[n]):r[n]&&(r[n]=r[n].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(r.dependencies||(r.dependencies={}),Object.prototype.hasOwnProperty.call(r.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),r.dependencies[a]="*"),!0)},this))},fixDependencies:function(r){iAs(r,this.warn),nAs(r,this.warn),this.fixBundleDependenciesField(r),["dependencies","devDependencies"].forEach(function(e){if(e in r){if(!r[e]||typeof r[e]!="object"){this.warn("nonObjectDependencies",e),delete r[e];return}Object.keys(r[e]).forEach(function(n){var a=r[e][n];typeof a!="string"&&(this.warn("nonStringDependency",n,JSON.stringify(a)),delete r[e][n]);var i=det.fromUrl(r[e][n]);i&&(r[e][n]=i.toString())},this)}},this)},fixModulesField:function(r){r.modules&&(this.warn("deprecatedModules"),delete r.modules)},fixKeywordsField:function(r){typeof r.keywords=="string"&&(r.keywords=r.keywords.split(/,\s+/)),r.keywords&&!Array.isArray(r.keywords)?(delete r.keywords,this.warn("nonArrayKeywords")):r.keywords&&(r.keywords=r.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(r,e){var n=!e;if(!r.version)return r.version="",!0;if(!M5s(r.version,n))throw new Error('Invalid version: "'+r.version+'"');return r.version=U5s(r.version,n),!0},fixPeople:function(r){uOn(r,tAs),uOn(r,rAs)},fixNameField:function(r,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var n=e.strict;if(!r.name&&!n){r.name="";return}if(typeof r.name!="string")throw new Error("name field must be a string.");n||(r.name=r.name.trim()),eAs(r.name,n,e.allowLegacyCase),P5s.builtinModules.includes(r.name)&&this.warn("conflictingName",r.name)},fixDescriptionField:function(r){r.description&&typeof r.description!="string"&&(this.warn("nonStringDescription"),delete r.description),r.readme&&!r.description&&(r.description=q5s(r.readme)),r.description===void 0&&delete r.description,r.description||this.warn("missingDescription")},fixReadmeField:function(r){r.readme||(this.warn("missingReadme"),r.readme="ERROR: No README data found!")},fixBugsField:function(r){if(!r.bugs&&r.repository&&r.repository.url){var e=det.fromUrl(r.repository.url);e&&e.bugs()&&(r.bugs={url:e.bugs()})}else if(r.bugs){if(typeof r.bugs=="string")cOn(r.bugs)?r.bugs={email:r.bugs}:mPt.parse(r.bugs).protocol?r.bugs={url:r.bugs}:this.warn("nonEmailUrlBugsString");else{sAs(r.bugs,this.warn);var n=r.bugs;r.bugs={},n.url&&(typeof n.url=="string"&&mPt.parse(n.url).protocol?r.bugs.url=n.url:this.warn("nonUrlBugsUrlField")),n.email&&(typeof n.email=="string"&&cOn(n.email)?r.bugs.email=n.email:this.warn("nonEmailBugsEmailField"))}!r.bugs.email&&!r.bugs.url&&(delete r.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(r){if(!r.homepage&&r.repository&&r.repository.url){var e=det.fromUrl(r.repository.url);e&&e.docs()&&(r.homepage=e.docs())}if(r.homepage){if(typeof r.homepage!="string")return this.warn("nonUrlHomepage"),delete r.homepage;mPt.parse(r.homepage).protocol||(r.homepage="http://"+r.homepage)}},fixLicenseField:function(r){let e=r.license||r.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!z5s(e).validForNewPackages)return this.warn("invalidLicense")}};function K5s(r){if(r.charAt(0)!=="@")return!1;var e=r.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function $5s(r){return!r.match(/[/@\s+%:]/)&&r===encodeURIComponent(r)}function eAs(r,e,n){if(r.charAt(0)==="."||!(K5s(r)||$5s(r))||e&&!n&&r!==r.toLowerCase()||r.toLowerCase()==="node_modules"||r.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(r))}function uOn(r,e){return r.author&&(r.author=e(r.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(r[n])&&(r[n]=r[n].map(e))}),r}function tAs(r){if(typeof r=="string")return r;var e=r.name||"",n=r.url||r.web,a=n?" ("+n+")":"",i=r.email||r.mail,s=i?" <"+i+">":"";return e+s+a}function rAs(r){if(typeof r!="string")return r;var e=r.match(/^([^(<]+)/),n=r.match(/\(([^()]+)\)/),a=r.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),n&&(i.url=n[1]),i}function nAs(r){var e=r.optionalDependencies;if(e){var n=r.dependencies||{};Object.keys(e).forEach(function(a){n[a]=e[a]}),r.dependencies=n}}function aAs(r,e,n){if(!r)return{};if(typeof r=="string"&&(r=r.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(r))return r;n("deprecatedArrayDependencies",e);var a={};return r.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(/^@/,""),a[s]=t}),a}function iAs(r,e){j5s.forEach(function(n){r[n]&&(r[n]=aAs(r[n],n,e))})}function sAs(r,e){r&&Object.keys(r).forEach(function(n){vJ.bugs[n]&&(e("typo",n,vJ.bugs[n],"bugs"),r[vJ.bugs[n]]=r[n],delete r[n])})}});var IOn=ve((UVl,oAs)=>{oAs.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 fOn=ve((zVl,pOn)=>{var mOn=Wt("util"),pPt=IOn();pOn.exports=function(){var r=Array.prototype.slice.call(arguments,0),e=r.shift();if(e==="typo")return lAs.apply(null,r);var n=pPt[e]?pPt[e]:e+": '%s'";return r.unshift(n),mOn.format.apply(null,r)};function lAs(r,e,n){return n&&(r=n+"['"+r+"']",e=n+"['"+e+"']"),mOn.format(pPt.typo,r,e)}});var vOn=ve((PVl,GOn)=>{GOn.exports=bOn;var fPt=hOn();bOn.fixer=fPt;var cAs=fOn(),uAs=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],dAs=["dependencies","people","typos"],bPt=uAs.map(function(r){return gOn(r)+"Field"});bPt=bPt.concat(dAs);function bOn(r,e,n){e===!0&&(e=null,n=!0),n||(n=!1),(!e||r.private)&&(e=function(){}),r.scripts&&r.scripts.install==="node-gyp rebuild"&&!r.scripts.preinstall&&(r.gypfile=!0),fPt.warn=function(){e(cAs.apply(null,arguments))},bPt.forEach(function(a){fPt["fix"+gOn(a)](r,n)}),r._id=r.name+"@"+r.version}function gOn(r){return r.charAt(0).toUpperCase()+r.slice(1)}});var yOn=Xe(()=>{});import{fileURLToPath as hAs}from"node:url";function NOn(r){return r instanceof URL?hAs(r):r}var ZOn=Xe(()=>{yOn()});import IAs from"node:fs/promises";import mAs from"node:path";async function wOn({cwd:r,normalize:e=!0}={}){let n=await IAs.readFile(pAs(r),"utf8");return fAs(n,e)}var WOn,pAs,fAs,FOn=Xe(()=>{hBn();WOn=Vt(vOn(),1);ZOn();pAs=r=>mAs.resolve(NOn(r)??".","package.json"),fAs=(r,e)=>{let n=typeof r=="string"?jzt(r):r;return e&&(0,WOn.default)(n),n}});import bAs from"node:path";async function EOn(r){let e=await S8n("package.json",r);if(e)return{packageJson:await wOn({...r,cwd:bAs.dirname(e)}),path:e}}var ROn=Xe(()=>{L8n();FOn()});import{fileURLToPath as gAs}from"url";import GAs from"path";async function het(){if($ce)return $ce;let r=await EOn({cwd:yAs});if(!r){let e="easycode-cli",n="1.1.73";return e&&n?($ce={name:e,version:n},$ce):void 0}return $ce=r.packageJson,$ce}var vAs,yAs,$ce,gPt=Xe(()=>{"use strict";ROn();vAs=gAs(import.meta.url),yAs=GAs.dirname(vAs)});var AOn={};xs(AOn,{getCliVersion:()=>$H});async function $H(){let r=await het();return"1.1.73"}var eue=Xe(()=>{"use strict";gPt();});import iz from"node:process";var xOn,COn=Xe(()=>{"use strict";eue();Ni();Ls();hn();xOn={name:"about",description:Re("command.about.description"),kind:"built-in",action:async r=>{let e=iz.platform,n="no sandbox";iz.env.SANDBOX&&iz.env.SANDBOX!=="sandbox-exec"?n=iz.env.SANDBOX:iz.env.SANDBOX==="sandbox-exec"&&(n=`sandbox-exec (${iz.env.SEATBELT_PROFILE||"unknown"})`);let a=r.services.config?.getModel()||"Unknown",i=await $H(),s=r.services.settings.merged.selectedAuthType||"",t=iz.env.GOOGLE_CLOUD_PROJECT||"",o={type:"about",cliVersion:i,osVersion:e,sandboxEnv:n,modelVersion:a,selectedAuthType:s,gcpProject:t};r.ui.addItem(o,Date.now())}}});var YOn,VOn=Xe(()=>{"use strict";Ni();hn();YOn={name:"auth",altNames:["login"],description:Re("command.auth.description"),kind:"built-in",action:(r,e)=>({type:"dialog",dialog:"auth"})}});var kOn,HOn=Xe(()=>{"use strict";Ni();$r();hn();kOn={name:"logout",description:Re("command.logout.description"),kind:"built-in",action:(r,e)=>{let n=Is.getInstance();return n.isConfigured()?(n.clear(),{type:"message",messageType:"info",content:Re("command.logout.success")}):{type:"message",messageType:"info",content:Re("command.logout.not_logged_in")}}}});var QOn,XOn=Xe(()=>{"use strict";Ni();hn();QOn={name:"clear",description:Re("command.clear.description"),kind:"built-in",action:async(r,e)=>{r.ui.setDebugMessage("Clearing terminal screen."),r.ui.clear()}}});var SOn,LOn=Xe(()=>{"use strict";Ls();Ni();hn();SOn={name:"compress",altNames:["summarize","compact"],description:Re("command.compress.description"),kind:"built-in",action:async r=>{let{ui:e}=r,n=r.services.config?.getGeminiClient();if(e.pendingItem){e.addItem({type:"error",text:"Already compressing, wait for previous request to complete"},Date.now());return}if(n?.isCompressionInProgress()){e.addItem({type:"error",text:"Compression already in progress at client level, please wait"},Date.now());return}e.addItem({type:"info",text:Re("command.compress.starting")},Date.now());let a={type:"compression",compression:{isPending:!0,originalTokenCount:null,newTokenCount:null}};try{e.setPendingItem(a);let i=`compress-${Date.now()}`,s=await n?.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 NAs(r){let{config:e,settings:n}=r.services;if(!e||!n)return{type:"message",messageType:"error",content:Re("error.config.not.loaded")};let a=n.merged.vimMode||!1,i=e.getApprovalMode(),s=n.merged.preferredLanguage||Re("config.value.default");return{type:"message",messageType:"info",content:`\u2699\uFE0F ${Re("command.config.description")}
|
|
8166
8166
|
|
|
8167
8167
|
${Re("command.config.available.options")}:
|
|
8168
8168
|
|