easycode-ai 1.1.1 → 1.1.2
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/easycode.js +12 -9
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -608,7 +608,7 @@ ${h}`)}return t}),dge=bYa(pJt);wge=class extends Ege{create(e,r){var n;let{api_v
|
|
|
608
608
|
`):[]}};SD.NEWLINE_CHARS=new Set([`
|
|
609
609
|
`,"\r"]);SD.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Cge={off:0,error:200,warn:300,info:400,debug:500},oJt=(a,e,r)=>{if(a){if($xa(Cge,a))return a;b2(r).warn(`${e} was set to ${JSON.stringify(a)}, expected one of ${JSON.stringify(Object.keys(Cge))}`)}};yYa={error:gre,warn:gre,info:gre,debug:gre},lJt=new WeakMap;kX=a=>(a.options&&(a.options=Object.assign({},a.options),delete a.options.headers),a.headers&&(a.headers=Object.fromEntries((a.headers instanceof Headers?[...a.headers]:Object.entries(a.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in a&&(a.retryOfRequestLogID&&(a.retryOf=a.retryOfRequestLogID),delete a.retryOfRequestLogID),a);IOe=class a{constructor(e,r,n){this.iterator=e,this.controller=r,this.client=n}static fromSSEResponse(e,r,n){let i=!1,o=n?b2(n):console;function t(){return QD(this,arguments,function*(){var u,I,d,h;if(i)throw new Ug("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,G=SX(AYa(e,r)),y;y=yield Ou(G.next()),u=y.done,!u;m=!0){h=y.value,m=!1;let N=h;if(!c)if(N.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield Ou(JSON.parse(N.data))}catch(Z){throw o.error("Could not parse message into JSON:",N.data),o.error("From chunk:",N.raw),Z}}}catch(N){I={error:N}}finally{try{!m&&!u&&(d=G.return)&&(yield Ou(d.call(G)))}finally{if(I)throw I.error}}c=!0}catch(N){if(lOe(N))return yield Ou(void 0);throw N}finally{c||r.abort()}})}return new a(t,r,n)}static fromReadableStream(e,r,n){let i=!1;function o(){return QD(this,arguments,function*(){var u,I,d,h;let c=new SD,m=IJt(e);try{for(var G=!0,y=SX(m),N;N=yield Ou(y.next()),u=N.done,!u;G=!0){h=N.value,G=!1;let Z=h;for(let R of c.decode(Z))yield yield Ou(R)}}catch(Z){I={error:Z}}finally{try{!G&&!u&&(d=y.return)&&(yield Ou(d.call(y)))}finally{if(I)throw I.error}}for(let Z of c.flush())yield yield Ou(Z)})}function t(){return QD(this,arguments,function*(){var u,I,d,h;if(i)throw new Ug("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,G=SX(o()),y;y=yield Ou(G.next()),u=y.done,!u;m=!0){h=y.value,m=!1;let N=h;c||N&&(yield yield Ou(JSON.parse(N)))}}catch(N){I={error:N}}finally{try{!m&&!u&&(d=G.return)&&(yield Ou(d.call(G)))}finally{if(I)throw I.error}}c=!0}catch(N){if(lOe(N))return yield Ou(void 0);throw N}finally{c||r.abort()}})}return new a(t,r,n)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let t=n.next();e.push(t),r.push(t)}return o.shift()}});return[new a(()=>i(e),this.controller,this.client),new a(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return dJt({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let t=fOe(JSON.stringify(i)+`
|
|
610
610
|
`);n.enqueue(t)}catch(i){n.error(i)}},async cancel(){var n;await((n=r.return)===null||n===void 0?void 0:n.call(r))}})}};hOe=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 o={event:this.event,data:this.data.join(`
|
|
611
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=NYa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};mOe=class a extends Promise{constructor(e,r,n=WYa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,this.client=e}_thenUnwrap(e){return new a(this.client,this.responsePromise,async(r,n)=>e(await this.parseResponse(r,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};fJt=Symbol("brand.privateNullableHeaders");bre=a=>{let e=new Headers,r=new Set;for(let n of a){let i=new Set;for(let[o,t]of FYa(n)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[fJt]:!0,values:e,nulls:r}};oOe=a=>{var e,r,n,i,o,t;if(typeof globalThis.process<"u")return(n=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[a])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,a))===null||t===void 0?void 0:t.trim()};xge=class a{constructor(e){var r,n,i,o,t,s,u,{baseURL:I=oOe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=oOe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=fge(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(n=m.timeout)!==null&&n!==void 0?n:a.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let G="warn";this.logLevel=G,this.logLevel=(t=(o=oJt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:oJt(oOe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:G,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:oYa(),this.encoder=uYa,this._options=m,this.apiKey=d,this.apiVersion=h,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:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.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 r=bre([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return bre([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return bre([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new Ug(`Cannot stringify type ${typeof n}; 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 ${VD}`}defaultIdempotencyKey(){return`stainless-node-retry-${_xa()}`}makeStatusError(e,r,n,i){return _g.generate(e,r,n,i)}buildURL(e,r,n){let i=!this.baseURLOverridden()&&n||this.baseURL,o=Pxa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return Kxa(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new mOe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){var i,o,t;let s=await e,u=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(s);let{req:I,url:d,timeout:h}=await this.buildRequest(s,{retryCount:u-r});await this.prepareRequest(I,{url:d,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=n===void 0?"":`, retryOf: ${n}`,G=Date.now();if(b2(this).debug(`[${c}] sending request`,kX({retryOfRequestLogID:n,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Gre;let y=new AbortController,N=await this.fetchWithTimeout(d,I,h,y).catch(cOe),Z=Date.now();if(N instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Gre;let w=lOe(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return b2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),b2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,kX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),this.retryRequest(s,r,n??c);throw b2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),b2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,kX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),w?new gge:new kD({cause:N})}let R=`[${c}${m}] ${I.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${Z-G}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let f=`retrying, ${r} attempts remaining`;return await cYa(N.body),b2(this).info(`${R} - ${f}`),b2(this).debug(`[${c}] response error (${f})`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),this.retryRequest(s,r,n??c,N.headers)}let w=F?"error; no more retries left":"error; not retryable";b2(this).info(`${R} - ${w}`);let b=await N.text().catch(f=>cOe(f).message),v=tYa(b),A=v?void 0:b;throw b2(this).debug(`[${c}] response error (${w})`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-G})),this.makeStatusError(N.status,v,A,N.headers)}return b2(this).info(R),b2(this).debug(`[${c}] response start`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),{response:N,options:s,controller:y,requestLogID:c,retryOfRequestLogID:n,startTime:G}}async fetchWithTimeout(e,r,n,i){let o=r||{},{signal:t,method:s}=o,u=fge(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),n),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);s&&(h.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let u=i?.get("retry-after");if(u&&!t){let I=parseFloat(u);Number.isNaN(I)?t=Date.parse(u)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(o=e.maxRetries)!==null&&o!==void 0?o:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await rYa(t),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var n,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&eYa("timeout",t.timeout),t.timeout=(n=t.timeout)!==null&&n!==void 0?n:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),G=await this.buildHeaders({options:e,method:s,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:s,headers:G},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(o=t.fetchOptions)!==null&&o!==void 0?o:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=bre([o,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))}:{}),sYa()),this._options.defaultHeaders,n,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=bre([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.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:lYa(e)}:this.encoder({body:e,headers:n})}};xge.DEFAULT_TIMEOUT=6e4;Y0=class extends xge{constructor(){super(...arguments),this.interactions=new Rge(this)}};bJt=Y0;Y0.GeminiNextGenAPIClient=bJt;Y0.GeminiNextGenAPIClientError=Ug;Y0.APIError=_g;Y0.APIConnectionError=kD;Y0.APIConnectionTimeoutError=gge;Y0.APIUserAbortError=Gre;Y0.NotFoundError=Age;Y0.ConflictError=Zge;Y0.RateLimitError=Wge;Y0.BadRequestError=Gge;Y0.AuthenticationError=vge;Y0.InternalServerError=Fge;Y0.PermissionDeniedError=yge;Y0.UnprocessableEntityError=Nge;Y0.toFile=pYa;Y0.Interactions=Rge;$Di=1024*1024*8;});function EYa(a,e){return{...a,...e}}function gJt(a){let{prompt_id:e,...r}=a;return r}function LX(a){return Array.isArray(a)?a.map(gJt):a}var Yge=ct(()=>{"use strict";hi();});var GJt={};lo(GJt,{DEFAULT_PROXY_CONFIG:()=>CYa,getActiveProxyServerUrl:()=>OF,getAvailableProxyServers:()=>wYa,getProxyServerInfo:()=>RYa,getProxyServers:()=>vre,hasAvailableProxyServer:()=>bOe});function vre(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function OF(){let e=vre().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function wYa(){return vre().filter(e=>e.status==="active")}function bOe(){return vre().some(e=>e.status==="active")}function RYa(a){return vre().find(r=>r.url===a)}var CYa,LD=ct(()=>{"use strict";CYa={serverUrl:OF(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as xYa}from"crypto";function _1(){return yre||(yre=xYa()),yre}function vJt(a){yre=a}function yJt(){yre=void 0}var yre,AJt,Vge=ct(()=>{"use strict";AJt=_1()});function Ad(a){let e=a??"1.1.1"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${gOe}/VSCode/${i} (${r}; ${n})`}return`${gOe}/CLI/${e} (${r}; ${n})`}var gOe,bY=ct(()=>{"use strict";gOe="EasyCode"});import*as Nu from"fs";import*as LN from"path";import*as BX from"os";function YYa(a){Ao.configure(a)}function VYa(a){Ao.setUserInfo(a)}function QYa(a){Ao.setCliVersion(a)}async function HYa(){return await Ao.getUserHeaders()}function XYa(){return Ao.getStatus()}var Are,Oo,Ao,gY=ct(()=>{"use strict";LD();Vge();bY();Are=259200,Oo=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Ad(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\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=LN.join(BX.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LN.join(BX.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LN.join(BX.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LN.join(BX.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LN.join(BX.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LN.join(BX.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.1",this.config={proxyServerUrl:OF()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Are*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${n} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return a.instance||(a.instance=new a),a.instance}loadUserInfo(){try{if(Nu.existsSync(this.userInfoFilePath)){let e=Nu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,o]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=LN.dirname(this.userInfoFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),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(Nu.existsSync(this.jwtTokenFilePath)){let e=Nu.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e);let r=Date.now();this.isTokenExpired()?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")}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=LN.dirname(this.jwtTokenFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),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(Nu.existsSync(this.usageStatsFilePath)){let e=Nu.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=LN.dirname(this.usageStatsFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),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.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Are*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), next renewal: ${t}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Are*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Are){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Are*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${o} (until ${t}), next renewal: ${s}${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{Nu.existsSync(this.jwtTokenFilePath)&&Nu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),n=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":n,"User-Agent":i,"X-Session-ID":_1()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),n={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":_1()};return this.jwtTokenData?.accessToken&&(n.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),n}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Nu.existsSync(this.userInfoFilePath)&&Nu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Nu.existsSync(this.jwtTokenFilePath)&&Nu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Ao=Oo.getInstance()});import{promises as JX}from"node:fs";import Zre from"node:path";import kYa from"os";var z1,Qge,ea,P1=ct(()=>{"use strict";(function(a){a[a.DEBUG=0]="DEBUG",a[a.INFO=1]="INFO",a[a.WARN=2]="WARN",a[a.ERROR=3]="ERROR"})(z1||(z1={}));Qge=class{config;logBuffer=[];constructor(e={}){if(this.config={level:z1.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Zre.join(kYa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...n){let i=new Date().toISOString(),o=n.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await JX.mkdir(Zre.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await JX.appendFile(this.config.filePath,e+`
|
|
611
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=NYa(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};mOe=class a extends Promise{constructor(e,r,n=WYa){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,this.client=e}_thenUnwrap(e){return new a(this.client,this.responsePromise,async(r,n)=>e(await this.parseResponse(r,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};fJt=Symbol("brand.privateNullableHeaders");bre=a=>{let e=new Headers,r=new Set;for(let n of a){let i=new Set;for(let[o,t]of FYa(n)){let s=o.toLowerCase();i.has(s)||(e.delete(o),i.add(s)),t===null?(e.delete(o),r.add(s)):(e.append(o,t),r.delete(s))}}return{[fJt]:!0,values:e,nulls:r}};oOe=a=>{var e,r,n,i,o,t;if(typeof globalThis.process<"u")return(n=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[a])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:void 0;if(typeof globalThis.Deno<"u")return(t=(o=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||o===void 0?void 0:o.call(i,a))===null||t===void 0?void 0:t.trim()};xge=class a{constructor(e){var r,n,i,o,t,s,u,{baseURL:I=oOe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=oOe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=fge(e,["baseURL","apiKey","apiVersion"]);let m=Object.assign(Object.assign({apiKey:d,apiVersion:h},c),{baseURL:I||"https://generativelanguage.googleapis.com"});this.baseURL=m.baseURL,this.timeout=(n=m.timeout)!==null&&n!==void 0?n:a.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let G="warn";this.logLevel=G,this.logLevel=(t=(o=oJt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:oJt(oOe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:G,this.fetchOptions=m.fetchOptions,this.maxRetries=(s=m.maxRetries)!==null&&s!==void 0?s:2,this.fetch=(u=m.fetch)!==null&&u!==void 0?u:oYa(),this.encoder=uYa,this._options=m,this.apiKey=d,this.apiVersion=h,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:r}){if(!(e.has("authorization")||e.has("x-goog-api-key"))&&!(this.apiKey&&e.get("x-goog-api-key"))&&!r.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 r=bre([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return bre([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return bre([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new Ug(`Cannot stringify type ${typeof n}; 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 ${VD}`}defaultIdempotencyKey(){return`stainless-node-retry-${_xa()}`}makeStatusError(e,r,n,i){return _g.generate(e,r,n,i)}buildURL(e,r,n){let i=!this.baseURLOverridden()&&n||this.baseURL,o=Pxa(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return Kxa(t)||(r=Object.assign(Object.assign({},t),r)),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let r=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${r}`}}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new mOe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){var i,o,t;let s=await e,u=(i=s.maxRetries)!==null&&i!==void 0?i:this.maxRetries;r==null&&(r=u),await this.prepareOptions(s);let{req:I,url:d,timeout:h}=await this.buildRequest(s,{retryCount:u-r});await this.prepareRequest(I,{url:d,options:s});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),m=n===void 0?"":`, retryOf: ${n}`,G=Date.now();if(b2(this).debug(`[${c}] sending request`,kX({retryOfRequestLogID:n,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Gre;let y=new AbortController,N=await this.fetchWithTimeout(d,I,h,y).catch(cOe),Z=Date.now();if(N instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Gre;let w=lOe(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):""));if(r)return b2(this).info(`[${c}] connection ${w?"timed out":"failed"} - ${F}`),b2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (${F})`,kX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),this.retryRequest(s,r,n??c);throw b2(this).info(`[${c}] connection ${w?"timed out":"failed"} - error; no more retries left`),b2(this).debug(`[${c}] connection ${w?"timed out":"failed"} (error; no more retries left)`,kX({retryOfRequestLogID:n,url:d,durationMs:Z-G,message:N.message})),w?new gge:new kD({cause:N})}let R=`[${c}${m}] ${I.method} ${d} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${Z-G}ms`;if(!N.ok){let F=await this.shouldRetry(N);if(r&&F){let f=`retrying, ${r} attempts remaining`;return await cYa(N.body),b2(this).info(`${R} - ${f}`),b2(this).debug(`[${c}] response error (${f})`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),this.retryRequest(s,r,n??c,N.headers)}let w=F?"error; no more retries left":"error; not retryable";b2(this).info(`${R} - ${w}`);let b=await N.text().catch(f=>cOe(f).message),v=tYa(b),A=v?void 0:b;throw b2(this).debug(`[${c}] response error (${w})`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-G})),this.makeStatusError(N.status,v,A,N.headers)}return b2(this).info(R),b2(this).debug(`[${c}] response start`,kX({retryOfRequestLogID:n,url:N.url,status:N.status,headers:N.headers,durationMs:Z-G})),{response:N,options:s,controller:y,requestLogID:c,retryOfRequestLogID:n,startTime:G}}async fetchWithTimeout(e,r,n,i){let o=r||{},{signal:t,method:s}=o,u=fge(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),n),d=globalThis.ReadableStream&&u.body instanceof globalThis.ReadableStream||typeof u.body=="object"&&u.body!==null&&Symbol.asyncIterator in u.body,h=Object.assign(Object.assign(Object.assign({signal:i.signal},d?{duplex:"half"}:{}),{method:"GET"}),u);s&&(h.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,h)}finally{clearTimeout(I)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){var o;let t,s=i?.get("retry-after-ms");if(s){let I=parseFloat(s);Number.isNaN(I)||(t=I)}let u=i?.get("retry-after");if(u&&!t){let I=parseFloat(u);Number.isNaN(I)?t=Date.parse(u)-Date.now():t=I*1e3}if(!(t&&0<=t&&t<60*1e3)){let I=(o=e.maxRetries)!==null&&o!==void 0?o:this.maxRetries;t=this.calculateDefaultRetryTimeoutMillis(r,I)}return await rYa(t),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,t=Math.min(.5*Math.pow(2,o),8),s=1-Math.random()*.25;return t*s*1e3}async buildRequest(e,{retryCount:r=0}={}){var n,i,o;let t=Object.assign({},e),{method:s,path:u,query:I,defaultBaseURL:d}=t,h=this.buildURL(u,I,d);"timeout"in t&&eYa("timeout",t.timeout),t.timeout=(n=t.timeout)!==null&&n!==void 0?n:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),G=await this.buildHeaders({options:e,method:s,bodyHeaders:c,retryCount:r});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:s,headers:G},t.signal&&{signal:t.signal}),globalThis.ReadableStream&&m instanceof globalThis.ReadableStream&&{duplex:"half"}),m&&{body:m}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(o=t.fetchOptions)!==null&&o!==void 0?o:{}),url:h,timeout:t.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let t=await this.authHeaders(e),s=bre([o,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))}:{}),sYa()),this._options.defaultHeaders,n,e.headers,t]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=bre([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.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:lYa(e)}:this.encoder({body:e,headers:n})}};xge.DEFAULT_TIMEOUT=6e4;Y0=class extends xge{constructor(){super(...arguments),this.interactions=new Rge(this)}};bJt=Y0;Y0.GeminiNextGenAPIClient=bJt;Y0.GeminiNextGenAPIClientError=Ug;Y0.APIError=_g;Y0.APIConnectionError=kD;Y0.APIConnectionTimeoutError=gge;Y0.APIUserAbortError=Gre;Y0.NotFoundError=Age;Y0.ConflictError=Zge;Y0.RateLimitError=Wge;Y0.BadRequestError=Gge;Y0.AuthenticationError=vge;Y0.InternalServerError=Fge;Y0.PermissionDeniedError=yge;Y0.UnprocessableEntityError=Nge;Y0.toFile=pYa;Y0.Interactions=Rge;$Di=1024*1024*8;});function EYa(a,e){return{...a,...e}}function gJt(a){let{prompt_id:e,...r}=a;return r}function LX(a){return Array.isArray(a)?a.map(gJt):a}var Yge=ct(()=>{"use strict";hi();});var GJt={};lo(GJt,{DEFAULT_PROXY_CONFIG:()=>CYa,getActiveProxyServerUrl:()=>OF,getAvailableProxyServers:()=>wYa,getProxyServerInfo:()=>RYa,getProxyServers:()=>vre,hasAvailableProxyServer:()=>bOe});function vre(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function OF(){let e=vre().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function wYa(){return vre().filter(e=>e.status==="active")}function bOe(){return vre().some(e=>e.status==="active")}function RYa(a){return vre().find(r=>r.url===a)}var CYa,LD=ct(()=>{"use strict";CYa={serverUrl:OF(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as xYa}from"crypto";function _1(){return yre||(yre=xYa()),yre}function vJt(a){yre=a}function yJt(){yre=void 0}var yre,AJt,Vge=ct(()=>{"use strict";AJt=_1()});function Ad(a){let e=a??"1.1.2"??"unknown",r=process.platform,n=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${gOe}/VSCode/${i} (${r}; ${n})`}return`${gOe}/CLI/${e} (${r}; ${n})`}var gOe,bY=ct(()=>{"use strict";gOe="EasyCode"});import*as Nu from"fs";import*as LN from"path";import*as BX from"os";function YYa(a){Ao.configure(a)}function VYa(a){Ao.setUserInfo(a)}function QYa(a){Ao.setCliVersion(a)}async function HYa(){return await Ao.getUserHeaders()}function XYa(){return Ao.getStatus()}var Are,Oo,Ao,gY=ct(()=>{"use strict";LD();Vge();bY();Are=259200,Oo=class a{static instance=null;config;userInfo=null;jwtTokenData=null;usageStats={totalCreditsConsumed:0,lastUpdated:new Date().toISOString()};userInfoFilePath;jwtTokenFilePath;usageStatsFilePath;refreshPromise=null;cliVersion="unknown";periodicStatusCheckIntervalId=null;onLoginSuccessCallbacks=[];getCliVersion(){return this.cliVersion}getUserAgent(){return Ad(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),n=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return n>0?`${n}\u5929${i}\u5C0F\u65F6${o}\u5206\u949F`:i>0?`${i}\u5C0F\u65F6${o}\u5206\u949F${t}\u79D2`:o>0?`${o}\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=LN.join(BX.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=LN.join(BX.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=LN.join(BX.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=LN.join(BX.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=LN.join(BX.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=LN.join(BX.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.2",this.config={proxyServerUrl:OF()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Are*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${n} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return a.instance||(a.instance=new a),a.instance}loadUserInfo(){try{if(Nu.existsSync(this.userInfoFilePath)){let e=Nu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=n=>{if(!n||!n.includes("@"))return n;let[i,o]=n.split("@");return i.length<=2?n:`${i[0]+"*".repeat(i.length-2)+i[i.length-1]}@${o}`}}}catch(e){console.warn("[Login Check] Failed to load user info from local file:",e),this.userInfo=null}}saveUserInfo(){try{let e=LN.dirname(this.userInfoFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.userInfoFilePath,JSON.stringify(this.userInfo,null,2)),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(Nu.existsSync(this.jwtTokenFilePath)){let e=Nu.readFileSync(this.jwtTokenFilePath,"utf8");this.jwtTokenData=JSON.parse(e);let r=Date.now();this.isTokenExpired()?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")}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=LN.dirname(this.jwtTokenFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.jwtTokenFilePath,JSON.stringify(this.jwtTokenData,null,2)),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(Nu.existsSync(this.usageStatsFilePath)){let e=Nu.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=LN.dirname(this.usageStatsFilePath);Nu.existsSync(e)||Nu.mkdirSync(e,{recursive:!0}),Nu.writeFileSync(this.usageStatsFilePath,JSON.stringify(this.usageStats,null,2)),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.triggerLoginSuccessCallbacks()}onLoginSuccess(e){this.onLoginSuccessCallbacks.push(e)}triggerLoginSuccessCallbacks(){this.onLoginSuccessCallbacks.forEach(e=>{try{e()}catch(r){console.error("[ProxyAuthManager] Error in login success callback:",r)}})}setCliVersion(e){this.cliVersion=e,console.log(`[Login Check] CLI version updated: ${e}`)}setJwtToken(e){let r=Date.now();this.jwtTokenData={accessToken:e,expiresIn:900,expiresAt:r+900*1e3,savedAt:new Date().toISOString()},this.saveJwtToken(),console.log("[Login Check] Access credential updated")}setJwtTokenData(e){let n=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:n,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(n),t=this.formatAbsoluteTime(n-Are*1e3),u=!!e.refreshToken?", will auto-renew":", manual login required";console.log(`[Login Check] Access credential updated - valid for: ${i} (until ${o}), next renewal: ${t}${u}`)}async getAccessToken(){if(!this.jwtTokenData)return console.log("[Login Check] No access credential available, authentication required"),null;let e=Date.now(),r=this.jwtTokenData.expiresAt-e,n=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-Are*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${n}), starting auto-renewal...`);try{return await this.refreshAccessToken()}catch(t){return console.error("[Login Check] Credential renewal failed:",t),null}}return this.jwtTokenData.accessToken}isTokenExpired(){return this.jwtTokenData?Date.now()>=this.jwtTokenData.expiresAt:!0}isTokenNearExpiry(e=Are){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),n=r<=e*1e3;if(n){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${n}`)}return n}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let n=Date.now(),i=!!r.data.refreshToken;this.jwtTokenData={accessToken:r.data.accessToken,refreshToken:r.data.refreshToken||this.jwtTokenData.refreshToken,expiresIn:r.data.expiresIn||900,expiresAt:n+(r.data.expiresIn||900)*1e3,savedAt:new Date().toISOString()},this.saveJwtToken();let o=this.formatTimeRemaining((r.data.expiresIn||900)*1e3),t=this.formatAbsoluteTime(this.jwtTokenData.expiresAt),s=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-Are*1e3);return console.log(`[Login Check] \u2705 Credential renewed successfully - valid for: ${o} (until ${t}), next renewal: ${s}${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{Nu.existsSync(this.jwtTokenFilePath)&&Nu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}}getProxyServerUrl(){return this.config.proxyServerUrl}async getUserHeaders(e){let r=await this.getAccessToken(),n=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":n,"User-Agent":i,"X-Session-ID":_1()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),n={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":_1()};return this.jwtTokenData?.accessToken&&(n.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),n}getUserInfo(){return this.userInfo}isConfigured(){return!!this.userInfo}getStatus(){return{configured:this.isConfigured(),proxyServerUrl:this.config.proxyServerUrl,hasUserInfo:!!this.userInfo,userInfo:this.userInfo}}clear(){this.userInfo=null,this.jwtTokenData=null,this.periodicStatusCheckIntervalId!==null&&(clearInterval(this.periodicStatusCheckIntervalId),this.periodicStatusCheckIntervalId=null);try{Nu.existsSync(this.userInfoFilePath)&&Nu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Nu.existsSync(this.jwtTokenFilePath)&&Nu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Ao=Oo.getInstance()});import{promises as JX}from"node:fs";import Zre from"node:path";import kYa from"os";var z1,Qge,ea,P1=ct(()=>{"use strict";(function(a){a[a.DEBUG=0]="DEBUG",a[a.INFO=1]="INFO",a[a.WARN=2]="WARN",a[a.ERROR=3]="ERROR"})(z1||(z1={}));Qge=class{config;logBuffer=[];constructor(e={}){if(this.config={level:z1.INFO,enableConsole:!0,enableFile:!1,maxFileSize:10,maxFiles:5,...e},this.config.enableFile&&!this.config.filePath){let r=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-");this.config.filePath=Zre.join(kYa.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...n){let i=new Date().toISOString(),o=n.map(t=>typeof t=="object"?JSON.stringify(t,null,2):String(t)).join(" ");return`[${i}] [${e}] ${r} ${o}`.trim()}async writeToFile(e){if(!(!this.config.enableFile||!this.config.filePath))try{await JX.mkdir(Zre.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await JX.appendFile(this.config.filePath,e+`
|
|
612
612
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await JX.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let n=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${n}.log`);await JX.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=Zre.dirname(this.config.filePath),n=(await JX.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Zre.join(e,t),time:JX.stat(Zre.join(e,t)).then(s=>s.mtime)})),i=await Promise.all(n.map(async t=>({...t,time:await t.time})));i.sort((t,s)=>s.time.getTime()-t.time.getTime());let o=i.slice(this.config.maxFiles||5);for(let t of o)await JX.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,n,...i){if(e<this.config.level)return;let o=this.formatMessage(r,n,...i);this.config.enableConsole&&(e>=z1.ERROR?console.error:e>=z1.WARN?console.warn:e>=z1.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log(z1.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(z1.INFO,"INFO",e,...r)}warn(e,...r){this.log(z1.WARN,"WARN",e,...r)}error(e,...r){this.log(z1.ERROR,"ERROR",e,...r)}logApiRequest(e,r){this.debug("API\u8BF7\u6C42",{endpoint:e,timestamp:new Date().toISOString(),requestSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{requestData:r}:{}})}logApiResponse(e,r){this.debug("API\u54CD\u5E94",{endpoint:e,timestamp:new Date().toISOString(),responseSize:JSON.stringify(r).length,...process.env.FILE_DEBUG==="1"?{responseData:r}:{}})}},ea=new Qge({level:process.env.FILE_DEBUG==="1"?z1.DEBUG:z1.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Zc(a){return a instanceof Error&&"code"in a}function fa(a){if(a instanceof Error)return a.message;try{return String(a)}catch{return"Failed to get error details"}}function GOe(a){if(a&&typeof a=="object"&&"response"in a){let r=SYa(a);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Xge(r.error.message);case 401:return new sI(r.error.message);case 403:return new Hge(r.error.message);default:}}return a}function SYa(a){return typeof a.response?.data=="string"?JSON.parse(a.response?.data):a.response?.data}function TX(a){if(!a)return!1;try{let e=JSON.parse(a);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var Hge,sI,Xge,Lc=ct(()=>{"use strict";Hge=class extends Error{},sI=class extends Error{},Xge=class extends Error{}});var yn,ZJt,Lh,sA=ct(()=>{"use strict";(function(a){a.CHAT_CONVERSATION="chat_conversation",a.WEB_FETCH="web_fetch",a.WEB_SEARCH="web_search",a.CONTENT_SUMMARY="content_summary",a.JSON_GENERATION="json_generation",a.COMPRESSION="compression",a.SUB_AGENT="sub_agent",a.CODE_ASSIST="code_assist",a.EDIT_CORRECTION="edit_correction",a.IMAGE_READER="image_reader"})(yn||(yn={}));ZJt={[yn.CHAT_CONVERSATION]:"auto",[yn.WEB_FETCH]:"gemini-2.5-flash",[yn.WEB_SEARCH]:"gemini-2.5-flash",[yn.CODE_ASSIST]:"auto",[yn.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[yn.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[yn.JSON_GENERATION]:"gemini-2.5-flash",[yn.COMPRESSION]:"gemini-2.5-flash",[yn.SUB_AGENT]:"auto",[yn.IMAGE_READER]:"gemini-2.5-flash"},Lh=class{static getModelForScene(e){if(e)return ZJt[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{[yn.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[yn.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[yn.WEB_SEARCH]:"Web\u641C\u7D22",[yn.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[yn.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[yn.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[yn.JSON_GENERATION]:"JSON\u751F\u6210",[yn.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[yn.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[yn.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B"}[e]||e}}});function oA(a){return typeof a=="object"&&a!==null&&"error"in a&&typeof a.error=="object"&&"message"in a.error}function Mf(a){return typeof a=="object"&&a!==null&&"message"in a&&typeof a.message=="string"}function BN(a){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof a=="string")return e(a);if(Mf(a))return e(a.message);if(oA(a))return e(a.error.message);if(a&&typeof a=="object"&&"response"in a){let r=a;if(r.response&&r.response.data){if(typeof r.response.data=="string")return e(r.response.data);if(typeof r.response.data=="object"&&r.response.data!==null&&"error"in r.response.data){let n=r.response.data;return e(n.error?.message||"")}}}return!1}function JN(a){return typeof a=="string"?a.includes("Quota exceeded for quota metric"):Mf(a)?a.message.includes("Quota exceeded for quota metric"):oA(a)?a.error.message.includes("Quota exceeded for quota metric"):!1}function zg(a){if(a&&typeof a=="object"&&"response"in a){let e=a;if(e.response?.status===402&&e.response.data){let r=e.response.data;if(r&&typeof r.error=="string"&&(r.error==="Quota limit exceeded"||r.error==="No quota configuration")&&typeof r.message=="string")return!0}if(e.response?.status===500&&e.response.data){let r=e.response.data;if(r&&typeof r.message=="string"&&r.message.includes("quota exceeded"))return!0}}if(a instanceof Error&&a.message&&(a.message.includes("API request failed (402):")&&(a.message.includes('"error":"Quota limit exceeded"')||a.message.includes('"error":"No quota configuration"'))||a.message.includes("API request failed (500):")&&a.message.includes("quota exceeded")||a.message.includes("Stream API error (500):")&&a.message.includes("quota exceeded")))return!0;if(typeof a=="object"&&a!==null){let e=a;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 a=="string"?a.includes("Quota limit exceeded")||a.includes("No quota configuration")||a.includes("Daily token limit would be exceeded")||a.includes("Daily request limit exceeded")||a.includes("Daily cost limit would be exceeded")||a.includes("500")&&a.includes("quota exceeded"):!1}function Nre(a){let e=null;if(a&&typeof a=="object"&&"response"in a){let r=a;if(r.response?.status===402&&r.response.data)e=r.response.data;else if(r.response?.status===500&&r.response.data){let n=r.response.data;n&&typeof n.message=="string"&&n.message.includes("quota exceeded")&&(e=n)}}else if(typeof a=="object"&&a!==null){let r=a;if(r.message&&typeof r.message=="string"&&(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 n=r.message.match(/\{.*\}$/);n&&(e=JSON.parse(n[0]))}catch{}e||(e=a)}if(!e&&a instanceof Error&&a.message&&(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 r=a.message.match(/\{.*\}$/);r&&(e=JSON.parse(r[0]))}catch{}return e?e.message&&e.message.includes("quota exceeded")?LYa(e):BYa(e):null}function LYa(a){let r=(()=>{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}})(),n="",i="",o="",t="",s=a.message||"",u=s.match(/Role:\s*([^,]+)/);u&&(n=u[1].trim());let I=s.match(/Limit:\s*([^,]+)/);I&&(i=I[1].trim());let d=s.match(/Used:\s*([^,]+)/);d&&(o=d[1].trim());let h=s.match(/Cycle:\s*([^,]+)/);if(h&&(t=h[1].trim()),r){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
|
|
613
613
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
614
614
|
`,n&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${n}
|
|
@@ -3732,7 +3732,7 @@ ${n}
|
|
|
3732
3732
|
\u{1F50D} Model Diagnostics: ${a}`),console.log(`\u{1F4CA} Reliability: ${r.capabilities.toolCallReliability}`),console.log(`\u{1F527} Format Tolerance: ${r.capabilities.needsFormatTolerance?"Yes":"No"}`),console.log(`\u{1F504} Max Concurrent Tools: ${r.capabilities.maxConcurrentTools}`),r.warnings.length>0&&(console.log(`
|
|
3733
3733
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(n=>console.log(` \u2022 ${n}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
3734
3734
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(n=>console.log(` \u2022 ${n}`))),e&&(console.log(`
|
|
3735
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function zIi(a){let e=sHe(a);return e.isSmallModel||e.needsSpecialHandling}function PIi(a){let e=sHe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var kta=ct(()=>{"use strict";hle();});import*as HZ from"fs";import*as oHe from"path";var jIi,qhe,Sta=ct(()=>{"use strict";Xm();jIi="healthy-use-reminder.json",qhe=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=ZG(e);this.stateFilePath=oHe.join(r,jIi)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let o=2700*1e3;return Date.now()-i.lastReminderShownAt>=o}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=oHe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var F3t,E3t,qIi,KIi,$Ii,Lta=ct(()=>{"use strict";F3t="--- Content from referenced files ---",E3t="--- End of content ---",qIi=2e3,KIi=2e3,$Ii=20});function Jta(...a){return ehi(...a)}function Tta(...a){return thi(...a)}function Bta(a,e){return a in e}function w3t(){let a={get(i,o){if(o==="write")return Jta;if(Bta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,o){if(o==="write")return Tta;if(Bta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var ehi,thi,Dta=ct(()=>{"use strict";ehi=process.stdout.write.bind(process.stdout),thi=process.stderr.write.bind(process.stderr)});import{readFile as rhi}from"node:fs/promises";import{fileURLToPath as ahi}from"node:url";import R3t from"node:path";function nhi(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return R3t.dirname(ahi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function BC(){return Khe||(Khe=(async()=>"1.1.1")(),Khe)}function ihi(){Khe=void 0}var Khe,C3t=ct(()=>{"use strict";});import{EventEmitter as shi}from"node:events";var $he,x3t,Y3t,Ota=ct(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})($he||($he={}));x3t=class{emitter=new shi;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Y3t=new x3t});function lHe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function ohi(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function V3t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??lHe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?lHe(r.content):[],i=ohi(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...lHe(r.content)),i)for(let o of r.toolCalls)n.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...lHe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Mta=ct(()=>{"use strict";});var qB,Uta,e0e,_ta=ct(()=>{"use strict";qB=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},Uta="latest",e0e=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw qB.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=n.length)return n[o-1];throw qB.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===Uta){let o=await this.listSessions();if(o.length===0)throw qB.noSessionsFound();n=o[o.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new qB(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function lhi(a,e,r){return new cHe(a,e,r)}var cHe,uHe,dHe,zta=ct(()=>{"use strict";sle();bY();cHe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(n,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(n,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Ad(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:m4("warn","\u26A0\uFE0F No access token available")}catch(n){m4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(m4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{m4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){m4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},o=fetch(e,i);return this.processRequestQueue(n),await o}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(m4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new uHe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:o})=>{o().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new dHe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},uHe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},dHe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function chi(a){return t0e.getInstance(a)}function uhi(a){let e=t0e.getInstance(a);return()=>e.handleAuthenticationRequired()}var t0e,Pta=ct(()=>{"use strict";gY();t0e=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Oo.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Oo.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function hHe(a){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${a||7863}/callback?plat=deepvlab`};return new IHe(r)}var IHe,Q3t=ct(()=>{"use strict";IHe=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 r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let n=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):n?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",n),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:n,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 mHe from"fs";import*as cg from"path";function dhi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var r0e,T9,H3t=ct(()=>{"use strict";r0e=dhi(),T9=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(cg.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(cg.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(cg.join(this.customBasePath,"auth","login","templates",e))),r0e&&r.push(cg.join(r0e,e)),r0e){let o=r0e;for(let t=0;t<10;t++)r.push(cg.join(o,"bundled","auth","login","templates",e)),r.push(cg.join(o,"bundled",e)),r.push(cg.join(o,"bundle","login","templates",e)),r.push(cg.join(o,"auth","login","templates",e)),o=cg.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(cg.join(o,"bundle","login","templates",e)),r.push(cg.join(o,"dist","bundled","auth","login","templates",e)),r.push(cg.join(o,"bundled","auth","login","templates",e)),r.push(cg.join(o,"auth","login","templates",e))}catch{}let n=null;for(let o of r)try{if(mHe.existsSync(o)){n=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${r0e||"(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=mHe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
3735
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function zIi(a){let e=sHe(a);return e.isSmallModel||e.needsSpecialHandling}function PIi(a){let e=sHe(a);return e.capabilities.toolCallReliability==="high"?"\u2705 Excellent tool calling compatibility":e.capabilities.toolCallReliability==="medium"?"\u{1F7E1} Good compatibility with enhanced error handling":"\u{1F7E0} Limited compatibility - enhanced robustness features active"}var kta=ct(()=>{"use strict";hle();});import*as HZ from"fs";import*as oHe from"path";var jIi,qhe,Sta=ct(()=>{"use strict";Xm();jIi="healthy-use-reminder.json",qhe=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=ZG(e);this.stateFilePath=oHe.join(r,jIi)}shouldShowReminder(){let r=new Date().getHours();if(!(r>=22||r<6))return this.clearState(),!1;let i=this.loadState();if(!i||i.lastReminderShownAt===0)return!0;let o=2700*1e3;return Date.now()-i.lastReminderShownAt>=o}markReminderShown(){this.saveState({lastReminderShownAt:Date.now()})}clearState(){try{HZ.existsSync(this.stateFilePath)&&HZ.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!HZ.existsSync(this.stateFilePath))return null;let e=HZ.readFileSync(this.stateFilePath,"utf-8");return JSON.parse(e)}catch(e){return process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to load state:",e),null}}saveState(e){try{let r=oHe.dirname(this.stateFilePath);HZ.existsSync(r)||HZ.mkdirSync(r,{recursive:!0}),HZ.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var F3t,E3t,qIi,KIi,$Ii,Lta=ct(()=>{"use strict";F3t="--- Content from referenced files ---",E3t="--- End of content ---",qIi=2e3,KIi=2e3,$Ii=20});function Jta(...a){return ehi(...a)}function Tta(...a){return thi(...a)}function Bta(a,e){return a in e}function w3t(){let a={get(i,o){if(o==="write")return Jta;if(Bta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,a),r={get(i,o){if(o==="write")return Tta;if(Bta(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},n=new Proxy(process.stderr,r);return{stdout:e,stderr:n}}var ehi,thi,Dta=ct(()=>{"use strict";ehi=process.stdout.write.bind(process.stdout),thi=process.stderr.write.bind(process.stderr)});import{readFile as rhi}from"node:fs/promises";import{fileURLToPath as ahi}from"node:url";import R3t from"node:path";function nhi(){let a=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return R3t.dirname(ahi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function BC(){return Khe||(Khe=(async()=>"1.1.2")(),Khe)}function ihi(){Khe=void 0}var Khe,C3t=ct(()=>{"use strict";});import{EventEmitter as shi}from"node:events";var $he,x3t,Y3t,Ota=ct(()=>{"use strict";(function(a){a.ApprovalModeChanged="approval_mode_changed"})($he||($he={}));x3t=class{emitter=new shi;on(e,r){return this.emitter.on(e,r),()=>this.emitter.off(e,r)}off(e,r){this.emitter.off(e,r)}emit(e,r){this.emitter.emit(e,r)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}},Y3t=new x3t});function lHe(a){return Array.isArray(a)?a.map(e=>typeof e=="string"?{text:e}:e):typeof a=="string"?[{text:a}]:[a]}function ohi(a){return a.map(e=>typeof e.text=="string"?e.text:"").join("")}function V3t(a){if(!a||a.length===0)return[];let e=[];for(let r of a){if(r.role&&(r.parts||r.content!==void 0)){let n=r.parts??lHe(r.content);e.push({role:r.role,parts:n});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let n=r.content!==void 0?lHe(r.content):[],i=ohi(n).trim();if(i.startsWith("/")||i.startsWith("?")||n.length===0)continue;e.push({role:"user",parts:n});continue}if(r.type==="gemini"){let n=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;n.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&n.push(...lHe(r.content)),i)for(let o of r.toolCalls)n.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(n.length>0&&e.push({role:"model",parts:n}),i){let o=[];for(let t of r.toolCalls)t.result!==void 0&&(typeof t.result=="string"?o.push({functionResponse:{id:t.id,name:t.name,response:{output:t.result}}}):Array.isArray(t.result)?o.push(...lHe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Mta=ct(()=>{"use strict";});var qB,Uta,e0e,_ta=ct(()=>{"use strict";qB=class a extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new a("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new a(`Session '${e}' was not found under ${r}.`)}},Uta="latest",e0e=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(n=>n.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,n)=>new Date(r.startTime).getTime()-new Date(n.startTime).getTime())}async findSession(e){let r=e.trim(),n=await this.listSessions();if(n.length===0)throw qB.noSessionsFound();let i=n.find(t=>t.id===r);if(i)return i;let o=Number.parseInt(r,10);if(Number.isInteger(o)&&o.toString()===r&&o>0&&o<=n.length)return n[o-1];throw qB.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),n;if(r===Uta){let o=await this.listSessions();if(o.length===0)throw qB.noSessionsFound();n=o[o.length-1]}else n=await this.findSession(r);let i=await this.manager.loadSession(n.id);if(!i)throw new qB(`Session '${n.id}' exists in index but could not be loaded.`);return{session:n,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function lhi(a,e,r){return new cHe(a,e,r)}var cHe,uHe,dHe,zta=ct(()=>{"use strict";sle();bY();cHe=class a{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,n){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=n}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let n=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(n,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(n,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,n={}){let i={...n,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async put(e,r,n={}){let i={...n,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!n.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...n.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Ad(),...e.headers};if(this.tokenManager)try{let n=await this.tokenManager.getAccessToken();n?r.Authorization=`Bearer ${n}`:m4("warn","\u26A0\uFE0F No access token available")}catch(n){m4("warn","\u26A0\uFE0F Failed to get access token:",n),this.onAuthenticationRequired&&n instanceof Error&&n.message?.includes("authentication required")&&(m4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((n,i)=>{this.requestQueue.push({resolve:n,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{m4("log","\u{1F504} Access token expired, attempting refresh...");let n=await this.tokenManager.refreshAccessToken();if(n){m4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${n}`}},o=fetch(e,i);return this.processRequestQueue(n),await o}else throw new Error("Failed to refresh token")}catch(n){throw console.error("\u274C Token refresh failed:",n),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(m4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new uHe("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:n,reject:i,request:o})=>{o().then(t=>n(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:n})=>{n(e)})}static async checkResponse(e){if(!e.ok){let n=await e.text();throw new dHe(`HTTP ${e.status}: ${e.statusText}`,e.status,n)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let n=await this.request(e,r);return a.checkResponse(n)}async postJson(e,r){let n=await this.post(e,r);return a.checkResponse(n)}async putJson(e,r){let n=await this.put(e,r);return a.checkResponse(n)}async getJson(e){let r=await this.get(e);return a.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return a.checkResponse(r)}},uHe=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},dHe=class extends Error{status;response;constructor(e,r,n){super(e),this.name="HttpError",this.status=r,this.response=n}}});function chi(a){return t0e.getInstance(a)}function uhi(a){let e=t0e.getInstance(a);return()=>e.handleAuthenticationRequired()}var t0e,Pta=ct(()=>{"use strict";gY();t0e=class a{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}updateConfig(e){this.config={...this.config,...e}}async handleAuthenticationRequired(){if(this.isAuthenticating){console.log("[AuthNavigator] Authentication already in progress, skipping...");return}this.isAuthenticating=!0;try{console.log("\u{1F510} [AuthNavigator] Authentication required"),Oo.getInstance().clear(),this.config.customAuthHandler?(console.log("[AuthNavigator] Using custom authentication handler"),await this.config.customAuthHandler()):await this.handleDefaultAuthentication()}catch(e){console.error("[AuthNavigator] Authentication handling failed:",e)}finally{this.isAuthenticating=!1}}async handleDefaultAuthentication(){console.log("[AuthNavigator] Starting default authentication flow"),typeof process<"u"&&process.argv?await this.handleCLIAuthentication():await this.handleWebAuthentication()}async handleCLIAuthentication(){console.log(""),console.log("\u{1F510} \u8BA4\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u9700\u8981\u91CD\u65B0\u8BA4\u8BC1"),console.log("\u{1F4A1} \u8BF7\u5728CLI\u4E2D\u8F93\u5165 /auth \u547D\u4EE4\u8FDB\u884C\u91CD\u65B0\u8BA4\u8BC1"),console.log("")}async handleWebAuthentication(){if(typeof window<"u"){let n=`${Oo.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${n}`),window.location.href=n}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function hHe(a){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${a||7863}/callback?plat=deepvlab`};return new IHe(r)}var IHe,Q3t=ct(()=>{"use strict";IHe=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 r=Object.fromEntries(e.searchParams.entries());console.log("\u{1F504} [DeepVlab Auth] \u56DE\u8C03\u53C2\u6570:",r);let n=e.searchParams.get("token"),i=e.searchParams.get("user_id"),o=e.searchParams.get("error");return o?(console.error("\u274C [DeepVlab Auth] \u8BA4\u8BC1\u9519\u8BEF:",o),{success:!1,error:`DeepVlab\u8BA4\u8BC1\u5931\u8D25: ${o}`}):n?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",n),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:n,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 mHe from"fs";import*as cg from"path";function dhi(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var r0e,T9,H3t=ct(()=>{"use strict";r0e=dhi(),T9=class{static cache=new Map;static customBasePath=null;static setBasePath(e){this.customBasePath=e,console.log(`\u{1F4C1} [AuthTemplates] Custom base path set: ${e}`)}static getAuthSelectPage(){return this.loadTemplate("authSelectPage.html")}static getFeishuSuccessPage(){return this.generateFeishuSuccessTemplate()}static getDeepvlabSuccessPage(){return this.generateDeepvlabSuccessTemplate()}static getErrorPage(e){return this.generateErrorTemplate(e)}static loadTemplate(e){if(this.cache.has(e))return this.cache.get(e);try{let r=[];if(this.customBasePath&&(r.push(cg.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(cg.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(cg.join(this.customBasePath,"auth","login","templates",e))),r0e&&r.push(cg.join(r0e,e)),r0e){let o=r0e;for(let t=0;t<10;t++)r.push(cg.join(o,"bundled","auth","login","templates",e)),r.push(cg.join(o,"bundled",e)),r.push(cg.join(o,"bundle","login","templates",e)),r.push(cg.join(o,"auth","login","templates",e)),o=cg.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(cg.join(o,"bundle","login","templates",e)),r.push(cg.join(o,"dist","bundled","auth","login","templates",e)),r.push(cg.join(o,"bundled","auth","login","templates",e)),r.push(cg.join(o,"auth","login","templates",e))}catch{}let n=null;for(let o of r)try{if(mHe.existsSync(o)){n=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!n){if(console.warn(`\u26A0\uFE0F [AuthTemplates] Template ${e} not found in any location.`),console.warn(` Tried ${r.length} paths. First 5:`),r.slice(0,5).forEach((o,t)=>console.warn(` ${t+1}. ${o}`)),console.warn(` Current dirname: ${r0e||"(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=mHe.readFileSync(n,"utf-8");return this.cache.set(e,i),i}catch(r){return console.error(`\u274C [AuthTemplates] Failed to load template ${e}:`,r),this.generateBasicAuthSelectTemplate()}}static generateBasicAuthSelectTemplate(){return`
|
|
3736
3736
|
<!DOCTYPE html>
|
|
3737
3737
|
<html>
|
|
3738
3738
|
<head>
|
|
@@ -4766,7 +4766,7 @@ ${c}`),n?i.reset(c):c}function Epi(a,e,r,n={}){if(!Bna){Bna=!0;let o="Passing li
|
|
|
4766
4766
|
|
|
4767
4767
|
${e}
|
|
4768
4768
|
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=xpi(r,this.#t.message);if(n)return(0,Pna.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#a??=this.#i(!0),this.#a}get rawCodeFrame(){return this.#n??=this.#i(!1),this.#n}},xpi=(a,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:vWt(a,Number(n),{oneBased:!0})},Ypi=a=>a.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Cpi(n)})`)});var ZWt=Ze((Qqs,Vpi)=>{Vpi.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 qna=Ze((Hqs,Qpi)=>{Qpi.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 Kna=Ze((Xqs,Hpi)=>{Hpi.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 eia=Ze((kqs,$na)=>{"use strict";var Xpi=[].concat(ZWt()).concat(qna()),kpi=Kna();$na.exports=function(a){var e=0;function r(){return e<a.length}function n(G){if(G instanceof RegExp){var y=a.slice(e),N=y.match(G);if(N)return e+=N[0].length,N[0]}else if(a.indexOf(G,e)===e)return e+=G.length,G}function i(){n(/[ ]*/)}function o(){for(var G,y=["WITH","AND","OR","(",")",":","+"],N=0;N<y.length&&(G=n(y[N]),!G);N++);if(G==="+"&&e>1&&a[e-2]===" ")throw new Error("Space before `+`");return G&&{type:"OPERATOR",string:G}}function t(){return n(/[A-Za-z0-9-.]+/)}function s(){var G=t();if(!G)throw new Error("Expected idstring at offset "+e);return G}function u(){if(n("DocumentRef-")){var G=s();return{type:"DOCUMENTREF",string:G}}}function I(){if(n("LicenseRef-")){var G=s();return{type:"LICENSEREF",string:G}}}function d(){var G=e,y=t();if(Xpi.indexOf(y)!==-1)return{type:"LICENSE",string:y};if(kpi.indexOf(y)!==-1)return{type:"EXCEPTION",string:y};e=G}function h(){return o()||u()||I()||d()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+a[e]+"` at offset "+e);c.push(m)}return c}});var ria=Ze((Sqs,tia)=>{"use strict";tia.exports=function(a){var e=0;function r(){return e<a.length}function n(){return r()?a[e]:null}function i(){if(!r())throw new Error;e++}function o(y){var N=n();if(N&&N.type==="OPERATOR"&&y===N.string)return i(),N.string}function t(){if(o("WITH")){var y=n();if(y&&y.type==="EXCEPTION")return i(),y.string;throw new Error("Expected exception after `WITH`")}}function s(){var y=e,N="",Z=n();if(Z.type==="DOCUMENTREF"&&(i(),N+="DocumentRef-"+Z.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(Z=n(),Z.type==="LICENSEREF")return i(),N+="LicenseRef-"+Z.string,{license:N};e=y}function u(){var y=n();if(y&&y.type==="LICENSE"){i();var N={license:y.string};o("+")&&(N.plus=!0);var Z=t();return Z&&(N.exception=Z),N}}function I(){var y=o("(");if(y){var N=m();if(!o(")"))throw new Error("Expected `)`");return N}}function d(){return I()||s()||u()}function h(y,N){return function Z(){var R=N();if(R){if(!o(y))return R;var F=Z();if(!F)throw new Error("Expected expression");return{left:R,conjunction:y.toLowerCase(),right:F}}}}var c=h("AND",d),m=h("OR",c),G=m();if(!G||r())throw new Error("Syntax error");return G}});var NWt=Ze((Lqs,aia)=>{"use strict";var Spi=eia(),Lpi=ria();aia.exports=function(a){return Lpi(Spi(a))}});var Iia=Ze((Bqs,dia)=>{var Bpi=NWt(),Jpi=ZWt();function rXe(a){try{return Bpi(a),!0}catch{return!1}}function uia(a,e){var r=e[0].length-a[0].length;return r!==0?r:a[0].toUpperCase().localeCompare(e[0].toUpperCase())}var nia=[["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(uia),Tpi=0,Dpi=1,iia=[function(a){return a.toUpperCase()},function(a){return a.trim()},function(a){return a.replace(/\./g,"")},function(a){return a.replace(/\s+/g,"")},function(a){return a.replace(/\s+/g,"-")},function(a){return a.replace("v","-")},function(a){return a.replace(/,?\s*(\d)/,"-$1")},function(a){return a.replace(/,?\s*(\d)/,"-$1.0")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(a){return a.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(a){return a[0].toUpperCase()+a.slice(1)},function(a){return a.replace("/","-")},function(a){return a.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(a){return a.indexOf("3.0")!==-1?a+"-or-later":a+"-only"},function(a){return a+"only"},function(a){return a.replace(/(\d)$/,"-$1.0")},function(a){return a.replace(/(-| )?(\d)$/,"-$2-Clause")},function(a){return a.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(a){return a.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(a){return a.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(a){return a.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(a){return a.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(a){return a.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(a){return"CC-"+a},function(a){return"CC-"+a+"-4.0"},function(a){return a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(a){return"CC-"+a.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],WWt=Jpi.map(function(a){var e=/^(.*)-\d+\.\d+$/.exec(a);return e?[e[0],e[1]]:[a,null]}).reduce(function(a,e){var r=e[1];return a[r]=a[r]||[],a[r].push(e[0]),a},{}),Opi=Object.keys(WWt).map(function(e){return[e,WWt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});WWt=void 0;var sia=[["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(Opi).sort(uia),Mpi=0,Upi=1,oia=function(a){for(var e=0;e<iia.length;e++){var r=iia[e](a).trim();if(r!==a&&rXe(r))return r}return null},lia=function(a){for(var e=a.toUpperCase(),r=0;r<sia.length;r++){var n=sia[r];if(e.indexOf(n[Mpi])>-1)return n[Upi]}return null},cia=function(a,e){for(var r=0;r<nia.length;r++){var n=nia[r],i=n[Tpi];if(a.indexOf(i)>-1){var o=a.replace(i,n[Dpi]),t=e(o);if(t!==null)return t}}return null};dia.exports=function(a,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(s){return r?_pi(s):s}var i=typeof a=="string"&&a.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(a=a.trim(),rXe(a))return n(a);var o=a.replace(/\+$/,"").trim();if(rXe(o))return n(o);var t=oia(a);return t!==null||(t=cia(a,function(s){return rXe(s)?s:oia(s)}),t!==null)||(t=lia(a),t!==null)||(t=cia(a,lia),t!==null)?n(t):null};function _pi(a){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(a)!==-1?a+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(a)!==-1?a.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(a)!==-1?a+"-or-later":a}});var fia=Ze((Jqs,pia)=>{var zpi=NWt(),Ppi=Iia(),hia='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',jpi=/^SEE LICEN[CS]E IN (.+)$/;function mia(a,e){return e.slice(0,a.length)===a}function FWt(a){if(a.hasOwnProperty("license")){var e=a.license;return mia("LicenseRef",e)||mia("DocumentRef",e)}else return FWt(a.left)||FWt(a.right)}pia.exports=function(a){var e;try{e=zpi(a)}catch{var r;if(a==="UNLICENSED"||a==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=jpi.exec(a))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[hia]};if(a.trim().length!==0){var i=Ppi(a);i&&n.warnings.push('license is similar to the valid expression "'+i+'"')}return n}return FWt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[hia]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var yia=Ze(nXe=>{"use strict";Object.defineProperty(nXe,"__esModule",{value:!0});nXe.LRUCache=void 0;var NK=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,gia=new Set,EWt=typeof process=="object"&&process?process:{},Gia=(a,e,r,n)=>{typeof EWt.emitWarning=="function"?EWt.emitWarning(a,e,r,n):console.error(`[${r}] ${e}: ${a}`)},aXe=globalThis.AbortController,bia=globalThis.AbortSignal;if(typeof aXe>"u"){bia=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},aXe=class{constructor(){e()}signal=new bia;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let a=EWt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{a&&(a=!1,Gia("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 qpi=a=>!gia.has(a),Oqs=Symbol("type"),$9=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),via=a=>$9(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?WK:null:null,WK=class extends Array{constructor(e){super(e),this.fill(0)}},wWt=class a{heap;length;static#e=!1;static create(e){let r=via(e);if(!r)return[];a.#e=!0;let n=new a(e,r);return a.#e=!1,n}constructor(e,r){if(!a.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},RWt=class a{#e;#t;#r;#a;#n;#i;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#o;#s;#I;#d;#h;#l;#m;#b;#A;#f;#E;#G;#Z;#N;#y;#g;static unsafeExposeInternals(e){return{starts:e.#G,ttls:e.#Z,sizes:e.#E,keyMap:e.#s,keyList:e.#I,valList:e.#d,next:e.#h,prev:e.#l,get head(){return e.#m},get tail(){return e.#b},free:e.#A,isBackgroundFetch:r=>e.#v(r),backgroundFetch:(r,n,i,o)=>e.#x(r,n,i,o),moveToTail:r=>e.#D(r),indexes:r=>e.#L(r),rindexes:r=>e.#V(r),isStale:r=>e.#R(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#u}get fetchMethod(){return this.#n}get memoMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#a}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:t,updateAgeOnHas:s,allowStale:u,dispose:I,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:G=0,sizeCalculation:y,fetchMethod:N,memoMethod:Z,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:b,ignoreFetchAbort:v}=e;if(r!==0&&!$9(r))throw new TypeError("max option must be a nonnegative integer");let A=r?via(r):Array;if(!A)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=G||this.#t,this.sizeCalculation=y,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Z!==void 0&&typeof Z!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#i=Z,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#n=N,this.#y=!!N,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new A(r),this.#l=new A(r),this.#m=0,this.#b=0,this.#A=wWt.create(r),this.#u=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof d=="function"?(this.#a=d,this.#f=[]):(this.#a=void 0,this.#f=void 0),this.#N=!!this.#r,this.#g=!!this.#a,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#t!==0&&!$9(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!$9(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!t,this.updateAgeOnHas=!!s,this.ttlResolution=$9(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!$9(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#W()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let E="LRU_CACHE_UNBOUNDED";qpi(E)&&(gia.add(E),Gia("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,a))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#W(){let e=new WK(this.#e),r=new WK(this.#e);this.#Z=e,this.#G=r,this.#H=(o,t,s=NK.now())=>{if(r[o]=t!==0?s:0,e[o]=t,t!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#R(o)&&this.#k(this.#I[o],"expire")},t+1);u.unref&&u.unref()}},this.#w=o=>{r[o]=e[o]!==0?NK.now():0},this.#c=(o,t)=>{if(e[t]){let s=e[t],u=r[t];if(!s||!u)return;o.ttl=s,o.start=u,o.now=n||i();let I=o.now-u;o.remainingTTL=s-I}};let n=0,i=()=>{let o=NK.now();if(this.ttlResolution>0){n=o;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return o};this.getRemainingTTL=o=>{let t=this.#s.get(o);if(t===void 0)return 0;let s=e[t],u=r[t];if(!s||!u)return 1/0;let I=(n||i())-u;return s-I},this.#R=o=>{let t=r[o],s=e[o];return!!s&&!!t&&(n||i())-t>s}}#w=()=>{};#c=()=>{};#H=()=>{};#R=()=>!1;#C(){let e=new WK(this.#e);this.#o=0,this.#E=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#F=(r,n,i,o)=>{if(this.#v(n))return 0;if(!$9(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(n,r),!$9(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#S=(r,n,i)=>{if(e[r]=n,this.#t){let o=this.#t-e[r];for(;this.#o>o;)this.#B(!0)}this.#o+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,n)=>{};#F=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#b;!(!this.#X(r)||((e||!this.#R(r))&&(yield r),r===this.#m));)r=this.#l[r]}*#V({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#m;!(!this.#X(r)||((e||!this.#R(r))&&(yield r),r===this.#b));)r=this.#h[r]}#X(e){return e!==void 0&&this.#s.get(this.#I[e])===e}*entries(){for(let e of this.#L())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#v(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*rentries(){for(let e of this.#V())this.#d[e]!==void 0&&this.#I[e]!==void 0&&!this.#v(this.#d[e])&&(yield[this.#I[e],this.#d[e]])}*keys(){for(let e of this.#L()){let r=this.#I[e];r!==void 0&&!this.#v(this.#d[e])&&(yield r)}}*rkeys(){for(let e of this.#V()){let r=this.#I[e];r!==void 0&&!this.#v(this.#d[e])&&(yield r)}}*values(){for(let e of this.#L())this.#d[e]!==void 0&&!this.#v(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#V())this.#d[e]!==void 0&&!this.#v(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#L()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#I[n],this))return this.get(this.#I[n],r)}}forEach(e,r=this){for(let n of this.#L()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[n],this)}}rforEach(e,r=this){for(let n of this.#V()){let i=this.#d[n],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[n],this)}}purgeStale(){let e=!1;for(let r of this.#V({allowStale:!0}))this.#R(r)&&(this.#k(this.#I[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#d[r],i=this.#v(n)?n.__staleWhileFetching:n;if(i===void 0)return;let o={value:i};if(this.#Z&&this.#G){let t=this.#Z[r],s=this.#G[r];if(t&&s){let u=t-(NK.now()-s);o.ttl=u,o.start=Date.now()}}return this.#E&&(o.size=this.#E[r]),o}dump(){let e=[];for(let r of this.#L({allowStale:!0})){let n=this.#I[r],i=this.#d[r],o=this.#v(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let t={value:o};if(this.#Z&&this.#G){t.ttl=this.#Z[r];let s=NK.now()-this.#G[r];t.start=Math.floor(Date.now()-s)}this.#E&&(t.size=this.#E[r]),e.unshift([n,t])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=NK.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:t=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:u}=n,{noUpdateTTL:I=this.noUpdateTTL}=n,d=this.#F(e,r,n.size||0,s);if(this.maxEntrySize&&d>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let h=this.#u===0?void 0:this.#s.get(e);if(h===void 0)h=this.#u===0?this.#b:this.#A.length!==0?this.#A.pop():this.#u===this.#e?this.#B(!1):this.#u,this.#I[h]=e,this.#d[h]=r,this.#s.set(e,h),this.#h[this.#b]=h,this.#l[h]=this.#b,this.#b=h,this.#u++,this.#S(h,d,u),u&&(u.set="add"),I=!1;else{this.#D(h);let c=this.#d[h];if(r!==c){if(this.#y&&this.#v(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=c;m!==void 0&&!t&&(this.#N&&this.#r?.(m,e,"set"),this.#g&&this.#f?.push([m,e,"set"]))}else t||(this.#N&&this.#r?.(c,e,"set"),this.#g&&this.#f?.push([c,e,"set"]));if(this.#Y(h),this.#S(h,d,u),this.#d[h]=r,u){u.set="replace";let m=c&&this.#v(c)?c.__staleWhileFetching:c;m!==void 0&&(u.oldValue=m)}}else u&&(u.set="update")}if(i!==0&&!this.#Z&&this.#W(),this.#Z&&(I||this.#H(h,i,o),u&&this.#c(u,h)),!t&&this.#g&&this.#f){let c=this.#f,m;for(;m=c?.shift();)this.#a?.(...m)}return this}pop(){try{for(;this.#u;){let e=this.#d[this.#m];if(this.#B(!0),this.#v(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#g&&this.#f){let e=this.#f,r;for(;r=e?.shift();)this.#a?.(...r)}}}#B(e){let r=this.#m,n=this.#I[r],i=this.#d[r];return this.#y&&this.#v(i)?i.__abortController.abort(new Error("evicted")):(this.#N||this.#g)&&(this.#N&&this.#r?.(i,n,"evict"),this.#g&&this.#f?.push([i,n,"evict"])),this.#Y(r),e&&(this.#I[r]=void 0,this.#d[r]=void 0,this.#A.push(r)),this.#u===1?(this.#m=this.#b=0,this.#A.length=0):this.#m=this.#h[r],this.#s.delete(n),this.#u--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#s.get(e);if(o!==void 0){let t=this.#d[o];if(this.#v(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#R(o))i&&(i.has="stale",this.#c(i,o));else return n&&this.#w(o),i&&(i.has="hit",this.#c(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!n&&this.#R(i))return;let o=this.#d[i];return this.#v(o)?o.__staleWhileFetching:o}#x(e,r,n,i){let o=r===void 0?void 0:this.#d[r];if(this.#v(o))return o;let t=new aXe,{signal:s}=n;s?.addEventListener("abort",()=>t.abort(s.reason),{signal:t.signal});let u={signal:t.signal,options:n,context:i},I=(y,N=!1)=>{let{aborted:Z}=t.signal,R=n.ignoreFetchAbort&&y!==void 0;if(n.status&&(Z&&!N?(n.status.fetchAborted=!0,n.status.fetchError=t.signal.reason,R&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),Z&&!R&&!N)return h(t.signal.reason);let F=m;return this.#d[r]===m&&(y===void 0?F.__staleWhileFetching?this.#d[r]=F.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,y,u.options))),y},d=y=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=y),h(y)),h=y=>{let{aborted:N}=t.signal,Z=N&&n.allowStaleOnFetchAbort,R=Z||n.allowStaleOnFetchRejection,F=R||n.noDeleteOnFetchRejection,w=m;if(this.#d[r]===m&&(!F||w.__staleWhileFetching===void 0?this.#k(e,"fetch"):Z||(this.#d[r]=w.__staleWhileFetching)),R)return n.status&&w.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw y},c=(y,N)=>{let Z=this.#n?.(e,o,u);Z&&Z instanceof Promise&&Z.then(R=>y(R===void 0?void 0:R),N),t.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(y(void 0),n.allowStaleOnFetchAbort&&(y=R=>I(R,!0)))})};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(c).then(I,d),G=Object.assign(m,{__abortController:t,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,G,{...u.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=G,G}#v(e){if(!this.#y)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof aXe}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:t=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:u=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:G=this.allowStaleOnFetchAbort,context:y,forceRefresh:N=!1,status:Z,signal:R}=r;if(!this.#y)return Z&&(Z.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:Z});let F={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:t,noDisposeOnSet:s,size:u,sizeCalculation:I,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:G,ignoreFetchAbort:m,status:Z,signal:R},w=this.#s.get(e);if(w===void 0){Z&&(Z.fetch="miss");let b=this.#x(e,w,F,y);return b.__returned=b}else{let b=this.#d[w];if(this.#v(b)){let p=n&&b.__staleWhileFetching!==void 0;return Z&&(Z.fetch="inflight",p&&(Z.returnedStale=!0)),p?b.__staleWhileFetching:b.__returned=b}let v=this.#R(w);if(!N&&!v)return Z&&(Z.fetch="hit"),this.#D(w),i&&this.#w(w),Z&&this.#c(Z,w),b;let A=this.#x(e,w,F,y),f=A.__staleWhileFetching!==void 0&&n;return Z&&(Z.fetch=v?"stale":"refresh",f&&v&&(Z.returnedStale=!0)),f?A.__staleWhileFetching:A.__returned=A}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#i;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:o,...t}=r,s=this.get(e,t);if(!o&&s!==void 0)return s;let u=n(e,s,{options:t,context:i});return this.set(e,u,t),u}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:t}=r,s=this.#s.get(e);if(s!==void 0){let u=this.#d[s],I=this.#v(u);return t&&this.#c(t,s),this.#R(s)?(t&&(t.get="stale"),I?(t&&n&&u.__staleWhileFetching!==void 0&&(t.returnedStale=!0),n?u.__staleWhileFetching:void 0):(o||this.#k(e,"expire"),t&&n&&(t.returnedStale=!0),n?u:void 0)):(t&&(t.get="hit"),I?u.__staleWhileFetching:(this.#D(s),i&&this.#w(s),u))}else t&&(t.get="miss")}#T(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#m?this.#m=this.#h[e]:this.#T(this.#l[e],this.#h[e]),this.#T(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let n=!1;if(this.#u!==0){let i=this.#s.get(e);if(i!==void 0)if(n=!0,this.#u===1)this.#p(r);else{this.#Y(i);let o=this.#d[i];if(this.#v(o)?o.__abortController.abort(new Error("deleted")):(this.#N||this.#g)&&(this.#N&&this.#r?.(o,e,r),this.#g&&this.#f?.push([o,e,r])),this.#s.delete(e),this.#I[i]=void 0,this.#d[i]=void 0,i===this.#b)this.#b=this.#l[i];else if(i===this.#m)this.#m=this.#h[i];else{let t=this.#l[i];this.#h[t]=this.#h[i];let s=this.#h[i];this.#l[s]=this.#l[i]}this.#u--,this.#A.push(i)}}if(this.#g&&this.#f?.length){let i=this.#f,o;for(;o=i?.shift();)this.#a?.(...o)}return n}clear(){return this.#p("delete")}#p(e){for(let r of this.#V({allowStale:!0})){let n=this.#d[r];if(this.#v(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#N&&this.#r?.(n,i,e),this.#g&&this.#f?.push([n,i,e])}}if(this.#s.clear(),this.#d.fill(void 0),this.#I.fill(void 0),this.#Z&&this.#G&&(this.#Z.fill(0),this.#G.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#b=0,this.#A.length=0,this.#o=0,this.#u=0,this.#g&&this.#f){let r=this.#f,n;for(;n=r?.shift();)this.#a?.(...n)}}};nXe.LRUCache=RWt});var Nia=Ze((Uqs,Zia)=>{"use strict";var Ul=(...a)=>a.every(e=>e)?a.join(""):"",p0=a=>a?encodeURIComponent(a):"",Aia=a=>a.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),Kpi={sshtemplate:({domain:a,user:e,project:r,committish:n})=>`git@${a}:${e}/${r}.git${Ul("#",n)}`,sshurltemplate:({domain:a,user:e,project:r,committish:n})=>`git+ssh://git@${a}/${e}/${r}.git${Ul("#",n)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i,path:o})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n||"HEAD"),"/",o)}`,browsetemplate:({domain:a,user:e,project:r,committish:n,treepath:i})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n))}`,browsetreetemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:o,fragment:t,hashformat:s})=>`https://${a}/${e}/${r}/${i}/${p0(n||"HEAD")}/${o}${Ul("#",s(t||""))}`,browseblobtemplate:({domain:a,user:e,project:r,committish:n,blobpath:i,path:o,fragment:t,hashformat:s})=>`https://${a}/${e}/${r}/${i}/${p0(n||"HEAD")}/${o}${Ul("#",s(t||""))}`,docstemplate:({domain:a,user:e,project:r,treepath:n,committish:i})=>`https://${a}/${e}/${r}${Ul("/",n,"/",p0(i))}#readme`,httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/raw/${p0(n||"HEAD")}/${i}`,shortcuttemplate:({type:a,user:e,project:r,committish:n})=>`${a}:${e}/${r}${Ul("#",n)}`,pathtemplate:({user:a,project:e,committish:r})=>`${a}/${e}${Ul("#",r)}`,bugstemplate:({domain:a,user:e,project:r})=>`https://${a}/${e}/${r}/issues`,hashformat:Aia},eH={};eH.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:a,user:e,project:r,committish:n,path:i})=>`https://${Ul(a,"@")}raw.githubusercontent.com/${e}/${r}/${p0(n||"HEAD")}/${i}`,gittemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://codeload.${a}/${e}/${r}/tar.gz/${p0(n||"HEAD")}`,extract:a=>{let[,e,r,n,i]=a.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=a.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};eH.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:a,user:e,project:r,committish:n,treepath:i,path:o,editpath:t})=>`https://${a}/${e}/${r}${Ul("/",i,"/",p0(n||"HEAD"),"/",o,t)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/get/${p0(n||"HEAD")}.tar.gz`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};eH.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:a,domain:e,user:r,project:n,committish:i})=>`git+https://${Ul(a,"@")}${e}/${r}/${n}.git${Ul("#",i)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/repository/archive.tar.gz?ref=${p0(n||"HEAD")}`,extract:a=>{let e=a.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:a.hash.slice(1)}}};eH.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:a,project:e,committish:r})=>`git@${a}:${e}.git${Ul("#",r)}`,sshurltemplate:({domain:a,project:e,committish:r})=>`git+ssh://git@${a}/${e}.git${Ul("#",r)}`,edittemplate:({domain:a,user:e,project:r,committish:n,editpath:i})=>`https://${a}/${e}/${r}${Ul("/",p0(n))}/${i}`,browsetemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ul("/",p0(r))}`,browsetreetemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ul("/",p0(r))}${Ul("#",i(n))}`,browseblobtemplate:({domain:a,project:e,committish:r,path:n,hashformat:i})=>`https://${a}/${e}${Ul("/",p0(r))}${Ul("#",i(n))}`,docstemplate:({domain:a,project:e,committish:r})=>`https://${a}/${e}${Ul("/",p0(r))}`,httpstemplate:({domain:a,project:e,committish:r})=>`git+https://${a}/${e}.git${Ul("#",r)}`,filetemplate:({user:a,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${a}/${e}/raw${Ul("/",p0(r))}/${n}`,shortcuttemplate:({type:a,project:e,committish:r})=>`${a}:${e}${Ul("#",r)}`,pathtemplate:({project:a,committish:e})=>`${a}${Ul("#",e)}`,bugstemplate:({domain:a,project:e})=>`https://${a}/${e}`,gittemplate:({domain:a,project:e,committish:r})=>`git://${a}/${e}.git${Ul("#",r)}`,tarballtemplate:({project:a,committish:e})=>`https://codeload.github.com/gist/${a}/tar.gz/${p0(e||"HEAD")}`,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:a.hash.slice(1)}}},hashformat:function(a){return a&&"file-"+Aia(a)}};eH.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:a,user:e,project:r,committish:n,path:i})=>`https://${a}/${e}/${r}/blob/${p0(n)||"HEAD"}/${i}`,httpstemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}.git${Ul("#",n)}`,tarballtemplate:({domain:a,user:e,project:r,committish:n})=>`https://${a}/${e}/${r}/archive/${p0(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:a=>{let[,e,r,n]=a.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:a.hash.slice(1)}}};for(let[a,e]of Object.entries(eH))eH[a]=Object.assign({},Kpi,e);Zia.exports=eH});var xWt=Ze((_qs,Fia)=>{var $pi=Wt("url"),CWt=(a,e,r)=>{let n=a.indexOf(r);return a.lastIndexOf(e,n>-1?n:1/0)},Wia=a=>{try{return new $pi.URL(a)}catch{}},efi=(a,e)=>{let r=a.indexOf(":"),n=a.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return a;let i=a.indexOf("@");return i>-1?i>r?`git+ssh://${a}`:a:a.indexOf("//")===r+1?a:`${a.slice(0,r+1)}//${a.slice(r+1)}`},tfi=a=>{let e=CWt(a,"@","#"),r=CWt(a,":","#");return r>e&&(a=a.slice(0,r)+"/"+a.slice(r+1)),CWt(a,":","#")===-1&&a.indexOf("//")===-1&&(a=`git+ssh://${a}`),a};Fia.exports=(a,e)=>{let r=e?efi(a,e):a;return Wia(r)||Wia(tfi(r))}});var wia=Ze((zqs,Eia)=>{"use strict";var rfi=xWt(),afi=a=>{let e=a.indexOf("#"),r=a.indexOf("/"),n=a.indexOf("/",r+1),i=a.indexOf(":"),o=/\s/.exec(a),t=a.indexOf("@"),s=!o||e>-1&&o.index>e,u=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,d=n===-1||e>-1&&n>e,h=r>0,c=e>-1?a[e-1]!=="/":!a.endsWith("/"),m=!a.startsWith(".");return s&&h&&c&&m&&u&&I&&d};Eia.exports=(a,e,{gitHosts:r,protocols:n})=>{if(!a)return;let i=afi(a)?`github:${a}`:a,o=rfi(i,n);if(!o)return;let t=r.byShortcut[o.protocol],s=r.byDomain[o.hostname.startsWith("www.")?o.hostname.slice(4):o.hostname],u=t||s;if(!u)return;let I=r[t||s],d=null;n[o.protocol]?.auth&&(o.username||o.password)&&(d=`${o.username}${o.password?":"+o.password:""}`);let h=null,c=null,m=null,G=null;try{if(t){let y=o.pathname.startsWith("/")?o.pathname.slice(1):o.pathname,N=y.indexOf("@");N>-1&&(y=y.slice(N+1));let Z=y.lastIndexOf("/");Z>-1?(c=decodeURIComponent(y.slice(0,Z)),c||(c=null),m=decodeURIComponent(y.slice(Z+1))):m=decodeURIComponent(y),m.endsWith(".git")&&(m=m.slice(0,-4)),o.hash&&(h=decodeURIComponent(o.hash.slice(1))),G="shortcut"}else{if(!I.protocols.includes(o.protocol))return;let y=I.extract(o);if(!y)return;c=y.user&&decodeURIComponent(y.user),m=decodeURIComponent(y.project),h=decodeURIComponent(y.committish),G=n[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(y){if(y instanceof URIError)return;throw y}return[u,c,d,m,h,G,e]}});var Cia=Ze((Pqs,Ria)=>{"use strict";var{LRUCache:nfi}=yia(),ifi=Nia(),sfi=wia(),ofi=xWt(),YWt=new nfi({max:1e3}),iXe=class a{constructor(e,r,n,i,o,t,s={}){Object.assign(this,a.#e[e],{type:e,user:r,auth:n,project:i,committish:o,default:t,opts:s})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){a.#e[e]=r,a.#e.byDomain[r.domain]=e,a.#e.byShortcut[`${e}:`]=e,a.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!YWt.has(n)){let i=sfi(e,r,{gitHosts:a.#e,protocols:a.#t});YWt.set(n,i?new a(...i):void 0)}return YWt.get(n)}static parseUrl(e){return ofi(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let i=e(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[a,e]of Object.entries(ifi))iXe.addHost(a,e);Ria.exports=iXe});var Yia=Ze((jqs,xia)=>{xia.exports=lfi;function lfi(a){if(!a||a==="ERROR: No README data found!")return;a=a.trim().split(`
|
|
4769
|
-
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var Via=Ze((qqs,cfi)=>{cfi.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 kia=Ze((Kqs,Xia)=>{var ufi=Frt(),dfi=Ert(),Ifi=fia(),sXe=Cia(),hfi=Wt("node:module"),mfi=["dependencies","devDependencies","optionalDependencies"],pfi=Yia(),VWt=Wt("url"),tH=Via(),Qia=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");Xia.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=sXe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(tH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,tH.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):tH.script[e]&&!a.scripts[tH.script[e]]&&this.warn("typo",e,tH.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){Zfi(a,this.warn),yfi(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=sXe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!ufi(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=dfi(a.version,r),!0},fixPeople:function(a){Hia(a,Gfi),Hia(a,vfi)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),gfi(a.name,r,e.allowLegacyCase),hfi.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=pfi(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=sXe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")Qia(a.bugs)?a.bugs={email:a.bugs}:VWt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Nfi(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&VWt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Qia(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=sXe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;VWt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Ifi(e).validForNewPackages)return this.warn("invalidLicense")}};function ffi(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function bfi(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function gfi(a,e,r){if(a.charAt(0)==="."||!(ffi(a)||bfi(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function Hia(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function Gfi(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,o=i?" <"+i+">":"";return e+o+n}function vfi(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function yfi(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Afi(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[o]=t}),n}function Zfi(a,e){mfi.forEach(function(r){a[r]&&(a[r]=Afi(a[r],r,e))})}function Nfi(a,e){a&&Object.keys(a).forEach(function(r){tH.bugs[r]&&(e("typo",r,tH.bugs[r],"bugs"),a[tH.bugs[r]]=a[r],delete a[r])})}});var Sia=Ze(($qs,Wfi)=>{Wfi.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 Jia=Ze((eKs,Bia)=>{var Lia=Wt("util"),QWt=Sia();Bia.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return Ffi.apply(null,a);var r=QWt[e]?QWt[e]:e+": '%s'";return a.unshift(r),Lia.format.apply(null,a)};function Ffi(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Lia.format(QWt.typo,a,e)}});var Mia=Ze((tKs,Oia)=>{Oia.exports=Tia;var HWt=kia();Tia.fixer=HWt;var Efi=Jia(),wfi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Rfi=["dependencies","people","typos"],XWt=wfi.map(function(a){return Dia(a)+"Field"});XWt=XWt.concat(Rfi);function Tia(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),HWt.warn=function(){e(Efi.apply(null,arguments))},XWt.forEach(function(n){HWt["fix"+Dia(n)](a,r)}),a._id=a.name+"@"+a.version}function Dia(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var Uia=ct(()=>{});import{fileURLToPath as Cfi}from"node:url";function _ia(a){return a instanceof URL?Cfi(a):a}var zia=ct(()=>{Uia()});import xfi from"node:fs/promises";import Yfi from"node:path";async function jia({cwd:a,normalize:e=!0}={}){let r=await xfi.readFile(Vfi(a),"utf8");return Qfi(r,e)}var Pia,Vfi,Qfi,qia=ct(()=>{jna();Pia=Lt(Mia(),1);zia();Vfi=a=>Yfi.resolve(_ia(a)??".","package.json"),Qfi=(a,e)=>{let r=typeof a=="string"?AWt(a):a;return e&&(0,Pia.default)(r),r}});import Hfi from"node:path";async function Kia(a){let e=await Ana("package.json",a);if(e)return{packageJson:await jia({...a,cwd:Hfi.dirname(e)}),path:e}}var $ia=ct(()=>{Zna();qia()});import{fileURLToPath as Xfi}from"url";import kfi from"path";async function FK(){if(oXe)return oXe;let a=await Kia({cwd:Lfi});if(a)return oXe=a.packageJson,oXe}var Sfi,Lfi,oXe,lXe=ct(()=>{"use strict";$ia();Sfi=Xfi(import.meta.url),Lfi=kfi.dirname(Sfi)});var esa={};lo(esa,{getCliVersion:()=>KC});async function KC(){let a=await FK();return"1.1.1"}var EK=ct(()=>{"use strict";lXe();});var dFt=Ze((kio,cla)=>{cla.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ila=Ze((Sio,dla)=>{var Xgi=dFt();function ula(a){this.mode=Xgi.MODE_8BIT_BYTE,this.data=a}ula.prototype={getLength:function(){return this.data.length},write:function(a){for(var e=0;e<this.data.length;e++)a.put(this.data.charCodeAt(e),8)}};dla.exports=ula});var IFt=Ze((Lio,hla)=>{var VW={glog:function(a){if(a<1)throw new Error("glog("+a+")");return VW.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return VW.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(f0=0;f0<8;f0++)VW.EXP_TABLE[f0]=1<<f0;var f0;for(f0=8;f0<256;f0++)VW.EXP_TABLE[f0]=VW.EXP_TABLE[f0-4]^VW.EXP_TABLE[f0-5]^VW.EXP_TABLE[f0-6]^VW.EXP_TABLE[f0-8];var f0;for(f0=0;f0<255;f0++)VW.LOG_TABLE[VW.EXP_TABLE[f0]]=f0;var f0;hla.exports=VW});var hFt=Ze((Bio,mla)=>{var gJ=IFt();function RXe(a,e){if(a.length===void 0)throw new Error(a.length+"/"+e);for(var r=0;r<a.length&&a[r]===0;)r++;this.num=new Array(a.length-r+e);for(var n=0;n<a.length-r;n++)this.num[n]=a[n+r]}RXe.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var e=new Array(this.getLength()+a.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<a.getLength();n++)e[r+n]^=gJ.gexp(gJ.glog(this.get(r))+gJ.glog(a.get(n)));return new RXe(e,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var e=gJ.glog(this.get(0))-gJ.glog(a.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var i=0;i<a.getLength();i++)r[i]^=gJ.gexp(gJ.glog(a.get(i))+e);return new RXe(r,0).mod(a)}};mla.exports=RXe});var fla=Ze((Jio,pla)=>{pla.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Gla=Ze((Tio,gla)=>{var JZ=dFt(),bla=hFt(),kgi=IFt(),sH=fla(),Gf={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var e=a<<10;Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G15)>=0;)e^=Gf.G15<<Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G15);return(a<<10|e)^Gf.G15_MASK},getBCHTypeNumber:function(a){for(var e=a<<12;Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G18)>=0;)e^=Gf.G18<<Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G18);return a<<12|e},getBCHDigit:function(a){for(var e=0;a!==0;)e++,a>>>=1;return e},getPatternPosition:function(a){return Gf.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,e,r){switch(a){case sH.PATTERN000:return(e+r)%2===0;case sH.PATTERN001:return e%2===0;case sH.PATTERN010:return r%3===0;case sH.PATTERN011:return(e+r)%3===0;case sH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case sH.PATTERN101:return e*r%2+e*r%3===0;case sH.PATTERN110:return(e*r%2+e*r%3)%2===0;case sH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var e=new bla([1],0),r=0;r<a;r++)e=e.multiply(new bla([1,kgi.gexp(r)],0));return e},getLengthInBits:function(a,e){if(1<=e&&e<10)switch(a){case JZ.MODE_NUMBER:return 10;case JZ.MODE_ALPHA_NUM:return 9;case JZ.MODE_8BIT_BYTE:return 8;case JZ.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(e<27)switch(a){case JZ.MODE_NUMBER:return 12;case JZ.MODE_ALPHA_NUM:return 11;case JZ.MODE_8BIT_BYTE:return 16;case JZ.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else if(e<41)switch(a){case JZ.MODE_NUMBER:return 14;case JZ.MODE_ALPHA_NUM:return 13;case JZ.MODE_8BIT_BYTE:return 16;case JZ.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}else throw new Error("type:"+e)},getLostPoint:function(a){var e=a.getModuleCount(),r=0,n=0,i=0;for(n=0;n<e;n++)for(i=0;i<e;i++){for(var o=0,t=a.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||e<=n+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===a.isDark(n+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<e-1;n++)for(i=0;i<e-1;i++){var I=0;a.isDark(n,i)&&I++,a.isDark(n+1,i)&&I++,a.isDark(n,i+1)&&I++,a.isDark(n+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(n=0;n<e;n++)for(i=0;i<e-6;i++)a.isDark(n,i)&&!a.isDark(n,i+1)&&a.isDark(n,i+2)&&a.isDark(n,i+3)&&a.isDark(n,i+4)&&!a.isDark(n,i+5)&&a.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i++)for(n=0;n<e-6;n++)a.isDark(n,i)&&!a.isDark(n+1,i)&&a.isDark(n+2,i)&&a.isDark(n+3,i)&&a.isDark(n+4,i)&&!a.isDark(n+5,i)&&a.isDark(n+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(n=0;n<e;n++)a.isDark(n,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};gla.exports=Gf});var mFt=Ze((Dio,vla)=>{vla.exports={L:1,M:0,Q:3,H:2}});var Ala=Ze((Oio,yla)=>{var CXe=mFt();function Kw(a,e){this.totalCount=a,this.dataCount=e}Kw.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Kw.getRSBlocks=function(a,e){var r=Kw.getRsBlockTable(a,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+e);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var t=r[o*3+0],s=r[o*3+1],u=r[o*3+2],I=0;I<t;I++)i.push(new Kw(s,u));return i};Kw.getRsBlockTable=function(a,e){switch(e){case CXe.L:return Kw.RS_BLOCK_TABLE[(a-1)*4+0];case CXe.M:return Kw.RS_BLOCK_TABLE[(a-1)*4+1];case CXe.Q:return Kw.RS_BLOCK_TABLE[(a-1)*4+2];case CXe.H:return Kw.RS_BLOCK_TABLE[(a-1)*4+3];default:return}};yla.exports=Kw});var Wla=Ze((Mio,Nla)=>{function Zla(){this.buffer=[],this.length=0}Zla.prototype={get:function(a){var e=Math.floor(a/8);return(this.buffer[e]>>>7-a%8&1)==1},put:function(a,e){for(var r=0;r<e;r++)this.putBit((a>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),a&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Nla.exports=Zla});var Rla=Ze((Uio,wla)=>{var Sgi=Ila(),oH=Gla(),Lgi=hFt(),Fla=Ala(),Ela=Wla();function $w(a,e){this.typeNumber=a,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}$w.prototype={addData:function(a){var e=new Sgi(a);this.dataList.push(e),this.dataCache=null},isDark:function(a,e){if(a<0||this.moduleCount<=a||e<0||this.moduleCount<=e)throw new Error(a+","+e);return this.modules[a][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var e=Fla.getRSBlocks(a,this.errorCorrectLevel),r=new Ela,n=0,i=0;i<e.length;i++)n+=e[i].dataCount;for(var o=0;o<this.dataList.length;o++){var t=this.dataList[o];r.put(t.mode,4),r.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,e),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache===null&&(this.dataCache=$w.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(a,e){for(var r=-1;r<=7;r++)if(!(a+r<=-1||this.moduleCount<=a+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[a+r][e+n]=!0:this.modules[a+r][e+n]=!1)},getBestMaskPattern:function(){for(var a=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=oH.getLostPoint(this);(r===0||a>n)&&(a=n,e=r)}return e},createMovieClip:function(a,e,r){var n=a.createEmptyMovieClip(e,r),i=1;this.make();for(var o=0;o<this.modules.length;o++)for(var t=o*i,s=0;s<this.modules[o].length;s++){var u=s*i,I=this.modules[o][s];I&&(n.beginFill(0,100),n.moveTo(u,t),n.lineTo(u+i,t),n.lineTo(u+i,t+i),n.lineTo(u,t+i),n.endFill())}return n},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]===null&&(this.modules[a][6]=a%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var a=oH.getPatternPosition(this.typeNumber),e=0;e<a.length;e++)for(var r=0;r<a.length;r++){var n=a[e],i=a[r];if(this.modules[n][i]===null)for(var o=-2;o<=2;o++)for(var t=-2;t<=2;t++)Math.abs(o)===2||Math.abs(t)===2||o===0&&t===0?this.modules[n+o][i+t]=!0:this.modules[n+o][i+t]=!1}},setupTypeNumber:function(a){for(var e=oH.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!a&&(e>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!a&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(a,e){for(var r=this.errorCorrectLevel<<3|e,n=oH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!a&&(n>>o&1)===1,o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i;for(var t=0;t<15;t++)i=!a&&(n>>t&1)===1,t<8?this.modules[8][this.moduleCount-t-1]=i:t<9?this.modules[8][15-t-1+1]=i:this.modules[8][15-t-1]=i;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,e){for(var r=-1,n=this.moduleCount-1,i=7,o=0,t=this.moduleCount-1;t>0;t-=2)for(t===6&&t--;;){for(var s=0;s<2;s++)if(this.modules[n][t-s]===null){var u=!1;o<a.length&&(u=(a[o]>>>i&1)===1);var I=oH.getMask(e,n,t-s);I&&(u=!u),this.modules[n][t-s]=u,i--,i===-1&&(o++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};$w.PAD0=236;$w.PAD1=17;$w.createData=function(a,e,r){for(var n=Fla.getRSBlocks(a,e),i=new Ela,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(i)}for(var s=0,u=0;u<n.length;u++)s+=n[u].dataCount;if(i.getLengthInBits()>s*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+s*8+")");for(i.getLengthInBits()+4<=s*8&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(!1);for(;!(i.getLengthInBits()>=s*8||(i.put($w.PAD0,8),i.getLengthInBits()>=s*8));)i.put($w.PAD1,8);return $w.createBytes(i,n)};$w.createBytes=function(a,e){for(var r=0,n=0,i=0,o=new Array(e.length),t=new Array(e.length),s=0;s<e.length;s++){var u=e[s].dataCount,I=e[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&a.buffer[d+r];r+=u;var h=oH.getErrorCorrectPolynomial(I),c=new Lgi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var G=0;G<t[s].length;G++){var y=G+m.getLength()-t[s].length;t[s][G]=y>=0?m.get(y):0}}for(var N=0,Z=0;Z<e.length;Z++)N+=e[Z].totalCount;for(var R=new Array(N),F=0,w=0;w<n;w++)for(var b=0;b<e.length;b++)w<o[b].length&&(R[F++]=o[b][w]);for(var v=0;v<i;v++)for(var A=0;A<e.length;A++)v<t[A].length&&(R[F++]=t[A][v]);return R};wla.exports=$w});var Yla=Ze((_io,xla)=>{var Bgi=Rla(),Cla=mFt(),Jgi="\x1B[40m \x1B[0m",xXe="\x1B[47m \x1B[0m",Tgi=function(a){return a?Jgi:xXe},pFt=function(a){return{times:function(e){return new Array(e).join(a)}}},Dgi=function(a,e){for(var r=new Array(a),n=0;n<a;n++)r[n]=e;return r};xla.exports={error:Cla.L,generate:function(a,e,r){typeof e=="function"&&(r=e,e={});var n=new Bgi(-1,this.error);n.addData(a),n.make();var i="";if(e&&e.small){var o=!0,t=!1,s=n.getModuleCount(),u=n.modules.slice(),I=s%2===1;I&&u.push(Dgi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=pFt(d.BLACK_WHITE).times(s+3),c=pFt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
4769
|
+
`);let e=0;for(;a[e]&&a[e].trim().match(/^(#|$)/);)e++;let r=a.length,n=e+1;for(;n<r&&a[n].trim();)n++;return a.slice(e,n).join(" ").trim()}});var Via=Ze((qqs,cfi)=>{cfi.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 kia=Ze((Kqs,Xia)=>{var ufi=Frt(),dfi=Ert(),Ifi=fia(),sXe=Cia(),hfi=Wt("node:module"),mfi=["dependencies","devDependencies","optionalDependencies"],pfi=Yia(),VWt=Wt("url"),tH=Via(),Qia=a=>a.includes("@")&&a.indexOf("@")<a.lastIndexOf(".");Xia.exports={warn:function(){},fixRepositoryField:function(a){if(a.repositories&&(this.warn("repositories"),a.repository=a.repositories[0]),!a.repository)return this.warn("missingRepository");typeof a.repository=="string"&&(a.repository={type:"git",url:a.repository});var e=a.repository.url||"";if(e){var r=sXe.fromUrl(e);r&&(e=a.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(a){Object.keys(tH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(a,e)&&this.warn("typo",e,tH.topLevel[e])},this)},fixScriptsField:function(a){if(a.scripts){if(typeof a.scripts!="object"){this.warn("nonObjectScripts"),delete a.scripts;return}Object.keys(a.scripts).forEach(function(e){typeof a.scripts[e]!="string"?(this.warn("nonStringScript"),delete a.scripts[e]):tH.script[e]&&!a.scripts[tH.script[e]]&&this.warn("typo",e,tH.script[e],"scripts")},this)}},fixFilesField:function(a){var e=a.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete a.files):a.files&&(a.files=a.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(a){if(a.bin&&typeof a.bin=="string"){var e={},r;(r=a.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=a.bin:e[a.name]=a.bin,a.bin=e}},fixManField:function(a){a.man&&typeof a.man=="string"&&(a.man=[a.man])},fixBundleDependenciesField:function(a){var e="bundledDependencies",r="bundleDependencies";a[e]&&!a[r]&&(a[r]=a[e],delete a[e]),a[r]&&!Array.isArray(a[r])?(this.warn("nonArrayBundleDependencies"),delete a[r]):a[r]&&(a[r]=a[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(a.dependencies||(a.dependencies={}),Object.prototype.hasOwnProperty.call(a.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),a.dependencies[n]="*"),!0)},this))},fixDependencies:function(a){Zfi(a,this.warn),yfi(a,this.warn),this.fixBundleDependenciesField(a),["dependencies","devDependencies"].forEach(function(e){if(e in a){if(!a[e]||typeof a[e]!="object"){this.warn("nonObjectDependencies",e),delete a[e];return}Object.keys(a[e]).forEach(function(r){var n=a[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete a[e][r]);var i=sXe.fromUrl(a[e][r]);i&&(a[e][r]=i.toString())},this)}},this)},fixModulesField:function(a){a.modules&&(this.warn("deprecatedModules"),delete a.modules)},fixKeywordsField:function(a){typeof a.keywords=="string"&&(a.keywords=a.keywords.split(/,\s+/)),a.keywords&&!Array.isArray(a.keywords)?(delete a.keywords,this.warn("nonArrayKeywords")):a.keywords&&(a.keywords=a.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(a,e){var r=!e;if(!a.version)return a.version="",!0;if(!ufi(a.version,r))throw new Error('Invalid version: "'+a.version+'"');return a.version=dfi(a.version,r),!0},fixPeople:function(a){Hia(a,Gfi),Hia(a,vfi)},fixNameField:function(a,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!a.name&&!r){a.name="";return}if(typeof a.name!="string")throw new Error("name field must be a string.");r||(a.name=a.name.trim()),gfi(a.name,r,e.allowLegacyCase),hfi.builtinModules.includes(a.name)&&this.warn("conflictingName",a.name)},fixDescriptionField:function(a){a.description&&typeof a.description!="string"&&(this.warn("nonStringDescription"),delete a.description),a.readme&&!a.description&&(a.description=pfi(a.readme)),a.description===void 0&&delete a.description,a.description||this.warn("missingDescription")},fixReadmeField:function(a){a.readme||(this.warn("missingReadme"),a.readme="ERROR: No README data found!")},fixBugsField:function(a){if(!a.bugs&&a.repository&&a.repository.url){var e=sXe.fromUrl(a.repository.url);e&&e.bugs()&&(a.bugs={url:e.bugs()})}else if(a.bugs){if(typeof a.bugs=="string")Qia(a.bugs)?a.bugs={email:a.bugs}:VWt.parse(a.bugs).protocol?a.bugs={url:a.bugs}:this.warn("nonEmailUrlBugsString");else{Nfi(a.bugs,this.warn);var r=a.bugs;a.bugs={},r.url&&(typeof r.url=="string"&&VWt.parse(r.url).protocol?a.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Qia(r.email)?a.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!a.bugs.email&&!a.bugs.url&&(delete a.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(a){if(!a.homepage&&a.repository&&a.repository.url){var e=sXe.fromUrl(a.repository.url);e&&e.docs()&&(a.homepage=e.docs())}if(a.homepage){if(typeof a.homepage!="string")return this.warn("nonUrlHomepage"),delete a.homepage;VWt.parse(a.homepage).protocol||(a.homepage="http://"+a.homepage)}},fixLicenseField:function(a){let e=a.license||a.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Ifi(e).validForNewPackages)return this.warn("invalidLicense")}};function ffi(a){if(a.charAt(0)!=="@")return!1;var e=a.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function bfi(a){return!a.match(/[/@\s+%:]/)&&a===encodeURIComponent(a)}function gfi(a,e,r){if(a.charAt(0)==="."||!(ffi(a)||bfi(a))||e&&!r&&a!==a.toLowerCase()||a.toLowerCase()==="node_modules"||a.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(a))}function Hia(a,e){return a.author&&(a.author=e(a.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(a[r])&&(a[r]=a[r].map(e))}),a}function Gfi(a){if(typeof a=="string")return a;var e=a.name||"",r=a.url||a.web,n=r?" ("+r+")":"",i=a.email||a.mail,o=i?" <"+i+">":"";return e+o+n}function vfi(a){if(typeof a!="string")return a;var e=a.match(/^([^(<]+)/),r=a.match(/\(([^()]+)\)/),n=a.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),n&&(i.email=n[1]),r&&(i.url=r[1]),i}function yfi(a){var e=a.optionalDependencies;if(e){var r=a.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),a.dependencies=r}}function Afi(a,e,r){if(!a)return{};if(typeof a=="string"&&(a=a.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(a))return a;r("deprecatedArrayDependencies",e);var n={};return a.filter(function(i){return typeof i=="string"}).forEach(function(i){i=i.trim().split(/(:?[@\s><=])/);var o=i.shift(),t=i.join("");t=t.trim(),t=t.replace(/^@/,""),n[o]=t}),n}function Zfi(a,e){mfi.forEach(function(r){a[r]&&(a[r]=Afi(a[r],r,e))})}function Nfi(a,e){a&&Object.keys(a).forEach(function(r){tH.bugs[r]&&(e("typo",r,tH.bugs[r],"bugs"),a[tH.bugs[r]]=a[r],delete a[r])})}});var Sia=Ze(($qs,Wfi)=>{Wfi.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 Jia=Ze((eKs,Bia)=>{var Lia=Wt("util"),QWt=Sia();Bia.exports=function(){var a=Array.prototype.slice.call(arguments,0),e=a.shift();if(e==="typo")return Ffi.apply(null,a);var r=QWt[e]?QWt[e]:e+": '%s'";return a.unshift(r),Lia.format.apply(null,a)};function Ffi(a,e,r){return r&&(a=r+"['"+a+"']",e=r+"['"+e+"']"),Lia.format(QWt.typo,a,e)}});var Mia=Ze((tKs,Oia)=>{Oia.exports=Tia;var HWt=kia();Tia.fixer=HWt;var Efi=Jia(),wfi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Rfi=["dependencies","people","typos"],XWt=wfi.map(function(a){return Dia(a)+"Field"});XWt=XWt.concat(Rfi);function Tia(a,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||a.private)&&(e=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),HWt.warn=function(){e(Efi.apply(null,arguments))},XWt.forEach(function(n){HWt["fix"+Dia(n)](a,r)}),a._id=a.name+"@"+a.version}function Dia(a){return a.charAt(0).toUpperCase()+a.slice(1)}});var Uia=ct(()=>{});import{fileURLToPath as Cfi}from"node:url";function _ia(a){return a instanceof URL?Cfi(a):a}var zia=ct(()=>{Uia()});import xfi from"node:fs/promises";import Yfi from"node:path";async function jia({cwd:a,normalize:e=!0}={}){let r=await xfi.readFile(Vfi(a),"utf8");return Qfi(r,e)}var Pia,Vfi,Qfi,qia=ct(()=>{jna();Pia=Lt(Mia(),1);zia();Vfi=a=>Yfi.resolve(_ia(a)??".","package.json"),Qfi=(a,e)=>{let r=typeof a=="string"?AWt(a):a;return e&&(0,Pia.default)(r),r}});import Hfi from"node:path";async function Kia(a){let e=await Ana("package.json",a);if(e)return{packageJson:await jia({...a,cwd:Hfi.dirname(e)}),path:e}}var $ia=ct(()=>{Zna();qia()});import{fileURLToPath as Xfi}from"url";import kfi from"path";async function FK(){if(oXe)return oXe;let a=await Kia({cwd:Lfi});if(a)return oXe=a.packageJson,oXe}var Sfi,Lfi,oXe,lXe=ct(()=>{"use strict";$ia();Sfi=Xfi(import.meta.url),Lfi=kfi.dirname(Sfi)});var esa={};lo(esa,{getCliVersion:()=>KC});async function KC(){let a=await FK();return"1.1.2"}var EK=ct(()=>{"use strict";lXe();});var dFt=Ze((kio,cla)=>{cla.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ila=Ze((Sio,dla)=>{var Xgi=dFt();function ula(a){this.mode=Xgi.MODE_8BIT_BYTE,this.data=a}ula.prototype={getLength:function(){return this.data.length},write:function(a){for(var e=0;e<this.data.length;e++)a.put(this.data.charCodeAt(e),8)}};dla.exports=ula});var IFt=Ze((Lio,hla)=>{var VW={glog:function(a){if(a<1)throw new Error("glog("+a+")");return VW.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return VW.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(f0=0;f0<8;f0++)VW.EXP_TABLE[f0]=1<<f0;var f0;for(f0=8;f0<256;f0++)VW.EXP_TABLE[f0]=VW.EXP_TABLE[f0-4]^VW.EXP_TABLE[f0-5]^VW.EXP_TABLE[f0-6]^VW.EXP_TABLE[f0-8];var f0;for(f0=0;f0<255;f0++)VW.LOG_TABLE[VW.EXP_TABLE[f0]]=f0;var f0;hla.exports=VW});var hFt=Ze((Bio,mla)=>{var gJ=IFt();function RXe(a,e){if(a.length===void 0)throw new Error(a.length+"/"+e);for(var r=0;r<a.length&&a[r]===0;)r++;this.num=new Array(a.length-r+e);for(var n=0;n<a.length-r;n++)this.num[n]=a[n+r]}RXe.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var e=new Array(this.getLength()+a.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<a.getLength();n++)e[r+n]^=gJ.gexp(gJ.glog(this.get(r))+gJ.glog(a.get(n)));return new RXe(e,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var e=gJ.glog(this.get(0))-gJ.glog(a.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var i=0;i<a.getLength();i++)r[i]^=gJ.gexp(gJ.glog(a.get(i))+e);return new RXe(r,0).mod(a)}};mla.exports=RXe});var fla=Ze((Jio,pla)=>{pla.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Gla=Ze((Tio,gla)=>{var JZ=dFt(),bla=hFt(),kgi=IFt(),sH=fla(),Gf={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var e=a<<10;Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G15)>=0;)e^=Gf.G15<<Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G15);return(a<<10|e)^Gf.G15_MASK},getBCHTypeNumber:function(a){for(var e=a<<12;Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G18)>=0;)e^=Gf.G18<<Gf.getBCHDigit(e)-Gf.getBCHDigit(Gf.G18);return a<<12|e},getBCHDigit:function(a){for(var e=0;a!==0;)e++,a>>>=1;return e},getPatternPosition:function(a){return Gf.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,e,r){switch(a){case sH.PATTERN000:return(e+r)%2===0;case sH.PATTERN001:return e%2===0;case sH.PATTERN010:return r%3===0;case sH.PATTERN011:return(e+r)%3===0;case sH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case sH.PATTERN101:return e*r%2+e*r%3===0;case sH.PATTERN110:return(e*r%2+e*r%3)%2===0;case sH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var e=new bla([1],0),r=0;r<a;r++)e=e.multiply(new bla([1,kgi.gexp(r)],0));return e},getLengthInBits:function(a,e){if(1<=e&&e<10)switch(a){case JZ.MODE_NUMBER:return 10;case JZ.MODE_ALPHA_NUM:return 9;case JZ.MODE_8BIT_BYTE:return 8;case JZ.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(e<27)switch(a){case JZ.MODE_NUMBER:return 12;case JZ.MODE_ALPHA_NUM:return 11;case JZ.MODE_8BIT_BYTE:return 16;case JZ.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else if(e<41)switch(a){case JZ.MODE_NUMBER:return 14;case JZ.MODE_ALPHA_NUM:return 13;case JZ.MODE_8BIT_BYTE:return 16;case JZ.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}else throw new Error("type:"+e)},getLostPoint:function(a){var e=a.getModuleCount(),r=0,n=0,i=0;for(n=0;n<e;n++)for(i=0;i<e;i++){for(var o=0,t=a.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||e<=n+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===a.isDark(n+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<e-1;n++)for(i=0;i<e-1;i++){var I=0;a.isDark(n,i)&&I++,a.isDark(n+1,i)&&I++,a.isDark(n,i+1)&&I++,a.isDark(n+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(n=0;n<e;n++)for(i=0;i<e-6;i++)a.isDark(n,i)&&!a.isDark(n,i+1)&&a.isDark(n,i+2)&&a.isDark(n,i+3)&&a.isDark(n,i+4)&&!a.isDark(n,i+5)&&a.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i++)for(n=0;n<e-6;n++)a.isDark(n,i)&&!a.isDark(n+1,i)&&a.isDark(n+2,i)&&a.isDark(n+3,i)&&a.isDark(n+4,i)&&!a.isDark(n+5,i)&&a.isDark(n+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(n=0;n<e;n++)a.isDark(n,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};gla.exports=Gf});var mFt=Ze((Dio,vla)=>{vla.exports={L:1,M:0,Q:3,H:2}});var Ala=Ze((Oio,yla)=>{var CXe=mFt();function Kw(a,e){this.totalCount=a,this.dataCount=e}Kw.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Kw.getRSBlocks=function(a,e){var r=Kw.getRsBlockTable(a,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+e);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var t=r[o*3+0],s=r[o*3+1],u=r[o*3+2],I=0;I<t;I++)i.push(new Kw(s,u));return i};Kw.getRsBlockTable=function(a,e){switch(e){case CXe.L:return Kw.RS_BLOCK_TABLE[(a-1)*4+0];case CXe.M:return Kw.RS_BLOCK_TABLE[(a-1)*4+1];case CXe.Q:return Kw.RS_BLOCK_TABLE[(a-1)*4+2];case CXe.H:return Kw.RS_BLOCK_TABLE[(a-1)*4+3];default:return}};yla.exports=Kw});var Wla=Ze((Mio,Nla)=>{function Zla(){this.buffer=[],this.length=0}Zla.prototype={get:function(a){var e=Math.floor(a/8);return(this.buffer[e]>>>7-a%8&1)==1},put:function(a,e){for(var r=0;r<e;r++)this.putBit((a>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),a&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Nla.exports=Zla});var Rla=Ze((Uio,wla)=>{var Sgi=Ila(),oH=Gla(),Lgi=hFt(),Fla=Ala(),Ela=Wla();function $w(a,e){this.typeNumber=a,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}$w.prototype={addData:function(a){var e=new Sgi(a);this.dataList.push(e),this.dataCache=null},isDark:function(a,e){if(a<0||this.moduleCount<=a||e<0||this.moduleCount<=e)throw new Error(a+","+e);return this.modules[a][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var a=1;for(a=1;a<40;a++){for(var e=Fla.getRSBlocks(a,this.errorCorrectLevel),r=new Ela,n=0,i=0;i<e.length;i++)n+=e[i].dataCount;for(var o=0;o<this.dataList.length;o++){var t=this.dataList[o];r.put(t.mode,4),r.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,e),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache===null&&(this.dataCache=$w.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(a,e){for(var r=-1;r<=7;r++)if(!(a+r<=-1||this.moduleCount<=a+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[a+r][e+n]=!0:this.modules[a+r][e+n]=!1)},getBestMaskPattern:function(){for(var a=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=oH.getLostPoint(this);(r===0||a>n)&&(a=n,e=r)}return e},createMovieClip:function(a,e,r){var n=a.createEmptyMovieClip(e,r),i=1;this.make();for(var o=0;o<this.modules.length;o++)for(var t=o*i,s=0;s<this.modules[o].length;s++){var u=s*i,I=this.modules[o][s];I&&(n.beginFill(0,100),n.moveTo(u,t),n.lineTo(u+i,t),n.lineTo(u+i,t+i),n.lineTo(u,t+i),n.endFill())}return n},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)this.modules[a][6]===null&&(this.modules[a][6]=a%2===0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]===null&&(this.modules[6][e]=e%2===0)},setupPositionAdjustPattern:function(){for(var a=oH.getPatternPosition(this.typeNumber),e=0;e<a.length;e++)for(var r=0;r<a.length;r++){var n=a[e],i=a[r];if(this.modules[n][i]===null)for(var o=-2;o<=2;o++)for(var t=-2;t<=2;t++)Math.abs(o)===2||Math.abs(t)===2||o===0&&t===0?this.modules[n+o][i+t]=!0:this.modules[n+o][i+t]=!1}},setupTypeNumber:function(a){for(var e=oH.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!a&&(e>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!a&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(a,e){for(var r=this.errorCorrectLevel<<3|e,n=oH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!a&&(n>>o&1)===1,o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i;for(var t=0;t<15;t++)i=!a&&(n>>t&1)===1,t<8?this.modules[8][this.moduleCount-t-1]=i:t<9?this.modules[8][15-t-1+1]=i:this.modules[8][15-t-1]=i;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,e){for(var r=-1,n=this.moduleCount-1,i=7,o=0,t=this.moduleCount-1;t>0;t-=2)for(t===6&&t--;;){for(var s=0;s<2;s++)if(this.modules[n][t-s]===null){var u=!1;o<a.length&&(u=(a[o]>>>i&1)===1);var I=oH.getMask(e,n,t-s);I&&(u=!u),this.modules[n][t-s]=u,i--,i===-1&&(o++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};$w.PAD0=236;$w.PAD1=17;$w.createData=function(a,e,r){for(var n=Fla.getRSBlocks(a,e),i=new Ela,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),oH.getLengthInBits(t.mode,a)),t.write(i)}for(var s=0,u=0;u<n.length;u++)s+=n[u].dataCount;if(i.getLengthInBits()>s*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+s*8+")");for(i.getLengthInBits()+4<=s*8&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(!1);for(;!(i.getLengthInBits()>=s*8||(i.put($w.PAD0,8),i.getLengthInBits()>=s*8));)i.put($w.PAD1,8);return $w.createBytes(i,n)};$w.createBytes=function(a,e){for(var r=0,n=0,i=0,o=new Array(e.length),t=new Array(e.length),s=0;s<e.length;s++){var u=e[s].dataCount,I=e[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&a.buffer[d+r];r+=u;var h=oH.getErrorCorrectPolynomial(I),c=new Lgi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var G=0;G<t[s].length;G++){var y=G+m.getLength()-t[s].length;t[s][G]=y>=0?m.get(y):0}}for(var N=0,Z=0;Z<e.length;Z++)N+=e[Z].totalCount;for(var R=new Array(N),F=0,w=0;w<n;w++)for(var b=0;b<e.length;b++)w<o[b].length&&(R[F++]=o[b][w]);for(var v=0;v<i;v++)for(var A=0;A<e.length;A++)v<t[A].length&&(R[F++]=t[A][v]);return R};wla.exports=$w});var Yla=Ze((_io,xla)=>{var Bgi=Rla(),Cla=mFt(),Jgi="\x1B[40m \x1B[0m",xXe="\x1B[47m \x1B[0m",Tgi=function(a){return a?Jgi:xXe},pFt=function(a){return{times:function(e){return new Array(e).join(a)}}},Dgi=function(a,e){for(var r=new Array(a),n=0;n<a;n++)r[n]=e;return r};xla.exports={error:Cla.L,generate:function(a,e,r){typeof e=="function"&&(r=e,e={});var n=new Bgi(-1,this.error);n.addData(a),n.make();var i="";if(e&&e.small){var o=!0,t=!1,s=n.getModuleCount(),u=n.modules.slice(),I=s%2===1;I&&u.push(Dgi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=pFt(d.BLACK_WHITE).times(s+3),c=pFt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
4770
4770
|
`;for(var m=0;m<s;m+=2){i+=d.WHITE_ALL;for(var G=0;G<s;G++)u[m][G]===t&&u[m+1][G]===t?i+=d.WHITE_ALL:u[m][G]===t&&u[m+1][G]===o?i+=d.WHITE_BLACK:u[m][G]===o&&u[m+1][G]===t?i+=d.BLACK_WHITE:i+=d.BLACK_ALL;i+=d.WHITE_ALL+`
|
|
4771
4771
|
`}I||(i+=c)}else{var y=pFt(xXe).times(n.getModuleCount()+3);i+=y+`
|
|
4772
4772
|
`,n.modules.forEach(function(N){i+=xXe,i+=N.map(Tgi).join(""),i+=xXe+`
|
|
@@ -6533,12 +6533,15 @@ ${a.output}
|
|
|
6533
6533
|
${a.stderr}
|
|
6534
6534
|
`),a.error&&(r+=`- Error: ${a.error}
|
|
6535
6535
|
`),r}var wH=Lt(ra(),1);na();ua();var vf=Lt(wr(),1);var Nma=({isVisible:a,onClose:e,terminalWidth:r})=>{let[n,i]=(0,wH.useState)([]),[o,t]=(0,wH.useState)(0),[,s]=(0,wH.useState)(0),u=(0,wH.useCallback)(()=>{let y=[...Vb().getAllTasks()].sort((N,Z)=>Z.startTime-N.startTime);i(y)},[]);if((0,wH.useEffect)(()=>{if(!a)return;u();let m=Vb(),G=()=>{u()};m.on("task-started",G),m.on("task-completed",G),m.on("task-failed",G),m.on("task-killed",G);let y=setInterval(()=>{s(N=>N+1),u()},1e3);return()=>{m.removeListener("task-started",G),m.removeListener("task-completed",G),m.removeListener("task-failed",G),m.removeListener("task-killed",G),clearInterval(y)}},[a,u]),Cs((m,G)=>{if(G.upArrow){t(y=>Math.max(0,y-1));return}if(G.downArrow){t(y=>Math.min(n.length-1,y+1));return}if(m.toLowerCase()==="k"&&n.length>0){let y=n[o];y&&y.status==="running"&&(Vb().killTask(y.id),u());return}},{isActive:a}),!a)return null;let I=m=>{switch(m){case"running":return _e.AccentYellow;case"completed":return _e.AccentGreen;case"failed":return _e.AccentRed;default:return _e.Gray}},d=m=>{switch(m){case"running":return"\xBB";case"completed":return"\u2022";case"failed":return"\u2717";default:return"?"}},h=m=>{let y=(m.endTime||Date.now())-m.startTime,N=Math.floor(y/1e3);if(N<60)return`${N}s`;let Z=Math.floor(N/60),R=N%60;return`${Z}m ${R}s`},c=Math.min(r-4,80);return(0,vf.jsxs)(Ke,{flexDirection:"column",borderStyle:"round",borderColor:_e.AccentBlue,width:c,marginLeft:2,paddingX:1,children:[(0,vf.jsxs)(Ke,{justifyContent:"space-between",marginBottom:1,children:[(0,vf.jsx)(ke,{bold:!0,color:_e.AccentBlue,children:Re("background.task.panel.title")}),(0,vf.jsx)(ke,{color:_e.Gray,children:Re("background.task.panel.hint")})]}),n.length===0?(0,vf.jsx)(Ke,{paddingY:1,children:(0,vf.jsx)(ke,{color:_e.Gray,children:Re("background.task.panel.empty")})}):(0,vf.jsx)(Ke,{flexDirection:"column",children:n.map((m,G)=>{let y=G===o,N=I(m.status),Z=c-30,R=m.command.length>Z?m.command.substring(0,Z-3)+"...":m.command;return(0,vf.jsxs)(Ke,{flexDirection:"row",children:[(0,vf.jsx)(ke,{color:y?_e.AccentBlue:void 0,children:y?"\u25B8 ":" "}),(0,vf.jsxs)(ke,{color:_e.Gray,children:["[",m.id,"] "]}),(0,vf.jsx)(ke,{color:N,children:d(m.status)}),(0,vf.jsx)(ke,{children:" "}),(0,vf.jsx)(ke,{bold:y,children:R}),(0,vf.jsxs)(ke,{color:_e.Gray,children:[" (",h(m),")"]}),m.status==="completed"&&m.exitCode!==void 0&&(0,vf.jsxs)(ke,{color:m.exitCode===0?_e.AccentGreen:_e.AccentRed,children:[" ","[",m.exitCode,"]"]})]},m.id)})})]})};var A6e=Lt(ra(),1);na();ua();var o5=Lt(wr(),1);var Wma=({maxCommandLength:a=40})=>{let[e,r]=(0,A6e.useState)([]);if((0,A6e.useEffect)(()=>{let o=Vb(),t=()=>{let u=o.getRunningTasks();r(u)};t(),o.on("task-started",t),o.on("task-completed",t),o.on("task-failed",t),o.on("task-killed",t);let s=setInterval(t,1e3);return()=>{o.removeListener("task-started",t),o.removeListener("task-completed",t),o.removeListener("task-failed",t),o.removeListener("task-killed",t),clearInterval(s)}},[]),e.length===0)return null;if(e.length>1)return(0,o5.jsxs)(Ke,{marginLeft:2,children:[(0,o5.jsx)(ke,{color:_e.Gray,children:"\u23BF "}),(0,o5.jsx)(ke,{color:_e.AccentCyan,children:zt("background.task.hint.multiple",{count:e.length})}),(0,o5.jsx)(ke,{color:_e.Gray,children:" (\u2193 to manage)"})]});let n=e[0],i=n.command.length>a?n.command.substring(0,a-3)+"...":n.command;return(0,o5.jsxs)(Ke,{marginLeft:2,children:[(0,o5.jsx)(ke,{color:_e.Gray,children:"\u23BF "}),(0,o5.jsx)(ke,{color:_e.AccentCyan,children:i}),(0,o5.jsx)(ke,{color:_e.Gray,children:" (running) (\u2193 to manage)"})]})};var Ix=Lt(ra(),1);na();ua();import Xme from"node:fs";import xma from"node:path";import $5i from"node:os";var Fma=`
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
`;function Ema(a,e=!1){return e?`v${a}(${process.versions.node})`:`v${a}`}function DJ(a,e=!1){if(!e)return a;let r=[/^Claude-(?:3\.5-)?(.+)$/i,/^Claude-(.+)$/i,/^Gemini-(?:2\.0-)?(.+)$/i,/^Gemini-(.+)$/i,/^GPT-(.+)$/i,/^OpenAI-(.+)$/i];for(let n of r){let i=a.match(n);if(i&&i[1])return i[1]}return a}function wma(a,e=!1){if((typeof a=="string"?parseFloat(a):a)===100)return"";let n=`${a}%`;return e?n:`${n} ctx left`}function Rma(a){if(!a||a.mode==="off")return"";switch(a.effort){case"max":return"max";case"xhigh":return"xhi";case"high":return"high";case"medium":return"med";case"low":return"low";default:return a.mode==="auto"?"auto":"on"}}function Cma(a){return a>=80?{showNodeVersion:!1,simplifyContext:!1,simplifyModel:!1,level:"full"}:{showNodeVersion:!1,simplifyContext:!0,simplifyModel:!0,level:"compact"}}var yh=Lt(wr(),1);var Yma=["tip.help","tip.theme","tip.auth","tip.stats","tip.memory","tip.mcp","tip.tools","tip.init","tip.model","tip.plan","tip.docs","tip.session","tip.restore","tip.at.filepath","tip.shell.command","tip.shell.mode","tip.ctrl.j","tip.cli.update","tip.cli.cloud"],Vma=({config:a,version:e})=>{let r=(0,Ix.useMemo)(()=>{try{let c=xma.join($5i.homedir(),".easycode-user"),m=xma.join(c,"brand_upgrade_status.json");Xme.existsSync(c)||Xme.mkdirSync(c,{recursive:!0});let G=0;if(Xme.existsSync(m)){let y=Xme.readFileSync(m,"utf-8"),N=JSON.parse(y);G=typeof N.showCount=="number"?N.showCount:0}return G<3?(Xme.writeFileSync(m,JSON.stringify({showCount:G+1},null,2),"utf-8"),!0):!1}catch{return!0}},[]),n=(0,Ix.useMemo)(()=>Oo.getInstance().getUserInfo()?.name,[]),i=(0,Ix.useMemo)(()=>{let c=a.getModel(),m=a.getCloudModelInfo(c);if(m){let N=m.creditsPerRequest;return{displayName:DJ(m.displayName,!0),creditsText:`${N}x credits`}}return{displayName:DJ(c==="auto"?"Gemini":c,!0),creditsText:"API Usage Billing"}},[a]),[o,t]=(0,Ix.useState)([]);(0,Ix.useEffect)(()=>{(async()=>{await new Promise(m=>setTimeout(m,1e3));try{let y=(await new Ms(a.getProjectRoot()).listSessions()).slice(0,1).map(N=>({time:"",description:N.title||N.firstUserMessage?.slice(0,30)||"Untitled session"}));t(y)}catch{}})()},[a]);let s=(0,Ix.useMemo)(()=>{let c=Math.floor(Math.random()*Yma.length),m=Yma[c];return Re(m).replace(/^Tip:\s*/i,"").replace(/[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/gu,"").trim()},[]),u=a.getProjectRoot(),I=n?`Welcome back, ${n}!`:"Welcome back!",d=Fma.trim();return(0,yh.jsxs)(Ke,{flexDirection:"column",width:68,marginBottom:0,children:[(0,yh.jsxs)(Ke,{justifyContent:"space-between",paddingX:1,children:[(0,yh.jsxs)(ke,{color:_e.AccentBlue,bold:!0,children:["Easy Code v",e]}),(0,yh.jsx)(ke,{dimColor:!0,wrap:"truncate-middle",children:u})]}),r&&(0,yh.jsx)(Ke,{paddingX:1,marginY:0,children:(0,yh.jsx)(ke,{color:_e.AccentCyan,children:Re("welcome.brand.upgrade")})}),(0,yh.jsx)(Ke,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,paddingY:0,children:(0,yh.jsxs)(Ke,{flexDirection:"row",paddingX:0,children:[(0,yh.jsx)(Ke,{flexDirection:"column",width:18,justifyContent:"center",alignItems:"center",children:(0,yh.jsx)(ke,{color:_e.AccentBlue,children:d})}),(0,yh.jsxs)(Ke,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"flex-end",paddingLeft:1,children:[(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{color:_e.AccentBlue,bold:!0,wrap:"truncate-end",children:I})}),(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{dimColor:!0,wrap:"truncate-end",children:i.displayName})}),(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{color:_e.AccentCyan,wrap:"truncate-end",children:s})}),o.length>0&&(0,yh.jsx)(Ke,{children:(0,yh.jsxs)(ke,{dimColor:!0,wrap:"truncate-end",children:["Last: ",o[0].description]})})]})]})})]})};var F6e=Lt(ra(),1);var Z6e=Lt(ra(),1);var bRt=(0,Z6e.createContext)(void 0),l5=()=>{let a=Z6e.default.useContext(bRt);if(a===void 0)throw new Error("useStreamingContext must be used within a StreamingContextProvider");return a};var OJ=Lt(ra(),1);var N6e=Lt(wr(),1);var E$=({nonRespondingDisplay:a,isWaitingForConfirmation:e=!1})=>{let r=l5(),n=Kc(),[i,o]=(0,OJ.useState)(!0),[t,s]=(0,OJ.useState)(!0),u=(0,OJ.useRef)(null);(0,OJ.useEffect)(()=>(u.current&&(clearInterval(u.current),u.current=null),e&&!FW(n,"spinner")?(u.current=setInterval(()=>{s(m=>!m)},500),()=>{u.current&&clearInterval(u.current)}):(r==="responding"&&!FW(n,"spinner")?u.current=setInterval(()=>{o(m=>!m)},1e3):o(!0),()=>{u.current&&(clearInterval(u.current),u.current=null)})),[r,n,e]);let h=ko.getActiveTheme().colors.type==="dark"?_e.Foreground:_e.AccentBlue;return r==="responding"?FW(n,"spinner")?(0,N6e.jsx)(ke,{color:h,children:"\u2022"},"spinner-static"):(0,N6e.jsx)(ke,{color:h,children:i?"\u2022":"\u25E6"},"spinner-animated"):a?(0,N6e.jsx)(ke,{children:a},"spinner-static"):null};var W6e=Lt(ra(),1);na();var Qma=()=>{let[a,e]=(0,W6e.useState)(null);return(0,W6e.useEffect)(()=>{let r=i=>{e({inputTokens:i.inputTokens,outputTokens:i.outputTokens,totalTokens:i.totalTokens,timestamp:i.timestamp})},n=()=>{e(null)};return Pg.onRealTimeToken(r),Pg.onClearRealTimeToken(n),()=>{Pg.offRealTimeToken(r),Pg.offClearRealTimeToken(n)}},[]),a};ua();ua();var w$=Lt(ra(),1);function eRi(a){if(a.length>1)return!0;let e=a.codePointAt(0);return e?e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=127456&&e<=127487||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=126976&&e<=127023||e>=127136&&e<=127231||e===8252||e===8265||e===8482||e===8505||e===8596||e===8597||e===8598||e===8599||e===8600||e===8601||e===8617||e===8618||e===8986||e===8987||e===9e3||e===9167||e===9193||e===9194||e===9195||e===9196||e===9197||e===9198||e===9199||e===9200||e===9201||e===9202||e===9203||e===9725||e===9726||e===11088||e===11093:!1}function tRi(a){return["\u{1F4A1}","\u{1F680}","\u26A1","\u{1F525}","\u2B50","\u2728","\u{1F3AF}","\u{1F389}","\u{1F38A}","\u{1F31F}","\u{1F4AF}","\u{1F527}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F528}","\u2692\uFE0F","\u{1F9F0}","\u270C\uFE0F","\u{1F185}","\u24CB"].includes(a)}function gRt(a){return Array.from(a).map((e,r)=>{let n=eRi(e)||tRi(e);return{char:e,index:r,isEmoji:n,shouldHighlight:!n}})}function Hma(a){return gRt(a).filter(r=>r.shouldHighlight).length}var Xma=(a,e)=>{let{isActive:r,interval:n=80,highlightLength:i,stepSize:o=1,highlightRatio:t=.3}=e,s=gRt(a),u=Hma(a),d=(N=>{if(i!==void 0)return i;let Z=Math.round(N*t);return Math.max(2,Math.min(Z,Math.floor(N/2)))})(u),[h,c]=(0,w$.useState)(0),m=(0,w$.useRef)(null),G=n;return(0,w$.useEffect)(()=>{if(m.current&&(clearInterval(m.current),m.current=null),!r){c(0);return}if(!a||a.length===0){c(0);return}return m.current=setInterval(()=>{c(N=>{let Z=N+o;return Z>=u?0:Z})},G),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[r,a,G,d,o,u]),{highlightedChars:(()=>{if(!a||!r)return s.map((w,b)=>({char:w.char,isHighlighted:!1,index:b}));let N=0,Z=0,R=d+4,F=h-2;return s.map((w,b)=>{let v=!1,A=0;if(w.shouldHighlight){if(N>=F&&N<F+R){let E=N-F;E<2?A=0:E<2+Math.floor(d*.3)?A=1:E<2+Math.floor(d*.7)?A=2:E<2+d?A=1:A=0,v=A>0}N++}return{char:w.char,isHighlighted:v,highlightIntensity:A,index:b}})})(),currentPosition:h,isAnimating:r&&a.length>0}};function kma(a){return{dim:"#666666",medium:"#CCCCCC",bright:"#F2F2F2"}}var zb=Lt(wr(),1);var Sma=a=>a==null?"0":a>=1e3?`${(a/1e3).toFixed(2)}k`:a.toString();var Lma=({currentLoadingPhrase:a,elapsedTime:e,rightContent:r,thought:n,estimatedInputTokens:i,isExecutingTools:o=!1,lastTokenUsage:t})=>{let s=l5(),u=Qma(),I=Kc(),d=o,h=({isToolCall:A})=>{let[E,f]=(0,F6e.useState)(!0);return(0,F6e.useEffect)(()=>{if(s==="waiting_for_confirmation"){f(!0);return}let p=setInterval(()=>{f(g=>!g)},800);return()=>clearInterval(p)},[s]),(0,zb.jsx)(ke,{color:_e.AccentOrange,children:E?A?"\u2692\uFE0F":"\u2191":A?" ":" "})},c=s==="waiting_for_confirmation"?js()?"\u7B49\u5F85\u7528\u6237\u786E\u8BA4...":"Waiting for user confirmation...":n?.subject||a||"",m=s==="responding"&&!FW(I,"loading"),{highlightedChars:G}=Xma(c,{isActive:m,interval:80,highlightRatio:.3,stepSize:1}),Z=ko.getActiveTheme().colors.type==="dark"?_e.Foreground:_e.AccentBlue,R=kma(Z);if(s==="idle")return null;let F=s==="waiting_for_confirmation"?js()?"\u7B49\u5F85\u7528\u6237\u786E\u8BA4...":"Waiting for user confirmation...":n?.subject||a,w=u?.inputTokens||i,b=!!u?.inputTokens,v=m;return(0,zb.jsx)(Ke,{marginTop:1,paddingLeft:0,flexDirection:"column",children:(0,zb.jsxs)(Ke,{width:"100%",children:[(0,zb.jsx)(Ke,{marginRight:1,children:s==="waiting_for_confirmation"?(0,zb.jsx)(ke,{children:"\u280F"},"static-indicator"):(0,zb.jsx)(E$,{},"dynamic-spinner")}),(0,zb.jsx)(Ke,{flexShrink:1,children:(0,zb.jsxs)(ke,{wrap:"wrap",color:_e.AccentOrange,children:[F?v?(0,zb.jsx)(ke,{children:G.map(({char:A,highlightIntensity:E,index:f})=>{let p;switch(E){case 2:p=R.bright;break;case 1:p=R.medium;break;default:p=R.dim;break}return(0,zb.jsx)(ke,{color:p,children:A},f)})}):(0,zb.jsx)(ke,{color:_e.AccentOrange,children:F}):null,(0,zb.jsx)(ke,{color:_e.Gray,children:s==="waiting_for_confirmation"?"":(()=>{let A=`${BTe()} to cancel, ${e<60?`${e}s`:np(e*1e3)}`;if(t&&(t.input_tokens>0||t.output_tokens>0)){let E=Sma(t.input_tokens),f=Sma(t.output_tokens);return` (${A} | \u2191 ${E} \u2193 ${f})`}return` (${A})`})()})]})}),(0,zb.jsx)(Ke,{flexGrow:1}),r?(0,zb.jsx)(Ke,{children:r}):null]})})};na();var kme=Lt(wr(),1);var Bma=({approvalMode:a})=>{let e="",r="",n="";switch(a){case za.AUTO_EDIT:e=_e.AccentGreen,r="accepting edits",n=" (shift+tab to toggle)";break;case za.YOLO:e=_e.AccentRed,r="YOLO mode",n=" (ctrl+y)";break;case za.DEFAULT:default:break}return(0,kme.jsxs)(Ke,{children:[(0,kme.jsx)(ke,{color:e,dimColor:!0,children:r}),n?(0,kme.jsx)(ke,{color:_e.Gray,children:n}):null]})};var R$=Lt(ra(),1);var Sme=Lt(wr(),1);var Jma=({config:a})=>{let r=l5()!=="idle",[,n]=(0,R$.useState)(0);(0,R$.useEffect)(()=>{if(!r)return;let u=setInterval(()=>n(I=>(I+1)%1e6),1e3);return()=>clearInterval(u)},[r]);let i=(0,R$.useRef)(null),o=null;try{o=a?.getGeminiClient()?.getGoalContext()??null}catch{o=null}if(!o)return null;let t;r?(t=Date.now()-o.startedAt,i.current=t):i.current!=null?t=i.current:(t=Date.now()-o.startedAt,i.current=t);let s=rRi(t);return(0,Sme.jsxs)(Ke,{children:[(0,Sme.jsx)(ke,{color:_e.AccentPurple,dimColor:!0,children:"\u25CE /goal active"}),(0,Sme.jsx)(ke,{color:_e.Gray,children:` (${s})`})]})};function rRi(a){let e=Math.max(0,Math.floor(a/1e3));if(e<60)return`${e}s`;let r=Math.floor(e/60);if(r<60){let o=e%60;return`${r}m ${o}s`}let n=Math.floor(r/60),i=r%60;return`${n}h ${i}m`}var Dma=Lt(wr(),1);var Tma=()=>(0,Dma.jsx)(ke,{color:_e.AccentCyan,dimColor:!0,children:"\u26A1 workflow running"});var yf=Lt(ra(),1);rY();var Uma=Lt(Mma(),1),aRi=new Intl.Segmenter,nRi=/^\p{Default_Ignorable_Code_Point}$/u;function $o(a,e={}){if(typeof a!="string"||a.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(a=h2(a)),a.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:t}of aRi.segment(a)){let s=t.codePointAt(0);if(!(s<=31||s>=127&&s<=159)&&!(s>=8203&&s<=8207||s===65279)&&!(s>=768&&s<=879||s>=6832&&s<=6911||s>=7616&&s<=7679||s>=8400&&s<=8447||s>=65056&&s<=65071)&&!(s>=55296&&s<=57343)&&!(s>=65024&&s<=65039)&&!nRi.test(t)){if((0,Uma.default)().test(t)){i+=2;continue}i+=ute(s,o)}}return i}na();Dbe();var wa=Lt(wr(),1);function E6e(a){let e=Math.floor(a/1e3),r=Math.floor(e/60),n=Math.floor(r/60);return n>0?`${n}h ${r%60}m ${e%60}s`:r>0?`${r}m ${e%60}s`:`${e}s`}function yRt(a){return a>=1e6?`${(a/1e6).toFixed(1)}M tok`:a>=1e3?`${(a/1e3).toFixed(1)}k tok`:`${a} tok`}function Lme(a){return a==="completed"?"\u2714":a==="failed"?"\u2718":"\u2026"}function C$(a){return a==="completed"?_e.AccentGreen:a==="failed"?_e.AccentRed:_e.AccentYellow}function vRt(a){let e=a.phases.flatMap(r=>r.agents);return e.length?e:a.agents}function _ma(a){return a.agents}function RH(a,e){if(e=Math.max(1,e),$o(a)<=e)return a+" ".repeat(e-$o(a));let r=0,n=0,i=[...a];for(;n<i.length;){let t=$o(i[n]);if(r+t>e-1)break;r+=t,n++}let o=Math.max(0,e-1-r);return i.slice(0,n).join("")+"\u2026"+" ".repeat(o)}function GRt(a,e){if(e<=0)return[a];let r=[];for(let n of a.split(`
|
|
6536
|
+
.-+*-
|
|
6537
|
+
:+oo*=.
|
|
6538
|
+
:=ooo=:
|
|
6539
|
+
:oo*: .+*:
|
|
6540
|
+
:oo*: \u2726 :+*-.
|
|
6541
|
+
:=ooo=. . :+*=
|
|
6542
|
+
-+++=+*oo=.
|
|
6543
|
+
=**+:
|
|
6544
|
+
`;function Ema(a,e=!1){return e?`v${a}(${process.versions.node})`:`v${a}`}function DJ(a,e=!1){if(!e)return a;let r=[/^Claude-(?:3\.5-)?(.+)$/i,/^Claude-(.+)$/i,/^Gemini-(?:2\.0-)?(.+)$/i,/^Gemini-(.+)$/i,/^GPT-(.+)$/i,/^OpenAI-(.+)$/i];for(let n of r){let i=a.match(n);if(i&&i[1])return i[1]}return a}function wma(a,e=!1){if((typeof a=="string"?parseFloat(a):a)===100)return"";let n=`${a}%`;return e?n:`${n} ctx left`}function Rma(a){if(!a||a.mode==="off")return"";switch(a.effort){case"max":return"max";case"xhigh":return"xhi";case"high":return"high";case"medium":return"med";case"low":return"low";default:return a.mode==="auto"?"auto":"on"}}function Cma(a){return a>=80?{showNodeVersion:!1,simplifyContext:!1,simplifyModel:!1,level:"full"}:{showNodeVersion:!1,simplifyContext:!0,simplifyModel:!0,level:"compact"}}var yh=Lt(wr(),1);var Yma=["tip.help","tip.theme","tip.auth","tip.stats","tip.memory","tip.mcp","tip.tools","tip.init","tip.model","tip.plan","tip.docs","tip.session","tip.restore","tip.at.filepath","tip.shell.command","tip.shell.mode","tip.ctrl.j","tip.cli.update","tip.cli.cloud"],Vma=({config:a,version:e})=>{let r=(0,Ix.useMemo)(()=>{try{let c=xma.join($5i.homedir(),".easycode-user"),m=xma.join(c,"brand_upgrade_status.json");Xme.existsSync(c)||Xme.mkdirSync(c,{recursive:!0});let G=0;if(Xme.existsSync(m)){let y=Xme.readFileSync(m,"utf-8"),N=JSON.parse(y);G=typeof N.showCount=="number"?N.showCount:0}return G<3?(Xme.writeFileSync(m,JSON.stringify({showCount:G+1},null,2),"utf-8"),!0):!1}catch{return!0}},[]),n=(0,Ix.useMemo)(()=>Oo.getInstance().getUserInfo()?.name,[]),i=(0,Ix.useMemo)(()=>{let c=a.getModel(),m=a.getCloudModelInfo(c);if(m){let N=m.creditsPerRequest;return{displayName:DJ(m.displayName,!0),creditsText:`${N}x credits`}}return{displayName:DJ(c==="auto"?"Gemini":c,!0),creditsText:"API Usage Billing"}},[a]),[o,t]=(0,Ix.useState)([]);(0,Ix.useEffect)(()=>{(async()=>{await new Promise(m=>setTimeout(m,1e3));try{let y=(await new Ms(a.getProjectRoot()).listSessions()).slice(0,1).map(N=>({time:"",description:N.title||N.firstUserMessage?.slice(0,30)||"Untitled session"}));t(y)}catch{}})()},[a]);let s=(0,Ix.useMemo)(()=>{let c=Math.floor(Math.random()*Yma.length),m=Yma[c];return Re(m).replace(/^Tip:\s*/i,"").replace(/[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/gu,"").trim()},[]),u=a.getProjectRoot(),I=n?`Welcome back, ${n}!`:"Welcome back!",d=Fma.replace(/^\n+/,"").replace(/\s+$/,"");return(0,yh.jsxs)(Ke,{flexDirection:"column",width:68,marginBottom:0,children:[(0,yh.jsxs)(Ke,{justifyContent:"space-between",paddingX:1,children:[(0,yh.jsxs)(ke,{color:_e.AccentBlue,bold:!0,children:["Easy Code v",e]}),(0,yh.jsx)(ke,{dimColor:!0,wrap:"truncate-middle",children:u})]}),r&&(0,yh.jsx)(Ke,{paddingX:1,marginY:0,children:(0,yh.jsx)(ke,{color:_e.AccentCyan,children:Re("welcome.brand.upgrade")})}),(0,yh.jsx)(Ke,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,paddingY:0,children:(0,yh.jsxs)(Ke,{flexDirection:"row",paddingX:0,children:[(0,yh.jsx)(Ke,{flexDirection:"column",width:18,justifyContent:"center",alignItems:"center",children:(0,yh.jsx)(ke,{color:_e.AccentBlue,children:d})}),(0,yh.jsxs)(Ke,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"flex-end",paddingLeft:1,children:[(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{color:_e.AccentBlue,bold:!0,wrap:"truncate-end",children:I})}),(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{dimColor:!0,wrap:"truncate-end",children:i.displayName})}),(0,yh.jsx)(Ke,{children:(0,yh.jsx)(ke,{color:_e.AccentCyan,wrap:"truncate-end",children:s})}),o.length>0&&(0,yh.jsx)(Ke,{children:(0,yh.jsxs)(ke,{dimColor:!0,wrap:"truncate-end",children:["Last: ",o[0].description]})})]})]})})]})};var F6e=Lt(ra(),1);var Z6e=Lt(ra(),1);var bRt=(0,Z6e.createContext)(void 0),l5=()=>{let a=Z6e.default.useContext(bRt);if(a===void 0)throw new Error("useStreamingContext must be used within a StreamingContextProvider");return a};var OJ=Lt(ra(),1);var N6e=Lt(wr(),1);var E$=({nonRespondingDisplay:a,isWaitingForConfirmation:e=!1})=>{let r=l5(),n=Kc(),[i,o]=(0,OJ.useState)(!0),[t,s]=(0,OJ.useState)(!0),u=(0,OJ.useRef)(null);(0,OJ.useEffect)(()=>(u.current&&(clearInterval(u.current),u.current=null),e&&!FW(n,"spinner")?(u.current=setInterval(()=>{s(m=>!m)},500),()=>{u.current&&clearInterval(u.current)}):(r==="responding"&&!FW(n,"spinner")?u.current=setInterval(()=>{o(m=>!m)},1e3):o(!0),()=>{u.current&&(clearInterval(u.current),u.current=null)})),[r,n,e]);let h=ko.getActiveTheme().colors.type==="dark"?_e.Foreground:_e.AccentBlue;return r==="responding"?FW(n,"spinner")?(0,N6e.jsx)(ke,{color:h,children:"\u2022"},"spinner-static"):(0,N6e.jsx)(ke,{color:h,children:i?"\u2022":"\u25E6"},"spinner-animated"):a?(0,N6e.jsx)(ke,{children:a},"spinner-static"):null};var W6e=Lt(ra(),1);na();var Qma=()=>{let[a,e]=(0,W6e.useState)(null);return(0,W6e.useEffect)(()=>{let r=i=>{e({inputTokens:i.inputTokens,outputTokens:i.outputTokens,totalTokens:i.totalTokens,timestamp:i.timestamp})},n=()=>{e(null)};return Pg.onRealTimeToken(r),Pg.onClearRealTimeToken(n),()=>{Pg.offRealTimeToken(r),Pg.offClearRealTimeToken(n)}},[]),a};ua();ua();var w$=Lt(ra(),1);function eRi(a){if(a.length>1)return!0;let e=a.codePointAt(0);return e?e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=127456&&e<=127487||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=126976&&e<=127023||e>=127136&&e<=127231||e===8252||e===8265||e===8482||e===8505||e===8596||e===8597||e===8598||e===8599||e===8600||e===8601||e===8617||e===8618||e===8986||e===8987||e===9e3||e===9167||e===9193||e===9194||e===9195||e===9196||e===9197||e===9198||e===9199||e===9200||e===9201||e===9202||e===9203||e===9725||e===9726||e===11088||e===11093:!1}function tRi(a){return["\u{1F4A1}","\u{1F680}","\u26A1","\u{1F525}","\u2B50","\u2728","\u{1F3AF}","\u{1F389}","\u{1F38A}","\u{1F31F}","\u{1F4AF}","\u{1F527}","\u2699\uFE0F","\u{1F6E0}\uFE0F","\u{1F528}","\u2692\uFE0F","\u{1F9F0}","\u270C\uFE0F","\u{1F185}","\u24CB"].includes(a)}function gRt(a){return Array.from(a).map((e,r)=>{let n=eRi(e)||tRi(e);return{char:e,index:r,isEmoji:n,shouldHighlight:!n}})}function Hma(a){return gRt(a).filter(r=>r.shouldHighlight).length}var Xma=(a,e)=>{let{isActive:r,interval:n=80,highlightLength:i,stepSize:o=1,highlightRatio:t=.3}=e,s=gRt(a),u=Hma(a),d=(N=>{if(i!==void 0)return i;let Z=Math.round(N*t);return Math.max(2,Math.min(Z,Math.floor(N/2)))})(u),[h,c]=(0,w$.useState)(0),m=(0,w$.useRef)(null),G=n;return(0,w$.useEffect)(()=>{if(m.current&&(clearInterval(m.current),m.current=null),!r){c(0);return}if(!a||a.length===0){c(0);return}return m.current=setInterval(()=>{c(N=>{let Z=N+o;return Z>=u?0:Z})},G),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[r,a,G,d,o,u]),{highlightedChars:(()=>{if(!a||!r)return s.map((w,b)=>({char:w.char,isHighlighted:!1,index:b}));let N=0,Z=0,R=d+4,F=h-2;return s.map((w,b)=>{let v=!1,A=0;if(w.shouldHighlight){if(N>=F&&N<F+R){let E=N-F;E<2?A=0:E<2+Math.floor(d*.3)?A=1:E<2+Math.floor(d*.7)?A=2:E<2+d?A=1:A=0,v=A>0}N++}return{char:w.char,isHighlighted:v,highlightIntensity:A,index:b}})})(),currentPosition:h,isAnimating:r&&a.length>0}};function kma(a){return{dim:"#666666",medium:"#CCCCCC",bright:"#F2F2F2"}}var zb=Lt(wr(),1);var Sma=a=>a==null?"0":a>=1e3?`${(a/1e3).toFixed(2)}k`:a.toString();var Lma=({currentLoadingPhrase:a,elapsedTime:e,rightContent:r,thought:n,estimatedInputTokens:i,isExecutingTools:o=!1,lastTokenUsage:t})=>{let s=l5(),u=Qma(),I=Kc(),d=o,h=({isToolCall:A})=>{let[E,f]=(0,F6e.useState)(!0);return(0,F6e.useEffect)(()=>{if(s==="waiting_for_confirmation"){f(!0);return}let p=setInterval(()=>{f(g=>!g)},800);return()=>clearInterval(p)},[s]),(0,zb.jsx)(ke,{color:_e.AccentOrange,children:E?A?"\u2692\uFE0F":"\u2191":A?" ":" "})},c=s==="waiting_for_confirmation"?js()?"\u7B49\u5F85\u7528\u6237\u786E\u8BA4...":"Waiting for user confirmation...":n?.subject||a||"",m=s==="responding"&&!FW(I,"loading"),{highlightedChars:G}=Xma(c,{isActive:m,interval:80,highlightRatio:.3,stepSize:1}),Z=ko.getActiveTheme().colors.type==="dark"?_e.Foreground:_e.AccentBlue,R=kma(Z);if(s==="idle")return null;let F=s==="waiting_for_confirmation"?js()?"\u7B49\u5F85\u7528\u6237\u786E\u8BA4...":"Waiting for user confirmation...":n?.subject||a,w=u?.inputTokens||i,b=!!u?.inputTokens,v=m;return(0,zb.jsx)(Ke,{marginTop:1,paddingLeft:0,flexDirection:"column",children:(0,zb.jsxs)(Ke,{width:"100%",children:[(0,zb.jsx)(Ke,{marginRight:1,children:s==="waiting_for_confirmation"?(0,zb.jsx)(ke,{children:"\u280F"},"static-indicator"):(0,zb.jsx)(E$,{},"dynamic-spinner")}),(0,zb.jsx)(Ke,{flexShrink:1,children:(0,zb.jsxs)(ke,{wrap:"wrap",color:_e.AccentOrange,children:[F?v?(0,zb.jsx)(ke,{children:G.map(({char:A,highlightIntensity:E,index:f})=>{let p;switch(E){case 2:p=R.bright;break;case 1:p=R.medium;break;default:p=R.dim;break}return(0,zb.jsx)(ke,{color:p,children:A},f)})}):(0,zb.jsx)(ke,{color:_e.AccentOrange,children:F}):null,(0,zb.jsx)(ke,{color:_e.Gray,children:s==="waiting_for_confirmation"?"":(()=>{let A=`${BTe()} to cancel, ${e<60?`${e}s`:np(e*1e3)}`;if(t&&(t.input_tokens>0||t.output_tokens>0)){let E=Sma(t.input_tokens),f=Sma(t.output_tokens);return` (${A} | \u2191 ${E} \u2193 ${f})`}return` (${A})`})()})]})}),(0,zb.jsx)(Ke,{flexGrow:1}),r?(0,zb.jsx)(Ke,{children:r}):null]})})};na();var kme=Lt(wr(),1);var Bma=({approvalMode:a})=>{let e="",r="",n="";switch(a){case za.AUTO_EDIT:e=_e.AccentGreen,r="accepting edits",n=" (shift+tab to toggle)";break;case za.YOLO:e=_e.AccentRed,r="YOLO mode",n=" (ctrl+y)";break;case za.DEFAULT:default:break}return(0,kme.jsxs)(Ke,{children:[(0,kme.jsx)(ke,{color:e,dimColor:!0,children:r}),n?(0,kme.jsx)(ke,{color:_e.Gray,children:n}):null]})};var R$=Lt(ra(),1);var Sme=Lt(wr(),1);var Jma=({config:a})=>{let r=l5()!=="idle",[,n]=(0,R$.useState)(0);(0,R$.useEffect)(()=>{if(!r)return;let u=setInterval(()=>n(I=>(I+1)%1e6),1e3);return()=>clearInterval(u)},[r]);let i=(0,R$.useRef)(null),o=null;try{o=a?.getGeminiClient()?.getGoalContext()??null}catch{o=null}if(!o)return null;let t;r?(t=Date.now()-o.startedAt,i.current=t):i.current!=null?t=i.current:(t=Date.now()-o.startedAt,i.current=t);let s=rRi(t);return(0,Sme.jsxs)(Ke,{children:[(0,Sme.jsx)(ke,{color:_e.AccentPurple,dimColor:!0,children:"\u25CE /goal active"}),(0,Sme.jsx)(ke,{color:_e.Gray,children:` (${s})`})]})};function rRi(a){let e=Math.max(0,Math.floor(a/1e3));if(e<60)return`${e}s`;let r=Math.floor(e/60);if(r<60){let o=e%60;return`${r}m ${o}s`}let n=Math.floor(r/60),i=r%60;return`${n}h ${i}m`}var Dma=Lt(wr(),1);var Tma=()=>(0,Dma.jsx)(ke,{color:_e.AccentCyan,dimColor:!0,children:"\u26A1 workflow running"});var yf=Lt(ra(),1);rY();var Uma=Lt(Mma(),1),aRi=new Intl.Segmenter,nRi=/^\p{Default_Ignorable_Code_Point}$/u;function $o(a,e={}){if(typeof a!="string"||a.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(a=h2(a)),a.length===0)return 0;let i=0,o={ambiguousAsWide:!r};for(let{segment:t}of aRi.segment(a)){let s=t.codePointAt(0);if(!(s<=31||s>=127&&s<=159)&&!(s>=8203&&s<=8207||s===65279)&&!(s>=768&&s<=879||s>=6832&&s<=6911||s>=7616&&s<=7679||s>=8400&&s<=8447||s>=65056&&s<=65071)&&!(s>=55296&&s<=57343)&&!(s>=65024&&s<=65039)&&!nRi.test(t)){if((0,Uma.default)().test(t)){i+=2;continue}i+=ute(s,o)}}return i}na();Dbe();var wa=Lt(wr(),1);function E6e(a){let e=Math.floor(a/1e3),r=Math.floor(e/60),n=Math.floor(r/60);return n>0?`${n}h ${r%60}m ${e%60}s`:r>0?`${r}m ${e%60}s`:`${e}s`}function yRt(a){return a>=1e6?`${(a/1e6).toFixed(1)}M tok`:a>=1e3?`${(a/1e3).toFixed(1)}k tok`:`${a} tok`}function Lme(a){return a==="completed"?"\u2714":a==="failed"?"\u2718":"\u2026"}function C$(a){return a==="completed"?_e.AccentGreen:a==="failed"?_e.AccentRed:_e.AccentYellow}function vRt(a){let e=a.phases.flatMap(r=>r.agents);return e.length?e:a.agents}function _ma(a){return a.agents}function RH(a,e){if(e=Math.max(1,e),$o(a)<=e)return a+" ".repeat(e-$o(a));let r=0,n=0,i=[...a];for(;n<i.length;){let t=$o(i[n]);if(r+t>e-1)break;r+=t,n++}let o=Math.max(0,e-1-r);return i.slice(0,n).join("")+"\u2026"+" ".repeat(o)}function GRt(a,e){if(e<=0)return[a];let r=[];for(let n of a.split(`
|
|
6542
6545
|
`)){if(n===""){r.push("");continue}let i="",o=0;for(let t of[...n]){let s=$o(t);o+s>e?(r.push(i),i=t,o=s):(i+=t,o+=s)}r.push(i)}return r}var iRi=({wf:a,selected:e,now:r,rowWidth:n})=>{let i=vRt(a),o=a.endTime?a.endTime-a.startTime:r-a.startTime,t=a.totalTokenUsage.totalTokens,s=` ${i.length} agent${i.length!==1?"s":""}${t>0?` \xB7 ${yRt(t)}`:""} \xB7 ${E6e(o)}`,u=Math.max(6,n-$o(s)-4),I=RH(a.slug,u).trimEnd();return(0,wa.jsxs)(Ke,{children:[(0,wa.jsx)(ke,{color:_e.AccentCyan,children:e?"\u276F ":" "}),(0,wa.jsxs)(ke,{color:C$(a.status),children:[Lme(a.status)," "]}),(0,wa.jsx)(ke,{bold:e,children:I}),(0,wa.jsx)(ke,{color:_e.Gray,children:s})]})},sRi=({wf:a,selectedPhase:e,selectedAgent:r,focus:n,now:i,width:o,height:t})=>{let s=Math.max(22,Math.floor(o*.26)),u=o-s-3,I=t-8,d=a.phases.length?a.phases:[{index:0,name:"\u6267\u884C",description:"",agents:a.agents}],h=d[e],c=h?_ma(h):a.agents,m=vRt(a).length,G=vRt(a).filter(H=>H.status==="completed").length,y=E6e((a.endTime??i)-a.startTime),N=`${G}/${m} agent${m!==1?"s":""} \xB7 ${y} \xB7 ${a.status}`,Z=$o(N),R=Math.max(10,o-Z-4),F=RH(a.description??"",R).trimEnd(),w=$o(F),b=Math.max(1,o-w-Z-2),v=s-8,A=Math.max(...d.map(H=>{let k=H.agents.length,S=H.agents.filter(J=>J.status==="completed").length;return k>0?`${S}/${k}`.length:0}),0),E=Math.max(4,v-A-1),f=u-8,p=34,g=c.length?Math.max(...c.map(H=>$o(H.model??"")),0):0,W=Math.max(8,f-g-(g>0?2:0)-p-2),x=H=>{let k=H.tokenUsage?yRt(H.tokenUsage.totalTokens):"0 tok",S=E6e((H.endTime??i)-H.startTime),J=H.status==="failed"&&H.outcome?` \xB7 failed: ${H.outcome.slice(0,28)}\u2026`:"";return`${k} \xB7 ${H.toolCallCount} tools \xB7 ${S}${J}`};return(0,wa.jsxs)(Ke,{flexDirection:"column",children:[(0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{bold:!0,children:a.slug})}),(0,wa.jsxs)(Ke,{marginBottom:1,children:[(0,wa.jsx)(ke,{color:_e.Gray,children:F}),(0,wa.jsx)(ke,{children:" ".repeat(b)}),(0,wa.jsx)(ke,{color:C$(a.status),children:N})]}),(0,wa.jsxs)(Ke,{children:[(0,wa.jsxs)(Ke,{flexDirection:"column",width:s,borderStyle:"round",borderColor:n==="left"?_e.AccentCyan:_e.Gray,children:[(0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsx)(ke,{bold:!0,color:_e.AccentCyan,children:"Phases"})}),d.map((H,k)=>{let S=H.agents.filter(Y=>Y.status==="completed").length,J=H.agents.length,L=H.agents.length===0?"running":H.agents.every(Y=>Y.status==="completed")?"completed":H.agents.some(Y=>Y.status==="failed")?"failed":"running",X=n==="left"&&k===e,Q=J>0?`${S}/${J}`:"",V=RH(H.name,E),C=Q.padStart(A);return(0,wa.jsxs)(Ke,{paddingX:1,children:[(0,wa.jsx)(ke,{color:X?_e.AccentCyan:void 0,children:X?"\u276F ":" "}),(0,wa.jsxs)(ke,{color:C$(L),children:[Lme(L)," "]}),(0,wa.jsx)(ke,{bold:X,children:V}),Q?(0,wa.jsx)(ke,{color:_e.Gray,children:C}):null]},k)}),Array.from({length:Math.max(0,I-d.length-1)}).map((H,k)=>(0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},`pad-${k}`))]}),(0,wa.jsx)(ke,{children:" "}),(0,wa.jsxs)(Ke,{flexDirection:"column",width:u,borderStyle:"round",borderColor:n==="right"?_e.AccentCyan:_e.Gray,children:[(0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsxs)(ke,{bold:!0,color:_e.AccentCyan,children:[h?.name??"\u6267\u884C"," \xB7 ",c.length," agent",c.length!==1?"s":""]})}),c.length===0&&(0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:"No agents yet"})}),c.map((H,k)=>{let S=n==="right"&&k===r,J=(H.model??"").padEnd(g),L=x(H),X=RH(H.label,W);return(0,wa.jsxs)(Ke,{paddingX:1,children:[(0,wa.jsx)(ke,{color:S?_e.AccentCyan:void 0,children:S?"\u276F ":" "}),(0,wa.jsxs)(ke,{color:C$(H.status),children:[Lme(H.status)," "]}),(0,wa.jsx)(ke,{bold:S,children:X}),(0,wa.jsx)(ke,{color:_e.Gray,children:` ${J} ${L}`})]},H.agentId)}),Array.from({length:Math.max(0,I-c.length-1)}).map((H,k)=>(0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},`rpad-${k}`))]})]}),(0,wa.jsx)(Ke,{marginTop:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:n==="left"?"\u2191\u2193 select \xB7 \u23CE view agents \xB7 esc back":"\u2191\u2193 select \xB7 \u23CE view detail \xB7 \u2190 phases \xB7 esc close"})})]})},oRi=({wf:a,agent:e,phaseAgents:r,selectedAgentIndex:n,phaseName:i,now:o,width:t,height:s,promptExpanded:u,scrollOffset:I})=>{let d=Math.max(24,Math.floor(t*.3)),h=t-d-3,c=Math.max(20,h-7),m=E6e((e.endTime??o)-e.startTime),G=e.tokenUsage?yRt(e.tokenUsage.totalTokens):"",y=Math.max(6,s-4),N=Math.max(3,y-3),Z=[],R=e.status==="failed"?"Failed":e.status==="completed"?"Completed":e.currentPhase==="executing_tools"?"Executing tools":"Thinking",F=e.status==="failed"&&e.outcome?` (${e.outcome.slice(0,60)})`:"";Z.push((0,wa.jsxs)(Ke,{paddingX:1,children:[(0,wa.jsxs)(ke,{color:C$(e.status),children:[Lme(e.status)," "]}),(0,wa.jsx)(ke,{bold:!0,children:R}),(0,wa.jsxs)(ke,{color:_e.Gray,children:[e.model?` \xB7 ${e.model}`:"",G?` \xB7 ${G}`:"",` \xB7 ${e.toolCallCount} tool calls`,` \xB7 ${m}`,F]})]},"status")),Z.push((0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},"sep1"));let w=e.prompt.split(`
|
|
6543
6546
|
`),b=w.length>2;Z.push((0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsxs)(ke,{color:_e.Gray,children:[`Prompt \xB7 ${w.length} line${w.length!==1?"s":""}`,b?u?" \xB7 \u23CE collapse":" \xB7 \u23CE expand":""]})},"prompt-hdr")),(u?w:w.slice(0,2)).forEach((W,x)=>{GRt(W,c).forEach((H,k)=>{Z.push((0,wa.jsx)(Ke,{paddingLeft:3,children:(0,wa.jsx)(ke,{color:_e.AccentCyan,children:H})},`prompt-${x}-${k}`))})}),!u&&w.length>2&&Z.push((0,wa.jsx)(Ke,{paddingLeft:3,children:(0,wa.jsx)(ke,{color:_e.Gray,children:`\u2026 ${w.length-2} more lines`})},"prompt-more")),e.toolCallCount>0&&(Z.push((0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},"sep2")),Z.push((0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:`Activity \xB7 last ${e.recentToolCalls.length} of ${e.toolCallCount} tool calls`})},"activity-hdr")),e.recentToolCalls.forEach((W,x)=>{GRt(W,c).forEach((H,k)=>{Z.push((0,wa.jsx)(Ke,{paddingLeft:3,children:(0,wa.jsx)(ke,{children:H})},`tc-${x}-${k}`))})})),e.outcome&&(Z.push((0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},"sep3")),Z.push((0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:"Outcome"})},"outcome-hdr")),GRt(e.outcome,c).forEach((W,x)=>{Z.push((0,wa.jsx)(Ke,{paddingLeft:3,children:(0,wa.jsx)(ke,{color:e.status==="failed"?_e.AccentRed:_e.AccentGreen,children:W})},`outcome-${x}`))}));let A=Math.max(0,Z.length-N),E=Math.max(0,Math.min(I,A)),f=Z.slice(E,E+N),p=E>0,g=E<A;return(0,wa.jsxs)(Ke,{flexDirection:"column",children:[(0,wa.jsxs)(Ke,{marginBottom:1,children:[(0,wa.jsx)(ke,{bold:!0,children:a.slug}),(0,wa.jsx)(ke,{color:_e.Gray,children:" \u2014 "}),(0,wa.jsx)(ke,{color:_e.Gray,children:RH(a.description??"",Math.max(10,t-$o(a.slug)-5)).trimEnd()})]}),(0,wa.jsxs)(Ke,{children:[(0,wa.jsxs)(Ke,{flexDirection:"column",width:d,height:y,borderStyle:"round",borderColor:_e.Gray,overflow:"hidden",children:[(0,wa.jsx)(Ke,{paddingX:1,children:(0,wa.jsx)(ke,{bold:!0,color:_e.AccentCyan,children:(()=>{let W=` \xB7 ${r.length} agent${r.length!==1?"s":""}`,x=Math.max(4,d-6-W.length);return RH(i,x).trimEnd()+W})()})}),r.map((W,x)=>{let H=Math.max(4,d-8),k=RH(W.label,H).trimEnd(),S=x===n;return(0,wa.jsxs)(Ke,{paddingX:1,children:[(0,wa.jsx)(ke,{color:S?_e.AccentCyan:void 0,children:S?"\u276F ":" "}),(0,wa.jsxs)(ke,{color:C$(W.status),children:[Lme(W.status)," "]}),(0,wa.jsx)(ke,{bold:S,children:k})]},W.agentId)})]}),(0,wa.jsx)(ke,{children:" "}),(0,wa.jsxs)(Ke,{flexDirection:"column",width:h,height:y,borderStyle:"round",borderColor:_e.AccentCyan,overflow:"hidden",children:[(0,wa.jsxs)(Ke,{paddingX:1,justifyContent:"space-between",children:[(0,wa.jsx)(ke,{bold:!0,color:_e.AccentCyan,children:RH(e.label,h-6).trimEnd()}),(p||g)&&(0,wa.jsxs)(ke,{color:_e.Gray,children:[p?"\u2191":" ",g?"\u2193":" "]})]}),f,Array.from({length:Math.max(0,N-f.length)}).map((W,x)=>(0,wa.jsx)(Ke,{children:(0,wa.jsx)(ke,{children:" "})},`fill-${x}`))]})]}),(0,wa.jsx)(Ke,{marginTop:1,children:(0,wa.jsxs)(ke,{color:_e.Gray,children:["\u2191\u2193/jk scroll \xB7 \u23CE ",u?"collapse":"expand"," prompt \xB7 \u2190 back \xB7 esc close"]})})]})},zma=({isVisible:a,onClose:e,terminalWidth:r,terminalHeight:n})=>{let[i,o]=(0,yf.useState)([]),[,t]=(0,yf.useState)(0),[s,u]=(0,yf.useState)("list"),[I,d]=(0,yf.useState)(0),[h,c]=(0,yf.useState)(0),[m,G]=(0,yf.useState)(0),[y,N]=(0,yf.useState)("left"),[Z,R]=(0,yf.useState)(!1),[F,w]=(0,yf.useState)(null),[b,v]=(0,yf.useState)(0),[A,E]=(0,yf.useState)(0),f=(0,yf.useCallback)(()=>{let J=[...sg.getAll()];o(J),d(L=>Math.min(L,Math.max(0,J.length-1)))},[]);(0,yf.useEffect)(()=>(Tbe(a),()=>{a&&Tbe(!1)}),[a]),(0,yf.useEffect)(()=>{if(!a)return;f();let J=!1,L=()=>{J||(J=!0,setTimeout(()=>{J=!1,f(),t(C=>C+1)},500))},X=sg.subscribe(L),Q,V=()=>sg.getAll().some(C=>C.status==="running");return V()&&(Q=setInterval(()=>{t(C=>C+1),V()||(clearInterval(Q),Q=void 0)},2e3)),()=>{X(),Q&&clearInterval(Q)}},[a,f]);let p=Date.now(),g=i[I],W=g?g.phases.length?g.phases:[{index:0,name:"\u6267\u884C",description:"",agents:g.agents}]:[],x=W[h],H=x?_ma(x):g?g.agents:[];if(Cs((J,L)=>{if(a){if(s==="list")L.upArrow&&d(X=>Math.max(0,X-1)),L.downArrow&&d(X=>Math.min(i.length-1,X+1)),L.return&&g&&(u("detail"),c(0),G(0),N("left")),L.escape&&e();else if(s==="detail")y==="left"?(L.upArrow&&c(X=>Math.max(0,X-1)),L.downArrow&&c(X=>Math.min(W.length-1,X+1)),L.return&&(N("right"),G(0)),L.escape&&u("list")):(L.upArrow&&G(X=>Math.max(0,X-1)),L.downArrow&&G(X=>Math.min(H.length-1,X+1)),L.return&&H[m]&&(w(H[m]),v(m),R(!1),E(0),u("agent")),L.leftArrow&&N("left"),L.escape&&e());else if(s==="agent"){let X=g?.phases.find(V=>F&&V.agents.includes(F)),Q=X?X.agents:g?g.agents:[];if(L.upArrow&&b>0){let V=b-1;v(V),w(Q[V]),E(0),R(!1)}else if(L.downArrow&&b<Q.length-1){let V=b+1;v(V),w(Q[V]),E(0),R(!1)}J==="j"&&E(V=>V+1),J==="k"&&E(V=>Math.max(0,V-1)),L.return&&R(V=>!V),(L.leftArrow||L.escape)&&(L.leftArrow?(u("detail"),N("right"),E(0)):e())}}},{isActive:a}),!a)return null;let k=Math.min(r-2,120),S=Math.max(10,n-8);return(0,wa.jsxs)(Ke,{flexDirection:"column",width:k,children:[(0,wa.jsxs)(Ke,{marginBottom:1,children:[(0,wa.jsx)(ke,{bold:!0,color:_e.AccentCyan,children:"Dynamic workflows"}),i.length>0&&(0,wa.jsxs)(ke,{color:_e.Gray,children:[" ",i.filter(J=>J.status==="completed").length," completed",i.some(J=>J.status==="running")?`, ${i.filter(J=>J.status==="running").length} running`:""]})]}),(0,wa.jsx)(Ke,{marginBottom:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:"\u2500".repeat(k-2)})}),s==="list"&&(0,wa.jsxs)(wa.Fragment,{children:[i.length===0?(0,wa.jsx)(Ke,{paddingX:2,children:(0,wa.jsx)(ke,{color:_e.Gray,children:"No workflows have run in this session."})}):i.map((J,L)=>(0,wa.jsx)(iRi,{wf:J,selected:L===I,now:p,rowWidth:k-2},J.id)),(0,wa.jsx)(Ke,{marginTop:1,children:(0,wa.jsx)(ke,{color:_e.Gray,children:"\u2191/\u2193 to select \xB7 Enter to view \xB7 Esc to close"})})]}),s==="detail"&&g&&(0,wa.jsx)(sRi,{wf:g,selectedPhase:h,selectedAgent:m,focus:y,now:p,width:k,height:S}),s==="agent"&&g&&F&&(()=>{let J=g.phases.find(Q=>F&&Q.agents.includes(F)),L=J?J.agents:g.agents,X=J?.name??"\u6267\u884C";return(0,wa.jsx)(oRi,{wf:g,agent:F,phaseAgents:L,selectedAgentIndex:b,phaseName:X,now:p,width:k,height:S,promptExpanded:Z,scrollOffset:A})})()]})};var Bme=Lt(wr(),1);var Pma=()=>(0,Bme.jsx)(Ke,{children:(0,Bme.jsxs)(ke,{color:_e.AccentYellow,children:["shell mode enabled",(0,Bme.jsx)(ke,{color:_e.Gray,children:" (esc to disable)"})]})});var Jme=Lt(wr(),1);var jma=()=>(0,Jme.jsx)(Ke,{children:(0,Jme.jsxs)(ke,{color:_e.AccentCyan,children:["\u{1F4A1} AI help assistant active",(0,Jme.jsx)(ke,{color:_e.Gray,children:" (esc to exit \u2022 uses tokens)"})]})});ua();var w6e=Lt(wr(),1);var qma=()=>(0,w6e.jsx)(Ke,{borderStyle:"round",borderColor:_e.AccentGreen,paddingX:1,children:(0,w6e.jsxs)(ke,{color:_e.AccentGreen,children:["\u{1F4CB} ",Re("plan.mode.indicator")]})});var _l=Lt(ra(),1);ua();var Af=Lt(wr(),1);var CH=8;function Kma({suggestions:a,activeIndex:e,isLoading:r,width:n,scrollOffset:i,userInput:o}){if(r)return(0,Af.jsx)(Ke,{paddingX:1,width:n,children:(0,Af.jsx)(ke,{color:"gray",children:Re("suggestions.loading")})});if(a.length===0)return null;let t="",s=!1;if(o.startsWith("/")){s=!0;let m=o.lastIndexOf("/"),G=o.substring(m+1),y=G.indexOf(" ");t=y!==-1?G.substring(0,y):G}else if(o.includes("@")){let m=o.lastIndexOf("@"),G=o.substring(m+1),y=G.lastIndexOf("/");t=y!==-1?G.substring(y+1):G}let u=i,I=Math.min(i+CH,a.length),d=a.slice(u,I),h=Math.max(...a.map(m=>m.label.length),20),c=Math.min(h+2,n-10);return(0,Af.jsxs)(Ke,{flexDirection:"column",paddingX:1,width:n,children:[i>0?(0,Af.jsx)(ke,{color:_e.Foreground,children:"\u25B2"}):null,d.map((m,G)=>{let y=u+G,N=y===e,Z=N?_e.AccentOrange:_e.Foreground,R=N?_e.AccentOrange:_e.Gray,F=N?_e.Foreground:_e.AccentOrange,w=()=>{let b=m.label,v=b.lastIndexOf("/"),A=v!==-1&&v<b.length-1,E=(f,p,g=!1)=>{if(!t)return(0,Af.jsx)(ke,{color:p,dimColor:g,inverse:N,children:f});let W=Qoa(f,t);return(0,Af.jsx)(ke,{children:W.map((x,H)=>(0,Af.jsx)(ke,{color:x.highlighted?F:p,bold:x.highlighted,dimColor:!x.highlighted&&g,inverse:N,children:x.text},H))})};if(A&&!o.startsWith("/")){let f=b.substring(0,v+1),p=b.substring(v+1),g=m.description?25:0,W=n-g-5,x=10,H=15,k=W-p.length;if(k<x&&(k=Math.max(x,W-Math.min(p.length,W*.6))),f.length>k&&k>=H){let S=k-3,J=Math.floor(S*.4),L=S-J,X=f.substring(0,J),Q=f.substring(f.length-L);f=`${X}...${Q}`}return(0,Af.jsxs)(Ke,{flexDirection:"row",children:[E(f,R),E(p,Z)]})}return E(b,Z)};return(0,Af.jsx)(Ke,{width:n,children:(0,Af.jsxs)(Ke,{flexDirection:"row",children:[(0,Af.jsx)(Ke,{width:o.startsWith("/")?c:void 0,flexShrink:0,children:w()}),m.description?(0,Af.jsx)(Ke,{flexGrow:1,marginLeft:1,children:(0,Af.jsx)(ke,{color:R,wrap:"truncate-end",inverse:N,children:m.description})}):null]})},`suggestion-${y}`)}),I<a.length?(0,Af.jsx)(ke,{color:"gray",children:"\u25BC"}):null,a.length>CH?(0,Af.jsx)(ke,{color:"gray",children:`(${e+1}/${a.length})`}):null]})}var BW=Lt(ra(),1);function $ma({userMessages:a,onSubmit:e,isActive:r,currentQuery:n,onChange:i}){let[o,t]=(0,BW.useState)(-1),s=(0,BW.useRef)("");(0,BW.useEffect)(()=>{o===-1&&n.length>0&&(s.current=n)},[n,o]);let u=(0,BW.useCallback)(()=>{t(-1)},[]),I=(0,BW.useCallback)(c=>{let m=c.trim();m&&e(m),u()},[e,u]),d=(0,BW.useCallback)(()=>{if(!r||a.length===0)return!1;let c=o;if(o===-1)c=0;else if(o<a.length-1)c=o+1;else return!1;if(c!==o){t(c);let m=a[a.length-1-c];return i(m),!0}return!1},[o,t,i,a,r]),h=(0,BW.useCallback)(()=>{if(!r||o===-1)return!1;let c=o-1;if(t(c),c===-1)i(s.current);else{let m=a[a.length-1-c];i(m)}return!0},[o,t,i,a,r]);return{handleSubmit:I,navigateUp:d,navigateDown:h}}ZX();var Iy='\x1B[38;5;239m"\x1B[0m';function R6e(a){let e=a.replace(/@"([^"]+)"/g,(r,n)=>`@[${/\.(png|jpg|jpeg|gif|webp|bmp|svg|ico|heic|heif|avif|tiff?|raw)$/i.test(n)?"Image":"File"} #${Iy}${n}${Iy}]`);return e=e.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_\-./\\:]+)(?=\s|$|[,,;;::!!??、。\)\])】》>])/g,(r,n)=>`@[${/\.(png|jpg|jpeg|gif|webp|bmp|svg|ico|heic|heif|avif|tiff?|raw)$/i.test(n)?"Image":"File"} #${Iy}${n}${Iy}]`),e}function epa(a){let e=[],r=/@"([^"]+)"|(?<![a-zA-Z0-9])@([a-zA-Z0-9_\-./\\:]+)(?=\s|$|[,,;;::!!??、。\)\])】》>])/g,n=0,i;for(;(i=r.exec(a))!==null;){i.index>n&&e.push({text:a.slice(n,i.index),type:"text"});let o=i[1]||i[2],t=/\.(png|jpg|jpeg|gif|webp|bmp|svg|ico|heic|heif|avif|tiff?|raw)$/i.test(o);e.push({text:i[0],type:"attachment",attachmentType:t?"Image":"File",path:o}),n=r.lastIndex}return n<a.length&&e.push({text:a.slice(n),type:"text"}),e}function ARt(a,e){if(e===void 0)return a.type==="text"?a.text:`@[${a.attachmentType} #${Iy}${a.path}${Iy}]`;let r=a.text,n=r.slice(0,e),i=r.charAt(e)||" ",o=r.slice(e+1),t=Zl.inverse(i);if(a.type==="text")return n+t+o;{let s=r.startsWith('@"'),u=s?'@"':"@",I=e-u.length;if(I<0){let d=`${Iy}${a.path}${Iy}`;return`@[${a.attachmentType} #${Zl.inverse(r.charAt(e))}${r.slice(e+1,u.length)}${d}]`}else if(I>=(a.path?.length||0)){let d=`${Iy}${a.path}${Iy}`;return s&&e===r.length-1?`@[${a.attachmentType} #${d.slice(0,-Iy.length)}${Zl.inverse('"')}]`:`@[${a.attachmentType} #${d}]${t}`}else{let d=a.path.slice(0,I),h=a.path.charAt(I),c=a.path.slice(I+1);return`@[${a.attachmentType} #${Iy}${d}${Zl.inverse(h)}${c}${Iy}]`}}}function tpa(a){let e=a;return e=e.replace(/@\[(File|Image)\s*#"([^"]*)"\]/g,(r,n,i)=>`@"${i}"`),e=e.replace(/(?<![a-zA-Z0-9])@(?!clipboard)(?!\[)([a-zA-Z0-9_\-./\\:]+)(?=\s|$|[,,;;::!!??、。\)\])】》>])/g,(r,n)=>`@"${n}"`),e}ZX();var c5=Lt(ra(),1);na();import*as x$ from"fs/promises";import*as C6e from"path";var lRi="shell_history",cRi=100;async function uRi(a){let e=ZG(a);return C6e.join(e,lRi)}async function dRi(a){try{return(await x$.readFile(a,"utf-8")).split(`
|
|
6544
6547
|
`).filter(Boolean)}catch(e){return Zc(e)&&e.code==="ENOENT"?[]:(console.error("Error reading shell history:",e),[])}}async function IRi(a,e){try{await x$.mkdir(C6e.dirname(a),{recursive:!0}),await x$.writeFile(a,e.join(`
|