easycode-ai 1.1.24 → 1.1.25
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 +3 -3
- package/package.json +1 -1
package/bundle/easycode.js
CHANGED
|
@@ -608,7 +608,7 @@ ${h}`)}return t}),OGe=mHn(iDt);o1e=class extends s1e{create(e,r){var a;let{api_v
|
|
|
608
608
|
`):[]}};wO.NEWLINE_CHARS=new Set([`
|
|
609
609
|
`,"\r"]);wO.NEWLINE_REGEXP=/\r\n|[\n\r]/g;c1e={off:0,error:200,warn:300,info:400,debug:500},q8t=(n,e,r)=>{if(n){if(j9n(c1e,n))return n;Y2(r).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(c1e))}`)}};gHn={error:yne,warn:yne,info:yne,debug:yne},K8t=new WeakMap;vk=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);oMe=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 NO(this,arguments,function*(){var u,I,d,h;if(i)throw new $g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=yk(GHn(e,r)),G;G=yield td(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 td(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 td(d.call(v)))}finally{if(I)throw I.error}}c=!0}catch(A){if(nMe(A))return yield td(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 NO(this,arguments,function*(){var u,I,d,h;let c=new wO,m=rDt(e);try{for(var v=!0,G=yk(m),A;A=yield td(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 td(R)}}catch(Z){I={error:Z}}finally{try{!v&&!u&&(d=G.return)&&(yield td(d.call(G)))}finally{if(I)throw I.error}}for(let Z of c.flush())yield yield td(Z)})}function t(){return NO(this,arguments,function*(){var u,I,d,h;if(i)throw new $g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var m=!0,v=yk(o()),G;G=yield td(v.next()),u=G.done,!u;m=!0){h=G.value,m=!1;let A=h;c||A&&(yield yield td(JSON.parse(A)))}}catch(A){I={error:A}}finally{try{!m&&!u&&(d=v.return)&&(yield td(d.call(v)))}finally{if(I)throw I.error}}c=!0}catch(A){if(nMe(A))return yield td(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 tDt({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=dMe(JSON.stringify(i)+`
|
|
610
610
|
`);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))}})}};lMe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
611
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=yHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};cMe=class n extends Promise{constructor(e,r,a=AHn){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)}};sDt=Symbol("brand.privateNullableHeaders");vne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of ZHn(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{[sDt]:!0,values:e,nulls:r}};rMe=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=rMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=rMe("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=q8t(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:q8t(rMe("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:aHn(),this.encoder=oHn,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=vne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return vne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return vne([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 $g(`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 ${ZO}`}defaultIdempotencyKey(){return`stainless-node-retry-${O9n()}`}makeStatusError(e,r,a,i){return eG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=U9n(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return P9n(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 cMe(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`,vk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Ane;let G=new AbortController,A=await this.fetchWithTimeout(d,I,h,G).catch(aMe),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 Ane;let E=nMe(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})`,vk({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)`,vk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),E?new qGe:new EO({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 sHn(A.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,vk({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=>aMe(b).message),y=K9n(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${E})`,vk({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`,vk({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 $9n(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&&q9n("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=vne([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))}:{}),nHn()),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=vne([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:iHn(e)}:this.encoder({body:e,headers:a})}};u1e.DEFAULT_TIMEOUT=6e4;O0=class extends u1e{constructor(){super(...arguments),this.interactions=new l1e(this)}};oDt=O0;O0.GeminiNextGenAPIClient=oDt;O0.GeminiNextGenAPIClientError=$g;O0.APIError=eG;O0.APIConnectionError=EO;O0.APIConnectionTimeoutError=qGe;O0.APIUserAbortError=Ane;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=IHn;O0.Interactions=l1e;PPi=1024*1024*8;});function NHn(n,e){return{...n,...e}}function lDt(n){let{prompt_id:e,...r}=n;return r}function JY(n){return Array.isArray(n)?n.map(lDt):n}var d1e=ct(()=>{"use strict";si();});var cDt={};ho(cDt,{DEFAULT_PROXY_CONFIG:()=>EHn,getActiveProxyServerUrl:()=>cE,getAvailableProxyServers:()=>WHn,getProxyServerInfo:()=>FHn,getProxyServers:()=>Zne,hasAvailableProxyServer:()=>IMe});function Zne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function cE(){let e=Zne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function WHn(){return Zne().filter(e=>e.status==="active")}function IMe(){return Zne().some(e=>e.status==="active")}function FHn(n){return Zne().find(r=>r.url===n)}var EHn,RO=ct(()=>{"use strict";EHn={serverUrl:cE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as wHn}from"crypto";function tv(){return Nne||(Nne=wHn()),Nne}function uDt(n){Nne=n}function dDt(){Nne=void 0}var Nne,IDt,I1e=ct(()=>{"use strict";IDt=tv()});function Yu(n){let e=n??"1.1.24"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${hMe}/VSCode/${i} (${r}; ${a})`}return`${hMe}/CLI/${e} (${r}; ${a})`}var hMe,L5=ct(()=>{"use strict";hMe="EasyCode"});import*as Vu from"fs";import*as $N from"path";import*as Ak from"os";function RHn(n){Co.configure(n)}function CHn(n){Co.setUserInfo(n)}function xHn(n){Co.setCliVersion(n)}async function YHn(){return await Co.getUserHeaders()}function VHn(){return Co.getStatus()}var Wne,Ro,Co,B5=ct(()=>{"use strict";RO();I1e();L5();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=$N.join(Ak.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.24",this.config={proxyServerUrl:cE()},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=$N.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=$N.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=$N.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":tv()};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":tv()};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 Zk}from"node:fs";import Fne from"node:path";import QHn from"os";var rv,h1e,en,nv=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"})(rv||(rv={}));h1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.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=Fne.join(QHn.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 Zk.mkdir(Fne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Zk.appendFile(this.config.filePath,e+`
|
|
611
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,a,i]=yHn(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};cMe=class n extends Promise{constructor(e,r,a=AHn){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)}};sDt=Symbol("brand.privateNullableHeaders");vne=n=>{let e=new Headers,r=new Set;for(let a of n){let i=new Set;for(let[o,t]of ZHn(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{[sDt]:!0,values:e,nulls:r}};rMe=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=rMe("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:d=(r=rMe("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=q8t(m.logLevel,"ClientOptions.logLevel",this))!==null&&o!==void 0?o:q8t(rMe("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:aHn(),this.encoder=oHn,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=vne([e.headers]);if(!(r.values.has("authorization")||r.values.has("x-goog-api-key"))){if(this.apiKey)return vne([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return vne([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 $g(`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 ${ZO}`}defaultIdempotencyKey(){return`stainless-node-retry-${O9n()}`}makeStatusError(e,r,a,i){return eG.generate(e,r,a,i)}buildURL(e,r,a){let i=!this.baseURLOverridden()&&a||this.baseURL,o=U9n(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),t=this.defaultQuery();return P9n(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 cMe(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`,vk({retryOfRequestLogID:a,method:s.method,url:d,options:s,headers:I.headers})),!((o=s.signal)===null||o===void 0)&&o.aborted)throw new Ane;let G=new AbortController,A=await this.fetchWithTimeout(d,I,h,G).catch(aMe),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 Ane;let E=nMe(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})`,vk({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)`,vk({retryOfRequestLogID:a,url:d,durationMs:Z-v,message:A.message})),E?new qGe:new EO({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 sHn(A.body),Y2(this).info(`${R} - ${b}`),Y2(this).debug(`[${c}] response error (${b})`,vk({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=>aMe(b).message),y=K9n(p),N=y?void 0:p;throw Y2(this).debug(`[${c}] response error (${E})`,vk({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`,vk({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 $9n(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&&q9n("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=vne([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))}:{}),nHn()),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=vne([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:iHn(e)}:this.encoder({body:e,headers:a})}};u1e.DEFAULT_TIMEOUT=6e4;O0=class extends u1e{constructor(){super(...arguments),this.interactions=new l1e(this)}};oDt=O0;O0.GeminiNextGenAPIClient=oDt;O0.GeminiNextGenAPIClientError=$g;O0.APIError=eG;O0.APIConnectionError=EO;O0.APIConnectionTimeoutError=qGe;O0.APIUserAbortError=Ane;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=IHn;O0.Interactions=l1e;PPi=1024*1024*8;});function NHn(n,e){return{...n,...e}}function lDt(n){let{prompt_id:e,...r}=n;return r}function JY(n){return Array.isArray(n)?n.map(lDt):n}var d1e=ct(()=>{"use strict";si();});var cDt={};ho(cDt,{DEFAULT_PROXY_CONFIG:()=>EHn,getActiveProxyServerUrl:()=>cE,getAvailableProxyServers:()=>WHn,getProxyServerInfo:()=>FHn,getProxyServers:()=>Zne,hasAvailableProxyServer:()=>IMe});function Zne(){return[{url:"https://api-code.deepvlab.ai",name:"Primary Development Server",region:"default",status:"active"}]}function cE(){let e=Zne().find(r=>r.status==="active");if(!e)throw new Error("No active proxy server available. Please contact support.");return e.url}function WHn(){return Zne().filter(e=>e.status==="active")}function IMe(){return Zne().some(e=>e.status==="active")}function FHn(n){return Zne().find(r=>r.url===n)}var EHn,RO=ct(()=>{"use strict";EHn={serverUrl:cE(),timeout:2e5,retryAttempts:3,retryDelay:1e3}});import{randomUUID as wHn}from"crypto";function tv(){return Nne||(Nne=wHn()),Nne}function uDt(n){Nne=n}function dDt(){Nne=void 0}var Nne,IDt,I1e=ct(()=>{"use strict";IDt=tv()});function Yu(n){let e=n??"1.1.25"??"unknown",r=process.platform,a=process.arch;if(e.startsWith("VSCode-")){let i=e.slice(7)||"unknown";return`${hMe}/VSCode/${i} (${r}; ${a})`}return`${hMe}/CLI/${e} (${r}; ${a})`}var hMe,L5=ct(()=>{"use strict";hMe="EasyCode"});import*as Vu from"fs";import*as $N from"path";import*as Ak from"os";function RHn(n){Co.configure(n)}function CHn(n){Co.setUserInfo(n)}function xHn(n){Co.setCliVersion(n)}async function YHn(){return await Co.getUserHeaders()}function VHn(){return Co.getStatus()}var Wne,Ro,Co,B5=ct(()=>{"use strict";RO();I1e();L5();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=$N.join(Ak.homedir(),".easycode-user","user-info-dev.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token-dev.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats-dev.json")):(this.userInfoFilePath=$N.join(Ak.homedir(),".easycode-user","user-info.json"),this.jwtTokenFilePath=$N.join(Ak.homedir(),".easycode-user","jwt-token.json"),this.usageStatsFilePath=$N.join(Ak.homedir(),".easycode-user","usage-stats.json")),this.cliVersion="1.1.25",this.config={proxyServerUrl:cE()},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=$N.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=$N.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=$N.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":tv()};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":tv()};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 Zk}from"node:fs";import Fne from"node:path";import QHn from"os";var rv,h1e,en,nv=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"})(rv||(rv={}));h1e=class{config;logBuffer=[];constructor(e={}){if(this.config={level:rv.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=Fne.join(QHn.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 Zk.mkdir(Fne.dirname(this.config.filePath),{recursive:!0}),await this.rotateLogIfNeeded(),await Zk.appendFile(this.config.filePath,e+`
|
|
612
612
|
`,"utf-8")}catch(r){console.error("\u5199\u5165\u65E5\u5FD7\u6587\u4EF6\u5931\u8D25:",r)}}async rotateLogIfNeeded(){if(this.config.filePath)try{if((await Zk.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 Zk.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=Fne.dirname(this.config.filePath),a=(await Zk.readdir(e)).filter(t=>t.startsWith("deepv-")&&t.endsWith(".log")).map(t=>({name:t,path:Fne.join(e,t),time:Zk.stat(Fne.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 Zk.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>=rv.ERROR?console.error:e>=rv.WARN?console.warn:e>=rv.INFO?console.log:console.debug)(o),this.config.enableFile&&this.writeToFile(o)}debug(e,...r){this.log(rv.DEBUG,"DEBUG",e,...r)}info(e,...r){this.log(rv.INFO,"INFO",e,...r)}warn(e,...r){this.log(rv.WARN,"WARN",e,...r)}error(e,...r){this.log(rv.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 h1e({level:process.env.FILE_DEBUG==="1"?rv.DEBUG:rv.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 mMe(n){if(n&&typeof n=="object"&&"response"in n){let r=HHn(n);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new p1e(r.error.message);case 401:return new GI(r.error.message);case 403:return new m1e(r.error.message);default:}}return n}function HHn(n){return typeof n.response?.data=="string"?JSON.parse(n.response?.data):n.response?.data}function Nk(n){if(!n)return!1;try{let e=JSON.parse(n);return e&&e.error==="Unauthorized"&&e.errorCode==="AUTHENTICATION_FAILED"}catch{return!1}}var m1e,GI,p1e,Oc=ct(()=>{"use strict";m1e=class extends Error{},GI=class extends Error{},p1e=class extends Error{}});var va,hDt,Ph,av=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"})(va||(va={}));hDt={[va.CHAT_CONVERSATION]:"auto",[va.WEB_FETCH]:"gemini-2.5-flash",[va.WEB_SEARCH]:"gemini-2.5-flash",[va.CODE_ASSIST]:"auto",[va.CONTENT_SUMMARY]:"gemini-2.5-flash-lite",[va.EDIT_CORRECTION]:"gemini-2.5-flash-lite",[va.JSON_GENERATION]:"gemini-2.5-flash",[va.COMPRESSION]:"gemini-2.5-flash",[va.SUB_AGENT]:"auto",[va.IMAGE_READER]:"gemini-2.5-flash",[va.GOAL_EVALUATION]:"deepseek-v4-flash"},Ph=class{static getModelForScene(e){if(e)return hDt[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{[va.CHAT_CONVERSATION]:"\u804A\u5929\u5BF9\u8BDD",[va.WEB_FETCH]:"Web\u5185\u5BB9\u83B7\u53D6",[va.WEB_SEARCH]:"Web\u641C\u7D22",[va.CODE_ASSIST]:"\u4EE3\u7801\u52A9\u624B",[va.CONTENT_SUMMARY]:"\u5185\u5BB9\u6458\u8981",[va.EDIT_CORRECTION]:"\u7F16\u8F91\u6821\u6B63",[va.JSON_GENERATION]:"JSON\u751F\u6210",[va.COMPRESSION]:"\u5BF9\u8BDD\u538B\u7F29",[va.SUB_AGENT]:"SubAgent\u5B50\u4EE3\u7406",[va.IMAGE_READER]:"\u56FE\u7247\u8BC6\u522B",[va.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 e3(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 t3(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 tG(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 Ene(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")?XHn(e):kHn(e):null}function XHn(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
|
|
613
613
|
`;return c+=`\u{1F6AB} \u5F53\u524D\u6A21\u578B\u7684\u5FAA\u73AF\u914D\u989D\u5DF2\u7528\u5C3D (Cycle Quota Exceeded)
|
|
614
614
|
`,a&&(c+=`\u{1F464} \u89D2\u8272\u4FE1\u606F: ${a}
|
|
@@ -3852,7 +3852,7 @@ ${a}
|
|
|
3852
3852
|
\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(`
|
|
3853
3853
|
\u26A0\uFE0F Warnings:`),r.warnings.forEach(a=>console.log(` \u2022 ${a}`))),e&&r.recommendations.length>0&&(console.log(`
|
|
3854
3854
|
\u{1F4A1} Recommendations:`),r.recommendations.forEach(a=>console.log(` \u2022 ${a}`))),e&&(console.log(`
|
|
3855
|
-
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function Sbi(n){let e=jXe(n);return e.isSmallModel||e.needsSpecialHandling}function Lbi(n){let e=jXe(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 cin=ct(()=>{"use strict";fce();});import*as _Z from"fs";import*as qXe from"path";var Bbi,ome,uin=ct(()=>{"use strict";qm();Bbi="healthy-use-reminder.json",ome=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=CG(e);this.stateFilePath=qXe.join(r,Bbi)}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=qXe.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 rEt,nEt,Tbi,Jbi,Dbi,din=ct(()=>{"use strict";rEt="--- Content from referenced files ---",nEt="--- End of content ---",Tbi=2e3,Jbi=2e3,Dbi=20});function hin(...n){return Obi(...n)}function min(...n){return Mbi(...n)}function Iin(n,e){return n in e}function aEt(){let n={get(i,o){if(o==="write")return hin;if(Iin(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 min;if(Iin(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 Obi,Mbi,pin=ct(()=>{"use strict";Obi=process.stdout.write.bind(process.stdout),Mbi=process.stderr.write.bind(process.stderr)});import{readFile as Ubi}from"node:fs/promises";import{fileURLToPath as _bi}from"node:url";import iEt from"node:path";function zbi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return iEt.dirname(_bi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function sR(){return lme||(lme=(async()=>"1.1.24")(),lme)}function Pbi(){lme=void 0}var lme,sEt=ct(()=>{"use strict";});import{EventEmitter as jbi}from"node:events";var cme,oEt,lEt,fin=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(cme||(cme={}));oEt=class{emitter=new jbi;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()}},lEt=new oEt});function KXe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function qbi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function cEt(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??KXe(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?KXe(r.content):[],i=qbi(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(...KXe(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(...KXe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var bin=ct(()=>{"use strict";});var XT,gin,ume,Gin=ct(()=>{"use strict";XT=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}.`)}},gin="latest",ume=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 XT.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 XT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===gin){let o=await this.listSessions();if(o.length===0)throw XT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new XT(`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 Kbi(n,e,r){return new $Xe(n,e,r)}var $Xe,eke,tke,vin=ct(()=>{"use strict";cce();L5();$Xe=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}`:L4("warn","\u26A0\uFE0F No access token available")}catch(a){L4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(L4("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{L4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){L4("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&&(L4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new eke("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 tke(`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)}},eke=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},tke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function $bi(n){return dme.getInstance(n)}function e2i(n){let e=dme.getInstance(n);return()=>e.handleAuthenticationRequired()}var dme,yin=ct(()=>{"use strict";B5();dme=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 nke(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new rke(r)}var rke,uEt=ct(()=>{"use strict";rke=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 ake from"fs";import*as Ng from"path";function t2i(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ime,dH,dEt=ct(()=>{"use strict";Ime=t2i(),dH=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))),Ime&&r.push(Ng.join(Ime,e)),Ime){let o=Ime;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(ake.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: ${Ime||"(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=ake.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`
|
|
3855
|
+
\u{1F4CB} Full Capabilities:`),console.log(JSON.stringify(r.capabilities,null,2)))}function Sbi(n){let e=jXe(n);return e.isSmallModel||e.needsSpecialHandling}function Lbi(n){let e=jXe(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 cin=ct(()=>{"use strict";fce();});import*as _Z from"fs";import*as qXe from"path";var Bbi,ome,uin=ct(()=>{"use strict";qm();Bbi="healthy-use-reminder.json",ome=class{projectRoot;stateFilePath;constructor(e){this.projectRoot=e;let r=CG(e);this.stateFilePath=qXe.join(r,Bbi)}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=qXe.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 rEt,nEt,Tbi,Jbi,Dbi,din=ct(()=>{"use strict";rEt="--- Content from referenced files ---",nEt="--- End of content ---",Tbi=2e3,Jbi=2e3,Dbi=20});function hin(...n){return Obi(...n)}function min(...n){return Mbi(...n)}function Iin(n,e){return n in e}function aEt(){let n={get(i,o){if(o==="write")return hin;if(Iin(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 min;if(Iin(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 Obi,Mbi,pin=ct(()=>{"use strict";Obi=process.stdout.write.bind(process.stdout),Mbi=process.stderr.write.bind(process.stderr)});import{readFile as Ubi}from"node:fs/promises";import{fileURLToPath as _bi}from"node:url";import iEt from"node:path";function zbi(){let n=globalThis.import?.meta??void 0;try{let r=typeof import.meta<"u"?import.meta.url:void 0;if(r)return iEt.dirname(_bi(r))}catch{}let e=globalThis.__dirname;return typeof e=="string"?e:process.cwd()}function sR(){return lme||(lme=(async()=>"1.1.25")(),lme)}function Pbi(){lme=void 0}var lme,sEt=ct(()=>{"use strict";});import{EventEmitter as jbi}from"node:events";var cme,oEt,lEt,fin=ct(()=>{"use strict";(function(n){n.ApprovalModeChanged="approval_mode_changed"})(cme||(cme={}));oEt=class{emitter=new jbi;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()}},lEt=new oEt});function KXe(n){return Array.isArray(n)?n.map(e=>typeof e=="string"?{text:e}:e):typeof n=="string"?[{text:n}]:[n]}function qbi(n){return n.map(e=>typeof e.text=="string"?e.text:"").join("")}function cEt(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??KXe(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?KXe(r.content):[],i=qbi(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(...KXe(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(...KXe(t.result)):o.push(t.result));o.length>0&&e.push({role:"user",parts:o})}}}}return e}var bin=ct(()=>{"use strict";});var XT,gin,ume,Gin=ct(()=>{"use strict";XT=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}.`)}},gin="latest",ume=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 XT.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 XT.invalidSessionIdentifier(r,"sessions/")}async resolveSession(e){let r=e.trim(),a;if(r===gin){let o=await this.listSessions();if(o.length===0)throw XT.noSessionsFound();a=o[o.length-1]}else a=await this.findSession(r);let i=await this.manager.loadSession(a.id);if(!i)throw new XT(`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 Kbi(n,e,r){return new $Xe(n,e,r)}var $Xe,eke,tke,vin=ct(()=>{"use strict";cce();L5();$Xe=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}`:L4("warn","\u26A0\uFE0F No access token available")}catch(a){L4("warn","\u26A0\uFE0F Failed to get access token:",a),this.onAuthenticationRequired&&a instanceof Error&&a.message?.includes("authentication required")&&(L4("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{L4("log","\u{1F504} Access token expired, attempting refresh...");let a=await this.tokenManager.refreshAccessToken();if(a){L4("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&&(L4("log","\u{1F504} Authentication required, triggering auth flow..."),this.onAuthenticationRequired()),new eke("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 tke(`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)}},eke=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}},tke=class extends Error{status;response;constructor(e,r,a){super(e),this.name="HttpError",this.status=r,this.response=a}}});function $bi(n){return dme.getInstance(n)}function e2i(n){let e=dme.getInstance(n);return()=>e.handleAuthenticationRequired()}var dme,yin=ct(()=>{"use strict";B5();dme=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 nke(n){let r={authUrl:"https://accounts.deepvlab.ai/login",redirectUri:`http://localhost:${n||7863}/callback?plat=deepvlab`};return new rke(r)}var rke,uEt=ct(()=>{"use strict";rke=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 ake from"fs";import*as Ng from"path";function t2i(){return typeof globalThis.__dirname=="string"?globalThis.__dirname:""}var Ime,dH,dEt=ct(()=>{"use strict";Ime=t2i(),dH=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))),Ime&&r.push(Ng.join(Ime,e)),Ime){let o=Ime;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(ake.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: ${Ime||"(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=ake.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`
|
|
3856
3856
|
<!DOCTYPE html>
|
|
3857
3857
|
<html>
|
|
3858
3858
|
<head>
|
|
@@ -5024,7 +5024,7 @@ ${c}`),a?i.reset(c):c}function C1i(n,e,r,a={}){if(!Nln){Nln=!0;let o="Passing li
|
|
|
5024
5024
|
|
|
5025
5025
|
${e}
|
|
5026
5026
|
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,a=Q1i(r,this.#t.message);if(a)return(0,Vln.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}},Q1i=(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)}:twt(n,Number(a),{oneBased:!0})},H1i=n=>n.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,a)=>`"${a}"(${V1i(a)})`)});var awt=Ze((Mio,X1i)=>{X1i.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 Hln=Ze((Uio,k1i)=>{k1i.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 Xln=Ze((_io,S1i)=>{S1i.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 Sln=Ze((zio,kln)=>{"use strict";var L1i=[].concat(awt()).concat(Hln()),B1i=Xln();kln.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(L1i.indexOf(G)!==-1)return{type:"LICENSE",string:G};if(B1i.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 Bln=Ze((Pio,Lln)=>{"use strict";Lln.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 iwt=Ze((jio,Tln)=>{"use strict";var T1i=Sln(),J1i=Bln();Tln.exports=function(n){return J1i(T1i(n))}});var jln=Ze((qio,Pln)=>{var D1i=iwt(),O1i=awt();function jke(n){try{return D1i(n),!0}catch{return!1}}function zln(n,e){var r=e[0].length-n[0].length;return r!==0?r:n[0].toUpperCase().localeCompare(e[0].toUpperCase())}var Jln=[["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(zln),M1i=0,U1i=1,Dln=[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"}],swt=O1i.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},{}),_1i=Object.keys(swt).map(function(e){return[e,swt[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});swt=void 0;var Oln=[["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(_1i).sort(zln),z1i=0,P1i=1,Mln=function(n){for(var e=0;e<Dln.length;e++){var r=Dln[e](n).trim();if(r!==n&&jke(r))return r}return null},Uln=function(n){for(var e=n.toUpperCase(),r=0;r<Oln.length;r++){var a=Oln[r];if(e.indexOf(a[z1i])>-1)return a[P1i]}return null},_ln=function(n,e){for(var r=0;r<Jln.length;r++){var a=Jln[r],i=a[M1i];if(n.indexOf(i)>-1){var o=n.replace(i,a[U1i]),t=e(o);if(t!==null)return t}}return null};Pln.exports=function(n,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function a(s){return r?j1i(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(),jke(n))return a(n);var o=n.replace(/\+$/,"").trim();if(jke(o))return a(o);var t=Mln(n);return t!==null||(t=_ln(n,function(s){return jke(s)?s:Mln(s)}),t!==null)||(t=Uln(n),t!==null)||(t=_ln(n,Uln),t!==null)?a(t):null};function j1i(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 ecn=Ze((Kio,$ln)=>{var q1i=iwt(),K1i=jln(),qln='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',$1i=/^SEE LICEN[CS]E IN (.+)$/;function Kln(n,e){return e.slice(0,n.length)===n}function owt(n){if(n.hasOwnProperty("license")){var e=n.license;return Kln("LicenseRef",e)||Kln("DocumentRef",e)}else return owt(n.left)||owt(n.right)}$ln.exports=function(n){var e;try{e=q1i(n)}catch{var r;if(n==="UNLICENSED"||n==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=$1i.exec(n))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var a={validForOldPackages:!1,validForNewPackages:!1,warnings:[qln]};if(n.trim().length!==0){var i=K1i(n);i&&a.warnings.push('license is similar to the valid expression "'+i+'"')}return a}return owt(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[qln]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var icn=Ze(Kke=>{"use strict";Object.defineProperty(Kke,"__esModule",{value:!0});Kke.LRUCache=void 0;var W$=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,rcn=new Set,lwt=typeof process=="object"&&process?process:{},ncn=(n,e,r,a)=>{typeof lwt.emitWarning=="function"?lwt.emitWarning(n,e,r,a):console.error(`[${r}] ${e}: ${n}`)},qke=globalThis.AbortController,tcn=globalThis.AbortSignal;if(typeof qke>"u"){tcn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(a,i){this._onabort.push(i)}},qke=class{constructor(){e()}signal=new tcn;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=lwt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,ncn("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 evi=n=>!rcn.has(n),tso=Symbol("type"),AH=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),acn=n=>AH(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?F$:null:null,F$=class extends Array{constructor(e){super(e),this.fill(0)}},cwt=class n{heap;length;static#e=!1;static create(e){let r=acn(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]}},uwt=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&&!AH(r))throw new TypeError("max option must be a nonnegative integer");let N=r?acn(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=cwt.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&&!AH(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!AH(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=AH(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=a||0,this.ttl){if(!AH(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";evi(w)&&(rcn.add(w),ncn("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 F$(this.#e),r=new F$(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 F$(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(!AH(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(a,r),!AH(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 qke,{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 qke}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)}}};Kke.LRUCache=uwt});var lcn=Ze((nso,ocn)=>{"use strict";var Pl=(...n)=>n.every(e=>e)?n.join(""):"",W0=n=>n?encodeURIComponent(n):"",scn=n=>n.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),tvi={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:scn},ZH={};ZH.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}}};ZH.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)}}};ZH.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)}}};ZH.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-"+scn(n)}};ZH.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(ZH))ZH[n]=Object.assign({},tvi,e);ocn.exports=ZH});var Iwt=Ze((aso,ucn)=>{var rvi=Wt("url"),dwt=(n,e,r)=>{let a=n.indexOf(r);return n.lastIndexOf(e,a>-1?a:1/0)},ccn=n=>{try{return new rvi.URL(n)}catch{}},nvi=(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)}`},avi=n=>{let e=dwt(n,"@","#"),r=dwt(n,":","#");return r>e&&(n=n.slice(0,r)+"/"+n.slice(r+1)),dwt(n,":","#")===-1&&n.indexOf("//")===-1&&(n=`git+ssh://${n}`),n};ucn.exports=(n,e)=>{let r=e?nvi(n,e):n;return ccn(r)||ccn(avi(r))}});var Icn=Ze((iso,dcn)=>{"use strict";var ivi=Iwt(),svi=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};dcn.exports=(n,e,{gitHosts:r,protocols:a})=>{if(!n)return;let i=svi(n)?`github:${n}`:n,o=ivi(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 mcn=Ze((sso,hcn)=>{"use strict";var{LRUCache:ovi}=icn(),lvi=lcn(),cvi=Icn(),uvi=Iwt(),hwt=new ovi({max:1e3}),$ke=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(!hwt.has(a)){let i=cvi(e,r,{gitHosts:n.#e,protocols:n.#t});hwt.set(a,i?new n(...i):void 0)}return hwt.get(a)}static parseUrl(e){return uvi(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(lvi))$ke.addHost(n,e);hcn.exports=$ke});var fcn=Ze((oso,pcn)=>{pcn.exports=dvi;function dvi(n){if(!n||n==="ERROR: No README data found!")return;n=n.trim().split(`
|
|
5027
|
-
`);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 bcn=Ze((lso,Ivi)=>{Ivi.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 ycn=Ze((cso,vcn)=>{var hvi=Aat(),mvi=Zat(),pvi=ecn(),e6e=mcn(),fvi=Wt("node:module"),bvi=["dependencies","devDependencies","optionalDependencies"],gvi=fcn(),mwt=Wt("url"),NH=bcn(),gcn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");vcn.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=e6e.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(NH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,NH.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]):NH.script[e]&&!n.scripts[NH.script[e]]&&this.warn("typo",e,NH.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){Fvi(n,this.warn),Nvi(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=e6e.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(!hvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=mvi(n.version,r),!0},fixPeople:function(n){Gcn(n,Avi),Gcn(n,Zvi)},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()),yvi(n.name,r,e.allowLegacyCase),fvi.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=gvi(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=e6e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")gcn(n.bugs)?n.bugs={email:n.bugs}:mwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{Evi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&mwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&gcn(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=e6e.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;mwt.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(!pvi(e).validForNewPackages)return this.warn("invalidLicense")}};function Gvi(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 vvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function yvi(n,e,r){if(n.charAt(0)==="."||!(Gvi(n)||vvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function Gcn(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 Avi(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 Zvi(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 Nvi(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 Wvi(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 Fvi(n,e){bvi.forEach(function(r){n[r]&&(n[r]=Wvi(n[r],r,e))})}function Evi(n,e){n&&Object.keys(n).forEach(function(r){NH.bugs[r]&&(e("typo",r,NH.bugs[r],"bugs"),n[NH.bugs[r]]=n[r],delete n[r])})}});var Acn=Ze((uso,wvi)=>{wvi.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 Wcn=Ze((dso,Ncn)=>{var Zcn=Wt("util"),pwt=Acn();Ncn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Rvi.apply(null,n);var r=pwt[e]?pwt[e]:e+": '%s'";return n.unshift(r),Zcn.format.apply(null,n)};function Rvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),Zcn.format(pwt.typo,n,e)}});var Rcn=Ze((Iso,wcn)=>{wcn.exports=Fcn;var fwt=ycn();Fcn.fixer=fwt;var Cvi=Wcn(),xvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Yvi=["dependencies","people","typos"],bwt=xvi.map(function(n){return Ecn(n)+"Field"});bwt=bwt.concat(Yvi);function Fcn(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),fwt.warn=function(){e(Cvi.apply(null,arguments))},bwt.forEach(function(a){fwt["fix"+Ecn(a)](n,r)}),n._id=n.name+"@"+n.version}function Ecn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Ccn=ct(()=>{});import{fileURLToPath as Vvi}from"node:url";function xcn(n){return n instanceof URL?Vvi(n):n}var Ycn=ct(()=>{Ccn()});import Qvi from"node:fs/promises";import Hvi from"node:path";async function Qcn({cwd:n,normalize:e=!0}={}){let r=await Qvi.readFile(Xvi(n),"utf8");return kvi(r,e)}var Vcn,Xvi,kvi,Hcn=ct(()=>{Qln();Vcn=St(Rcn(),1);Ycn();Xvi=n=>Hvi.resolve(xcn(n)??".","package.json"),kvi=(n,e)=>{let r=typeof n=="string"?nwt(n):n;return e&&(0,Vcn.default)(r),r}});import Svi from"node:path";async function Xcn(n){let e=await sln("package.json",n);if(e)return{packageJson:await Qcn({...n,cwd:Svi.dirname(e)}),path:e}}var kcn=ct(()=>{oln();Hcn()});import{fileURLToPath as Lvi}from"url";import Bvi from"path";async function E$(){if(t6e)return t6e;let n=await Xcn({cwd:Jvi});if(n)return t6e=n.packageJson,t6e}var Tvi,Jvi,t6e,r6e=ct(()=>{"use strict";kcn();Tvi=Lvi(import.meta.url),Jvi=Bvi.dirname(Tvi)});var Scn={};ho(Scn,{getCliVersion:()=>Zx});async function Zx(){let n=await E$();return"1.1.24"}var w$=ct(()=>{"use strict";r6e();});var Uwt=Ze((r0o,qdn)=>{qdn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var eIn=Ze((n0o,$dn)=>{var JZi=Uwt();function Kdn(n){this.mode=JZi.MODE_8BIT_BYTE,this.data=n}Kdn.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)}};$dn.exports=Kdn});var _wt=Ze((a0o,tIn)=>{var _W={glog:function(n){if(n<1)throw new Error("glog("+n+")");return _W.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return _W.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)_W.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)_W.EXP_TABLE[F0]=_W.EXP_TABLE[F0-4]^_W.EXP_TABLE[F0-5]^_W.EXP_TABLE[F0-6]^_W.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)_W.LOG_TABLE[_W.EXP_TABLE[F0]]=F0;var F0;tIn.exports=_W});var zwt=Ze((i0o,rIn)=>{var nJ=_wt();function Z6e(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]}Z6e.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]^=nJ.gexp(nJ.glog(this.get(r))+nJ.glog(n.get(a)));return new Z6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=nJ.glog(this.get(0))-nJ.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]^=nJ.gexp(nJ.glog(n.get(i))+e);return new Z6e(r,0).mod(n)}};rIn.exports=Z6e});var aIn=Ze((s0o,nIn)=>{nIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var oIn=Ze((o0o,sIn)=>{var $Z=Uwt(),iIn=zwt(),DZi=_wt(),RH=aIn(),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 RH.PATTERN000:return(e+r)%2===0;case RH.PATTERN001:return e%2===0;case RH.PATTERN010:return r%3===0;case RH.PATTERN011:return(e+r)%3===0;case RH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case RH.PATTERN101:return e*r%2+e*r%3===0;case RH.PATTERN110:return(e*r%2+e*r%3)%2===0;case RH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new iIn([1],0),r=0;r<n;r++)e=e.multiply(new iIn([1,DZi.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}};sIn.exports=Vf});var Pwt=Ze((l0o,lIn)=>{lIn.exports={L:1,M:0,Q:3,H:2}});var uIn=Ze((c0o,cIn)=>{var N6e=Pwt();function vR(n,e){this.totalCount=n,this.dataCount=e}vR.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]];vR.getRSBlocks=function(n,e){var r=vR.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 vR(s,u));return i};vR.getRsBlockTable=function(n,e){switch(e){case N6e.L:return vR.RS_BLOCK_TABLE[(n-1)*4+0];case N6e.M:return vR.RS_BLOCK_TABLE[(n-1)*4+1];case N6e.Q:return vR.RS_BLOCK_TABLE[(n-1)*4+2];case N6e.H:return vR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};cIn.exports=vR});var hIn=Ze((u0o,IIn)=>{function dIn(){this.buffer=[],this.length=0}dIn.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++}};IIn.exports=dIn});var bIn=Ze((d0o,fIn)=>{var OZi=eIn(),CH=oIn(),MZi=zwt(),mIn=uIn(),pIn=hIn();function yR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}yR.prototype={addData:function(n){var e=new OZi(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=mIn.getRSBlocks(n,this.errorCorrectLevel),r=new pIn,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(),CH.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=yR.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=CH.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=CH.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=CH.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=CH.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=CH.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}}}};yR.PAD0=236;yR.PAD1=17;yR.createData=function(n,e,r){for(var a=mIn.getRSBlocks(n,e),i=new pIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),CH.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(yR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(yR.PAD1,8);return yR.createBytes(i,a)};yR.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=CH.getErrorCorrectPolynomial(I),c=new MZi(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};fIn.exports=yR});var vIn=Ze((I0o,GIn)=>{var UZi=bIn(),gIn=Pwt(),_Zi="\x1B[40m \x1B[0m",W6e="\x1B[47m \x1B[0m",zZi=function(n){return n?_Zi:W6e},jwt=function(n){return{times:function(e){return new Array(e).join(n)}}},PZi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};GIn.exports={error:gIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new UZi(-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(PZi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=jwt(d.BLACK_WHITE).times(s+3),c=jwt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
5027
|
+
`);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 bcn=Ze((lso,Ivi)=>{Ivi.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 ycn=Ze((cso,vcn)=>{var hvi=Aat(),mvi=Zat(),pvi=ecn(),e6e=mcn(),fvi=Wt("node:module"),bvi=["dependencies","devDependencies","optionalDependencies"],gvi=fcn(),mwt=Wt("url"),NH=bcn(),gcn=n=>n.includes("@")&&n.indexOf("@")<n.lastIndexOf(".");vcn.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=e6e.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(NH.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(n,e)&&this.warn("typo",e,NH.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]):NH.script[e]&&!n.scripts[NH.script[e]]&&this.warn("typo",e,NH.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){Fvi(n,this.warn),Nvi(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=e6e.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(!hvi(n.version,r))throw new Error('Invalid version: "'+n.version+'"');return n.version=mvi(n.version,r),!0},fixPeople:function(n){Gcn(n,Avi),Gcn(n,Zvi)},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()),yvi(n.name,r,e.allowLegacyCase),fvi.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=gvi(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=e6e.fromUrl(n.repository.url);e&&e.bugs()&&(n.bugs={url:e.bugs()})}else if(n.bugs){if(typeof n.bugs=="string")gcn(n.bugs)?n.bugs={email:n.bugs}:mwt.parse(n.bugs).protocol?n.bugs={url:n.bugs}:this.warn("nonEmailUrlBugsString");else{Evi(n.bugs,this.warn);var r=n.bugs;n.bugs={},r.url&&(typeof r.url=="string"&&mwt.parse(r.url).protocol?n.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&gcn(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=e6e.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;mwt.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(!pvi(e).validForNewPackages)return this.warn("invalidLicense")}};function Gvi(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 vvi(n){return!n.match(/[/@\s+%:]/)&&n===encodeURIComponent(n)}function yvi(n,e,r){if(n.charAt(0)==="."||!(Gvi(n)||vvi(n))||e&&!r&&n!==n.toLowerCase()||n.toLowerCase()==="node_modules"||n.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(n))}function Gcn(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 Avi(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 Zvi(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 Nvi(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 Wvi(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 Fvi(n,e){bvi.forEach(function(r){n[r]&&(n[r]=Wvi(n[r],r,e))})}function Evi(n,e){n&&Object.keys(n).forEach(function(r){NH.bugs[r]&&(e("typo",r,NH.bugs[r],"bugs"),n[NH.bugs[r]]=n[r],delete n[r])})}});var Acn=Ze((uso,wvi)=>{wvi.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 Wcn=Ze((dso,Ncn)=>{var Zcn=Wt("util"),pwt=Acn();Ncn.exports=function(){var n=Array.prototype.slice.call(arguments,0),e=n.shift();if(e==="typo")return Rvi.apply(null,n);var r=pwt[e]?pwt[e]:e+": '%s'";return n.unshift(r),Zcn.format.apply(null,n)};function Rvi(n,e,r){return r&&(n=r+"['"+n+"']",e=r+"['"+e+"']"),Zcn.format(pwt.typo,n,e)}});var Rcn=Ze((Iso,wcn)=>{wcn.exports=Fcn;var fwt=ycn();Fcn.fixer=fwt;var Cvi=Wcn(),xvi=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],Yvi=["dependencies","people","typos"],bwt=xvi.map(function(n){return Ecn(n)+"Field"});bwt=bwt.concat(Yvi);function Fcn(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),fwt.warn=function(){e(Cvi.apply(null,arguments))},bwt.forEach(function(a){fwt["fix"+Ecn(a)](n,r)}),n._id=n.name+"@"+n.version}function Ecn(n){return n.charAt(0).toUpperCase()+n.slice(1)}});var Ccn=ct(()=>{});import{fileURLToPath as Vvi}from"node:url";function xcn(n){return n instanceof URL?Vvi(n):n}var Ycn=ct(()=>{Ccn()});import Qvi from"node:fs/promises";import Hvi from"node:path";async function Qcn({cwd:n,normalize:e=!0}={}){let r=await Qvi.readFile(Xvi(n),"utf8");return kvi(r,e)}var Vcn,Xvi,kvi,Hcn=ct(()=>{Qln();Vcn=St(Rcn(),1);Ycn();Xvi=n=>Hvi.resolve(xcn(n)??".","package.json"),kvi=(n,e)=>{let r=typeof n=="string"?nwt(n):n;return e&&(0,Vcn.default)(r),r}});import Svi from"node:path";async function Xcn(n){let e=await sln("package.json",n);if(e)return{packageJson:await Qcn({...n,cwd:Svi.dirname(e)}),path:e}}var kcn=ct(()=>{oln();Hcn()});import{fileURLToPath as Lvi}from"url";import Bvi from"path";async function E$(){if(t6e)return t6e;let n=await Xcn({cwd:Jvi});if(n)return t6e=n.packageJson,t6e}var Tvi,Jvi,t6e,r6e=ct(()=>{"use strict";kcn();Tvi=Lvi(import.meta.url),Jvi=Bvi.dirname(Tvi)});var Scn={};ho(Scn,{getCliVersion:()=>Zx});async function Zx(){let n=await E$();return"1.1.25"}var w$=ct(()=>{"use strict";r6e();});var Uwt=Ze((r0o,qdn)=>{qdn.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var eIn=Ze((n0o,$dn)=>{var JZi=Uwt();function Kdn(n){this.mode=JZi.MODE_8BIT_BYTE,this.data=n}Kdn.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)}};$dn.exports=Kdn});var _wt=Ze((a0o,tIn)=>{var _W={glog:function(n){if(n<1)throw new Error("glog("+n+")");return _W.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return _W.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(F0=0;F0<8;F0++)_W.EXP_TABLE[F0]=1<<F0;var F0;for(F0=8;F0<256;F0++)_W.EXP_TABLE[F0]=_W.EXP_TABLE[F0-4]^_W.EXP_TABLE[F0-5]^_W.EXP_TABLE[F0-6]^_W.EXP_TABLE[F0-8];var F0;for(F0=0;F0<255;F0++)_W.LOG_TABLE[_W.EXP_TABLE[F0]]=F0;var F0;tIn.exports=_W});var zwt=Ze((i0o,rIn)=>{var nJ=_wt();function Z6e(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]}Z6e.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]^=nJ.gexp(nJ.glog(this.get(r))+nJ.glog(n.get(a)));return new Z6e(e,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var e=nJ.glog(this.get(0))-nJ.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]^=nJ.gexp(nJ.glog(n.get(i))+e);return new Z6e(r,0).mod(n)}};rIn.exports=Z6e});var aIn=Ze((s0o,nIn)=>{nIn.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var oIn=Ze((o0o,sIn)=>{var $Z=Uwt(),iIn=zwt(),DZi=_wt(),RH=aIn(),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 RH.PATTERN000:return(e+r)%2===0;case RH.PATTERN001:return e%2===0;case RH.PATTERN010:return r%3===0;case RH.PATTERN011:return(e+r)%3===0;case RH.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case RH.PATTERN101:return e*r%2+e*r%3===0;case RH.PATTERN110:return(e*r%2+e*r%3)%2===0;case RH.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){for(var e=new iIn([1],0),r=0;r<n;r++)e=e.multiply(new iIn([1,DZi.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}};sIn.exports=Vf});var Pwt=Ze((l0o,lIn)=>{lIn.exports={L:1,M:0,Q:3,H:2}});var uIn=Ze((c0o,cIn)=>{var N6e=Pwt();function vR(n,e){this.totalCount=n,this.dataCount=e}vR.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]];vR.getRSBlocks=function(n,e){var r=vR.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 vR(s,u));return i};vR.getRsBlockTable=function(n,e){switch(e){case N6e.L:return vR.RS_BLOCK_TABLE[(n-1)*4+0];case N6e.M:return vR.RS_BLOCK_TABLE[(n-1)*4+1];case N6e.Q:return vR.RS_BLOCK_TABLE[(n-1)*4+2];case N6e.H:return vR.RS_BLOCK_TABLE[(n-1)*4+3];default:return}};cIn.exports=vR});var hIn=Ze((u0o,IIn)=>{function dIn(){this.buffer=[],this.length=0}dIn.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++}};IIn.exports=dIn});var bIn=Ze((d0o,fIn)=>{var OZi=eIn(),CH=oIn(),MZi=zwt(),mIn=uIn(),pIn=hIn();function yR(n,e){this.typeNumber=n,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}yR.prototype={addData:function(n){var e=new OZi(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=mIn.getRSBlocks(n,this.errorCorrectLevel),r=new pIn,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(),CH.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=yR.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=CH.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=CH.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=CH.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=CH.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=CH.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}}}};yR.PAD0=236;yR.PAD1=17;yR.createData=function(n,e,r){for(var a=mIn.getRSBlocks(n,e),i=new pIn,o=0;o<r.length;o++){var t=r[o];i.put(t.mode,4),i.put(t.getLength(),CH.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(yR.PAD0,8),i.getLengthInBits()>=s*8));)i.put(yR.PAD1,8);return yR.createBytes(i,a)};yR.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=CH.getErrorCorrectPolynomial(I),c=new MZi(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};fIn.exports=yR});var vIn=Ze((I0o,GIn)=>{var UZi=bIn(),gIn=Pwt(),_Zi="\x1B[40m \x1B[0m",W6e="\x1B[47m \x1B[0m",zZi=function(n){return n?_Zi:W6e},jwt=function(n){return{times:function(e){return new Array(e).join(n)}}},PZi=function(n,e){for(var r=new Array(n),a=0;a<n;a++)r[a]=e;return r};GIn.exports={error:gIn.L,generate:function(n,e,r){typeof e=="function"&&(r=e,e={});var a=new UZi(-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(PZi(s,t));var d={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},h=jwt(d.BLACK_WHITE).times(s+3),c=jwt(d.WHITE_BLACK).times(s+3);i+=h+`
|
|
5028
5028
|
`;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+`
|
|
5029
5029
|
`}I||(i+=c)}else{var G=jwt(W6e).times(a.getModuleCount()+3);i+=G+`
|
|
5030
5030
|
`,a.modules.forEach(function(A){i+=W6e,i+=A.map(zZi).join(""),i+=W6e+`
|