easycode-ai 1.1.28 → 1.1.29
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 +5 -5
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -609,7 +609,7 @@ ${h}`)}return t}),OGe=RHn(hDt);o1e=class extends s1e{create(e,r){var a;let{api_v
|
|
|
609
609
|
`):[]}};xO.NEWLINE_CHARS=new Set([`
|
|
610
610
|
`,"\r"]);xO.NEWLINE_REGEXP=/\r\n|[\n\r]/g;c1e={off:0,error:200,warn:300,info:400,debug:500},iDt=(n,e,r)=>{if(n){if(dHn(c1e,n))return n;Y2(r).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(c1e))}`)}};VHn={error:Nne,warn:Nne,info:Nne,debug:Nne},sDt=new WeakMap;Nk=n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n);dMe=class n{constructor(e,r,a){this.iterator=e,this.controller=r,this.client=a}static fromSSEResponse(e,r,a){let i=!1,o=a?Y2(a):console;function t(){return EO(this,arguments,function*(){var u,I,d,h;if(i)throw new tG("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=Wk(QHn(e,r)),G;G=yield rd(v.next()),u=G.done,!u;m=!0){h=G.value,m=!1;let A=h;if(!c)if(A.data.startsWith("[DONE]")){c=!0;continue}else try{yield yield rd(JSON.parse(A.data))}catch(Z){throw o.error("Could not parse message into JSON:",A.data),o.error("From chunk:",A.raw),Z}}}catch(A){I={error:A}}finally{try{!m&&!u&&(d=v.return)&&(yield rd(d.call(v)))}finally{if(I)throw I.error}}c=!0}catch(A){if(oMe(A))return yield rd(void 0);throw A}finally{c||r.abort()}})}return new n(t,r,a)}static fromReadableStream(e,r,a){let i=!1;function o(){return EO(this,arguments,function*(){var u,I,d,h;let c=new xO,m=uDt(e);try{for(var v=!0,G=Wk(m),A;A=yield rd(G.next()),u=A.done,!u;v=!0){h=A.value,v=!1;let Z=h;for(let R of c.decode(Z))yield yield rd(R)}}catch(Z){I={error:Z}}finally{try{!v&&!u&&(d=G.return)&&(yield rd(d.call(G)))}finally{if(I)throw I.error}}for(let Z of c.flush())yield yield rd(Z)})}function t(){return EO(this,arguments,function*(){var u,I,d,h;if(i)throw new tG("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=Wk(o()),G;G=yield rd(v.next()),u=G.done,!u;m=!0){h=G.value,m=!1;let A=h;c||A&&(yield yield rd(JSON.parse(A)))}}catch(A){I={error:A}}finally{try{!m&&!u&&(d=v.return)&&(yield rd(d.call(v)))}finally{if(I)throw I.error}}c=!0}catch(A){if(oMe(A))return yield rd(void 0);throw A}finally{c||r.abort()}})}return new n(t,r,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],a=this.iterator(),i=o=>({next:()=>{if(o.length===0){let t=a.next();e.push(t),r.push(t)}return o.shift()}});return[new n(()=>i(e),this.controller,this.client),new n(()=>i(r),this.controller,this.client)]}toReadableStream(){let e=this,r;return cDt({async start(){r=e[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let t=pMe(JSON.stringify(i)+`
|
|
611
611
|
`);a.enqueue(t)}catch(i){a.error(i)}},async cancel(){var a;await((a=r.return)===null||a===void 0?void 0:a.call(r))}})}};IMe=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(`
|
|
612
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=XHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};hMe=class n extends Promise{constructor(e,r,a=kHn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}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)}};mDt=Symbol("brand.privateNullableHeaders");Zne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of SHn(a)){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{[mDt]:!0,values:e,nulls:r}};sMe=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a: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,n))===null||t===void 0?void 0:t.trim()};u1e=class n{constructor(e){var r,a,i,o,t,s,u,{baseURL:I=sMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=sMe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=PGe(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=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let v="warn";this.logLevel=v,this.logLevel=(t=(o=iDt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:iDt(sMe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:v,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:GHn(),this.encoder=AHn,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=Zne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Zne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Zne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new tG(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${FO}`}defaultIdempotencyKey(){return`stainless-node-retry-${iHn()}`}makeStatusError(e,r,a,i){return rG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=oHn(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return uHn(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:a}){}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,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new hMe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){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=a===void 0?"":`, retryOf: ${a}`,v=Date.now();if(Y2(this).debug(`[${c}] sending request`,Nk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Wne;let G=new AbortController,A=await this.fetchWithTimeout(d,I,h,G).catch(lMe),Z=Date.now();if(A instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Wne;let E=oMe(A)||/timed? ?out/i.test(String(A)+("cause"in A?String(A.cause):""));if(r)return Y2(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${F}`),Y2(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${F})`,Nk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),this.retryRequest(s,r,a??c);throw Y2(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Y2(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,Nk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),E?new qGe:new CO({cause:A})}let R=`[${c}${m}] ${I.method} ${d} ${A.ok?"succeeded":"failed"} with status ${A.status} in ${Z-v}ms`;if(!A.ok){let F=await this.shouldRetry(A);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await yHn(A.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,durationMs:Z-v})),this.retryRequest(s,r,a??c,A.headers)}let E=F?"error; no more retries left":"error; not retryable";Y2(this).info(`${R} - ${E}`);let p=await A.text().catch(b=>lMe(b).message),y=hHn(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${E})`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,message:N,durationMs:Date.now()-v})),this.makeStatusError(A.status,y,N,A.headers)}return Y2(this).info(R),Y2(this).debug(`[${c}] response start`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,durationMs:Z-v})),{response:A,options:s,controller:G,requestLogID:c,retryOfRequestLogID:a,startTime:v}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,u=PGe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),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,a,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 mHn(t),this.makeRequest(e,r-1,a)}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 a,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&&IHn("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),v=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:v},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:a,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=Zne([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))}:{}),gHn()),this._options.defaultHeaders,a,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 a=Zne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:vHn(e)}:this.encoder({body:e,headers:a})}};u1e.DEFAULT_TIMEOUT=6e4;O0=class extends u1e{constructor(){super(...arguments),this.interactions=new l1e(this)}};pDt=O0;O0.GeminiNextGenAPIClient=pDt;O0.GeminiNextGenAPIClientError=tG;O0.APIError=rG;O0.APIConnectionError=CO;O0.APIConnectionTimeoutError=qGe;O0.APIUserAbortError=Wne;O0.NotFoundError=t1e;O0.ConflictError=r1e;O0.RateLimitError=a1e;O0.BadRequestError=KGe;O0.AuthenticationError=$Ge;O0.InternalServerError=i1e;O0.PermissionDeniedError=e1e;O0.UnprocessableEntityError=n1e;O0.toFile=EHn;O0.Interactions=l1e;Wji=1024*1024*8;});function LHn(n,e){return{...n,...e}}function fDt(n){let{prompt_id:e,...r}=n;return r}function OY(n){return Array.isArray(n)?n.map(fDt):n}var d1e=ct(()=>{"use strict";si();});var bDt={};ho(bDt,{DEFAULT_PROXY_CONFIG:()=>JHn,getActiveProxyServerUrl:()=>dE,getAvailableProxyServers:()=>BHn,getProxyServerInfo:()=>THn,getProxyServers:()=>Fne,hasAvailableProxyServer:()=>fMe});function Fne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function dE(){let e=Fne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function BHn(){return Fne().filter(e=>e.status==="active")}function fMe(){return Fne().some(e=>e.status==="active")}function THn(n){return Fne().find(r=>r.url===n)}var JHn,YO=ct(()=>{"use strict";JHn={serverUrl:dE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as DHn}from"crypto";function rv(){return Ene||(Ene=DHn()),Ene}function gDt(n){Ene=n}function GDt(){Ene=void 0}var Ene,vDt,I1e=ct(()=>{"use strict";vDt=rv()});function Yu(n){let e=n??"1.1.28"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${h1e}/VSCode/${i} (${r}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${h1e}/Desktop/${i} (${r}; ${a})`}return`${h1e}/CLI/${e} (${r}; ${a})`}var h1e,J5=ct(()=>{"use strict";h1e="EasyCode"});import*as Vu from"fs";import*as e3 from"path";import*as Fk from"os";function OHn(n){Co.configure(n)}function MHn(n){Co.setUserInfo(n)}function UHn(n){Co.setCliVersion(n)}async function _Hn(){return await Co.getUserHeaders()}function zHn(){return Co.getStatus()}var wne,Ro,Co,D5=ct(()=>{"use strict";YO();I1e();J5();wne=259200,Ro=class n{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 Yu(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\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=e3.join(Fk.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=e3.join(Fk.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=e3.join(Fk.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=e3.join(Fk.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=e3.join(Fk.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=e3.join(Fk.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.28",this.config={proxyServerUrl:dE()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-wne*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vu.existsSync(this.userInfoFilePath)){let e=Vu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${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=e3.dirname(this.userInfoFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.jwtTokenFilePath)){let e=Vu.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=e3.dirname(this.jwtTokenFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.usageStatsFilePath)){let e=Vu.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=e3.dirname(this.usageStatsFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-wne*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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-wne*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), 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=wne){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=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:a+(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-wne*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{Vu.existsSync(this.jwtTokenFilePath)&&Vu.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(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":rv()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":rv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}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{Vu.existsSync(this.userInfoFilePath)&&Vu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Co=Ro.getInstance()});import{promises as Ek}from"node:fs";import Rne from"node:path";import PHn from"os";var nv,m1e,en,av=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(nv||(nv={}));m1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:nv.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=Rne.join(PHn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.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 Ek.mkdir(Rne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Ek.appendFile(this.config.filePath,e+`
|
|
612
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=XHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};hMe=class n extends Promise{constructor(e,r,a=kHn){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=a,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(r,a)=>e(await this.parseResponse(r,a),a))}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)}};mDt=Symbol("brand.privateNullableHeaders");Zne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of SHn(a)){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{[mDt]:!0,values:e,nulls:r}};sMe=n=>{var e,r,a,i,o,t;if(typeof globalThis.process<"u")return(a=(r=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||r===void 0?void 0:r.trim())!==null&&a!==void 0?a: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,n))===null||t===void 0?void 0:t.trim()};u1e=class n{constructor(e){var r,a,i,o,t,s,u,{baseURL:I=sMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=sMe("GEMINI_API_KEY"))!==null&&r!==void 0?r:null,apiVersion:h="v1beta"}=e,c=PGe(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=(a=m.timeout)!==null&&a!==void 0?a:n.DEFAULT_TIMEOUT,this.logger=(i=m.logger)!==null&&i!==void 0?i:console;let v="warn";this.logLevel=v,this.logLevel=(t=(o=iDt(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:iDt(sMe("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&t!==void 0?t:v,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:GHn(),this.encoder=AHn,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=Zne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return Zne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Zne([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return Object.entries(e).filter(([r,a])=>typeof a<"u").map(([r,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(r)}=`;throw new tG(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${FO}`}defaultIdempotencyKey(){return`stainless-node-retry-${iHn()}`}makeStatusError(e,r,a,i){return rG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=oHn(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return uHn(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:a}){}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,a){return this.request(Promise.resolve(a).then(i=>Object.assign({method:e,path:r},i)))}request(e,r=null){return new hMe(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,a){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=a===void 0?"":`, retryOf: ${a}`,v=Date.now();if(Y2(this).debug(`[${c}] sending request`,Nk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Wne;let G=new AbortController,A=await this.fetchWithTimeout(d,I,h,G).catch(lMe),Z=Date.now();if(A instanceof globalThis.Error){let F=`retrying, ${r} attempts remaining`;if(!((t=s.signal)===null||t===void 0)&&t.aborted)throw new Wne;let E=oMe(A)||/timed? ?out/i.test(String(A)+("cause"in A?String(A.cause):""));if(r)return Y2(this).info(`[${c}] connection ${E?"timed out":"failed"} - ${F}`),Y2(this).debug(`[${c}] connection ${E?"timed out":"failed"} (${F})`,Nk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),this.retryRequest(s,r,a??c);throw Y2(this).info(`[${c}] connection ${E?"timed out":"failed"} - error; no more retries left`),Y2(this).debug(`[${c}] connection ${E?"timed out":"failed"} (error; no more retries left)`,Nk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),E?new qGe:new CO({cause:A})}let R=`[${c}${m}] ${I.method} ${d} ${A.ok?"succeeded":"failed"} with status ${A.status} in ${Z-v}ms`;if(!A.ok){let F=await this.shouldRetry(A);if(r&&F){let b=`retrying, ${r} attempts remaining`;return await yHn(A.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,durationMs:Z-v})),this.retryRequest(s,r,a??c,A.headers)}let E=F?"error; no more retries left":"error; not retryable";Y2(this).info(`${R} - ${E}`);let p=await A.text().catch(b=>lMe(b).message),y=hHn(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${E})`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,message:N,durationMs:Date.now()-v})),this.makeStatusError(A.status,y,N,A.headers)}return Y2(this).info(R),Y2(this).debug(`[${c}] response start`,Nk({retryOfRequestLogID:a,url:A.url,status:A.status,headers:A.headers,durationMs:Z-v})),{response:A,options:s,controller:G,requestLogID:c,retryOfRequestLogID:a,startTime:v}}async fetchWithTimeout(e,r,a,i){let o=r||{},{signal:t,method:s}=o,u=PGe(o,["signal","method"]);t&&t.addEventListener("abort",()=>i.abort());let I=setTimeout(()=>i.abort(),a),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,a,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 mHn(t),this.makeRequest(e,r-1,a)}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 a,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&&IHn("timeout",t.timeout),t.timeout=(a=t.timeout)!==null&&a!==void 0?a:this.timeout;let{bodyHeaders:c,body:m}=this.buildBody({options:t}),v=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:v},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:a,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=Zne([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))}:{}),gHn()),this._options.defaultHeaders,a,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 a=Zne([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:vHn(e)}:this.encoder({body:e,headers:a})}};u1e.DEFAULT_TIMEOUT=6e4;O0=class extends u1e{constructor(){super(...arguments),this.interactions=new l1e(this)}};pDt=O0;O0.GeminiNextGenAPIClient=pDt;O0.GeminiNextGenAPIClientError=tG;O0.APIError=rG;O0.APIConnectionError=CO;O0.APIConnectionTimeoutError=qGe;O0.APIUserAbortError=Wne;O0.NotFoundError=t1e;O0.ConflictError=r1e;O0.RateLimitError=a1e;O0.BadRequestError=KGe;O0.AuthenticationError=$Ge;O0.InternalServerError=i1e;O0.PermissionDeniedError=e1e;O0.UnprocessableEntityError=n1e;O0.toFile=EHn;O0.Interactions=l1e;Wji=1024*1024*8;});function LHn(n,e){return{...n,...e}}function fDt(n){let{prompt_id:e,...r}=n;return r}function OY(n){return Array.isArray(n)?n.map(fDt):n}var d1e=ct(()=>{"use strict";si();});var bDt={};ho(bDt,{DEFAULT_PROXY_CONFIG:()=>JHn,getActiveProxyServerUrl:()=>dE,getAvailableProxyServers:()=>BHn,getProxyServerInfo:()=>THn,getProxyServers:()=>Fne,hasAvailableProxyServer:()=>fMe});function Fne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function dE(){let e=Fne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function BHn(){return Fne().filter(e=>e.status==="active")}function fMe(){return Fne().some(e=>e.status==="active")}function THn(n){return Fne().find(r=>r.url===n)}var JHn,YO=ct(()=>{"use strict";JHn={serverUrl:dE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as DHn}from"crypto";function rv(){return Ene||(Ene=DHn()),Ene}function gDt(n){Ene=n}function GDt(){Ene=void 0}var Ene,vDt,I1e=ct(()=>{"use strict";vDt=rv()});function Yu(n){let e=n??"1.1.29"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${h1e}/VSCode/${i} (${r}; ${a})`}if(e.startsWith("Desktop-")){let i=e.slice(8)||"unknown";return`${h1e}/Desktop/${i} (${r}; ${a})`}return`${h1e}/CLI/${e} (${r}; ${a})`}var h1e,J5=ct(()=>{"use strict";h1e="EasyCode"});import*as Vu from"fs";import*as e3 from"path";import*as Fk from"os";function OHn(n){Co.configure(n)}function MHn(n){Co.setUserInfo(n)}function UHn(n){Co.setCliVersion(n)}async function _Hn(){return await Co.getUserHeaders()}function zHn(){return Co.getStatus()}var wne,Ro,Co,D5=ct(()=>{"use strict";YO();I1e();J5();wne=259200,Ro=class n{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 Yu(this.cliVersion)}formatTimeRemaining(e){if(e<=0)return"\u5DF2\u8FC7\u671F";let r=Math.floor(e/1e3),a=Math.floor(r/(24*3600)),i=Math.floor(r%(24*3600)/3600),o=Math.floor(r%3600/60),t=r%60;return a>0?`${a}\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=e3.join(Fk.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=e3.join(Fk.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=e3.join(Fk.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=e3.join(Fk.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=e3.join(Fk.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=e3.join(Fk.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.29",this.config={proxyServerUrl:dE()},this.loadUserInfo(),this.loadJwtToken(),this.loadUsageStats(),this.startPeriodicStatusCheck()}startPeriodicStatusCheck(){this.periodicStatusCheckIntervalId=setInterval(()=>{if(this.jwtTokenData){let e=Date.now(),r=this.jwtTokenData.expiresAt-e,a=this.formatTimeRemaining(r),i=this.formatAbsoluteTime(this.jwtTokenData.expiresAt);if(r>0){let o=this.formatAbsoluteTime(this.jwtTokenData.expiresAt-wne*1e3);console.log(`[Login Check] \u{1F4CA} Periodic status check - Credential remaining: ${a} (until ${i}), next renewal: ${o}`)}else console.log(`[Login Check] \u26A0\uFE0F Periodic status check - Credential expired at: ${i}`)}},600*1e3)}static getInstance(){return n.instance||(n.instance=new n),n.instance}loadUserInfo(){try{if(Vu.existsSync(this.userInfoFilePath)){let e=Vu.readFileSync(this.userInfoFilePath,"utf8");this.userInfo=JSON.parse(e);let r=a=>{if(!a||!a.includes("@"))return a;let[i,o]=a.split("@");return i.length<=2?a:`${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=e3.dirname(this.userInfoFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.jwtTokenFilePath)){let e=Vu.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=e3.dirname(this.jwtTokenFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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(Vu.existsSync(this.usageStatsFilePath)){let e=Vu.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=e3.dirname(this.usageStatsFilePath);Vu.existsSync(e)||Vu.mkdirSync(e,{recursive:!0}),Vu.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 a=Date.now()+e.expiresIn*1e3;this.jwtTokenData={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,expiresAt:a,savedAt:new Date().toISOString()},this.saveJwtToken();let i=this.formatTimeRemaining(e.expiresIn*1e3),o=this.formatAbsoluteTime(a),t=this.formatAbsoluteTime(a-wne*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,a=this.formatTimeRemaining(r),i=this.jwtTokenData.expiresAt-wne*1e3,o=this.formatAbsoluteTime(i);if(this.isTokenNearExpiry()){console.log(`[Login Check] Access credential expiring soon (remaining: ${a}), 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=wne){if(!this.jwtTokenData)return!0;let r=this.jwtTokenData.expiresAt-Date.now(),a=r<=e*1e3;if(a){let i=this.formatTimeRemaining(r);console.log(`[Login Check] Credential expiry check: ${i} remaining <= ${e}s threshold, renewal needed: ${a}`)}return a}async refreshAccessToken(){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){if(!this.jwtTokenData?.refreshToken)throw new Error("No refresh token available");try{console.log("[Login Check] Refreshing access credential...");let e=await fetch(`${this.config.proxyServerUrl}/auth/jwt/refresh`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":this.getUserAgent()},body:JSON.stringify({refreshToken:this.jwtTokenData.refreshToken})});if(!e.ok){if(e.status===401)throw this.clearTokens(),new Error("Refresh credential expired or invalid - authentication required");let u=await e.text();throw new Error(`Credential refresh failed (${e.status}): ${u}`)}let r=await e.json();if(!r.success||!r.data?.accessToken)throw new Error("Invalid refresh response from server");let a=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:a+(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-wne*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{Vu.existsSync(this.jwtTokenFilePath)&&Vu.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(),a=this.getCliVersion(),i=this.getUserAgent(),o={"Content-Type":"application/json","X-Client-Version":a,"User-Agent":i,"X-Session-ID":rv()};return r&&(o.Authorization=`Bearer ${r}`),e&&(o["X-DVCode-Scene"]=e),o}getUserHeadersSync(){let e=this.getCliVersion(),r=this.getUserAgent(),a={"Content-Type":"application/json","X-Client-Version":e,"User-Agent":r,"X-Session-ID":rv()};return this.jwtTokenData?.accessToken&&(a.Authorization=`Bearer ${this.jwtTokenData.accessToken}`),a}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{Vu.existsSync(this.userInfoFilePath)&&Vu.unlinkSync(this.userInfoFilePath)}catch(e){console.warn("[Login Check] Failed to delete user info file:",e)}try{Vu.existsSync(this.jwtTokenFilePath)&&Vu.unlinkSync(this.jwtTokenFilePath)}catch(e){console.warn("[Login Check] Failed to delete access credential file:",e)}console.log("[Login Check] Authentication cleared")}},Co=Ro.getInstance()});import{promises as Ek}from"node:fs";import Rne from"node:path";import PHn from"os";var nv,m1e,en,av=ct(()=>{"use strict";(function(n){n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR"})(nv||(nv={}));m1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:nv.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=Rne.join(PHn.homedir(),".easycode-user","logs",`deepv-${r}.log`)}}formatMessage(e,r,...a){let i=new Date().toISOString(),o=a.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 Ek.mkdir(Rne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Ek.appendFile(this.config.filePath,e+`
|
|
613
613
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await Ek.stat(this.config.filePath)).size/(1024*1024)>(this.config.maxFileSize||10)){let a=new Date().toISOString().slice(0,19).replace(/[:.]/g,"-"),i=this.config.filePath.replace(".log",`-${a}.log`);await Ek.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=Rne.dirname(this.config.filePath),a=(await Ek.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Rne.join(e,t),time:Ek.stat(Rne.join(e,t)).then(s=>s.mtime)})),i=await Promise.all(a.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 Ek.unlink(t.path)}catch(e){console.error("\u6E05\u7406\u65E7\u65E5\u5FD7\u5931\u8D25:",e)}}log(e,r,a,...i){if(e<this.config.level)return;let o=this.formatMessage(r,a,...i);this.config.enableConsole&&(e>=nv.ERROR?console.error:e>=nv.WARN?console.warn:e>=nv.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log(nv.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(nv.INFO,"INFO",e,...r)}warn(e,...r){this.log(nv.WARN,"WARN",e,...r)}error(e,...r){this.log(nv.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}:{}})}},en=new m1e({level:process.env.FILE_DEBUG==="1"?nv.DEBUG:nv.INFO,enableConsole:!0,enableFile:process.env.LOG_TO_FILE==="true",filePath:process.env.LOG_FILE_PATH})});function Ec(n){return n instanceof Error&&"code"in n}function gn(n){if(n instanceof Error)return n.message;try{return String(n)}catch{return"Failed to get error details"}}function bMe(n){if(n&&typeof n=="object"&&"response"in n){let r=jHn(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new f1e(r.error.message);case 401:return new GI(r.error.message);case 403:return new p1e(r.error.message);default:}}return n}function jHn(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}function wk(n){if(!n)return!1;try{let e=JSON.parse(n);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var p1e,GI,f1e,Oc=ct(()=>{"use strict";p1e=class extends Error{},GI=class extends Error{},f1e=class extends Error{}});var ba,yDt,vI,iv=ct(()=>{"use strict";(function(n){n.CHAT_CONVERSATION="chat_conversation",n.WEB_FETCH="web_fetch",n.WEB_SEARCH="web_search",n.CONTENT_SUMMARY="content_summary",n.JSON_GENERATION="json_generation",n.COMPRESSION="compression",n.SUB_AGENT="sub_agent",n.CODE_ASSIST="code_assist",n.EDIT_CORRECTION="edit_correction",n.IMAGE_READER="image_reader",n.GOAL_EVALUATION="goal_evaluation"})(ba||(ba={}));yDt={[ba.CHAT_CONVERSATION]:"auto",[ba.WEB_FETCH]:"gemini-2.5-flash",[ba.WEB_SEARCH]:"gemini-2.5-flash",[ba.CODE_ASSIST]:"auto",[ba.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[ba.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[ba.JSON_GENERATION]:"gemini-2.5-flash",[ba.COMPRESSION]:"gemini-2.5-flash",[ba.SUB_AGENT]:"auto",[ba.IMAGE_READER]:"gemini-2.5-flash",[ba.GOAL_EVALUATION]:"deepseek-v4-flash"},vI=class{static getModelForScene(e){if(e)return yDt[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{[ba.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[ba.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[ba.WEB_SEARCH]:"Web\u641C\u7D22",[ba.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[ba.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[ba.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[ba.JSON_GENERATION]:"JSON\u751F\u6210",[ba.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[ba.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[ba.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[ba.GOAL_EVALUATION]:"\u76EE\u6807\u8FBE\u6210\u8BC4\u4F30"}[e]||e}}});function gA(n){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="object"&&"message"in n.error}function ab(n){return typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"}function t3(n){let e=r=>r.includes("Quota exceeded for quota metric 'Gemini")&&r.includes("Pro Requests'");if(typeof n=="string")return e(n);if(ab(n))return e(n.message);if(gA(n))return e(n.error.message);if(n&&typeof n=="object"&&"response"in n){let r=n;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 a=r.response.data;return e(a.error?.message||"")}}}return!1}function r3(n){return typeof n=="string"?n.includes("Quota exceeded for quota metric"):ab(n)?n.message.includes("Quota exceeded for quota metric"):gA(n)?n.error.message.includes("Quota exceeded for quota metric"):!1}function nG(n){if(n&&typeof n=="object"&&"response"in n){let e=n;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(n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"'))||n.message.includes("API request failed (500):")&&n.message.includes("quota exceeded")||n.message.includes("Stream API error (500):")&&n.message.includes("quota exceeded")))return!0;if(typeof n=="object"&&n!==null){let e=n;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 n=="string"?n.includes("Quota limit exceeded")||n.includes("No quota configuration")||n.includes("Daily token limit would be exceeded")||n.includes("Daily request limit exceeded")||n.includes("Daily cost limit would be exceeded")||n.includes("500")&&n.includes("quota exceeded"):!1}function Cne(n){let e=null;if(n&&typeof n=="object"&&"response"in n){let r=n;if(r.response?.status===402&&r.response.data)e=r.response.data;else if(r.response?.status===500&&r.response.data){let a=r.response.data;a&&typeof a.message=="string"&&a.message.includes("quota exceeded")&&(e=a)}}else if(typeof n=="object"&&n!==null){let r=n;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 a=r.message.match(/\{.*\}$/);a&&(e=JSON.parse(a[0]))}catch{}e||(e=n)}if(!e&&n instanceof Error&&n.message&&(n.message.includes("API request failed (402):")||n.message.includes("API request failed (500):")||n.message.includes("Stream API error (500):"))&&(n.message.includes('"error":"Quota limit exceeded"')||n.message.includes('"error":"No quota configuration"')||n.message.includes("quota exceeded")))try{let r=n.message.match(/\{.*\}$/);r&&(e=JSON.parse(r[0]))}catch{}return e?e.message&&e.message.includes("quota exceeded")?qHn(e):KHn(e):null}function qHn(n){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}})(),a="",i="",o="",t="",s=n.message||"",u=s.match(/Role:\s*([^,]+)/);u&&(a=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
|
|
614
614
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
615
615
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -3289,7 +3289,7 @@ Sources:
|
|
|
3289
3289
|
|
|
3290
3290
|
[Note: Content truncated from ${Z.length} to ${W3t} characters to prevent context overflow]`:"";return{llmContent:`Web search results for "${e.query}":
|
|
3291
3291
|
|
|
3292
|
-
${F}${p}`,returnDisplay:yh("websearch.results.returned",{query:e.query,truncated:E?yh("websearch.results.truncated"):""}),sources:G}}catch(d){let h=this.config.getModel(),c=rs(h);if(this.is401Error(d)){let G=c?`This tool (${n.Name}) is currently unavailable because you are not logged in to Easy Code. Web search requires a Easy Code account. Do NOT retry this tool until the user logs in. You can continue to assist the user using other tools and your own knowledge.`:`This tool (${n.Name}) is currently unavailable due to authentication failure. Please ask the user to re-login using the /auth command. Do NOT retry this tool until authentication is restored.`;return console.warn(`[WebSearchTool] Authentication error (401) detected for query "${e.query}"`),{llmContent:G,returnDisplay:yh("websearch.error.not.logged.in")||"Not logged in"}}if(nG(d)){let G=c?`This tool (${n.Name}) is currently unavailable because your Easy Code account has insufficient credits. Web search requires available credits in your account. Do NOT retry this tool until the user's credit balance is restored. You can continue to assist the user using other tools and your own knowledge.`:`This tool (${n.Name}) is currently unavailable due to insufficient credits in your Easy Code account. Please ask the user to check their account balance or upgrade their plan. Do NOT retry this tool until credits are available.`;return console.warn(`[WebSearchTool] Quota exceeded error detected for query "${e.query}"`),{llmContent:G,returnDisplay:yh("websearch.error.quota.exceeded")||"Insufficient credits"}}let v=`Error during web search for query "${e.query}": ${gn(d)}`;return console.error(v,d),{llmContent:`Error: ${v}`,returnDisplay:yh("websearch.error.performing")}}finally{clearTimeout(I),u.abort()}}}});import cen from"path";var iIi,uen,E3t,w0e,w3t=ct(()=>{"use strict";si();ji();jc();vW();qm();pL();iv();Oc();xA();iIi="Please describe the image in extreme detail. Include all visible objects, text (transcribed verbatim), people, scenes, colors, layout, charts/diagrams, code snippets, UI elements, and any other relevant information. Preserve any text content exactly as it appears. If the image is a screenshot, describe the UI structure and content faithfully. Output plain prose; do not refuse.",uen=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]),E3t=1e4,w0e=class n extends Jn{config;static Name="image_reader";constructor(e){super(n.Name,"ImageReader",'Fallback tool for text-only models that cannot natively view images. It offloads the vision work to a cheap model (gemini-2.5-flash) and returns a textual description. Do NOT call this tool proactively: only use it when the server has replaced an image with a filter marker explicitly instructing you to (e.g. "[Image Content was filtered. ... Try using image_reader tool to assist.]"). If you can already see and understand the image content yourself, just answer directly and do NOT call this tool. Supports PNG / JPG / JPEG / GIF / WEBP / BMP / SVG.',Gn.FileSearch,{type:hr.OBJECT,properties:{absolute_path:{type:hr.STRING,description:"Absolute path to the image file on disk (e.g. /home/user/pic.png or C:\\\\Users\\\\me\\\\pic.png). Relative paths are not supported."},prompt:{type:hr.STRING,description:'Optional custom instruction for the vision model. If omitted, the tool asks for a detailed, neutral description of the image. Use this when you need targeted information, e.g. "Transcribe all text from this screenshot" or "What error message is shown in this dialog?".'},allow_external_access:{type:hr.BOOLEAN,description:"Optional: Allow reading images outside the workspace directory. Defaults to false. Set to true only when the user explicitly provides an external image path."}},required:["absolute_path"]}),this.config=e}validateToolParams(e){if(e&&typeof e.absolute_path=="string"){let o=e.absolute_path.trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1).trim()),e.absolute_path=o}let r=hi.validate(this.schema.parameters,e,n.Name);if(r)return r;let a=e.absolute_path;if(!a||typeof a!="string")return"absolute_path must be a non-empty string.";if(!cen.isAbsolute(a))return`File path must be absolute, but was relative: ${a}`;if(!e.allow_external_access&&!tu(a,this.config.getTargetDir()))return`File path must be within the workspace directory (${this.config.getTargetDir()}) or set allow_external_access=true: ${a}`;let i=cen.extname(a).toLowerCase();return uen.has(i)?e.prompt!==void 0&&typeof e.prompt!="string"?"prompt must be a string when provided.":null:`Unsupported image extension "${i}". Supported: ${Array.from(uen).join(", ")}.`}getDescription(e){if(e&&typeof e.absolute_path=="string"){let a=e.absolute_path.trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1).trim()),e.absolute_path=a}if(!e||typeof e.absolute_path!="string"||e.absolute_path.trim()==="")return"Path unavailable";let r=Jd(e.absolute_path,this.config.getTargetDir());return`Describing image: ${tc(r)}`}toolLocations(e){if(e&&typeof e.absolute_path=="string"){let r=e.absolute_path.trim();(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1).trim()),e.absolute_path=r}return e?.absolute_path?[{path:e.absolute_path}]:[]}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:a};let i=typeof this.config.getModel=="function"?this.config.getModel():void 0,o=i?rs(i):!1,t;if(o&&typeof this.config.getCustomModels=="function"){let v=(this.config.getCustomModels()||[]).find(G=>{if(G.enabled===!1)return!1;let A=(G.modelId||"").toLowerCase(),Z=(G.displayName||"").toLowerCase();return A.includes("gemini")&&A.includes("flash")||Z.includes("gemini")&&Z.includes("flash")});if(!v)return{llmContent:`This tool (${n.Name}) is currently unavailable because you are using custom models, but no custom Gemini Flash model (e.g., gemini-2.5-flash) was found in your custom models list to execute this tool. Please configure a custom Gemini Flash model to use this feature.`,returnDisplay:"Tool unavailable: Gemini Flash required"};t=Qu(v)}let s=e.absolute_path,u;try{u=await GW(s)}catch(m){let v=gn(m);return{llmContent:`Error: failed to detect file type for "${s}": ${v}`,returnDisplay:`Error: failed to detect file type: ${v}`}}if(u!=="image"&&u!=="svg")return{llmContent:`Error: file at "${s}" is not an image (detected type: ${u}). Use the read_file tool for non-image content.`,returnDisplay:`Not an image (detected: ${u})`};let I=await _B(s,this.config.getTargetDir());if(I.error)return{llmContent:`Error reading image: ${I.error}`,returnDisplay:typeof I.returnDisplay=="string"?I.returnDisplay:"Error reading image"};let d=I.llmContent,h,c=e.prompt&&e.prompt.trim()||iIi;if(u==="svg"||typeof d=="string"){let m=typeof d=="string"?d:String(d);h=[{text:`${c}
|
|
3292
|
+
${F}${p}`,returnDisplay:yh("websearch.results.returned",{query:e.query,truncated:E?yh("websearch.results.truncated"):""}),sources:G}}catch(d){let h=this.config.getModel(),c=rs(h);if(this.is401Error(d)){let G=c?`This tool (${n.Name}) is currently unavailable because you are not logged in to Easy Code. Web search requires a Easy Code account. Do NOT retry this tool until the user logs in. You can continue to assist the user using other tools and your own knowledge.`:`This tool (${n.Name}) is currently unavailable due to authentication failure. Please ask the user to re-login using the /auth command. Do NOT retry this tool until authentication is restored.`;return console.warn(`[WebSearchTool] Authentication error (401) detected for query "${e.query}"`),{llmContent:G,returnDisplay:yh("websearch.error.not.logged.in")||"Not logged in"}}if(nG(d)){let G=c?`This tool (${n.Name}) is currently unavailable because your Easy Code account has insufficient credits. Web search requires available credits in your account. Do NOT retry this tool until the user's credit balance is restored. You can continue to assist the user using other tools and your own knowledge.`:`This tool (${n.Name}) is currently unavailable due to insufficient credits in your Easy Code account. Please ask the user to check their account balance or upgrade their plan. Do NOT retry this tool until credits are available.`;return console.warn(`[WebSearchTool] Quota exceeded error detected for query "${e.query}"`),{llmContent:G,returnDisplay:yh("websearch.error.quota.exceeded")||"Insufficient credits"}}let v=`Error during web search for query "${e.query}": ${gn(d)}`;return console.error(v,d),{llmContent:`Error: ${v}`,returnDisplay:yh("websearch.error.performing")}}finally{clearTimeout(I),u.abort()}}}});import cen from"path";var iIi,uen,E3t,w0e,w3t=ct(()=>{"use strict";si();ji();jc();vW();qm();pL();iv();Oc();xA();iIi="Please describe the image in extreme detail. Include all visible objects, text (transcribed verbatim), people, scenes, colors, layout, charts/diagrams, code snippets, UI elements, and any other relevant information. Preserve any text content exactly as it appears. If the image is a screenshot, describe the UI structure and content faithfully. Output plain prose; do not refuse.",uen=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]),E3t=1e4,w0e=class n extends Jn{config;static Name="image_reader";constructor(e){super(n.Name,"ImageReader",'Fallback tool for text-only models that cannot natively view images. It offloads the vision work to a cheap model (gemini-2.5-flash) and returns a textual description. Do NOT call this tool proactively: only use it when the server has replaced an image with a filter marker explicitly instructing you to (e.g. "[Image Content was filtered. ... Try using image_reader tool to assist.]"). If you can already see and understand the image content yourself, just answer directly and do NOT call this tool. If you are a Claude, Gemini, or GPT series model (or any multimodal model with native vision capability), do NOT use this tool \u2014 use read_many_files instead to read the image directly. Supports PNG / JPG / JPEG / GIF / WEBP / BMP / SVG.',Gn.FileSearch,{type:hr.OBJECT,properties:{absolute_path:{type:hr.STRING,description:"Absolute path to the image file on disk (e.g. /home/user/pic.png or C:\\\\Users\\\\me\\\\pic.png). Relative paths are not supported."},prompt:{type:hr.STRING,description:'Optional custom instruction for the vision model. If omitted, the tool asks for a detailed, neutral description of the image. Use this when you need targeted information, e.g. "Transcribe all text from this screenshot" or "What error message is shown in this dialog?".'},allow_external_access:{type:hr.BOOLEAN,description:"Optional: Allow reading images outside the workspace directory. Defaults to false. Set to true only when the user explicitly provides an external image path."}},required:["absolute_path"]}),this.config=e}validateToolParams(e){if(e&&typeof e.absolute_path=="string"){let o=e.absolute_path.trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1).trim()),e.absolute_path=o}let r=hi.validate(this.schema.parameters,e,n.Name);if(r)return r;let a=e.absolute_path;if(!a||typeof a!="string")return"absolute_path must be a non-empty string.";if(!cen.isAbsolute(a))return`File path must be absolute, but was relative: ${a}`;if(!e.allow_external_access&&!tu(a,this.config.getTargetDir()))return`File path must be within the workspace directory (${this.config.getTargetDir()}) or set allow_external_access=true: ${a}`;let i=cen.extname(a).toLowerCase();return uen.has(i)?e.prompt!==void 0&&typeof e.prompt!="string"?"prompt must be a string when provided.":null:`Unsupported image extension "${i}". Supported: ${Array.from(uen).join(", ")}.`}getDescription(e){if(e&&typeof e.absolute_path=="string"){let a=e.absolute_path.trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1).trim()),e.absolute_path=a}if(!e||typeof e.absolute_path!="string"||e.absolute_path.trim()==="")return"Path unavailable";let r=Jd(e.absolute_path,this.config.getTargetDir());return`Describing image: ${tc(r)}`}toolLocations(e){if(e&&typeof e.absolute_path=="string"){let r=e.absolute_path.trim();(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1).trim()),e.absolute_path=r}return e?.absolute_path?[{path:e.absolute_path}]:[]}async execute(e,r){let a=this.validateToolParams(e);if(a)return{llmContent:`Error: Invalid parameters provided. Reason: ${a}`,returnDisplay:a};let i=typeof this.config.getModel=="function"?this.config.getModel():void 0,o=i?rs(i):!1,t;if(o&&typeof this.config.getCustomModels=="function"){let v=(this.config.getCustomModels()||[]).find(G=>{if(G.enabled===!1)return!1;let A=(G.modelId||"").toLowerCase(),Z=(G.displayName||"").toLowerCase();return A.includes("gemini")&&A.includes("flash")||Z.includes("gemini")&&Z.includes("flash")});if(!v)return{llmContent:`This tool (${n.Name}) is currently unavailable because you are using custom models, but no custom Gemini Flash model (e.g., gemini-2.5-flash) was found in your custom models list to execute this tool. Please configure a custom Gemini Flash model to use this feature.`,returnDisplay:"Tool unavailable: Gemini Flash required"};t=Qu(v)}let s=e.absolute_path,u;try{u=await GW(s)}catch(m){let v=gn(m);return{llmContent:`Error: failed to detect file type for "${s}": ${v}`,returnDisplay:`Error: failed to detect file type: ${v}`}}if(u!=="image"&&u!=="svg")return{llmContent:`Error: file at "${s}" is not an image (detected type: ${u}). Use the read_file tool for non-image content.`,returnDisplay:`Not an image (detected: ${u})`};let I=await _B(s,this.config.getTargetDir());if(I.error)return{llmContent:`Error reading image: ${I.error}`,returnDisplay:typeof I.returnDisplay=="string"?I.returnDisplay:"Error reading image"};let d=I.llmContent,h,c=e.prompt&&e.prompt.trim()||iIi;if(u==="svg"||typeof d=="string"){let m=typeof d=="string"?d:String(d);h=[{text:`${c}
|
|
3293
3293
|
|
|
3294
3294
|
The image is an SVG. Treat the following XML as the image source and describe what it would render plus transcribe all text:
|
|
3295
3295
|
|
|
@@ -3864,7 +3864,7 @@ ${a}
|
|
|
3864
3864
|
\u{1F50D} Model Diagnostics: ${n}`),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(`
|
|
3865
3865
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
3866
3866
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
|
|
3867
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function n2i(n){let e=KXe(n);return e.isSmallModel||e.needsSpecialHandling}function a2i(n){let e=KXe(n);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 yin=ct(()=>{"use strict";Gce();});import*as _Z from"fs";import*as $Xe from"path";var i2i,ume,Ain=ct(()=>{"use strict";qm();i2i="healthy-use-reminder.json",ume=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=YG(e);this.stateFilePath=$Xe.join(r,i2i)}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{_Z.existsSync(this.stateFilePath)&&_Z.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!_Z.existsSync(this.stateFilePath))return null;let e=_Z.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=$Xe.dirname(this.stateFilePath);_Z.existsSync(r)||_Z.mkdirSync(r,{recursive:!0}),_Z.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var sEt,oEt,s2i,o2i,l2i,Zin=ct(()=>{"use strict";sEt="--- Content from referenced files ---",oEt="--- End of content ---",s2i=2e3,o2i=2e3,l2i=20});function Win(...n){return c2i(...n)}function Fin(...n){return u2i(...n)}function Nin(n,e){return n in e}function lEt(){let n={get(i,o){if(o==="write")return Win;if(Nin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return Fin;if(Nin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var c2i,u2i,Ein=ct(()=>{"use strict";c2i=process.stdout.write.bind(process.stdout),u2i=process.stderr.write.bind(process.stderr)});import{readFile as d2i}from"node:fs/promises";import{fileURLToPath as I2i}from"node:url";import cEt from"node:path";function h2i(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return cEt.dirname(I2i(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function lR(){return dme||(dme=(async()=>"1.1.28")(),dme)}function m2i(){dme=void 0}var dme,uEt=ct(()=>{"use strict";});import{EventEmitter as p2i}from"node:events";var Ime,dEt,IEt,win=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(Ime||(Ime={}));dEt=class{emitter=new p2i;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()}},IEt=new dEt});function eke(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function f2i(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function hEt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??eke(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?eke(r.content):[],i=f2i(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...eke(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),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(...eke(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Rin=ct(()=>{"use strict";});var BT,Cin,hme,xin=ct(()=>{"use strict";BT=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},Cin="latest",hme=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw BT.noSessionsFound();let i=a.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<=a.length)return a[o-1];throw BT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===Cin){let o=await this.listSessions();if(o.length===0)throw BT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new BT(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function b2i(n,e,r){return new tke(n,e,r)}var tke,rke,nke,Yin=ct(()=>{"use strict";Ice();J5();tke=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Yu(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:J4("warn","\u26A0\uFE0F No access token available")}catch(a){J4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(J4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{J4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){J4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(J4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new rke("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new nke(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},rke=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},nke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function g2i(n){return mme.getInstance(n)}function G2i(n){let e=mme.getInstance(n);return()=>e.handleAuthenticationRequired()}var mme,Vin=ct(()=>{"use strict";D5();mme=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.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"),Ro.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 a=`${Ro.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function ike(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new ake(r)}var ake,mEt=ct(()=>{"use strict";ake=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 a=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}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as ske from"fs";import*as Ng from"path";function v2i(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var pme,hH,pEt=ct(()=>{"use strict";pme=v2i(),hH=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(Ng.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"auth","login","templates",e))),pme&&r.push(Ng.join(pme,e)),pme){let o=pme;for(let t=0;t<10;t++)r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled",e)),r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e)),o=Ng.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(ske.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){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: ${pme||"(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=ske.readFileSync(a,"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`
|
|
3867
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function n2i(n){let e=KXe(n);return e.isSmallModel||e.needsSpecialHandling}function a2i(n){let e=KXe(n);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 yin=ct(()=>{"use strict";Gce();});import*as _Z from"fs";import*as $Xe from"path";var i2i,ume,Ain=ct(()=>{"use strict";qm();i2i="healthy-use-reminder.json",ume=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=YG(e);this.stateFilePath=$Xe.join(r,i2i)}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{_Z.existsSync(this.stateFilePath)&&_Z.unlinkSync(this.stateFilePath)}catch(e){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to clear state:",e)}}loadState(){try{if(!_Z.existsSync(this.stateFilePath))return null;let e=_Z.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=$Xe.dirname(this.stateFilePath);_Z.existsSync(r)||_Z.mkdirSync(r,{recursive:!0}),_Z.writeFileSync(this.stateFilePath,JSON.stringify(e,null,2),"utf-8")}catch(r){process.env.DEBUG&&console.error("[HealthyUseReminderState] Failed to save state:",r)}}}});var sEt,oEt,s2i,o2i,l2i,Zin=ct(()=>{"use strict";sEt="--- Content from referenced files ---",oEt="--- End of content ---",s2i=2e3,o2i=2e3,l2i=20});function Win(...n){return c2i(...n)}function Fin(...n){return u2i(...n)}function Nin(n,e){return n in e}function lEt(){let n={get(i,o){if(o==="write")return Win;if(Nin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},e=new Proxy(process.stdout,n),r={get(i,o){if(o==="write")return Fin;if(Nin(o,i)){let t=i[o];return typeof t=="function"?t.bind(i):t}}},a=new Proxy(process.stderr,r);return{stdout:e,stderr:a}}var c2i,u2i,Ein=ct(()=>{"use strict";c2i=process.stdout.write.bind(process.stdout),u2i=process.stderr.write.bind(process.stderr)});import{readFile as d2i}from"node:fs/promises";import{fileURLToPath as I2i}from"node:url";import cEt from"node:path";function h2i(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return cEt.dirname(I2i(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function lR(){return dme||(dme=(async()=>"1.1.29")(),dme)}function m2i(){dme=void 0}var dme,uEt=ct(()=>{"use strict";});import{EventEmitter as p2i}from"node:events";var Ime,dEt,IEt,win=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(Ime||(Ime={}));dEt=class{emitter=new p2i;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()}},IEt=new dEt});function eke(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function f2i(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function hEt(n){if(!n||n.length===0)return[];let e=[];for(let r of n){if(r.role&&(r.parts||r.content!==void 0)){let a=r.parts??eke(r.content);e.push({role:r.role,parts:a});continue}if(!(r.type==="info"||r.type==="error"||r.type==="warning")){if(r.type==="user"){let a=r.content!==void 0?eke(r.content):[],i=f2i(a).trim();if(i.startsWith("/")||i.startsWith("?")||a.length===0)continue;e.push({role:"user",parts:a});continue}if(r.type==="gemini"){let a=[];if(r.thoughts&&r.thoughts.length>0)for(let o of r.thoughts){let t=o.subject?`**${o.subject}** ${o.description}`:o.description;a.push({text:t,thought:!0})}let i=!!r.toolCalls&&r.toolCalls.length>0;if(r.content!==void 0&&a.push(...eke(r.content)),i)for(let o of r.toolCalls)a.push({functionCall:{name:o.name,args:o.args,...o.id?{id:o.id}:{}}});if(a.length>0&&e.push({role:"model",parts:a}),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(...eke(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var Rin=ct(()=>{"use strict";});var BT,Cin,hme,xin=ct(()=>{"use strict";BT=class n extends Error{constructor(e){super(e),this.name="SessionError"}static noSessionsFound(){return new n("No persisted sessions found.")}static invalidSessionIdentifier(e,r){return new n(`Session '${e}' was not found under ${r}.`)}},Cin="latest",hme=class{manager;constructor(e){this.manager=e}async sessionExists(e){return(await this.listAllMetadata()).some(a=>a.sessionId===e)}async listSessions(){return(await this.listAllMetadata()).map(r=>({id:r.sessionId,startTime:r.createdAt,title:r.title,messageCount:r.messageCount})).sort((r,a)=>new Date(r.startTime).getTime()-new Date(a.startTime).getTime())}async findSession(e){let r=e.trim(),a=await this.listSessions();if(a.length===0)throw BT.noSessionsFound();let i=a.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<=a.length)return a[o-1];throw BT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===Cin){let o=await this.listSessions();if(o.length===0)throw BT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new BT(`Session '${a.id}' exists in index but could not be loaded.`);return{session:a,data:i}}async listAllMetadata(){let e=this.manager;return typeof e.listSessions=="function"?await e.listSessions():typeof e.getSessionIndex=="function"?(await e.getSessionIndex())?.sessions??[]:[]}}});function b2i(n,e,r){return new tke(n,e,r)}var tke,rke,nke,Yin=ct(()=>{"use strict";Ice();J5();tke=class n{tokenManager;baseURL;requestQueue=[];isRefreshing=!1;onAuthenticationRequired;constructor(e,r,a){this.baseURL=e.replace(/\/$/,""),this.tokenManager=r,this.onAuthenticationRequired=a}setAuthenticationRequiredCallback(e){this.onAuthenticationRequired=e}async request(e,r={}){let a=`${this.baseURL}${e}`,i=await this.prepareRequestOptions(r),o=await fetch(a,i);return o.status===401&&this.tokenManager&&(o=await this.handleUnauthorized(a,i)),o}async get(e,r={}){return this.request(e,{...r,method:"GET"})}async post(e,r,a={}){let i={...a,method:"POST",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async put(e,r,a={}){let i={...a,method:"PUT",body:r?JSON.stringify(r):void 0};return r&&!a.headers?.["Content-Type"]&&(i.headers={"Content-Type":"application/json",...a.headers}),this.request(e,i)}async delete(e,r={}){return this.request(e,{...r,method:"DELETE"})}async prepareRequestOptions(e){let r={"User-Agent":Yu(),...e.headers};if(this.tokenManager)try{let a=await this.tokenManager.getAccessToken();a?r.Authorization=`Bearer ${a}`:J4("warn","\u26A0\uFE0F No access token available")}catch(a){J4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(J4("log","\u{1F504} Triggering authentication flow..."),this.onAuthenticationRequired())}return{...e,headers:r}}async handleUnauthorized(e,r){if(this.isRefreshing)return new Promise((a,i)=>{this.requestQueue.push({resolve:a,reject:i,request:()=>fetch(e,r)})});this.isRefreshing=!0;try{J4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){J4("log","\u2705 Token refreshed successfully");let i={...r,headers:{...r.headers,Authorization:`Bearer ${a}`}},o=fetch(e,i);return this.processRequestQueue(a),await o}else throw new Error("Failed to refresh token")}catch(a){throw console.error("\u274C Token refresh failed:",a),this.tokenManager.clearTokens?await this.tokenManager.clearTokens():this.tokenManager.clear&&this.tokenManager.clear(),this.rejectRequestQueue(new Error("Authentication required")),this.onAuthenticationRequired&&(J4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new rke("Authentication required - please re-authenticate")}finally{this.isRefreshing=!1}}processRequestQueue(e){this.requestQueue.splice(0).forEach(({resolve:a,reject:i,request:o})=>{o().then(t=>a(t)).catch(t=>i(t))})}rejectRequestQueue(e){this.requestQueue.splice(0).forEach(({reject:a})=>{a(e)})}static async checkResponse(e){if(!e.ok){let a=await e.text();throw new nke(`HTTP ${e.status}: ${e.statusText}`,e.status,a)}let r=e.headers.get("content-type");return r&&r.includes("application/json")?await e.json():await e.text()}async requestJson(e,r={}){let a=await this.request(e,r);return n.checkResponse(a)}async postJson(e,r){let a=await this.post(e,r);return n.checkResponse(a)}async putJson(e,r){let a=await this.put(e,r);return n.checkResponse(a)}async getJson(e){let r=await this.get(e);return n.checkResponse(r)}async deleteJson(e){let r=await this.delete(e);return n.checkResponse(r)}},rke=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},nke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function g2i(n){return mme.getInstance(n)}function G2i(n){let e=mme.getInstance(n);return()=>e.handleAuthenticationRequired()}var mme,Vin=ct(()=>{"use strict";D5();mme=class n{static instance=null;config;isAuthenticating=!1;constructor(e={}){this.config={authUrl:"/auth",autoOpenBrowser:!0,...e}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.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"),Ro.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 a=`${Ro.getInstance().getProxyServerUrl()}${this.config.authUrl}`;console.log(`[AuthNavigator] Redirecting to auth page: ${a}`),window.location.href=a}else console.error("[AuthNavigator] Cannot redirect in non-browser environment")}isInProgress(){return this.isAuthenticating}}});function ike(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new ake(r)}var ake,mEt=ct(()=>{"use strict";ake=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 a=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}`}):a?i?(console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230JWT Token:",a),console.log("\u{1F389} [DeepVlab Auth] \u83B7\u53D6\u5230User ID:",i),console.log("\u2705 [DeepVlab Auth] DeepVlab\u8BA4\u8BC1\u6210\u529F"),{success:!0,token:a,user_id:i}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11user_id\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11user_id\u53C2\u6570"}):(console.error("\u274C [DeepVlab Auth] \u7F3A\u5C11token\u53C2\u6570"),{success:!1,error:"DeepVlab\u8BA4\u8BC1\u56DE\u8C03\u4E2D\u7F3A\u5C11token\u53C2\u6570"})}}});import*as ske from"fs";import*as Ng from"path";function v2i(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var pme,hH,pEt=ct(()=>{"use strict";pme=v2i(),hH=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(Ng.join(this.customBasePath,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"bundled","auth","login","templates",e)),r.push(Ng.join(this.customBasePath,"auth","login","templates",e))),pme&&r.push(Ng.join(pme,e)),pme){let o=pme;for(let t=0;t<10;t++)r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled",e)),r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e)),o=Ng.dirname(o)}if(typeof process<"u"&&process.cwd)try{let o=process.cwd();r.push(Ng.join(o,"bundle","login","templates",e)),r.push(Ng.join(o,"dist","bundled","auth","login","templates",e)),r.push(Ng.join(o,"bundled","auth","login","templates",e)),r.push(Ng.join(o,"auth","login","templates",e))}catch{}let a=null;for(let o of r)try{if(ske.existsSync(o)){a=o,console.error(`\u2705 [AuthTemplates] Template loaded: ${e} from ${o}`);break}}catch{continue}if(!a){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: ${pme||"(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=ske.readFileSync(a,"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`
|
|
3868
3868
|
<!DOCTYPE html>
|
|
3869
3869
|
<html>
|
|
3870
3870
|
<head>
|
|
@@ -5036,7 +5036,7 @@ ${c}`),a?i.reset(c):c}function P1i(n,e,r,a={}){if(!Xln){Xln=!0;let o="Passing li
|
|
|
5036
5036
|
|
|
5037
5037
|
${e}
|
|
5038
5038
|
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,a=$1i(r,this.#t.message);if(a)return(0,Mln.codeFrameColumns)(r,{start:a},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#a??=this.#i(!1),this.#a}},$1i=(n,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:a,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:iwt(n,Number(a),{oneBased:!0})},evi=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,a)=>`"${a}"(${K1i(a)})`)});var lwt=Ze((Wso,tvi)=>{tvi.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 _ln=Ze((Fso,rvi)=>{rvi.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 zln=Ze((Eso,nvi)=>{nvi.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 jln=Ze((wso,Pln)=>{"use strict";var avi=[].concat(lwt()).concat(_ln()),ivi=zln();Pln.exports=function(n){var e=0;function r(){return e<n.length}function a(v){if(v instanceof RegExp){var G=n.slice(e),A=G.match(v);if(A)return e+=A[0].length,A[0]}else if(n.indexOf(v,e)===e)return e+=v.length,v}function i(){a(/[ ]*/)}function o(){for(var v,G=["WITH","AND","OR","(",")",":","+"],A=0;A<G.length&&(v=a(G[A]),!v);A++);if(v==="+"&&e>1&&n[e-2]===" ")throw new Error("Space before `+`");return v&&{type:"OPERATOR",string:v}}function t(){return a(/[A-Za-z0-9-.]+/)}function s(){var v=t();if(!v)throw new Error("Expected idstring at offset "+e);return v}function u(){if(a("DocumentRef-")){var v=s();return{type:"DOCUMENTREF",string:v}}}function I(){if(a("LicenseRef-")){var v=s();return{type:"LICENSEREF",string:v}}}function d(){var v=e,G=t();if(avi.indexOf(G)!==-1)return{type:"LICENSE",string:G};if(ivi.indexOf(G)!==-1)return{type:"EXCEPTION",string:G};e=v}function h(){return o()||u()||I()||d()}for(var c=[];r()&&(i(),!!r());){var m=h();if(!m)throw new Error("Unexpected `"+n[e]+"` at offset "+e);c.push(m)}return c}});var Kln=Ze((Rso,qln)=>{"use strict";qln.exports=function(n){var e=0;function r(){return e<n.length}function a(){return r()?n[e]:null}function i(){if(!r())throw new Error;e++}function o(G){var A=a();if(A&&A.type==="OPERATOR"&&G===A.string)return i(),A.string}function t(){if(o("WITH")){var G=a();if(G&&G.type==="EXCEPTION")return i(),G.string;throw new Error("Expected exception after `WITH`")}}function s(){var G=e,A="",Z=a();if(Z.type==="DOCUMENTREF"&&(i(),A+="DocumentRef-"+Z.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(Z=a(),Z.type==="LICENSEREF")return i(),A+="LicenseRef-"+Z.string,{license:A};e=G}function u(){var G=a();if(G&&G.type==="LICENSE"){i();var A={license:G.string};o("+")&&(A.plus=!0);var Z=t();return Z&&(A.exception=Z),A}}function I(){var G=o("(");if(G){var A=m();if(!o(")"))throw new Error("Expected `)`");return A}}function d(){return I()||s()||u()}function h(G,A){return function Z(){var R=A();if(R){if(!o(G))return R;var F=Z();if(!F)throw new Error("Expected expression");return{left:R,conjunction:G.toLowerCase(),right:F}}}}var c=h("AND",d),m=h("OR",c),v=m();if(!v||r())throw new Error("Syntax error");return v}});var cwt=Ze((Cso,$ln)=>{"use strict";var svi=jln(),ovi=Kln();$ln.exports=function(n){return ovi(svi(n))}});var lcn=Ze((xso,ocn)=>{var lvi=cwt(),cvi=lwt();function Kke(n){try{return lvi(n),!0}catch{return!1}}function scn(n,e){var r=e[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(e[0].toUpperCase())}var ecn=[["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(scn),uvi=0,dvi=1,tcn=[function(n){return n.toUpperCase()},function(n){return n.trim()},function(n){return n.replace(/\./g,"")},function(n){return n.replace(/\s+/g,"")},function(n){return n.replace(/\s+/g,"-")},function(n){return n.replace("v","-")},function(n){return n.replace(/,?\s*(\d)/,"-$1")},function(n){return n.replace(/,?\s*(\d)/,"-$1.0")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(n){return n.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(n){return n[0].toUpperCase()+n.slice(1)},function(n){return n.replace("/","-")},function(n){return n.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(n){return n.indexOf("3.0")!==-1?n+"-or-later":n+"-only"},function(n){return n+"only"},function(n){return n.replace(/(\d)$/,"-$1.0")},function(n){return n.replace(/(-| )?(\d)$/,"-$2-Clause")},function(n){return n.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(n){return n.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(n){return n.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(n){return n.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(n){return n.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(n){return n.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(n){return"CC-"+n},function(n){return"CC-"+n+"-4.0"},function(n){return n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(n){return"CC-"+n.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],uwt=cvi.map(function(n){var e=/^(.*)-\d+\.\d+$/.exec(n);return e?[e[0],e[1]]:[n,null]}).reduce(function(n,e){var r=e[1];return n[r]=n[r]||[],n[r].push(e[0]),n},{}),Ivi=Object.keys(uwt).map(function(e){return[e,uwt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});uwt=void 0;var rcn=[["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(Ivi).sort(scn),hvi=0,mvi=1,ncn=function(n){for(var e=0;e<tcn.length;e++){var r=tcn[e](n).trim();if(r!==n&&Kke(r))return r}return null},acn=function(n){for(var e=n.toUpperCase(),r=0;r<rcn.length;r++){var a=rcn[r];if(e.indexOf(a[hvi])>-1)return a[mvi]}return null},icn=function(n,e){for(var r=0;r<ecn.length;r++){var a=ecn[r],i=a[uvi];if(n.indexOf(i)>-1){var o=n.replace(i,a[dvi]),t=e(o);if(t!==null)return t}}return null};ocn.exports=function(n,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function a(s){return r?pvi(s):s}var i=typeof n=="string"&&n.trim().length!==0;if(!i)throw Error("Invalid argument. Expected non-empty string.");if(n=n.trim(),Kke(n))return a(n);var o=n.replace(/\+$/,"").trim();if(Kke(o))return a(o);var t=ncn(n);return t!==null||(t=icn(n,function(s){return Kke(s)?s:ncn(s)}),t!==null)||(t=acn(n),t!==null)||(t=icn(n,acn),t!==null)?a(t):null};function pvi(n){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(n)!==-1?n+"-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(n)!==-1?n.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(n)!==-1?n+"-or-later":n}});var Icn=Ze((Yso,dcn)=>{var fvi=cwt(),bvi=lcn(),ccn='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',gvi=/^SEE LICEN[CS]E IN (.+)$/;function ucn(n,e){return e.slice(0,n.length)===n}function dwt(n){if(n.hasOwnProperty("license")){var e=n.license;return ucn("LicenseRef",e)||ucn("DocumentRef",e)}else return dwt(n.left)||dwt(n.right)}dcn.exports=function(n){var e;try{e=fvi(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=gvi.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[ccn]};if(n.trim().length!==0){var i=bvi(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return dwt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[ccn]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var bcn=Ze(e6e=>{"use strict";Object.defineProperty(e6e,"__esModule",{value:!0});e6e.LRUCache=void 0;var w$=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,mcn=new Set,Iwt=typeof process=="object"&&process?process:{},pcn=(n,e,r,a)=>{typeof Iwt.emitWarning=="function"?Iwt.emitWarning(n,e,r,a):console.error(`[${r}] ${e}: ${n}`)},$ke=globalThis.AbortController,hcn=globalThis.AbortSignal;if(typeof $ke>"u"){hcn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},$ke=class{constructor(){e()}signal=new hcn;abort(a){if(!this.signal.aborted){this.signal.reason=a,this.signal.aborted=!0;for(let i of this.signal._onabort)i(a);this.signal.onabort?.(a)}}};let n=Iwt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,pcn("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 Gvi=n=>!mcn.has(n),Hso=Symbol("type"),NH=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),fcn=n=>NH(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?R$:null:null,R$=class extends Array{constructor(e){super(e),this.fill(0)}},hwt=class n{heap;length;static#e=!1;static create(e){let r=fcn(e);if(!r)return[];n.#e=!0;let a=new n(e,r);return n.#e=!1,a}constructor(e,r){if(!n.#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]}},mwt=class n{#e;#t;#r;#n;#a;#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,a,i,o)=>e.#x(r,a,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.#a}get memoMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:a,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:t,updateAgeOnHas:s,allowStale:u,dispose:I,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:c,maxSize:m=0,maxEntrySize:v=0,sizeCalculation:G,fetchMethod:A,memoMethod:Z,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:p,ignoreFetchAbort:y}=e;if(r!==0&&!NH(r))throw new TypeError("max option must be a nonnegative integer");let N=r?fcn(r):Array;if(!N)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=m,this.maxEntrySize=v||this.#t,this.sizeCalculation=G,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,A!==void 0&&typeof A!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#a=A,this.#y=!!A,this.#s=new Map,this.#I=new Array(r).fill(void 0),this.#d=new Array(r).fill(void 0),this.#h=new N(r),this.#l=new N(r),this.#m=0,this.#b=0,this.#A=hwt.create(r),this.#u=0,this.#o=0,typeof I=="function"&&(this.#r=I),typeof d=="function"?(this.#n=d,this.#f=[]):(this.#n=void 0,this.#f=void 0),this.#N=!!this.#r,this.#g=!!this.#n,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!p,this.ignoreFetchAbort=!!y,this.maxEntrySize!==0){if(this.#t!==0&&!NH(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!NH(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=NH(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=a||0,this.ttl){if(!NH(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 w="LRU_CACHE_UNBOUNDED";Gvi(w)&&(mcn.add(w),pcn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",w,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#W(){let e=new R$(this.#e),r=new R$(this.#e);this.#Z=e,this.#G=r,this.#H=(o,t,s=w$.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?w$.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=a||i();let I=o.now-u;o.remainingTTL=s-I}};let a=0,i=()=>{let o=w$.now();if(this.ttlResolution>0){a=o;let t=setTimeout(()=>a=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=(a||i())-u;return s-I},this.#R=o=>{let t=r[o],s=e[o];return!!s&&!!t&&(a||i())-t>s}}#w=()=>{};#c=()=>{};#H=()=>{};#R=()=>!1;#C(){let e=new R$(this.#e);this.#o=0,this.#E=e,this.#Y=r=>{this.#o-=e[r],e[r]=0},this.#F=(r,a,i,o)=>{if(this.#v(a))return 0;if(!NH(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(a,r),!NH(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,a,i)=>{if(e[r]=a,this.#t){let o=this.#t-e[r];for(;this.#o>o;)this.#B(!0)}this.#o+=e[r],i&&(i.entrySize=a,i.totalCalculatedSize=this.#o)}}#Y=e=>{};#S=(e,r,a)=>{};#F=(e,r,a,i)=>{if(a||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#L({allowStale:e=this.allowStale}={}){if(this.#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 a of this.#L()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#I[a],this))return this.get(this.#I[a],r)}}forEach(e,r=this){for(let a of this.#L()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],this)}}rforEach(e,r=this){for(let a of this.#V()){let i=this.#d[a],o=this.#v(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#I[a],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 a=this.#d[r],i=this.#v(a)?a.__staleWhileFetching:a;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-(w$.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 a=this.#I[r],i=this.#d[r],o=this.#v(i)?i.__staleWhileFetching:i;if(o===void 0||a===void 0)continue;let t={value:o};if(this.#Z&&this.#G){t.ttl=this.#Z[r];let s=w$.now()-this.#G[r];t.start=Math.floor(Date.now()-s)}this.#E&&(t.size=this.#E[r]),e.unshift([a,t])}return e}load(e){this.clear();for(let[r,a]of e){if(a.start){let i=Date.now()-a.start;a.start=w$.now()-i}this.set(r,a.value,a)}}set(e,r,a={}){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}=a,{noUpdateTTL:I=this.noUpdateTTL}=a,d=this.#F(e,r,a.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.#n?.(...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.#n?.(...r)}}}#B(e){let r=this.#m,a=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,a,"evict"),this.#g&&this.#f?.push([i,a,"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(a),this.#u--,r}has(e,r={}){let{updateAgeOnHas:a=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 a&&this.#w(o),i&&(i.has="hit",this.#c(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:a=this.allowStale}=r,i=this.#s.get(e);if(i===void 0||!a&&this.#R(i))return;let o=this.#d[i];return this.#v(o)?o.__staleWhileFetching:o}#x(e,r,a,i){let o=r===void 0?void 0:this.#d[r];if(this.#v(o))return o;let t=new $ke,{signal:s}=a;s?.addEventListener("abort",()=>t.abort(s.reason),{signal:t.signal});let u={signal:t.signal,options:a,context:i},I=(G,A=!1)=>{let{aborted:Z}=t.signal,R=a.ignoreFetchAbort&&G!==void 0;if(a.status&&(Z&&!A?(a.status.fetchAborted=!0,a.status.fetchError=t.signal.reason,R&&(a.status.fetchAbortIgnored=!0)):a.status.fetchResolved=!0),Z&&!R&&!A)return h(t.signal.reason);let F=m;return this.#d[r]===m&&(G===void 0?F.__staleWhileFetching?this.#d[r]=F.__staleWhileFetching:this.#k(e,"fetch"):(a.status&&(a.status.fetchUpdated=!0),this.set(e,G,u.options))),G},d=G=>(a.status&&(a.status.fetchRejected=!0,a.status.fetchError=G),h(G)),h=G=>{let{aborted:A}=t.signal,Z=A&&a.allowStaleOnFetchAbort,R=Z||a.allowStaleOnFetchRejection,F=R||a.noDeleteOnFetchRejection,E=m;if(this.#d[r]===m&&(!F||E.__staleWhileFetching===void 0?this.#k(e,"fetch"):Z||(this.#d[r]=E.__staleWhileFetching)),R)return a.status&&E.__staleWhileFetching!==void 0&&(a.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw G},c=(G,A)=>{let Z=this.#a?.(e,o,u);Z&&Z instanceof Promise&&Z.then(R=>G(R===void 0?void 0:R),A),t.signal.addEventListener("abort",()=>{(!a.ignoreFetchAbort||a.allowStaleOnFetchAbort)&&(G(void 0),a.allowStaleOnFetchAbort&&(G=R=>I(R,!0)))})};a.status&&(a.status.fetchDispatched=!0);let m=new Promise(c).then(I,d),v=Object.assign(m,{__abortController:t,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,v,{...u.options,status:void 0}),r=this.#s.get(e)):this.#d[r]=v,v}#v(e){if(!this.#y)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof $ke}async fetch(e,r={}){let{allowStale:a=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:v=this.allowStaleOnFetchAbort,context:G,forceRefresh:A=!1,status:Z,signal:R}=r;if(!this.#y)return Z&&(Z.fetch="get"),this.get(e,{allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:Z});let F={allowStale:a,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:t,noDisposeOnSet:s,size:u,sizeCalculation:I,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:v,ignoreFetchAbort:m,status:Z,signal:R},E=this.#s.get(e);if(E===void 0){Z&&(Z.fetch="miss");let p=this.#x(e,E,F,G);return p.__returned=p}else{let p=this.#d[E];if(this.#v(p)){let f=a&&p.__staleWhileFetching!==void 0;return Z&&(Z.fetch="inflight",f&&(Z.returnedStale=!0)),f?p.__staleWhileFetching:p.__returned=p}let y=this.#R(E);if(!A&&!y)return Z&&(Z.fetch="hit"),this.#D(E),i&&this.#w(E),Z&&this.#c(Z,E),p;let N=this.#x(e,E,F,G),b=N.__staleWhileFetching!==void 0&&a;return Z&&(Z.fetch=y?"stale":"refresh",b&&y&&(Z.returnedStale=!0)),b?N.__staleWhileFetching:N.__returned=N}}async forceFetch(e,r={}){let a=await this.fetch(e,r);if(a===void 0)throw new Error("fetch() returned undefined");return a}memo(e,r={}){let a=this.#i;if(!a)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=a(e,s,{options:t,context:i});return this.set(e,u,t),u}get(e,r={}){let{allowStale:a=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&&a&&u.__staleWhileFetching!==void 0&&(t.returnedStale=!0),a?u.__staleWhileFetching:void 0):(o||this.#k(e,"expire"),t&&a&&(t.returnedStale=!0),a?u:void 0)):(t&&(t.get="hit"),I?u.__staleWhileFetching:(this.#D(s),i&&this.#w(s),u))}else t&&(t.get="miss")}#J(e,r){this.#l[r]=e,this.#h[e]=r}#D(e){e!==this.#b&&(e===this.#m?this.#m=this.#h[e]:this.#J(this.#l[e],this.#h[e]),this.#J(this.#b,e),this.#b=e)}delete(e){return this.#k(e,"delete")}#k(e,r){let a=!1;if(this.#u!==0){let i=this.#s.get(e);if(i!==void 0)if(a=!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.#n?.(...o)}return a}clear(){return this.#p("delete")}#p(e){for(let r of this.#V({allowStale:!0})){let a=this.#d[r];if(this.#v(a))a.__abortController.abort(new Error("deleted"));else{let i=this.#I[r];this.#N&&this.#r?.(a,i,e),this.#g&&this.#f?.push([a,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,a;for(;a=r?.shift();)this.#n?.(...a)}}};e6e.LRUCache=mwt});var vcn=Ze((kso,Gcn)=>{"use strict";var Pl=(...n)=>n.every(e=>e)?n.join(""):"",W0=n=>n?encodeURIComponent(n):"",gcn=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),vvi={sshtemplate:({domain:n,user:e,project:r,committish:a})=>`git@${n}:${e}/${r}.git${Pl("#",a)}`,sshurltemplate:({domain:n,user:e,project:r,committish:a})=>`git+ssh://git@${n}/${e}/${r}.git${Pl("#",a)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i,path:o})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a||"HEAD"),"/",o)}`,browsetemplate:({domain:n,user:e,project:r,committish:a,treepath:i})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a))}`,browsetreetemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${W0(a||"HEAD")}/${o}${Pl("#",s(t||""))}`,browseblobtemplate:({domain:n,user:e,project:r,committish:a,blobpath:i,path:o,fragment:t,hashformat:s})=>`https://${n}/${e}/${r}/${i}/${W0(a||"HEAD")}/${o}${Pl("#",s(t||""))}`,docstemplate:({domain:n,user:e,project:r,treepath:a,committish:i})=>`https://${n}/${e}/${r}${Pl("/",a,"/",W0(i))}#readme`,httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/raw/${W0(a||"HEAD")}/${i}`,shortcuttemplate:({type:n,user:e,project:r,committish:a})=>`${n}:${e}/${r}${Pl("#",a)}`,pathtemplate:({user:n,project:e,committish:r})=>`${n}/${e}${Pl("#",r)}`,bugstemplate:({domain:n,user:e,project:r})=>`https://${n}/${e}/${r}/issues`,hashformat:gcn},WH={};WH.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:e,project:r,committish:a,path:i})=>`https://${Pl(n,"@")}raw.githubusercontent.com/${e}/${r}/${W0(a||"HEAD")}/${i}`,gittemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://codeload.${n}/${e}/${r}/tar.gz/${W0(a||"HEAD")}`,extract:n=>{let[,e,r,a,i]=n.pathname.split("/",5);if(!(a&&a!=="tree")&&(a||(i=n.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:i}}};WH.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:e,project:r,committish:a,treepath:i,path:o,editpath:t})=>`https://${n}/${e}/${r}${Pl("/",i,"/",W0(a||"HEAD"),"/",o,t)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/get/${W0(a||"HEAD")}.tar.gz`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["get"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};WH.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:n,domain:e,user:r,project:a,committish:i})=>`git+https://${Pl(n,"@")}${e}/${r}/${a}.git${Pl("#",i)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/repository/archive.tar.gz?ref=${W0(a||"HEAD")}`,extract:n=>{let e=n.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),a=r.pop();a.endsWith(".git")&&(a=a.slice(0,-4));let i=r.join("/");if(!(!i||!a))return{user:i,project:a,committish:n.hash.slice(1)}}};WH.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:e,committish:r})=>`git@${n}:${e}.git${Pl("#",r)}`,sshurltemplate:({domain:n,project:e,committish:r})=>`git+ssh://git@${n}/${e}.git${Pl("#",r)}`,edittemplate:({domain:n,user:e,project:r,committish:a,editpath:i})=>`https://${n}/${e}/${r}${Pl("/",W0(a))}/${i}`,browsetemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Pl("/",W0(r))}`,browsetreetemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Pl("/",W0(r))}${Pl("#",i(a))}`,browseblobtemplate:({domain:n,project:e,committish:r,path:a,hashformat:i})=>`https://${n}/${e}${Pl("/",W0(r))}${Pl("#",i(a))}`,docstemplate:({domain:n,project:e,committish:r})=>`https://${n}/${e}${Pl("/",W0(r))}`,httpstemplate:({domain:n,project:e,committish:r})=>`git+https://${n}/${e}.git${Pl("#",r)}`,filetemplate:({user:n,project:e,committish:r,path:a})=>`https://gist.githubusercontent.com/${n}/${e}/raw${Pl("/",W0(r))}/${a}`,shortcuttemplate:({type:n,project:e,committish:r})=>`${n}:${e}${Pl("#",r)}`,pathtemplate:({project:n,committish:e})=>`${n}${Pl("#",e)}`,bugstemplate:({domain:n,project:e})=>`https://${n}/${e}`,gittemplate:({domain:n,project:e,committish:r})=>`git://${n}/${e}.git${Pl("#",r)}`,tarballtemplate:({project:n,committish:e})=>`https://codeload.github.com/gist/${n}/tar.gz/${W0(e||"HEAD")}`,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(a!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+gcn(n)}};WH.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:e,project:r,committish:a,path:i})=>`https://${n}/${e}/${r}/blob/${W0(a)||"HEAD"}/${i}`,httpstemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}.git${Pl("#",a)}`,tarballtemplate:({domain:n,user:e,project:r,committish:a})=>`https://${n}/${e}/${r}/archive/${W0(a)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,e,r,a]=n.pathname.split("/",4);if(!["archive"].includes(a)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:n.hash.slice(1)}}};for(let[n,e]of Object.entries(WH))WH[n]=Object.assign({},vvi,e);Gcn.exports=WH});var fwt=Ze((Sso,Acn)=>{var yvi=Wt("url"),pwt=(n,e,r)=>{let a=n.indexOf(r);return n.lastIndexOf(e,a>-1?a:1/0)},ycn=n=>{try{return new yvi.URL(n)}catch{}},Avi=(n,e)=>{let r=n.indexOf(":"),a=n.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,a))return n;let i=n.indexOf("@");return i>-1?i>r?`git+ssh://${n}`:n:n.indexOf("//")===r+1?n:`${n.slice(0,r+1)}//${n.slice(r+1)}`},Zvi=n=>{let e=pwt(n,"@","#"),r=pwt(n,":","#");return r>e&&(n=n.slice(0,r)+"/"+n.slice(r+1)),pwt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};Acn.exports=(n,e)=>{let r=e?Avi(n,e):n;return ycn(r)||ycn(Zvi(r))}});var Ncn=Ze((Lso,Zcn)=>{"use strict";var Nvi=fwt(),Wvi=n=>{let e=n.indexOf("#"),r=n.indexOf("/"),a=n.indexOf("/",r+1),i=n.indexOf(":"),o=/\s/.exec(n),t=n.indexOf("@"),s=!o||e>-1&&o.index>e,u=t===-1||e>-1&&t>e,I=i===-1||e>-1&&i>e,d=a===-1||e>-1&&a>e,h=r>0,c=e>-1?n[e-1]!=="/":!n.endsWith("/"),m=!n.startsWith(".");return s&&h&&c&&m&&u&&I&&d};Zcn.exports=(n,e,{gitHosts:r,protocols:a})=>{if(!n)return;let i=Wvi(n)?`github:${n}`:n,o=Nvi(i,a);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;a[o.protocol]?.auth&&(o.username||o.password)&&(d=`${o.username}${o.password?":"+o.password:""}`);let h=null,c=null,m=null,v=null;try{if(t){let G=o.pathname.startsWith("/")?o.pathname.slice(1):o.pathname,A=G.indexOf("@");A>-1&&(G=G.slice(A+1));let Z=G.lastIndexOf("/");Z>-1?(c=decodeURIComponent(G.slice(0,Z)),c||(c=null),m=decodeURIComponent(G.slice(Z+1))):m=decodeURIComponent(G),m.endsWith(".git")&&(m=m.slice(0,-4)),o.hash&&(h=decodeURIComponent(o.hash.slice(1))),v="shortcut"}else{if(!I.protocols.includes(o.protocol))return;let G=I.extract(o);if(!G)return;c=G.user&&decodeURIComponent(G.user),m=decodeURIComponent(G.project),h=decodeURIComponent(G.committish),v=a[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(G){if(G instanceof URIError)return;throw G}return[u,c,d,m,h,v,e]}});var Fcn=Ze((Bso,Wcn)=>{"use strict";var{LRUCache:Fvi}=bcn(),Evi=vcn(),wvi=Ncn(),Rvi=fwt(),bwt=new Fvi({max:1e3}),t6e=class n{constructor(e,r,a,i,o,t,s={}){Object.assign(this,n.#e[e],{type:e,user:r,auth:a,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){n.#e[e]=r,n.#e.byDomain[r.domain]=e,n.#e.byShortcut[`${e}:`]=e,n.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let a=e+JSON.stringify(r||{});if(!bwt.has(a)){let i=wvi(e,r,{gitHosts:n.#e,protocols:n.#t});bwt.set(a,i?new n(...i):void 0)}return bwt.get(a)}static parseUrl(e){return Rvi(e)}#r(e,r){if(typeof e!="function")return null;let a={...this,...this.opts,...r};a.path||(a.path=""),a.path.startsWith("/")&&(a.path=a.path.slice(1)),a.noCommittish&&(a.committish=null);let i=e(a);return a.noGitPlus&&i.startsWith("git+")?i.slice(4):i}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...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[n,e]of Object.entries(Evi))t6e.addHost(n,e);Wcn.exports=t6e});var wcn=Ze((Tso,Ecn)=>{Ecn.exports=Cvi;function Cvi(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
|
|
5039
|
-
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var Rcn=Ze((Jso,xvi)=>{xvi.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 Vcn=Ze((Dso,Ycn)=>{var Yvi=Wat(),Vvi=Fat(),Qvi=Icn(),r6e=Fcn(),Hvi=Wt("node:module"),Xvi=["dependencies","devDependencies","optionalDependencies"],kvi=wcn(),gwt=Wt("url"),FH=Rcn(),Ccn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");Ycn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=r6e.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(FH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,FH.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):FH.script[e]&&!n.scripts[FH.script[e]]&&this.warn("typo",e,FH.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){Mvi(n,this.warn),Dvi(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=r6e.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!Yvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=Vvi(n.version,r),!0},fixPeople:function(n){xcn(n,Tvi),xcn(n,Jvi)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Bvi(n.name,r,e.allowLegacyCase),Hvi.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=kvi(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=r6e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")Ccn(n.bugs)?n.bugs={email:n.bugs}:gwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{Uvi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&gwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Ccn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=r6e.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;gwt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Qvi(e).validForNewPackages)return this.warn("invalidLicense")}};function Svi(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Lvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Bvi(n,e,r){if(n.charAt(0)==="."||!(Svi(n)||Lvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function xcn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Tvi(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function Jvi(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Dvi(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function Ovi(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.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(/^@/,""),a[o]=t}),a}function Mvi(n,e){Xvi.forEach(function(r){n[r]&&(n[r]=Ovi(n[r],r,e))})}function Uvi(n,e){n&&Object.keys(n).forEach(function(r){FH.bugs[r]&&(e("typo",r,FH.bugs[r],"bugs"),n[FH.bugs[r]]=n[r],delete n[r])})}});var Qcn=Ze((Oso,_vi)=>{_vi.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 kcn=Ze((Mso,Xcn)=>{var Hcn=Wt("util"),Gwt=Qcn();Xcn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return zvi.apply(null,n);var r=Gwt[e]?Gwt[e]:e+": '%s'";return n.unshift(r),Hcn.format.apply(null,n)};function zvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),Hcn.format(Gwt.typo,n,e)}});var Tcn=Ze((Uso,Bcn)=>{Bcn.exports=Scn;var vwt=Vcn();Scn.fixer=vwt;var Pvi=kcn(),jvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],qvi=["dependencies","people","typos"],ywt=jvi.map(function(n){return Lcn(n)+"Field"});ywt=ywt.concat(qvi);function Scn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),vwt.warn=function(){e(Pvi.apply(null,arguments))},ywt.forEach(function(a){vwt["fix"+Lcn(a)](n,r)}),n._id=n.name+"@"+n.version}function Lcn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Jcn=ct(()=>{});import{fileURLToPath as Kvi}from"node:url";function Dcn(n){return n instanceof URL?Kvi(n):n}var Ocn=ct(()=>{Jcn()});import $vi from"node:fs/promises";import eyi from"node:path";async function Ucn({cwd:n,normalize:e=!0}={}){let r=await $vi.readFile(tyi(n),"utf8");return ryi(r,e)}var Mcn,tyi,ryi,_cn=ct(()=>{Uln();Mcn=St(Tcn(),1);Ocn();tyi=n=>eyi.resolve(Dcn(n)??".","package.json"),ryi=(n,e)=>{let r=typeof n=="string"?owt(n):n;return e&&(0,Mcn.default)(r),r}});import nyi from"node:path";async function zcn(n){let e=await gln("package.json",n);if(e)return{packageJson:await Ucn({...n,cwd:nyi.dirname(e)}),path:e}}var Pcn=ct(()=>{Gln();_cn()});import{fileURLToPath as ayi}from"url";import iyi from"path";async function C$(){if(n6e)return n6e;let n=await zcn({cwd:oyi});if(n)return n6e=n.packageJson,n6e}var syi,oyi,n6e,a6e=ct(()=>{"use strict";Pcn();syi=ayi(import.meta.url),oyi=iyi.dirname(syi)});var jcn={};ho(jcn,{getCliVersion:()=>Ex});async function Ex(){let n=await C$();return"1.1.28"}var x$=ct(()=>{"use strict";a6e();});var jwt=Ze((X0o,cIn)=>{cIn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var IIn=Ze((k0o,dIn)=>{var oNi=jwt();function uIn(n){this.mode=oNi.MODE_8BIT_BYTE,this.data=n}uIn.prototype={getLength:function(){return this.data.length},write:function(n){for(var e=0;e<this.data.length;e++)n.put(this.data.charCodeAt(e),8)}};dIn.exports=uIn});var qwt=Ze((S0o,hIn)=>{var zW={glog:function(n){if(n<1)throw new Error("glog("+n+")");return zW.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return zW.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)zW.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)zW.EXP_TABLE[F0]=zW.EXP_TABLE[F0-4]^zW.EXP_TABLE[F0-5]^zW.EXP_TABLE[F0-6]^zW.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)zW.LOG_TABLE[zW.EXP_TABLE[F0]]=F0;var F0;hIn.exports=zW});var Kwt=Ze((L0o,mIn)=>{var oJ=qwt();function W6e(n,e){if(n.length===void 0)throw new Error(n.length+"/"+e);for(var r=0;r<n.length&&n[r]===0;)r++;this.num=new Array(n.length-r+e);for(var a=0;a<n.length-r;a++)this.num[a]=n[a+r]}W6e.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var e=new Array(this.getLength()+n.getLength()-1),r=0;r<this.getLength();r++)for(var a=0;a<n.getLength();a++)e[r+a]^=oJ.gexp(oJ.glog(this.get(r))+oJ.glog(n.get(a)));return new W6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=oJ.glog(this.get(0))-oJ.glog(n.get(0)),r=new Array(this.getLength()),a=0;a<this.getLength();a++)r[a]=this.get(a);for(var i=0;i<n.getLength();i++)r[i]^=oJ.gexp(oJ.glog(n.get(i))+e);return new W6e(r,0).mod(n)}};mIn.exports=W6e});var fIn=Ze((B0o,pIn)=>{pIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var GIn=Ze((T0o,gIn)=>{var $Z=jwt(),bIn=Kwt(),lNi=qwt(),xH=fIn(),Vf={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(n){for(var e=n<<10;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15)>=0;)e^=Vf.G15<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15);return(n<<10|e)^Vf.G15_MASK},getBCHTypeNumber:function(n){for(var e=n<<12;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18)>=0;)e^=Vf.G18<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18);return n<<12|e},getBCHDigit:function(n){for(var e=0;n!==0;)e++,n>>>=1;return e},getPatternPosition:function(n){return Vf.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,e,r){switch(n){case xH.PATTERN000:return(e+r)%2===0;case xH.PATTERN001:return e%2===0;case xH.PATTERN010:return r%3===0;case xH.PATTERN011:return(e+r)%3===0;case xH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case xH.PATTERN101:return e*r%2+e*r%3===0;case xH.PATTERN110:return(e*r%2+e*r%3)%2===0;case xH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new bIn([1],0),r=0;r<n;r++)e=e.multiply(new bIn([1,lNi.gexp(r)],0));return e},getLengthInBits:function(n,e){if(1<=e&&e<10)switch(n){case $Z.MODE_NUMBER:return 10;case $Z.MODE_ALPHA_NUM:return 9;case $Z.MODE_8BIT_BYTE:return 8;case $Z.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(e<27)switch(n){case $Z.MODE_NUMBER:return 12;case $Z.MODE_ALPHA_NUM:return 11;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(e<41)switch(n){case $Z.MODE_NUMBER:return 14;case $Z.MODE_ALPHA_NUM:return 13;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+e)},getLostPoint:function(n){var e=n.getModuleCount(),r=0,a=0,i=0;for(a=0;a<e;a++)for(i=0;i<e;i++){for(var o=0,t=n.isDark(a,i),s=-1;s<=1;s++)if(!(a+s<0||e<=a+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===n.isDark(a+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(a=0;a<e-1;a++)for(i=0;i<e-1;i++){var I=0;n.isDark(a,i)&&I++,n.isDark(a+1,i)&&I++,n.isDark(a,i+1)&&I++,n.isDark(a+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(a=0;a<e;a++)for(i=0;i<e-6;i++)n.isDark(a,i)&&!n.isDark(a,i+1)&&n.isDark(a,i+2)&&n.isDark(a,i+3)&&n.isDark(a,i+4)&&!n.isDark(a,i+5)&&n.isDark(a,i+6)&&(r+=40);for(i=0;i<e;i++)for(a=0;a<e-6;a++)n.isDark(a,i)&&!n.isDark(a+1,i)&&n.isDark(a+2,i)&&n.isDark(a+3,i)&&n.isDark(a+4,i)&&!n.isDark(a+5,i)&&n.isDark(a+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(a=0;a<e;a++)n.isDark(a,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};gIn.exports=Vf});var $wt=Ze((J0o,vIn)=>{vIn.exports={L:1,M:0,Q:3,H:2}});var AIn=Ze((D0o,yIn)=>{var F6e=$wt();function AR(n,e){this.totalCount=n,this.dataCount=e}AR.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]];AR.getRSBlocks=function(n,e){var r=AR.getRsBlockTable(n,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+e);for(var a=r.length/3,i=[],o=0;o<a;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 AR(s,u));return i};AR.getRsBlockTable=function(n,e){switch(e){case F6e.L:return AR.RS_BLOCK_TABLE[(n-1)*4+0];case F6e.M:return AR.RS_BLOCK_TABLE[(n-1)*4+1];case F6e.Q:return AR.RS_BLOCK_TABLE[(n-1)*4+2];case F6e.H:return AR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};yIn.exports=AR});var WIn=Ze((O0o,NIn)=>{function ZIn(){this.buffer=[],this.length=0}ZIn.prototype={get:function(n){var e=Math.floor(n/8);return(this.buffer[e]>>>7-n%8&1)==1},put:function(n,e){for(var r=0;r<e;r++)this.putBit((n>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(n){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++}};NIn.exports=ZIn});var RIn=Ze((M0o,wIn)=>{var cNi=IIn(),YH=GIn(),uNi=Kwt(),FIn=AIn(),EIn=WIn();function ZR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}ZR.prototype={addData:function(n){var e=new cNi(n);this.dataList.push(e),this.dataCache=null},isDark:function(n,e){if(n<0||this.moduleCount<=n||e<0||this.moduleCount<=e)throw new Error(n+","+e);return this.modules[n][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var e=FIn.getRSBlocks(n,this.errorCorrectLevel),r=new EIn,a=0,i=0;i<e.length;i++)a+=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(),YH.getLengthInBits(t.mode,n)),t.write(r)}if(r.getLengthInBits()<=a*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(n,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 a=0;a<this.moduleCount;a++)this.modules[r][a]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,e),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache===null&&(this.dataCache=ZR.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(n,e){for(var r=-1;r<=7;r++)if(!(n+r<=-1||this.moduleCount<=n+r))for(var a=-1;a<=7;a++)e+a<=-1||this.moduleCount<=e+a||(0<=r&&r<=6&&(a===0||a===6)||0<=a&&a<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=a&&a<=4?this.modules[n+r][e+a]=!0:this.modules[n+r][e+a]=!1)},getBestMaskPattern:function(){for(var n=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var a=YH.getLostPoint(this);(r===0||n>a)&&(n=a,e=r)}return e},createMovieClip:function(n,e,r){var a=n.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&&(a.beginFill(0,100),a.moveTo(u,t),a.lineTo(u+i,t),a.lineTo(u+i,t+i),a.lineTo(u,t+i),a.endFill())}return a},setupTimingPattern:function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]===null&&(this.modules[n][6]=n%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 n=YH.getPatternPosition(this.typeNumber),e=0;e<n.length;e++)for(var r=0;r<n.length;r++){var a=n[e],i=n[r];if(this.modules[a][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[a+o][i+t]=!0:this.modules[a+o][i+t]=!1}},setupTypeNumber:function(n){for(var e=YH.getBCHTypeNumber(this.typeNumber),r,a=0;a<18;a++)r=!n&&(e>>a&1)===1,this.modules[Math.floor(a/3)][a%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!n&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(n,e){for(var r=this.errorCorrectLevel<<3|e,a=YH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!n&&(a>>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=!n&&(a>>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]=!n},mapData:function(n,e){for(var r=-1,a=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[a][t-s]===null){var u=!1;o<n.length&&(u=(n[o]>>>i&1)===1);var I=YH.getMask(e,a,t-s);I&&(u=!u),this.modules[a][t-s]=u,i--,i===-1&&(o++,i=7)}if(a+=r,a<0||this.moduleCount<=a){a-=r,r=-r;break}}}};ZR.PAD0=236;ZR.PAD1=17;ZR.createData=function(n,e,r){for(var a=FIn.getRSBlocks(n,e),i=new EIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),YH.getLengthInBits(t.mode,n)),t.write(i)}for(var s=0,u=0;u<a.length;u++)s+=a[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(ZR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(ZR.PAD1,8);return ZR.createBytes(i,a)};ZR.createBytes=function(n,e){for(var r=0,a=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;a=Math.max(a,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&n.buffer[d+r];r+=u;var h=YH.getErrorCorrectPolynomial(I),c=new uNi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var v=0;v<t[s].length;v++){var G=v+m.getLength()-t[s].length;t[s][v]=G>=0?m.get(G):0}}for(var A=0,Z=0;Z<e.length;Z++)A+=e[Z].totalCount;for(var R=new Array(A),F=0,E=0;E<a;E++)for(var p=0;p<e.length;p++)E<o[p].length&&(R[F++]=o[p][E]);for(var y=0;y<i;y++)for(var N=0;N<e.length;N++)y<t[N].length&&(R[F++]=t[N][y]);return R};wIn.exports=ZR});var YIn=Ze((U0o,xIn)=>{var dNi=RIn(),CIn=$wt(),INi="\x1B[40m \x1B[0m",E6e="\x1B[47m \x1B[0m",hNi=function(n){return n?INi:E6e},eRt=function(n){return{times:function(e){return new Array(e).join(n)}}},mNi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};xIn.exports={error:CIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new dNi(-1,this.error);a.addData(n),a.make();var i="";if(e&&e.small){var o=!0,t=!1,s=a.getModuleCount(),u=a.modules.slice(),I=s%2===1;I&&u.push(mNi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=eRt(d.BLACK_WHITE).times(s+3),c=eRt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
5039
|
+
`);let e=0;for(;n[e]&&n[e].trim().match(/^(#|$)/);)e++;let r=n.length,a=e+1;for(;a<r&&n[a].trim();)a++;return n.slice(e,a).join(" ").trim()}});var Rcn=Ze((Jso,xvi)=>{xvi.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 Vcn=Ze((Dso,Ycn)=>{var Yvi=Wat(),Vvi=Fat(),Qvi=Icn(),r6e=Fcn(),Hvi=Wt("node:module"),Xvi=["dependencies","devDependencies","optionalDependencies"],kvi=wcn(),gwt=Wt("url"),FH=Rcn(),Ccn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");Ycn.exports={warn:function(){},fixRepositoryField:function(n){if(n.repositories&&(this.warn("repositories"),n.repository=n.repositories[0]),!n.repository)return this.warn("missingRepository");typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository});var e=n.repository.url||"";if(e){var r=r6e.fromUrl(e);r&&(e=n.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(n){Object.keys(FH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,FH.topLevel[e])},this)},fixScriptsField:function(n){if(n.scripts){if(typeof n.scripts!="object"){this.warn("nonObjectScripts"),delete n.scripts;return}Object.keys(n.scripts).forEach(function(e){typeof n.scripts[e]!="string"?(this.warn("nonStringScript"),delete n.scripts[e]):FH.script[e]&&!n.scripts[FH.script[e]]&&this.warn("typo",e,FH.script[e],"scripts")},this)}},fixFilesField:function(n){var e=n.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete n.files):n.files&&(n.files=n.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(n){if(n.bin&&typeof n.bin=="string"){var e={},r;(r=n.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=n.bin:e[n.name]=n.bin,n.bin=e}},fixManField:function(n){n.man&&typeof n.man=="string"&&(n.man=[n.man])},fixBundleDependenciesField:function(n){var e="bundledDependencies",r="bundleDependencies";n[e]&&!n[r]&&(n[r]=n[e],delete n[e]),n[r]&&!Array.isArray(n[r])?(this.warn("nonArrayBundleDependencies"),delete n[r]):n[r]&&(n[r]=n[r].filter(function(a){return!a||typeof a!="string"?(this.warn("nonStringBundleDependency",a),!1):(n.dependencies||(n.dependencies={}),Object.prototype.hasOwnProperty.call(n.dependencies,a)||(this.warn("nonDependencyBundleDependency",a),n.dependencies[a]="*"),!0)},this))},fixDependencies:function(n){Mvi(n,this.warn),Dvi(n,this.warn),this.fixBundleDependenciesField(n),["dependencies","devDependencies"].forEach(function(e){if(e in n){if(!n[e]||typeof n[e]!="object"){this.warn("nonObjectDependencies",e),delete n[e];return}Object.keys(n[e]).forEach(function(r){var a=n[e][r];typeof a!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(a)),delete n[e][r]);var i=r6e.fromUrl(n[e][r]);i&&(n[e][r]=i.toString())},this)}},this)},fixModulesField:function(n){n.modules&&(this.warn("deprecatedModules"),delete n.modules)},fixKeywordsField:function(n){typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?(delete n.keywords,this.warn("nonArrayKeywords")):n.keywords&&(n.keywords=n.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(n,e){var r=!e;if(!n.version)return n.version="",!0;if(!Yvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=Vvi(n.version,r),!0},fixPeople:function(n){xcn(n,Tvi),xcn(n,Jvi)},fixNameField:function(n,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!n.name&&!r){n.name="";return}if(typeof n.name!="string")throw new Error("name field must be a string.");r||(n.name=n.name.trim()),Bvi(n.name,r,e.allowLegacyCase),Hvi.builtinModules.includes(n.name)&&this.warn("conflictingName",n.name)},fixDescriptionField:function(n){n.description&&typeof n.description!="string"&&(this.warn("nonStringDescription"),delete n.description),n.readme&&!n.description&&(n.description=kvi(n.readme)),n.description===void 0&&delete n.description,n.description||this.warn("missingDescription")},fixReadmeField:function(n){n.readme||(this.warn("missingReadme"),n.readme="ERROR: No README data found!")},fixBugsField:function(n){if(!n.bugs&&n.repository&&n.repository.url){var e=r6e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")Ccn(n.bugs)?n.bugs={email:n.bugs}:gwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{Uvi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&gwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&Ccn(r.email)?n.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!n.bugs.email&&!n.bugs.url&&(delete n.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(n){if(!n.homepage&&n.repository&&n.repository.url){var e=r6e.fromUrl(n.repository.url);e&&e.docs()&&(n.homepage=e.docs())}if(n.homepage){if(typeof n.homepage!="string")return this.warn("nonUrlHomepage"),delete n.homepage;gwt.parse(n.homepage).protocol||(n.homepage="http://"+n.homepage)}},fixLicenseField:function(n){let e=n.license||n.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Qvi(e).validForNewPackages)return this.warn("invalidLicense")}};function Svi(n){if(n.charAt(0)!=="@")return!1;var e=n.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Lvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function Bvi(n,e,r){if(n.charAt(0)==="."||!(Svi(n)||Lvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function xcn(n,e){return n.author&&(n.author=e(n.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(n[r])&&(n[r]=n[r].map(e))}),n}function Tvi(n){if(typeof n=="string")return n;var e=n.name||"",r=n.url||n.web,a=r?" ("+r+")":"",i=n.email||n.mail,o=i?" <"+i+">":"";return e+o+a}function Jvi(n){if(typeof n!="string")return n;var e=n.match(/^([^(<]+)/),r=n.match(/\(([^()]+)\)/),a=n.match(/<([^<>]+)>/),i={};return e&&e[0].trim()&&(i.name=e[0].trim()),a&&(i.email=a[1]),r&&(i.url=r[1]),i}function Dvi(n){var e=n.optionalDependencies;if(e){var r=n.dependencies||{};Object.keys(e).forEach(function(a){r[a]=e[a]}),n.dependencies=r}}function Ovi(n,e,r){if(!n)return{};if(typeof n=="string"&&(n=n.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(n))return n;r("deprecatedArrayDependencies",e);var a={};return n.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(/^@/,""),a[o]=t}),a}function Mvi(n,e){Xvi.forEach(function(r){n[r]&&(n[r]=Ovi(n[r],r,e))})}function Uvi(n,e){n&&Object.keys(n).forEach(function(r){FH.bugs[r]&&(e("typo",r,FH.bugs[r],"bugs"),n[FH.bugs[r]]=n[r],delete n[r])})}});var Qcn=Ze((Oso,_vi)=>{_vi.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 kcn=Ze((Mso,Xcn)=>{var Hcn=Wt("util"),Gwt=Qcn();Xcn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return zvi.apply(null,n);var r=Gwt[e]?Gwt[e]:e+": '%s'";return n.unshift(r),Hcn.format.apply(null,n)};function zvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),Hcn.format(Gwt.typo,n,e)}});var Tcn=Ze((Uso,Bcn)=>{Bcn.exports=Scn;var vwt=Vcn();Scn.fixer=vwt;var Pvi=kcn(),jvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],qvi=["dependencies","people","typos"],ywt=jvi.map(function(n){return Lcn(n)+"Field"});ywt=ywt.concat(qvi);function Scn(n,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||n.private)&&(e=function(){}),n.scripts&&n.scripts.install==="node-gyp rebuild"&&!n.scripts.preinstall&&(n.gypfile=!0),vwt.warn=function(){e(Pvi.apply(null,arguments))},ywt.forEach(function(a){vwt["fix"+Lcn(a)](n,r)}),n._id=n.name+"@"+n.version}function Lcn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Jcn=ct(()=>{});import{fileURLToPath as Kvi}from"node:url";function Dcn(n){return n instanceof URL?Kvi(n):n}var Ocn=ct(()=>{Jcn()});import $vi from"node:fs/promises";import eyi from"node:path";async function Ucn({cwd:n,normalize:e=!0}={}){let r=await $vi.readFile(tyi(n),"utf8");return ryi(r,e)}var Mcn,tyi,ryi,_cn=ct(()=>{Uln();Mcn=St(Tcn(),1);Ocn();tyi=n=>eyi.resolve(Dcn(n)??".","package.json"),ryi=(n,e)=>{let r=typeof n=="string"?owt(n):n;return e&&(0,Mcn.default)(r),r}});import nyi from"node:path";async function zcn(n){let e=await gln("package.json",n);if(e)return{packageJson:await Ucn({...n,cwd:nyi.dirname(e)}),path:e}}var Pcn=ct(()=>{Gln();_cn()});import{fileURLToPath as ayi}from"url";import iyi from"path";async function C$(){if(n6e)return n6e;let n=await zcn({cwd:oyi});if(n)return n6e=n.packageJson,n6e}var syi,oyi,n6e,a6e=ct(()=>{"use strict";Pcn();syi=ayi(import.meta.url),oyi=iyi.dirname(syi)});var jcn={};ho(jcn,{getCliVersion:()=>Ex});async function Ex(){let n=await C$();return"1.1.29"}var x$=ct(()=>{"use strict";a6e();});var jwt=Ze((X0o,cIn)=>{cIn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var IIn=Ze((k0o,dIn)=>{var oNi=jwt();function uIn(n){this.mode=oNi.MODE_8BIT_BYTE,this.data=n}uIn.prototype={getLength:function(){return this.data.length},write:function(n){for(var e=0;e<this.data.length;e++)n.put(this.data.charCodeAt(e),8)}};dIn.exports=uIn});var qwt=Ze((S0o,hIn)=>{var zW={glog:function(n){if(n<1)throw new Error("glog("+n+")");return zW.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return zW.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)zW.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)zW.EXP_TABLE[F0]=zW.EXP_TABLE[F0-4]^zW.EXP_TABLE[F0-5]^zW.EXP_TABLE[F0-6]^zW.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)zW.LOG_TABLE[zW.EXP_TABLE[F0]]=F0;var F0;hIn.exports=zW});var Kwt=Ze((L0o,mIn)=>{var oJ=qwt();function W6e(n,e){if(n.length===void 0)throw new Error(n.length+"/"+e);for(var r=0;r<n.length&&n[r]===0;)r++;this.num=new Array(n.length-r+e);for(var a=0;a<n.length-r;a++)this.num[a]=n[a+r]}W6e.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var e=new Array(this.getLength()+n.getLength()-1),r=0;r<this.getLength();r++)for(var a=0;a<n.getLength();a++)e[r+a]^=oJ.gexp(oJ.glog(this.get(r))+oJ.glog(n.get(a)));return new W6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=oJ.glog(this.get(0))-oJ.glog(n.get(0)),r=new Array(this.getLength()),a=0;a<this.getLength();a++)r[a]=this.get(a);for(var i=0;i<n.getLength();i++)r[i]^=oJ.gexp(oJ.glog(n.get(i))+e);return new W6e(r,0).mod(n)}};mIn.exports=W6e});var fIn=Ze((B0o,pIn)=>{pIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var GIn=Ze((T0o,gIn)=>{var $Z=jwt(),bIn=Kwt(),lNi=qwt(),xH=fIn(),Vf={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(n){for(var e=n<<10;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15)>=0;)e^=Vf.G15<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G15);return(n<<10|e)^Vf.G15_MASK},getBCHTypeNumber:function(n){for(var e=n<<12;Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18)>=0;)e^=Vf.G18<<Vf.getBCHDigit(e)-Vf.getBCHDigit(Vf.G18);return n<<12|e},getBCHDigit:function(n){for(var e=0;n!==0;)e++,n>>>=1;return e},getPatternPosition:function(n){return Vf.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,e,r){switch(n){case xH.PATTERN000:return(e+r)%2===0;case xH.PATTERN001:return e%2===0;case xH.PATTERN010:return r%3===0;case xH.PATTERN011:return(e+r)%3===0;case xH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case xH.PATTERN101:return e*r%2+e*r%3===0;case xH.PATTERN110:return(e*r%2+e*r%3)%2===0;case xH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new bIn([1],0),r=0;r<n;r++)e=e.multiply(new bIn([1,lNi.gexp(r)],0));return e},getLengthInBits:function(n,e){if(1<=e&&e<10)switch(n){case $Z.MODE_NUMBER:return 10;case $Z.MODE_ALPHA_NUM:return 9;case $Z.MODE_8BIT_BYTE:return 8;case $Z.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(e<27)switch(n){case $Z.MODE_NUMBER:return 12;case $Z.MODE_ALPHA_NUM:return 11;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(e<41)switch(n){case $Z.MODE_NUMBER:return 14;case $Z.MODE_ALPHA_NUM:return 13;case $Z.MODE_8BIT_BYTE:return 16;case $Z.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+e)},getLostPoint:function(n){var e=n.getModuleCount(),r=0,a=0,i=0;for(a=0;a<e;a++)for(i=0;i<e;i++){for(var o=0,t=n.isDark(a,i),s=-1;s<=1;s++)if(!(a+s<0||e<=a+s))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||s===0&&u===0||t===n.isDark(a+s,i+u)&&o++;o>5&&(r+=3+o-5)}for(a=0;a<e-1;a++)for(i=0;i<e-1;i++){var I=0;n.isDark(a,i)&&I++,n.isDark(a+1,i)&&I++,n.isDark(a,i+1)&&I++,n.isDark(a+1,i+1)&&I++,(I===0||I===4)&&(r+=3)}for(a=0;a<e;a++)for(i=0;i<e-6;i++)n.isDark(a,i)&&!n.isDark(a,i+1)&&n.isDark(a,i+2)&&n.isDark(a,i+3)&&n.isDark(a,i+4)&&!n.isDark(a,i+5)&&n.isDark(a,i+6)&&(r+=40);for(i=0;i<e;i++)for(a=0;a<e-6;a++)n.isDark(a,i)&&!n.isDark(a+1,i)&&n.isDark(a+2,i)&&n.isDark(a+3,i)&&n.isDark(a+4,i)&&!n.isDark(a+5,i)&&n.isDark(a+6,i)&&(r+=40);var d=0;for(i=0;i<e;i++)for(a=0;a<e;a++)n.isDark(a,i)&&d++;var h=Math.abs(100*d/e/e-50)/5;return r+=h*10,r}};gIn.exports=Vf});var $wt=Ze((J0o,vIn)=>{vIn.exports={L:1,M:0,Q:3,H:2}});var AIn=Ze((D0o,yIn)=>{var F6e=$wt();function AR(n,e){this.totalCount=n,this.dataCount=e}AR.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]];AR.getRSBlocks=function(n,e){var r=AR.getRsBlockTable(n,e);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+e);for(var a=r.length/3,i=[],o=0;o<a;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 AR(s,u));return i};AR.getRsBlockTable=function(n,e){switch(e){case F6e.L:return AR.RS_BLOCK_TABLE[(n-1)*4+0];case F6e.M:return AR.RS_BLOCK_TABLE[(n-1)*4+1];case F6e.Q:return AR.RS_BLOCK_TABLE[(n-1)*4+2];case F6e.H:return AR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};yIn.exports=AR});var WIn=Ze((O0o,NIn)=>{function ZIn(){this.buffer=[],this.length=0}ZIn.prototype={get:function(n){var e=Math.floor(n/8);return(this.buffer[e]>>>7-n%8&1)==1},put:function(n,e){for(var r=0;r<e;r++)this.putBit((n>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(n){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++}};NIn.exports=ZIn});var RIn=Ze((M0o,wIn)=>{var cNi=IIn(),YH=GIn(),uNi=Kwt(),FIn=AIn(),EIn=WIn();function ZR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}ZR.prototype={addData:function(n){var e=new cNi(n);this.dataList.push(e),this.dataCache=null},isDark:function(n,e){if(n<0||this.moduleCount<=n||e<0||this.moduleCount<=e)throw new Error(n+","+e);return this.modules[n][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var e=FIn.getRSBlocks(n,this.errorCorrectLevel),r=new EIn,a=0,i=0;i<e.length;i++)a+=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(),YH.getLengthInBits(t.mode,n)),t.write(r)}if(r.getLengthInBits()<=a*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(n,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 a=0;a<this.moduleCount;a++)this.modules[r][a]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,e),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache===null&&(this.dataCache=ZR.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(n,e){for(var r=-1;r<=7;r++)if(!(n+r<=-1||this.moduleCount<=n+r))for(var a=-1;a<=7;a++)e+a<=-1||this.moduleCount<=e+a||(0<=r&&r<=6&&(a===0||a===6)||0<=a&&a<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=a&&a<=4?this.modules[n+r][e+a]=!0:this.modules[n+r][e+a]=!1)},getBestMaskPattern:function(){for(var n=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var a=YH.getLostPoint(this);(r===0||n>a)&&(n=a,e=r)}return e},createMovieClip:function(n,e,r){var a=n.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&&(a.beginFill(0,100),a.moveTo(u,t),a.lineTo(u+i,t),a.lineTo(u+i,t+i),a.lineTo(u,t+i),a.endFill())}return a},setupTimingPattern:function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]===null&&(this.modules[n][6]=n%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 n=YH.getPatternPosition(this.typeNumber),e=0;e<n.length;e++)for(var r=0;r<n.length;r++){var a=n[e],i=n[r];if(this.modules[a][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[a+o][i+t]=!0:this.modules[a+o][i+t]=!1}},setupTypeNumber:function(n){for(var e=YH.getBCHTypeNumber(this.typeNumber),r,a=0;a<18;a++)r=!n&&(e>>a&1)===1,this.modules[Math.floor(a/3)][a%3+this.moduleCount-8-3]=r;for(var i=0;i<18;i++)r=!n&&(e>>i&1)===1,this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},setupTypeInfo:function(n,e){for(var r=this.errorCorrectLevel<<3|e,a=YH.getBCHTypeInfo(r),i,o=0;o<15;o++)i=!n&&(a>>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=!n&&(a>>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]=!n},mapData:function(n,e){for(var r=-1,a=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[a][t-s]===null){var u=!1;o<n.length&&(u=(n[o]>>>i&1)===1);var I=YH.getMask(e,a,t-s);I&&(u=!u),this.modules[a][t-s]=u,i--,i===-1&&(o++,i=7)}if(a+=r,a<0||this.moduleCount<=a){a-=r,r=-r;break}}}};ZR.PAD0=236;ZR.PAD1=17;ZR.createData=function(n,e,r){for(var a=FIn.getRSBlocks(n,e),i=new EIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),YH.getLengthInBits(t.mode,n)),t.write(i)}for(var s=0,u=0;u<a.length;u++)s+=a[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(ZR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(ZR.PAD1,8);return ZR.createBytes(i,a)};ZR.createBytes=function(n,e){for(var r=0,a=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;a=Math.max(a,u),i=Math.max(i,I),o[s]=new Array(u);for(var d=0;d<o[s].length;d++)o[s][d]=255&n.buffer[d+r];r+=u;var h=YH.getErrorCorrectPolynomial(I),c=new uNi(o[s],h.getLength()-1),m=c.mod(h);t[s]=new Array(h.getLength()-1);for(var v=0;v<t[s].length;v++){var G=v+m.getLength()-t[s].length;t[s][v]=G>=0?m.get(G):0}}for(var A=0,Z=0;Z<e.length;Z++)A+=e[Z].totalCount;for(var R=new Array(A),F=0,E=0;E<a;E++)for(var p=0;p<e.length;p++)E<o[p].length&&(R[F++]=o[p][E]);for(var y=0;y<i;y++)for(var N=0;N<e.length;N++)y<t[N].length&&(R[F++]=t[N][y]);return R};wIn.exports=ZR});var YIn=Ze((U0o,xIn)=>{var dNi=RIn(),CIn=$wt(),INi="\x1B[40m \x1B[0m",E6e="\x1B[47m \x1B[0m",hNi=function(n){return n?INi:E6e},eRt=function(n){return{times:function(e){return new Array(e).join(n)}}},mNi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};xIn.exports={error:CIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new dNi(-1,this.error);a.addData(n),a.make();var i="";if(e&&e.small){var o=!0,t=!1,s=a.getModuleCount(),u=a.modules.slice(),I=s%2===1;I&&u.push(mNi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=eRt(d.BLACK_WHITE).times(s+3),c=eRt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
5040
5040
|
`;for(var m=0;m<s;m+=2){i+=d.WHITE_ALL;for(var v=0;v<s;v++)u[m][v]===t&&u[m+1][v]===t?i+=d.WHITE_ALL:u[m][v]===t&&u[m+1][v]===o?i+=d.WHITE_BLACK:u[m][v]===o&&u[m+1][v]===t?i+=d.BLACK_WHITE:i+=d.BLACK_ALL;i+=d.WHITE_ALL+`
|
|
5041
5041
|
`}I||(i+=c)}else{var G=eRt(E6e).times(a.getModuleCount()+3);i+=G+`
|
|
5042
5042
|
`,a.modules.forEach(function(A){i+=E6e,i+=A.map(hNi).join(""),i+=E6e+`
|
|
@@ -7099,7 +7099,7 @@ ${pr.output?.substring(0,1e3)||"(no output)"}`;Fi==="idle"?(console.log("[App] A
|
|
|
7099
7099
|
`)}catch(e){process.stderr.write(`[acp] model-list preload failed: ${e instanceof Error?e.message:String(e)}
|
|
7100
7100
|
`)}}var dBi="CRITICAL SYSTEM CONTEXT - Easy Code AI Assistant",IBi="Got it. Thanks for the context!",hBi="[TITLE_UPDATE]";function D3n(n,e){return n==="user"?e.includes(dBi):e.trim()===IBi}function mBi(n){return(n?.candidates?.[0]?.content?.parts??[]).map(r=>typeof r.text=="string"?r.text:"").join("")}function pBi(n){let e=new Map,r=[];for(let a of n){if(a.id!=null&&e.has(a.id)){r[e.get(a.id)]=a;continue}a.id!=null&&e.set(a.id,r.length),r.push(a)}return r}function fBi(n){let e=(n??"").split(`
|
|
7101
7101
|
`).map(r=>r.trim()).find(r=>r.length>0)??"";return e=e.replace(/^["'`《》「」“”‘’\[\]]+|["'`《》「」“”‘’\[\]]+$/g,"").trim(),e=e.replace(/[。..!!??,,;;::]+$/u,"").trim(),e.length>60&&(e=e.slice(0,60).trim()),e}function bBi(n,e){if(e<=0)return[];let r=0;for(let a=0;a<n.length;a++){let i=n[a]??{};if(i.type==="user"||i.role==="user"&&!i.parts?.some(t=>t&&"functionResponse"in t)){if(r===e)return n.slice(0,a);r+=1}}return[...n]}var Tfe=class{constructor(e,r,a,i,o,t){this.id=e;this.chat=r;this.config=a;this.connection=i;this._settings=o;this.cwd=t;this.approvalModeUnsubscribe=IEt.on(Ime.ApprovalModeChanged,s=>{s.sessionId&&s.sessionId!==this.id||this.sendUpdate({sessionUpdate:"agent_message_chunk",content:{type:"text",text:`[MODE_UPDATE] ${s.mode}`}})})}pendingAbort;approvalModeUnsubscribe;titleGenerated=!1;configValues=new Map;dispose(){this.pendingAbort?.abort(),this.pendingAbort=void 0,this.approvalModeUnsubscribe()}async cancelPendingPrompt(){this.pendingAbort?.abort(),this.pendingAbort=void 0}async rewindToBeforeUserMessage(e){if(!Number.isFinite(e)||e<0)throw new Fs(-32602,`Invalid beforeUserMessageIndex: ${e}`);this.pendingAbort?.abort(),this.pendingAbort=void 0;let r=this.chat.getHistory(!1),a=0,i=r.length;for(let u=0;u<r.length;u++){let I=r[u];if(I.role===cn.USER&&!(I.parts??[]).some(h=>h.functionResponse)){if(a===e){i=u;break}a+=1}}let o=r.slice(0,i);this.chat.setHistory(o);let t=Math.min(a,e),s=await this.persistTruncatedHistory(o,t);return{keptContentCount:o.length,keptUserMessageCount:t,droppedContentCount:r.length-o.length,persisted:s}}async persistTruncatedHistory(e,r){let a=this.cwd??this.config.getProjectRoot?.();if(!a)return this.debug("persistTruncatedHistory skipped: no projectRoot"),!1;try{let i=new Ls(a),o=await i.loadSession(this.id),t=bBi(o?.history??[],r);return await i.saveSessionHistory(this.id,t,e),!0}catch(i){return this.debug(`persistTruncatedHistory failed: ${pF(i)}`),!1}}async persistHistory(){let e=this.cwd??this.config.getProjectRoot?.();if(!e){this.debug("persistHistory skipped: no projectRoot");return}try{let r=this.chat.getHistory(!1);if(r.length===0)return;let a=new Ls(e);await a.loadSession(this.id),await a.saveSessionHistory(this.id,r,r)}catch(r){this.debug(`persistHistory failed: ${pF(r)}`)}}markTitleGenerated(){this.titleGenerated=!0}setMode(e){this.config.setApprovalMode?.(e)}async setModel(e,r){let a=this.config,i=a.getGeminiClient?.(),o=r??new AbortController().signal;if(i?.switchModel){let s=await i.switchModel(e,o);return s?.success!==!1&&this.persistPreferredModel(e),s}return a.setModel?.(e),this.chat.setSpecifiedModel?.(e),this.persistPreferredModel(e),null}persistPreferredModel(e){try{this._settings.setValue("User","preferredModel",e)}catch(r){process.stderr.write(`[acp] failed to persist preferredModel=${e}: ${r instanceof Error?r.message:String(r)}
|
|
7102
|
-
`)}}async applyConfigOption(e,r){if(this.configValues.set(e,r),e==="model"&&typeof r=="string"){let a=await this.setModel(r);return a&&!a.success?(this.configValues.delete(e),{error:a.error}):{compressionInfo:a?.compressionInfo,compressionSkipReason:a?.compressionSkipReason}}else e==="mode"&&typeof r=="string"&&this.setMode(r);return{}}getConfigValue(e,r){return this.configValues.get(e)??r}getAllConfigValues(){return this.configValues}async streamHistory(e){for(let r of e){let a=r;if(!a)continue;let o=(Array.isArray(a.parts)?a.parts:a.content!==void 0?[].concat(typeof a.content=="string"?[{text:a.content}]:Array.isArray(a.content)?a.content:[a.content]):[]).map(
|
|
7102
|
+
`)}}async applyConfigOption(e,r){if(this.configValues.set(e,r),e==="model"&&typeof r=="string"){let a=await this.setModel(r);return a&&!a.success?(this.configValues.delete(e),{error:a.error}):{compressionInfo:a?.compressionInfo,compressionSkipReason:a?.compressionSkipReason}}else e==="mode"&&typeof r=="string"&&this.setMode(r);return{}}getConfigValue(e,r){return this.configValues.get(e)??r}getAllConfigValues(){return this.configValues}async streamHistory(e){for(let r of e){let a=r;if(!a)continue;let o=(Array.isArray(a.parts)?a.parts:a.content!==void 0?[].concat(typeof a.content=="string"?[{text:a.content}]:Array.isArray(a.content)?a.content:[a.content]):[]).map(s=>typeof s.text=="string"?s.text:"").join("");if(!o&&typeof a.text=="string"&&(o=a.text),!o)continue;let t;if(a.role)t=a.role==="user"?"user":"assistant";else{let s=a.type;if(s==="user")t="user";else if(s==="gemini"||s==="model"||s==="assistant")t="assistant";else continue}D3n(t==="user"?"user":"model",o)||await this.sendUpdate(t==="user"?{sessionUpdate:"user_message_chunk",content:{type:"text",text:o}}:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:o}})}}async sendAvailableCommands(){let e=[];try{let{CommandHandler:r}=await Promise.resolve().then(()=>(PVt(),zVt));e=new r().getAvailableCommands()}catch{e=[{name:"help",description:"List available commands"},{name:"about",description:"Show version / environment info"},{name:"memory show",description:"Show current memory"},{name:"init",description:"Generate a DEEPV.md for this project"}]}await this.sendUpdate({sessionUpdate:"available_commands_update",availableCommands:e.map(r=>({name:r.name,description:r.description}))})}async prompt(e){let r=e.prompt.filter(s=>s.type==="text").map(s=>s.text).join("").trim();if(r.startsWith("/")||r.startsWith("$"))try{let{CommandHandler:s}=await Promise.resolve().then(()=>(PVt(),zVt));if(await new s().handleCommand(r,{config:this.config,settings:this._settings,sendMessage:async d=>{await this.sendUpdate({sessionUpdate:"agent_message_chunk",content:{type:"text",text:d}})}}))return{stopReason:"end_turn"}}catch{}this.pendingAbort?.abort();let a=new AbortController;this.pendingAbort=a,!this.titleGenerated&&r.length>0&&this.countRealUserMessages()===0&&(this.titleGenerated=!0,this.generateTitle(r));let i=Math.random().toString(16).slice(2),o=await this.resolvePrompt(e,a.signal),t={role:cn.USER,parts:o};try{for(;t!==null;){if(a.signal.aborted)return{stopReason:"cancelled"};let s=[],u=[];try{let I=await this.config.getToolRegistry(),d=await this.chat.sendMessageStream({message:t.parts??[],config:{abortSignal:a.signal,tools:[{functionDeclarations:I.getFunctionDeclarations()}]}},i,ba.CHAT_CONVERSATION);t=null;for await(let h of d){if(a.signal.aborted)return{stopReason:"cancelled"};u.push(h);let c=h.candidates?.[0];for(let m of c?.content?.parts??[])m.text&&await this.sendUpdate(m.thought?{sessionUpdate:"agent_thought_chunk",content:{type:"text",text:m.text}}:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:m.text}});h.functionCalls&&s.push(...h.functionCalls)}}catch(I){throw VO(I)===429?new Fs(429,"Rate limit exceeded. Try again later."):I}if(await this.emitUsageUpdate(u),s.length>0){let I=pBi(s),d=[];for(let h of I){let c=await this.runTool(a.signal,i,h),m=Array.isArray(c)?c:[c];for(let v of m)typeof v=="string"?d.push({text:v}):v&&d.push(v)}t={role:cn.USER,parts:d}}}return{stopReason:"end_turn"}}finally{this.pendingAbort===a&&(this.pendingAbort=void 0),await this.persistHistory()}}async sendUpdate(e){try{await this.connection.sessionUpdate({sessionId:this.id,update:e})}catch(r){this.debug(`sessionUpdate failed: ${pF(r)}`)}}async emitUsageUpdate(e){if(e.length!==0)try{let r=this.chat.getFinalUsageMetadata?.(e),a=N3n(r,this.config);a&&await this.sendUpdate(a)}catch(r){this.debug(`emitUsageUpdate skipped: ${pF(r)}`)}}async runTool(e,r,a){let i=a.id??`${a.name??"unknown"}-${Date.now()}`,o=a.args??{},t=Date.now(),s=v=>(_A(this.config,{"event.name":"tool_call","event.timestamp":new Date().toISOString(),prompt_id:r,function_name:a.name??"",function_args:o,duration_ms:Date.now()-t,success:!1,error:v.message,response_length:v.message.length}),[{functionResponse:{id:i,name:a.name??"",response:{error:v.message}}}]);if(!a.name)return s(new Error("Missing function name"));let I=(await this.config.getToolRegistry()).getTool(a.name);if(!I)return s(new Error(`Tool "${a.name}" not found in registry.`));let d=i,h=I.kind,c=h?V3n(h):Y3n(I.icon);await this.sendUpdate({sessionUpdate:"tool_call",toolCallId:d,title:I.getDescription?.(o)??a.name,kind:c,status:"pending",rawInput:o,locations:I.toolLocations?.(o)??void 0});let m=await I.shouldConfirmExecute(o,e);if(m)if(this.config.getApprovalMode()===Un.YOLO?x3n(m):!0){let G=R3n(m,this.config),A=C3n(m);try{let Z=await this.connection.requestPermission({sessionId:this.id,toolCall:{toolCallId:d,title:I.getDescription?.(o)??a.name,kind:c,...A?{_meta:A}:{}},options:G}),R=F3n.parse(Z);if(R.outcome.outcome==="cancelled")return await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"failed"}),s(new Error(`Tool "${a.name}" was canceled by the user.`));let F=R.outcome.optionId;if(F===Vn.Cancel)return await m.onConfirm(F),await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"failed"}),s(new Error(`Tool "${a.name}" not allowed to run by the user.`));let E=E3n(R);await m.onConfirm(F,E)}catch(Z){await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"failed"});let R=Z instanceof Error?Z.message:String(Z);return s(new Error(`Tool "${a.name}" requires approval but the ACP client cannot present one (${R}). Refusing to run.`))}}else try{await m.onConfirm(Vn.ProceedOnce)}catch{}await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"in_progress"});try{let v=await I.execute(o,e),G=w3n(v);return await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"completed",content:G?[G]:void 0}),_A(this.config,{"event.name":"tool_call","event.timestamp":new Date().toISOString(),prompt_id:r,function_name:a.name,function_args:o,duration_ms:Date.now()-t,success:!0,response_length:typeof v.llmContent=="string"?v.llmContent.length:JSON.stringify(v.llmContent??"").length}),bL(a.name,i,v.llmContent)}catch(v){let G=v instanceof Error?v:new Error(String(v));return await this.sendUpdate({sessionUpdate:"tool_call_update",toolCallId:d,status:"failed",content:[{type:"content",content:{type:"text",text:G.message}}]}),s(G)}}async resolvePrompt(e,r){let a=e.prompt,i=a.filter(F=>F.type==="resource_link"||F.path!==void 0);if(i.length===0)return a.flatMap(F=>{let E=F.type;if(E==="text"||F.text!==void 0)return[{text:F.text}];if(E==="image"){let p=F;if(p.mimeType&&p.data)return[{inlineData:{mimeType:p.mimeType,data:p.data}}]}return[]});let o=this.config.getFileService(),t=this.config.getFileFilteringRespectGitIgnore(),s=[],u=new Map,I=[],d=[],h=await this.config.getToolRegistry(),c=h.getTool("read_many_files"),m=h.getTool("glob");if(!c)throw new Error("read_many_files tool not found.");let v=F=>{let E=F;if(typeof E.path=="string")return E.path;if(typeof E.uri=="string")return E.uri.replace(/^file:\/\//,"")};for(let F of i){let E=v(F);if(!E)continue;if(o.shouldGitIgnoreFile(E)){d.push(E);continue}let p=E,y=!1;try{let N=eTe.resolve(this.config.getTargetDir(),E);tu(N,this.config.getTargetDir())&&((await O3n.stat(N)).isDirectory()&&(p=E.endsWith("/")?`${E}**`:`${E}/**`),y=!0)}catch(N){if(Ec(N)&&N.code==="ENOENT"&&this.config.getEnableRecursiveFileSearch()&&m)try{let w=await m.execute({pattern:`**/*${E}*`,path:this.config.getTargetDir()},r);if(typeof w.llmContent=="string"&&!w.llmContent.startsWith("No files found")&&!w.llmContent.startsWith("Error:")){let b=w.llmContent.split(`
|
|
7103
7103
|
`);b.length>1&&b[1]&&(p=eTe.relative(this.config.getTargetDir(),b[1].trim()),y=!0)}}catch{}}y&&(s.push(p),u.set(E,p),I.push(E))}let G="";for(let F=0;F<a.length;F++){let E=a[F];if(E.text!==void 0){G+=E.text;continue}let p=v(E);if(!p)continue;let y=u.get(p);F>0&&G.length>0&&!G.endsWith(" ")&&(G+=" "),G+=`@${y??p}`}G=G.trim(),d.length>0&&this.debug(`Ignored ${d.length} path(s) (${t?"git-ignored":"custom-ignored"}): ${d.join(", ")}`);let A=a.flatMap(F=>{if(F.type!=="image")return[];let E=F;return E.mimeType&&E.data?[{inlineData:{mimeType:E.mimeType,data:E.data}}]:[]});if(s.length===0)return[{text:G},...A];let Z=[{text:G},...A],R={paths:s,respectGitIgnore:t};try{let F=await c.execute(R,r);if(Array.isArray(F.llmContent)){let E=/^--- (.*?) ---\n\n([\s\S]*?)\n\n$/;Z.push({text:`
|
|
7104
7104
|
${sEt}`});for(let p of F.llmContent)if(typeof p=="string"){let y=E.exec(p);y?(Z.push({text:`
|
|
7105
7105
|
Content from @${y[1]}:
|