@abacus-ai/cli 2.0.0-canary.8 → 2.0.0

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/README.md ADDED
@@ -0,0 +1,25 @@
1
+ <div id="abacusai-logo" align="center">
2
+ <br />
3
+ <img src="https://raw.githubusercontent.com/abacusai/codellm-releases/refs/heads/main/icons/codellm.svg" alt="AbacusAI Logo" width="200"/>
4
+ <h1>AbacusAI CLI</h1>
5
+ <h4>Your All-In-One AI Platform</h4>
6
+ </div>
7
+
8
+ <br/>
9
+
10
+ <div align="center">
11
+
12
+ AbacusAI's powerful CLI AI assistant with agentic browsing, listening, and coding capabilities.
13
+ Automate all your work with state of the art AI and the most powerful agent in the world.
14
+
15
+ [![Get Started Here]][GetStarted]
16
+
17
+ https://desktop.abacus.ai/
18
+
19
+ </div>
20
+
21
+ <br/>
22
+ <br/>
23
+
24
+ [Get Started Here]: https://img.shields.io/badge/Get_Started_Here-3391ed?style=for-the-badge
25
+ [GetStarted]: https://desktop.abacus.ai/
package/dist/index.mjs CHANGED
@@ -12472,7 +12472,7 @@ const cx={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
12472
12472
  `);for(let t=0;t<=r.length-i.length;t++){let n=r.slice(t,t+i.length),o=n.join(`
12473
12473
  `);if(bS(o)===e){f=r.slice(0,t).join(`
12474
12474
  `).length+(t>0?1:0),p=o.length;let e=n.map(e=>{let t=e.match(/^(\s*)/);return t?t[1]:``});m=a.map((t,n)=>n<e.length?e[n]+t.trimStart():t).join(`
12475
- `);break}}}}if(f===-1){let e=t.substring(0,200);throw Error(`Exact match not found for string: "${e}${t.length>200?`...`:``}"`)}let h=s.substring(0,l+f),g=0,_=0;for(;(_=h.indexOf(n,_))!==-1;)g++,_+=n.length;let v=l+f,y=s.substring(0,v)+m+s.substring(v+p);return await F.writeFile(o,y,`utf-8`),{filePath:o,type:`str_replace`,oldStr:t,newStr:n,previousNewStrings:g}}async grep(e){let{query:t,folderExcludes:n=[],folderIncludes:r=[],offset:i=0,isCaseSensitive:a=!1,path:o,outputMode:s=`files_with_matches`,contextBefore:c,contextAfter:l,contextLines:d,showLineNumbers:f,fileType:p,headLimit:m,multiline:h=!1}=e,g=this.workspacePath,_=o?C.resolve(this.workspacePath,o):`.`,v=[`--hidden`,`--max-columns`,`500`,`--path-separator`,`/`];for(let e of _S)v.push(`--glob`,`!${e}`);if(h&&v.push(`-U`,`--multiline-dotall`),a||v.push(`-i`),s===`files_with_matches`?v.push(`--files-with-matches`):s===`count`&&v.push(`--count`),s===`content`){try{let e=await F.stat(_);(!o||e.isDirectory())&&v.push(`-H`)}catch{v.push(`-H`)}f!==!1&&v.push(`-n`),d===void 0?(c!==void 0&&v.push(`-B`,String(c)),l!==void 0&&v.push(`-A`,String(l))):v.push(`-C`,String(d))}p&&v.push(`--type`,p);for(let e of r)v.push(`-g`,e);for(let e of n)v.push(`-g`,`!${e}`);return v.push(`--`,t,_),new Promise(e=>{let t=u(ue,v,{cwd:g,stdio:[`ignore`,`pipe`,`pipe`]}),n=A({input:t.stdout}),r=[];n.on(`line`,e=>{r.push(e)}),t.on(`close`,async()=>{try{let t=r.length;if(s===`files_with_matches`){let n=[];for(let e=0;e<r.length;e+=64){let t=r.slice(e,e+64),i=await Promise.all(t.map(async e=>{let t=C.isAbsolute(e)?e:C.resolve(g,e);try{return{filePath:e,mtimeMs:(await F.stat(t)).mtimeMs}}catch{return{filePath:e,mtimeMs:0}}}));n.push(...i)}n.sort((e,t)=>{let n=t.mtimeMs-e.mtimeMs;return n===0?e.filePath.localeCompare(t.filePath):n});let a=n.map(e=>kl(e.filePath,g));if(a=a.slice(i),m){let n=a.length>m;a=a.slice(0,m),e({matches:a,metadata:{offset:i,limit:m,totalMatches:t,hasMore:n}})}else e({matches:a,metadata:{offset:i,limit:a.length,totalMatches:t,hasMore:!1}})}else{let n=r.map(e=>{if(e===`--`)return e;let t=vS.exec(e);return t?kl(t[1],g)+e.substring(t[1].length):e});if(n=n.slice(i),m){let r=n.length>m;n=n.slice(0,m),e({matches:n,metadata:{offset:i,limit:m,totalMatches:t,hasMore:r}})}else e({matches:n,metadata:{offset:i,limit:n.length,totalMatches:t,hasMore:!1}})}}catch{e({matches:[],metadata:{offset:i,limit:0,totalMatches:0,hasMore:!1}})}}),t.on(`error`,()=>{e({matches:[],metadata:{offset:i,limit:0,totalMatches:0,hasMore:!1}})})})}async grepFile(e){let{query:t,maxResults:n=100}=e;return(await fS(t,{root:this.workspacePath,maxResults:n,includeHidden:!1})).paths.slice(0,n).map(e=>kl(e,this.workspacePath))}async grepTextFile(e){let{query:t,maxResults:n=100}=e,r=await fS(t,{root:this.workspacePath,maxResults:n,includeHidden:!1}),i=[];for(let e of r.paths.slice(0,n))try{await sx(e)||i.push(kl(e,this.workspacePath))}catch{}return i}async glob(e){let t=this.workspacePath,n=e.path?C.resolve(t,e.path):t,r=await this.globViaGit(n,e.pattern,t);return r===null?this.globViaRipgrep(n,e.pattern,t):r}async globViaGit(e,t,n){try{if(!await this.runGitCmd([`rev-parse`,`--show-toplevel`],e))return null;let[r,i]=await Promise.all([this.runGitLines([`ls-files`],e),this.runGitLines([`ls-files`,`--others`,`--exclude-standard`],e)]),a=(0,pS.default)(t,{dot:!0}),o=[];for(let t of[...r,...i]){if(!t)continue;let r=C.resolve(e,t),i=C.relative(n,r).replace(/\\/g,`/`);(a(t)||a(i)||a(C.basename(t)))&&o.push(r)}return this.sortAndBuildResult(o,n)}catch{return null}}globViaRipgrep(e,t,n){let r=[`--files`,`--hidden`,`--path-separator`,`/`,`-g`,t];for(let e of _S)r.push(`--glob`,`!${e}`);return r.push(e),new Promise(e=>{let t=u(ue,r,{cwd:n,stdio:[`ignore`,`pipe`,`pipe`]}),i=A({input:t.stdout}),a=[];i.on(`line`,e=>{a.push(e)}),t.on(`close`,async()=>{try{e(await this.sortAndBuildResult(a,n))}catch{e({files:[],metadata:{totalFiles:0}})}}),t.on(`error`,()=>{e({files:[],metadata:{totalFiles:0}})})})}async sortAndBuildResult(e,t){let n=[];for(let r=0;r<e.length;r+=64){let i=e.slice(r,r+64),a=await Promise.all(i.map(async e=>{let n=C.isAbsolute(e)?e:C.resolve(t,e);try{return{filePath:e,mtimeMs:(await F.stat(n)).mtimeMs}}catch{return{filePath:e,mtimeMs:0}}}));n.push(...a)}n.sort((e,t)=>{let n=t.mtimeMs-e.mtimeMs;return n===0?e.filePath.localeCompare(t.filePath):n});let r=n.map(e=>kl(e.filePath,t));return{files:r,metadata:{totalFiles:r.length}}}runGitCmd(e,t){return new Promise((n,r)=>{let i=u(`git`,e,{cwd:t,stdio:[`ignore`,`pipe`,`pipe`]}),a=``;i.stdout.on(`data`,e=>a+=e.toString()),i.on(`close`,e=>e===0?n(a.trim()):r()),i.on(`error`,r)})}runGitLines(e,t){return new Promise(n=>{let r=[],i=u(`git`,e,{cwd:t,stdio:[`ignore`,`pipe`,`pipe`]});A({input:i.stdout}).on(`line`,e=>r.push(e.trim())),i.on(`close`,()=>n(r)),i.on(`error`,()=>n(r))})}};function SS(e){return!!e._zod}function CS(e,t){return SS(e)?jt(e,t):e.safeParse(t)}function wS(e){if(!e)return;let t;if(t=SS(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function TS(e){if(SS(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}const ES=`2025-11-25`,DS=[ES,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],OS=`io.modelcontextprotocol/related-task`,kS=Rc(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),AS=ic([J(),Is().int()]),jS=J();nc({ttl:ic([Is(),Gs()]).optional(),pollInterval:Is().optional()});const MS=tc({ttl:Is().optional()}),NS=tc({taskId:J()}),PS=nc({progressToken:AS.optional(),[OS]:NS.optional()}),FS=tc({_meta:PS.optional()}),IS=FS.extend({task:MS.optional()}),LS=e=>IS.safeParse(e).success,RS=tc({method:J(),params:FS.loose().optional()}),zS=tc({_meta:PS.optional()}),BS=tc({method:J(),params:zS.loose().optional()}),VS=nc({_meta:PS.optional()}),HS=ic([J(),Is().int()]),US=tc({jsonrpc:gc(`2.0`),id:HS,...RS.shape}).strict(),WS=e=>US.safeParse(e).success,GS=tc({jsonrpc:gc(`2.0`),...BS.shape}).strict(),KS=e=>GS.safeParse(e).success,qS=tc({jsonrpc:gc(`2.0`),id:HS,result:VS}).strict(),JS=e=>qS.safeParse(e).success;var YS;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(YS||={});const XS=tc({jsonrpc:gc(`2.0`),id:HS.optional(),error:tc({code:Is().int(),message:J(),data:Ys().optional()})}).strict(),ZS=e=>XS.safeParse(e).success,QS=ic([US,GS,qS,XS]);ic([qS,XS]);const $S=VS.strict(),eC=zS.extend({requestId:HS.optional(),reason:J().optional()}),tC=BS.extend({method:gc(`notifications/cancelled`),params:eC}),nC=tc({icons:$s(tc({src:J(),mimeType:J().optional(),sizes:$s(J()).optional(),theme:mc([`light`,`dark`]).optional()})).optional()}),rC=tc({name:J(),title:J().optional()}),iC=rC.extend({...rC.shape,...nC.shape,version:J(),websiteUrl:J().optional(),description:J().optional()}),aC=Vc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,cc(tc({form:cc(tc({applyDefaults:Bs().optional()}),fc(J(),Ys())).optional(),url:kS.optional()}),fc(J(),Ys()).optional())),oC=nc({list:kS.optional(),cancel:kS.optional(),requests:nc({sampling:nc({createMessage:kS.optional()}).optional(),elicitation:nc({create:kS.optional()}).optional()}).optional()}),sC=nc({list:kS.optional(),cancel:kS.optional(),requests:nc({tools:nc({call:kS.optional()}).optional()}).optional()}),cC=tc({experimental:fc(J(),kS).optional(),sampling:tc({context:kS.optional(),tools:kS.optional()}).optional(),elicitation:aC.optional(),roots:tc({listChanged:Bs().optional()}).optional(),tasks:oC.optional()}),lC=FS.extend({protocolVersion:J(),capabilities:cC,clientInfo:iC}),uC=RS.extend({method:gc(`initialize`),params:lC}),dC=tc({experimental:fc(J(),kS).optional(),logging:kS.optional(),completions:kS.optional(),prompts:tc({listChanged:Bs().optional()}).optional(),resources:tc({subscribe:Bs().optional(),listChanged:Bs().optional()}).optional(),tools:tc({listChanged:Bs().optional()}).optional(),tasks:sC.optional()}),fC=VS.extend({protocolVersion:J(),capabilities:dC,serverInfo:iC,instructions:J().optional()}),pC=BS.extend({method:gc(`notifications/initialized`),params:zS.optional()}),mC=e=>pC.safeParse(e).success,hC=RS.extend({method:gc(`ping`),params:FS.optional()}),gC=tc({progress:Is(),total:bc(Is()),message:bc(J())}),_C=tc({...zS.shape,...gC.shape,progressToken:AS}),vC=BS.extend({method:gc(`notifications/progress`),params:_C}),yC=FS.extend({cursor:jS.optional()}),bC=RS.extend({params:yC.optional()}),xC=VS.extend({nextCursor:jS.optional()}),SC=mc([`working`,`input_required`,`completed`,`failed`,`cancelled`]),CC=tc({taskId:J(),status:SC,ttl:ic([Is(),Gs()]),createdAt:J(),lastUpdatedAt:J(),pollInterval:bc(Is()),statusMessage:bc(J())}),wC=VS.extend({task:CC}),TC=zS.merge(CC),EC=BS.extend({method:gc(`notifications/tasks/status`),params:TC}),DC=RS.extend({method:gc(`tasks/get`),params:FS.extend({taskId:J()})}),OC=VS.merge(CC),kC=RS.extend({method:gc(`tasks/result`),params:FS.extend({taskId:J()})});VS.loose();const AC=bC.extend({method:gc(`tasks/list`)}),jC=xC.extend({tasks:$s(CC)}),MC=RS.extend({method:gc(`tasks/cancel`),params:FS.extend({taskId:J()})}),NC=VS.merge(CC),PC=tc({uri:J(),mimeType:bc(J()),_meta:fc(J(),Ys()).optional()}),FC=PC.extend({text:J()}),IC=J().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),LC=PC.extend({blob:IC}),RC=mc([`user`,`assistant`]),zC=tc({audience:$s(RC).optional(),priority:Is().min(0).max(1).optional(),lastModified:Wo({offset:!0}).optional()}),BC=tc({...rC.shape,...nC.shape,uri:J(),description:bc(J()),mimeType:bc(J()),annotations:zC.optional(),_meta:bc(nc({}))}),VC=tc({...rC.shape,...nC.shape,uriTemplate:J(),description:bc(J()),mimeType:bc(J()),annotations:zC.optional(),_meta:bc(nc({}))}),HC=bC.extend({method:gc(`resources/list`)}),UC=xC.extend({resources:$s(BC)}),WC=bC.extend({method:gc(`resources/templates/list`)}),GC=xC.extend({resourceTemplates:$s(VC)}),KC=FS.extend({uri:J()}),qC=KC,JC=RS.extend({method:gc(`resources/read`),params:qC}),YC=VS.extend({contents:$s(ic([FC,LC]))}),XC=BS.extend({method:gc(`notifications/resources/list_changed`),params:zS.optional()}),ZC=KC,QC=RS.extend({method:gc(`resources/subscribe`),params:ZC}),$C=KC,ew=RS.extend({method:gc(`resources/unsubscribe`),params:$C}),tw=zS.extend({uri:J()}),nw=BS.extend({method:gc(`notifications/resources/updated`),params:tw}),rw=tc({name:J(),description:bc(J()),required:bc(Bs())}),iw=tc({...rC.shape,...nC.shape,description:bc(J()),arguments:bc($s(rw)),_meta:bc(nc({}))}),aw=bC.extend({method:gc(`prompts/list`)}),ow=xC.extend({prompts:$s(iw)}),sw=FS.extend({name:J(),arguments:fc(J(),J()).optional()}),cw=RS.extend({method:gc(`prompts/get`),params:sw}),lw=tc({type:gc(`text`),text:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),uw=tc({type:gc(`image`),data:IC,mimeType:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),dw=tc({type:gc(`audio`),data:IC,mimeType:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),fw=tc({type:gc(`tool_use`),name:J(),id:J(),input:fc(J(),Ys()),_meta:fc(J(),Ys()).optional()}),pw=tc({type:gc(`resource`),resource:ic([FC,LC]),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),mw=ic([lw,uw,dw,BC.extend({type:gc(`resource_link`)}),pw]),hw=tc({role:RC,content:mw}),gw=VS.extend({description:J().optional(),messages:$s(hw)}),_w=BS.extend({method:gc(`notifications/prompts/list_changed`),params:zS.optional()}),vw=tc({title:J().optional(),readOnlyHint:Bs().optional(),destructiveHint:Bs().optional(),idempotentHint:Bs().optional(),openWorldHint:Bs().optional()}),yw=tc({taskSupport:mc([`required`,`optional`,`forbidden`]).optional()}),bw=tc({...rC.shape,...nC.shape,description:J().optional(),inputSchema:tc({type:gc(`object`),properties:fc(J(),kS).optional(),required:$s(J()).optional()}).catchall(Ys()),outputSchema:tc({type:gc(`object`),properties:fc(J(),kS).optional(),required:$s(J()).optional()}).catchall(Ys()).optional(),annotations:vw.optional(),execution:yw.optional(),_meta:fc(J(),Ys()).optional()}),xw=bC.extend({method:gc(`tools/list`)}),Sw=xC.extend({tools:$s(bw)}),Cw=VS.extend({content:$s(mw).default([]),structuredContent:fc(J(),Ys()).optional(),isError:Bs().optional()});Cw.or(VS.extend({toolResult:Ys()}));const ww=IS.extend({name:J(),arguments:fc(J(),Ys()).optional()}),Tw=RS.extend({method:gc(`tools/call`),params:ww}),Ew=BS.extend({method:gc(`notifications/tools/list_changed`),params:zS.optional()}),Dw=tc({autoRefresh:Bs().default(!0),debounceMs:Is().int().nonnegative().default(300)}),Ow=mc([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kw=FS.extend({level:Ow}),Aw=RS.extend({method:gc(`logging/setLevel`),params:kw}),jw=zS.extend({level:Ow,logger:J().optional(),data:Ys()}),Mw=BS.extend({method:gc(`notifications/message`),params:jw}),Nw=tc({hints:$s(tc({name:J().optional()})).optional(),costPriority:Is().min(0).max(1).optional(),speedPriority:Is().min(0).max(1).optional(),intelligencePriority:Is().min(0).max(1).optional()}),Pw=tc({mode:mc([`auto`,`required`,`none`]).optional()}),Fw=tc({type:gc(`tool_result`),toolUseId:J().describe(`The unique identifier for the corresponding tool call.`),content:$s(mw).default([]),structuredContent:tc({}).loose().optional(),isError:Bs().optional(),_meta:fc(J(),Ys()).optional()}),Iw=oc(`type`,[lw,uw,dw]),Lw=oc(`type`,[lw,uw,dw,fw,Fw]),Rw=tc({role:RC,content:ic([Lw,$s(Lw)]),_meta:fc(J(),Ys()).optional()}),zw=IS.extend({messages:$s(Rw),modelPreferences:Nw.optional(),systemPrompt:J().optional(),includeContext:mc([`none`,`thisServer`,`allServers`]).optional(),temperature:Is().optional(),maxTokens:Is().int(),stopSequences:$s(J()).optional(),metadata:kS.optional(),tools:$s(bw).optional(),toolChoice:Pw.optional()}),Bw=RS.extend({method:gc(`sampling/createMessage`),params:zw}),Vw=VS.extend({model:J(),stopReason:bc(mc([`endTurn`,`stopSequence`,`maxTokens`]).or(J())),role:RC,content:Iw}),Hw=VS.extend({model:J(),stopReason:bc(mc([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(J())),role:RC,content:ic([Lw,$s(Lw)])}),Uw=tc({type:gc(`boolean`),title:J().optional(),description:J().optional(),default:Bs().optional()}),Ww=tc({type:gc(`string`),title:J().optional(),description:J().optional(),minLength:Is().optional(),maxLength:Is().optional(),format:mc([`email`,`uri`,`date`,`date-time`]).optional(),default:J().optional()}),Gw=tc({type:mc([`number`,`integer`]),title:J().optional(),description:J().optional(),minimum:Is().optional(),maximum:Is().optional(),default:Is().optional()}),Kw=tc({type:gc(`string`),title:J().optional(),description:J().optional(),enum:$s(J()),default:J().optional()}),qw=tc({type:gc(`string`),title:J().optional(),description:J().optional(),oneOf:$s(tc({const:J(),title:J()})),default:J().optional()}),Jw=ic([ic([tc({type:gc(`string`),title:J().optional(),description:J().optional(),enum:$s(J()),enumNames:$s(J()).optional(),default:J().optional()}),ic([Kw,qw]),ic([tc({type:gc(`array`),title:J().optional(),description:J().optional(),minItems:Is().optional(),maxItems:Is().optional(),items:tc({type:gc(`string`),enum:$s(J())}),default:$s(J()).optional()}),tc({type:gc(`array`),title:J().optional(),description:J().optional(),minItems:Is().optional(),maxItems:Is().optional(),items:tc({anyOf:$s(tc({const:J(),title:J()}))}),default:$s(J()).optional()})])]),Uw,Ww,Gw]),Yw=ic([IS.extend({mode:gc(`form`).optional(),message:J(),requestedSchema:tc({type:gc(`object`),properties:fc(J(),Jw),required:$s(J()).optional()})}),IS.extend({mode:gc(`url`),message:J(),elicitationId:J(),url:J().url()})]),Xw=RS.extend({method:gc(`elicitation/create`),params:Yw}),Zw=zS.extend({elicitationId:J()}),Qw=BS.extend({method:gc(`notifications/elicitation/complete`),params:Zw}),$w=VS.extend({action:mc([`accept`,`decline`,`cancel`]),content:Vc(e=>e===null?void 0:e,fc(J(),ic([J(),Is(),Bs(),$s(J())])).optional())}),eT=tc({type:gc(`ref/resource`),uri:J()}),tT=tc({type:gc(`ref/prompt`),name:J()}),nT=FS.extend({ref:ic([tT,eT]),argument:tc({name:J(),value:J()}),context:tc({arguments:fc(J(),J()).optional()}).optional()}),rT=RS.extend({method:gc(`completion/complete`),params:nT}),iT=VS.extend({completion:nc({values:$s(J()).max(100),total:bc(Is().int()),hasMore:bc(Bs())})}),aT=tc({uri:J().startsWith(`file://`),name:J().optional(),_meta:fc(J(),Ys()).optional()}),oT=RS.extend({method:gc(`roots/list`),params:FS.optional()}),sT=VS.extend({roots:$s(aT)}),cT=BS.extend({method:gc(`notifications/roots/list_changed`),params:zS.optional()});ic([hC,uC,rT,Aw,cw,aw,HC,WC,JC,QC,ew,Tw,xw,DC,kC,AC,MC]),ic([tC,vC,pC,cT,EC]),ic([$S,Vw,Hw,$w,sT,OC,jC,wC]),ic([hC,Bw,Xw,oT,DC,kC,AC,MC]),ic([tC,vC,Mw,nw,XC,Ew,_w,EC,Qw]),ic([$S,fC,iT,gw,ow,UC,GC,YC,Cw,Sw,OC,jC,wC]);var lT=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===YS.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new uT(e.elicitations,n)}return new e(t,n,r)}},uT=class extends lT{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(YS.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function dT(e){return e===`completed`||e===`failed`||e===`cancelled`}function fT(e){let t=wS(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=TS(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function pT(e,t){let n=CS(e,t);if(!n.success)throw n.error;return n.data}var mT=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(tC,e=>{this._oncancel(e)}),this.setNotificationHandler(vC,e=>{this._onprogress(e)}),this.setRequestHandler(hC,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(DC,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new lT(YS.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(kC,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new lT(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new lT(YS.InvalidParams,`Task not found: ${r}`);if(!dT(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(dT(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[OS]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(AC,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new lT(YS.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(MC,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new lT(YS.InvalidParams,`Task not found: ${e.params.taskId}`);if(dT(n.status))throw new lT(YS.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new lT(YS.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof lT?e:new lT(YS.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),lT.fromError(YS.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),JS(e)||ZS(e)?this._onresponse(e):WS(e)?this._onrequest(e,t):KS(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=lT.fromError(YS.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[OS]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:YS.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=LS(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new lT(YS.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:YS.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),JS(e)?n(e):n(new lT(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(JS(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),JS(e)?r(e):r(lT.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof lT?e:new lT(YS.InternalError,String(e))}}return}let i;try{let r=await this.request(e,wC,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new lT(YS.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},dT(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new lT(YS.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new lT(YS.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof lT?e:new lT(YS.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[OS]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof lT?e:new lT(YS.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=CS(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(lT.fromError(YS.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},OC,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},jC,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},NC,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[OS]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[OS]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[OS]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=fT(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=pT(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=fT(e);this._notificationHandlers.set(n,n=>{let r=pT(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&WS(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new lT(YS.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new lT(YS.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new lT(YS.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new lT(YS.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=EC.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),dT(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new lT(YS.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(dT(a.status))throw new lT(YS.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=EC.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),dT(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function hT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gT(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];hT(a)&&hT(i)?n[r]={...a,...i}:n[r]=i}return n}var _T=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),vT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=_T();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),yT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=_T(),n=vT();var r=_T();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=vT();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
12475
+ `);break}}}}if(f===-1){let e=t.substring(0,200);throw Error(`Exact match not found for string: "${e}${t.length>200?`...`:``}"`)}let h=s.substring(0,l+f),g=0;if(n.length>0){let e=0;for(;(e=h.indexOf(n,e))!==-1;)g++,e+=n.length}let _=l+f,v=s.substring(0,_)+m+s.substring(_+p);return await F.writeFile(o,v,`utf-8`),{filePath:o,type:`str_replace`,oldStr:t,newStr:n,previousNewStrings:g}}async grep(e){let{query:t,folderExcludes:n=[],folderIncludes:r=[],offset:i=0,isCaseSensitive:a=!1,path:o,outputMode:s=`files_with_matches`,contextBefore:c,contextAfter:l,contextLines:d,showLineNumbers:f,fileType:p,headLimit:m,multiline:h=!1}=e,g=this.workspacePath,_=o?C.resolve(this.workspacePath,o):`.`,v=[`--hidden`,`--max-columns`,`500`,`--path-separator`,`/`];for(let e of _S)v.push(`--glob`,`!${e}`);if(h&&v.push(`-U`,`--multiline-dotall`),a||v.push(`-i`),s===`files_with_matches`?v.push(`--files-with-matches`):s===`count`&&v.push(`--count`),s===`content`){try{let e=await F.stat(_);(!o||e.isDirectory())&&v.push(`-H`)}catch{v.push(`-H`)}f!==!1&&v.push(`-n`),d===void 0?(c!==void 0&&v.push(`-B`,String(c)),l!==void 0&&v.push(`-A`,String(l))):v.push(`-C`,String(d))}p&&v.push(`--type`,p);for(let e of r)v.push(`-g`,e);for(let e of n)v.push(`-g`,`!${e}`);return v.push(`--`,t,_),new Promise(e=>{let t=u(ue,v,{cwd:g,stdio:[`ignore`,`pipe`,`pipe`]}),n=A({input:t.stdout}),r=[];n.on(`line`,e=>{r.push(e)}),t.on(`close`,async()=>{try{let t=r.length;if(s===`files_with_matches`){let n=[];for(let e=0;e<r.length;e+=64){let t=r.slice(e,e+64),i=await Promise.all(t.map(async e=>{let t=C.isAbsolute(e)?e:C.resolve(g,e);try{return{filePath:e,mtimeMs:(await F.stat(t)).mtimeMs}}catch{return{filePath:e,mtimeMs:0}}}));n.push(...i)}n.sort((e,t)=>{let n=t.mtimeMs-e.mtimeMs;return n===0?e.filePath.localeCompare(t.filePath):n});let a=n.map(e=>kl(e.filePath,g));if(a=a.slice(i),m){let n=a.length>m;a=a.slice(0,m),e({matches:a,metadata:{offset:i,limit:m,totalMatches:t,hasMore:n}})}else e({matches:a,metadata:{offset:i,limit:a.length,totalMatches:t,hasMore:!1}})}else{let n=r.map(e=>{if(e===`--`)return e;let t=vS.exec(e);return t?kl(t[1],g)+e.substring(t[1].length):e});if(n=n.slice(i),m){let r=n.length>m;n=n.slice(0,m),e({matches:n,metadata:{offset:i,limit:m,totalMatches:t,hasMore:r}})}else e({matches:n,metadata:{offset:i,limit:n.length,totalMatches:t,hasMore:!1}})}}catch{e({matches:[],metadata:{offset:i,limit:0,totalMatches:0,hasMore:!1}})}}),t.on(`error`,()=>{e({matches:[],metadata:{offset:i,limit:0,totalMatches:0,hasMore:!1}})})})}async grepFile(e){let{query:t,maxResults:n=100}=e;return(await fS(t,{root:this.workspacePath,maxResults:n,includeHidden:!1})).paths.slice(0,n).map(e=>kl(e,this.workspacePath))}async grepTextFile(e){let{query:t,maxResults:n=100}=e,r=await fS(t,{root:this.workspacePath,maxResults:n,includeHidden:!1}),i=[];for(let e of r.paths.slice(0,n))try{await sx(e)||i.push(kl(e,this.workspacePath))}catch{}return i}async glob(e){let t=this.workspacePath,n=e.path?C.resolve(t,e.path):t,r=await this.globViaGit(n,e.pattern,t);return r===null?this.globViaRipgrep(n,e.pattern,t):r}async globViaGit(e,t,n){try{if(!await this.runGitCmd([`rev-parse`,`--show-toplevel`],e))return null;let[r,i]=await Promise.all([this.runGitLines([`ls-files`],e),this.runGitLines([`ls-files`,`--others`,`--exclude-standard`],e)]),a=(0,pS.default)(t,{dot:!0}),o=[];for(let t of[...r,...i]){if(!t)continue;let r=C.resolve(e,t),i=C.relative(n,r).replace(/\\/g,`/`);(a(t)||a(i)||a(C.basename(t)))&&o.push(r)}return this.sortAndBuildResult(o,n)}catch{return null}}globViaRipgrep(e,t,n){let r=[`--files`,`--hidden`,`--path-separator`,`/`,`-g`,t];for(let e of _S)r.push(`--glob`,`!${e}`);return r.push(e),new Promise(e=>{let t=u(ue,r,{cwd:n,stdio:[`ignore`,`pipe`,`pipe`]}),i=A({input:t.stdout}),a=[];i.on(`line`,e=>{a.push(e)}),t.on(`close`,async()=>{try{e(await this.sortAndBuildResult(a,n))}catch{e({files:[],metadata:{totalFiles:0}})}}),t.on(`error`,()=>{e({files:[],metadata:{totalFiles:0}})})})}async sortAndBuildResult(e,t){let n=[];for(let r=0;r<e.length;r+=64){let i=e.slice(r,r+64),a=await Promise.all(i.map(async e=>{let n=C.isAbsolute(e)?e:C.resolve(t,e);try{return{filePath:e,mtimeMs:(await F.stat(n)).mtimeMs}}catch{return{filePath:e,mtimeMs:0}}}));n.push(...a)}n.sort((e,t)=>{let n=t.mtimeMs-e.mtimeMs;return n===0?e.filePath.localeCompare(t.filePath):n});let r=n.map(e=>kl(e.filePath,t));return{files:r,metadata:{totalFiles:r.length}}}runGitCmd(e,t){return new Promise((n,r)=>{let i=u(`git`,e,{cwd:t,stdio:[`ignore`,`pipe`,`pipe`]}),a=``;i.stdout.on(`data`,e=>a+=e.toString()),i.on(`close`,e=>e===0?n(a.trim()):r()),i.on(`error`,r)})}runGitLines(e,t){return new Promise(n=>{let r=[],i=u(`git`,e,{cwd:t,stdio:[`ignore`,`pipe`,`pipe`]});A({input:i.stdout}).on(`line`,e=>r.push(e.trim())),i.on(`close`,()=>n(r)),i.on(`error`,()=>n(r))})}};function SS(e){return!!e._zod}function CS(e,t){return SS(e)?jt(e,t):e.safeParse(t)}function wS(e){if(!e)return;let t;if(t=SS(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function TS(e){if(SS(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}const ES=`2025-11-25`,DS=[ES,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],OS=`io.modelcontextprotocol/related-task`,kS=Rc(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),AS=ic([J(),Is().int()]),jS=J();nc({ttl:ic([Is(),Gs()]).optional(),pollInterval:Is().optional()});const MS=tc({ttl:Is().optional()}),NS=tc({taskId:J()}),PS=nc({progressToken:AS.optional(),[OS]:NS.optional()}),FS=tc({_meta:PS.optional()}),IS=FS.extend({task:MS.optional()}),LS=e=>IS.safeParse(e).success,RS=tc({method:J(),params:FS.loose().optional()}),zS=tc({_meta:PS.optional()}),BS=tc({method:J(),params:zS.loose().optional()}),VS=nc({_meta:PS.optional()}),HS=ic([J(),Is().int()]),US=tc({jsonrpc:gc(`2.0`),id:HS,...RS.shape}).strict(),WS=e=>US.safeParse(e).success,GS=tc({jsonrpc:gc(`2.0`),...BS.shape}).strict(),KS=e=>GS.safeParse(e).success,qS=tc({jsonrpc:gc(`2.0`),id:HS,result:VS}).strict(),JS=e=>qS.safeParse(e).success;var YS;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(YS||={});const XS=tc({jsonrpc:gc(`2.0`),id:HS.optional(),error:tc({code:Is().int(),message:J(),data:Ys().optional()})}).strict(),ZS=e=>XS.safeParse(e).success,QS=ic([US,GS,qS,XS]);ic([qS,XS]);const $S=VS.strict(),eC=zS.extend({requestId:HS.optional(),reason:J().optional()}),tC=BS.extend({method:gc(`notifications/cancelled`),params:eC}),nC=tc({icons:$s(tc({src:J(),mimeType:J().optional(),sizes:$s(J()).optional(),theme:mc([`light`,`dark`]).optional()})).optional()}),rC=tc({name:J(),title:J().optional()}),iC=rC.extend({...rC.shape,...nC.shape,version:J(),websiteUrl:J().optional(),description:J().optional()}),aC=Vc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,cc(tc({form:cc(tc({applyDefaults:Bs().optional()}),fc(J(),Ys())).optional(),url:kS.optional()}),fc(J(),Ys()).optional())),oC=nc({list:kS.optional(),cancel:kS.optional(),requests:nc({sampling:nc({createMessage:kS.optional()}).optional(),elicitation:nc({create:kS.optional()}).optional()}).optional()}),sC=nc({list:kS.optional(),cancel:kS.optional(),requests:nc({tools:nc({call:kS.optional()}).optional()}).optional()}),cC=tc({experimental:fc(J(),kS).optional(),sampling:tc({context:kS.optional(),tools:kS.optional()}).optional(),elicitation:aC.optional(),roots:tc({listChanged:Bs().optional()}).optional(),tasks:oC.optional()}),lC=FS.extend({protocolVersion:J(),capabilities:cC,clientInfo:iC}),uC=RS.extend({method:gc(`initialize`),params:lC}),dC=tc({experimental:fc(J(),kS).optional(),logging:kS.optional(),completions:kS.optional(),prompts:tc({listChanged:Bs().optional()}).optional(),resources:tc({subscribe:Bs().optional(),listChanged:Bs().optional()}).optional(),tools:tc({listChanged:Bs().optional()}).optional(),tasks:sC.optional()}),fC=VS.extend({protocolVersion:J(),capabilities:dC,serverInfo:iC,instructions:J().optional()}),pC=BS.extend({method:gc(`notifications/initialized`),params:zS.optional()}),mC=e=>pC.safeParse(e).success,hC=RS.extend({method:gc(`ping`),params:FS.optional()}),gC=tc({progress:Is(),total:bc(Is()),message:bc(J())}),_C=tc({...zS.shape,...gC.shape,progressToken:AS}),vC=BS.extend({method:gc(`notifications/progress`),params:_C}),yC=FS.extend({cursor:jS.optional()}),bC=RS.extend({params:yC.optional()}),xC=VS.extend({nextCursor:jS.optional()}),SC=mc([`working`,`input_required`,`completed`,`failed`,`cancelled`]),CC=tc({taskId:J(),status:SC,ttl:ic([Is(),Gs()]),createdAt:J(),lastUpdatedAt:J(),pollInterval:bc(Is()),statusMessage:bc(J())}),wC=VS.extend({task:CC}),TC=zS.merge(CC),EC=BS.extend({method:gc(`notifications/tasks/status`),params:TC}),DC=RS.extend({method:gc(`tasks/get`),params:FS.extend({taskId:J()})}),OC=VS.merge(CC),kC=RS.extend({method:gc(`tasks/result`),params:FS.extend({taskId:J()})});VS.loose();const AC=bC.extend({method:gc(`tasks/list`)}),jC=xC.extend({tasks:$s(CC)}),MC=RS.extend({method:gc(`tasks/cancel`),params:FS.extend({taskId:J()})}),NC=VS.merge(CC),PC=tc({uri:J(),mimeType:bc(J()),_meta:fc(J(),Ys()).optional()}),FC=PC.extend({text:J()}),IC=J().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),LC=PC.extend({blob:IC}),RC=mc([`user`,`assistant`]),zC=tc({audience:$s(RC).optional(),priority:Is().min(0).max(1).optional(),lastModified:Wo({offset:!0}).optional()}),BC=tc({...rC.shape,...nC.shape,uri:J(),description:bc(J()),mimeType:bc(J()),annotations:zC.optional(),_meta:bc(nc({}))}),VC=tc({...rC.shape,...nC.shape,uriTemplate:J(),description:bc(J()),mimeType:bc(J()),annotations:zC.optional(),_meta:bc(nc({}))}),HC=bC.extend({method:gc(`resources/list`)}),UC=xC.extend({resources:$s(BC)}),WC=bC.extend({method:gc(`resources/templates/list`)}),GC=xC.extend({resourceTemplates:$s(VC)}),KC=FS.extend({uri:J()}),qC=KC,JC=RS.extend({method:gc(`resources/read`),params:qC}),YC=VS.extend({contents:$s(ic([FC,LC]))}),XC=BS.extend({method:gc(`notifications/resources/list_changed`),params:zS.optional()}),ZC=KC,QC=RS.extend({method:gc(`resources/subscribe`),params:ZC}),$C=KC,ew=RS.extend({method:gc(`resources/unsubscribe`),params:$C}),tw=zS.extend({uri:J()}),nw=BS.extend({method:gc(`notifications/resources/updated`),params:tw}),rw=tc({name:J(),description:bc(J()),required:bc(Bs())}),iw=tc({...rC.shape,...nC.shape,description:bc(J()),arguments:bc($s(rw)),_meta:bc(nc({}))}),aw=bC.extend({method:gc(`prompts/list`)}),ow=xC.extend({prompts:$s(iw)}),sw=FS.extend({name:J(),arguments:fc(J(),J()).optional()}),cw=RS.extend({method:gc(`prompts/get`),params:sw}),lw=tc({type:gc(`text`),text:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),uw=tc({type:gc(`image`),data:IC,mimeType:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),dw=tc({type:gc(`audio`),data:IC,mimeType:J(),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),fw=tc({type:gc(`tool_use`),name:J(),id:J(),input:fc(J(),Ys()),_meta:fc(J(),Ys()).optional()}),pw=tc({type:gc(`resource`),resource:ic([FC,LC]),annotations:zC.optional(),_meta:fc(J(),Ys()).optional()}),mw=ic([lw,uw,dw,BC.extend({type:gc(`resource_link`)}),pw]),hw=tc({role:RC,content:mw}),gw=VS.extend({description:J().optional(),messages:$s(hw)}),_w=BS.extend({method:gc(`notifications/prompts/list_changed`),params:zS.optional()}),vw=tc({title:J().optional(),readOnlyHint:Bs().optional(),destructiveHint:Bs().optional(),idempotentHint:Bs().optional(),openWorldHint:Bs().optional()}),yw=tc({taskSupport:mc([`required`,`optional`,`forbidden`]).optional()}),bw=tc({...rC.shape,...nC.shape,description:J().optional(),inputSchema:tc({type:gc(`object`),properties:fc(J(),kS).optional(),required:$s(J()).optional()}).catchall(Ys()),outputSchema:tc({type:gc(`object`),properties:fc(J(),kS).optional(),required:$s(J()).optional()}).catchall(Ys()).optional(),annotations:vw.optional(),execution:yw.optional(),_meta:fc(J(),Ys()).optional()}),xw=bC.extend({method:gc(`tools/list`)}),Sw=xC.extend({tools:$s(bw)}),Cw=VS.extend({content:$s(mw).default([]),structuredContent:fc(J(),Ys()).optional(),isError:Bs().optional()});Cw.or(VS.extend({toolResult:Ys()}));const ww=IS.extend({name:J(),arguments:fc(J(),Ys()).optional()}),Tw=RS.extend({method:gc(`tools/call`),params:ww}),Ew=BS.extend({method:gc(`notifications/tools/list_changed`),params:zS.optional()}),Dw=tc({autoRefresh:Bs().default(!0),debounceMs:Is().int().nonnegative().default(300)}),Ow=mc([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kw=FS.extend({level:Ow}),Aw=RS.extend({method:gc(`logging/setLevel`),params:kw}),jw=zS.extend({level:Ow,logger:J().optional(),data:Ys()}),Mw=BS.extend({method:gc(`notifications/message`),params:jw}),Nw=tc({hints:$s(tc({name:J().optional()})).optional(),costPriority:Is().min(0).max(1).optional(),speedPriority:Is().min(0).max(1).optional(),intelligencePriority:Is().min(0).max(1).optional()}),Pw=tc({mode:mc([`auto`,`required`,`none`]).optional()}),Fw=tc({type:gc(`tool_result`),toolUseId:J().describe(`The unique identifier for the corresponding tool call.`),content:$s(mw).default([]),structuredContent:tc({}).loose().optional(),isError:Bs().optional(),_meta:fc(J(),Ys()).optional()}),Iw=oc(`type`,[lw,uw,dw]),Lw=oc(`type`,[lw,uw,dw,fw,Fw]),Rw=tc({role:RC,content:ic([Lw,$s(Lw)]),_meta:fc(J(),Ys()).optional()}),zw=IS.extend({messages:$s(Rw),modelPreferences:Nw.optional(),systemPrompt:J().optional(),includeContext:mc([`none`,`thisServer`,`allServers`]).optional(),temperature:Is().optional(),maxTokens:Is().int(),stopSequences:$s(J()).optional(),metadata:kS.optional(),tools:$s(bw).optional(),toolChoice:Pw.optional()}),Bw=RS.extend({method:gc(`sampling/createMessage`),params:zw}),Vw=VS.extend({model:J(),stopReason:bc(mc([`endTurn`,`stopSequence`,`maxTokens`]).or(J())),role:RC,content:Iw}),Hw=VS.extend({model:J(),stopReason:bc(mc([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(J())),role:RC,content:ic([Lw,$s(Lw)])}),Uw=tc({type:gc(`boolean`),title:J().optional(),description:J().optional(),default:Bs().optional()}),Ww=tc({type:gc(`string`),title:J().optional(),description:J().optional(),minLength:Is().optional(),maxLength:Is().optional(),format:mc([`email`,`uri`,`date`,`date-time`]).optional(),default:J().optional()}),Gw=tc({type:mc([`number`,`integer`]),title:J().optional(),description:J().optional(),minimum:Is().optional(),maximum:Is().optional(),default:Is().optional()}),Kw=tc({type:gc(`string`),title:J().optional(),description:J().optional(),enum:$s(J()),default:J().optional()}),qw=tc({type:gc(`string`),title:J().optional(),description:J().optional(),oneOf:$s(tc({const:J(),title:J()})),default:J().optional()}),Jw=ic([ic([tc({type:gc(`string`),title:J().optional(),description:J().optional(),enum:$s(J()),enumNames:$s(J()).optional(),default:J().optional()}),ic([Kw,qw]),ic([tc({type:gc(`array`),title:J().optional(),description:J().optional(),minItems:Is().optional(),maxItems:Is().optional(),items:tc({type:gc(`string`),enum:$s(J())}),default:$s(J()).optional()}),tc({type:gc(`array`),title:J().optional(),description:J().optional(),minItems:Is().optional(),maxItems:Is().optional(),items:tc({anyOf:$s(tc({const:J(),title:J()}))}),default:$s(J()).optional()})])]),Uw,Ww,Gw]),Yw=ic([IS.extend({mode:gc(`form`).optional(),message:J(),requestedSchema:tc({type:gc(`object`),properties:fc(J(),Jw),required:$s(J()).optional()})}),IS.extend({mode:gc(`url`),message:J(),elicitationId:J(),url:J().url()})]),Xw=RS.extend({method:gc(`elicitation/create`),params:Yw}),Zw=zS.extend({elicitationId:J()}),Qw=BS.extend({method:gc(`notifications/elicitation/complete`),params:Zw}),$w=VS.extend({action:mc([`accept`,`decline`,`cancel`]),content:Vc(e=>e===null?void 0:e,fc(J(),ic([J(),Is(),Bs(),$s(J())])).optional())}),eT=tc({type:gc(`ref/resource`),uri:J()}),tT=tc({type:gc(`ref/prompt`),name:J()}),nT=FS.extend({ref:ic([tT,eT]),argument:tc({name:J(),value:J()}),context:tc({arguments:fc(J(),J()).optional()}).optional()}),rT=RS.extend({method:gc(`completion/complete`),params:nT}),iT=VS.extend({completion:nc({values:$s(J()).max(100),total:bc(Is().int()),hasMore:bc(Bs())})}),aT=tc({uri:J().startsWith(`file://`),name:J().optional(),_meta:fc(J(),Ys()).optional()}),oT=RS.extend({method:gc(`roots/list`),params:FS.optional()}),sT=VS.extend({roots:$s(aT)}),cT=BS.extend({method:gc(`notifications/roots/list_changed`),params:zS.optional()});ic([hC,uC,rT,Aw,cw,aw,HC,WC,JC,QC,ew,Tw,xw,DC,kC,AC,MC]),ic([tC,vC,pC,cT,EC]),ic([$S,Vw,Hw,$w,sT,OC,jC,wC]),ic([hC,Bw,Xw,oT,DC,kC,AC,MC]),ic([tC,vC,Mw,nw,XC,Ew,_w,EC,Qw]),ic([$S,fC,iT,gw,ow,UC,GC,YC,Cw,Sw,OC,jC,wC]);var lT=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===YS.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new uT(e.elicitations,n)}return new e(t,n,r)}},uT=class extends lT{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(YS.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function dT(e){return e===`completed`||e===`failed`||e===`cancelled`}function fT(e){let t=wS(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=TS(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function pT(e,t){let n=CS(e,t);if(!n.success)throw n.error;return n.data}var mT=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(tC,e=>{this._oncancel(e)}),this.setNotificationHandler(vC,e=>{this._onprogress(e)}),this.setRequestHandler(hC,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(DC,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new lT(YS.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(kC,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new lT(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new lT(YS.InvalidParams,`Task not found: ${r}`);if(!dT(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(dT(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[OS]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(AC,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new lT(YS.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(MC,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new lT(YS.InvalidParams,`Task not found: ${e.params.taskId}`);if(dT(n.status))throw new lT(YS.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new lT(YS.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof lT?e:new lT(YS.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),lT.fromError(YS.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),JS(e)||ZS(e)?this._onresponse(e):WS(e)?this._onrequest(e,t):KS(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=lT.fromError(YS.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[OS]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:YS.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=LS(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new lT(YS.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:YS.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),JS(e)?n(e):n(new lT(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(JS(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),JS(e)?r(e):r(lT.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof lT?e:new lT(YS.InternalError,String(e))}}return}let i;try{let r=await this.request(e,wC,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new lT(YS.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},dT(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new lT(YS.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new lT(YS.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof lT?e:new lT(YS.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[OS]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof lT?e:new lT(YS.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=CS(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(lT.fromError(YS.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},OC,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},jC,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},NC,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[OS]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[OS]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[OS]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=fT(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=pT(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=fT(e);this._notificationHandlers.set(n,n=>{let r=pT(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&WS(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new lT(YS.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new lT(YS.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new lT(YS.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new lT(YS.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=EC.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),dT(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new lT(YS.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(dT(a.status))throw new lT(YS.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=EC.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),dT(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function hT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gT(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];hT(a)&&hT(i)?n[r]={...a,...i}:n[r]=i}return n}var _T=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),vT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=_T();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),yT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=_T(),n=vT();var r=_T();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=vT();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
12476
12476
  `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;let M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;let P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),bT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=yT(),n=_T();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),xT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=yT();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),ST=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=yT(),n=bT(),r=xT();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),CT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=ST(),n=yT(),r=xT(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),wT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),TT=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),ET=W((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=wT(),n=TT(),r=ST(),i=yT(),a=bT();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
12477
12477
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
12478
12478
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
@@ -12504,7 +12504,7 @@ const cx={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
12504
12504
  `:`
12505
12505
  `)+n,i=r+1,r=e.indexOf(`
12506
12506
  `,i)}while(r!==-1);return a+=e.slice(i),a}const{stdout:CA,stderr:wA}=bA,TA=Symbol(`GENERATOR`),EA=Symbol(`STYLER`),DA=Symbol(`IS_EMPTY`),OA=[`ansi`,`ansi`,`ansi256`,`ansi16m`],kA=Object.create(null),AA=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=CA?CA.level:0;e.level=t.level===void 0?n:t.level},jA=e=>{let t=(...e)=>e.join(` `);return AA(t,e),Object.setPrototypeOf(t,MA.prototype),t};function MA(e){return jA(e)}Object.setPrototypeOf(MA.prototype,Function.prototype);for(let[e,t]of Object.entries(fA))kA[e]={get(){let n=IA(this,FA(t.open,t.close,this[EA]),this[DA]);return Object.defineProperty(this,e,{value:n}),n}};kA.visible={get(){let e=IA(this,this[EA],!0);return Object.defineProperty(this,`visible`,{value:e}),e}};const NA=(e,t,n,...r)=>e===`rgb`?t===`ansi16m`?fA[n].ansi16m(...r):t===`ansi256`?fA[n].ansi256(fA.rgbToAnsi256(...r)):fA[n].ansi(fA.rgbToAnsi(...r)):e===`hex`?NA(`rgb`,t,n,...fA.hexToRgb(...r)):fA[n][e](...r);for(let e of[`rgb`,`hex`,`ansi256`]){kA[e]={get(){let{level:t}=this;return function(...n){let r=FA(NA(e,OA[t],`color`,...n),fA.color.close,this[EA]);return IA(this,r,this[DA])}}};let t=`bg`+e[0].toUpperCase()+e.slice(1);kA[t]={get(){let{level:t}=this;return function(...n){let r=FA(NA(e,OA[t],`bgColor`,...n),fA.bgColor.close,this[EA]);return IA(this,r,this[DA])}}}}const PA=Object.defineProperties(()=>{},{...kA,level:{enumerable:!0,get(){return this[TA].level},set(e){this[TA].level=e}}}),FA=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},IA=(e,t,n)=>{let r=(...e)=>LA(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,PA),r[TA]=e,r[EA]=t,r[DA]=n,r},LA=(e,t)=>{if(e.level<=0||!t)return e[DA]?``:t;let n=e[EA];if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.includes(`\x1B`))for(;n!==void 0;)t=xA(t,n.close,n.open),n=n.parent;let a=t.indexOf(`
12507
- `);return a!==-1&&(t=SA(t,i,r,a)),r+t+i};Object.defineProperties(MA.prototype,kA);const RA=MA();MA({level:wA?wA.level:0});var zA=`2.0.0-canary.8`,BA=W(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),VA=W(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),HA=W(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=BA(),a=VA();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),UA=W(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),WA=W(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),GA=W(((e,t)=>{let n=VA(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=BA(),{safeRe:a,t:o}=HA(),s=UA(),{compareIdentifiers:c}=WA();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),KA=W(((e,t)=>{let n=GA();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),qA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),JA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),YA=W(((e,t)=>{let n=GA();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),XA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),ZA=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).major})),QA=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).minor})),$A=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).patch})),ej=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),tj=W(((e,t)=>{let n=GA();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),nj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(t,e,r)})),rj=W(((e,t)=>{let n=tj();t.exports=(e,t)=>n(e,t,!0)})),ij=W(((e,t)=>{let n=GA();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),aj=W(((e,t)=>{let n=ij();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),oj=W(((e,t)=>{let n=ij();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),sj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)>0})),cj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)<0})),lj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)===0})),uj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)!==0})),dj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)>=0})),fj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)<=0})),pj=W(((e,t)=>{let n=lj(),r=uj(),i=sj(),a=dj(),o=cj(),s=fj();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),mj=W(((e,t)=>{let n=GA(),r=KA(),{safeRe:i,t:a}=HA();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),hj=W(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),gj=W(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(hj()),i=UA(),a=_j(),o=VA(),s=GA(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=HA(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=BA(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),_j=W(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=UA(),{safeRe:i,t:a}=HA(),o=pj(),s=VA(),c=GA(),l=gj()})),vj=W(((e,t)=>{let n=gj();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),yj=W(((e,t)=>{let n=gj();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),bj=W(((e,t)=>{let n=GA(),r=gj();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),xj=W(((e,t)=>{let n=GA(),r=gj();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Sj=W(((e,t)=>{let n=GA(),r=gj(),i=sj();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Cj=W(((e,t)=>{let n=gj();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),wj=W(((e,t)=>{let n=GA(),r=_j(),{ANY:i}=r,a=gj(),o=vj(),s=sj(),c=cj(),l=fj(),u=dj();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Tj=W(((e,t)=>{let n=wj();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ej=W(((e,t)=>{let n=wj();t.exports=(e,t,r)=>n(e,t,`<`,r)})),Dj=W(((e,t)=>{let n=gj();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Oj=W(((e,t)=>{let n=vj(),r=tj();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),kj=W(((e,t)=>{let n=gj(),r=_j(),{ANY:i}=r,a=vj(),o=tj(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Aj=W(((e,t)=>{let n=HA(),r=BA(),i=GA(),a=WA();t.exports={parse:KA(),valid:qA(),clean:JA(),inc:YA(),diff:XA(),major:ZA(),minor:QA(),patch:$A(),prerelease:ej(),compare:tj(),rcompare:nj(),compareLoose:rj(),compareBuild:ij(),sort:aj(),rsort:oj(),gt:sj(),lt:cj(),eq:lj(),neq:uj(),gte:dj(),lte:fj(),cmp:pj(),coerce:mj(),Comparator:_j(),Range:gj(),satisfies:vj(),toComparators:yj(),maxSatisfying:bj(),minSatisfying:xj(),minVersion:Sj(),validRange:Cj(),outside:wj(),gtr:Tj(),ltr:Ej(),intersects:Dj(),simplifyRange:Oj(),subset:kj(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))();let jj=null;function Mj(e){let t=(0,Aj.prerelease)(e);return t&&t.length>0&&typeof t[0]==`string`?t[0]:`latest`}function Nj(){let e=process.env.npm_command;if(e===`exec`||e===`dlx`)return!0;let t=process.argv[1]??``;return!!/_npx[/\\]|[/\\]dlx[/\\]|\.cache[/\\]/.test(t)}function Pj(){let e=process.env.npm_config_user_agent;if(e){let t=e.split(`/`)[0];if(t===`yarn`||t===`pnpm`||t===`bun`||t===`npm`)return t}let t=process.argv[1]??``;return t.includes(`yarn`)?`yarn`:t.includes(`pnpm`)?`pnpm`:t.includes(`bun`)?`bun`:`npm`}async function Fj(e){let t=Date.now();if(jj&&t-jj.timestamp<6e4)return jj.tags;let n=await fetch(`https://registry.npmjs.org/${e}`,{signal:AbortSignal.timeout(1e4),headers:{accept:`application/json`}});if(!n.ok)throw Error(`Registry returned ${n.status}`);let r=(await n.json())[`dist-tags`]??{};return jj={tags:r,timestamp:t},r}async function Ij(e){let t=Mj(e),n=Pj(),r=Nj(),i=(await Fj(Ae.publishName))[t];return!i&&t!==`latest`||!i||i===e?null:{currentVersion:e,latestVersion:i,tag:t,packageManager:n,isEphemeral:r}}function Lj(){return`${ke.binName} upgrade`}function Rj(e){let t=`${Ae.publishName}@${e.tag}`;switch(e.packageManager){case`yarn`:return`yarn global add ${t}`;case`pnpm`:return`pnpm add -g ${t}`;case`bun`:return`bun add -g ${t}`;default:return`npm install -g ${t}`}}function zj(e){try{return l(Rj(e),{stdio:`pipe`}),!0}catch{return!1}}const Bj=C.join(r(),ke.configDirName,ke.logsDirName),Vj=C.join(Bj,`cli.log`);let Hj=!1;function Uj(){if(!Hj)try{g(Bj)||_(Bj,{recursive:!0}),Hj=!0}catch{}}function Wj(e){return e.length===0?``:` `+e.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}function Gj(e,t,n){Uj();let r=`[${new Date().toISOString()}] [${e}] ${t instanceof Error?`${t.message}${t.stack?`
12507
+ `);return a!==-1&&(t=SA(t,i,r,a)),r+t+i};Object.defineProperties(MA.prototype,kA);const RA=MA();MA({level:wA?wA.level:0});var zA=`2.0.0`,BA=W(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),VA=W(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),HA=W(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=BA(),a=VA();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),UA=W(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),WA=W(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),GA=W(((e,t)=>{let n=VA(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=BA(),{safeRe:a,t:o}=HA(),s=UA(),{compareIdentifiers:c}=WA();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),KA=W(((e,t)=>{let n=GA();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),qA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),JA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),YA=W(((e,t)=>{let n=GA();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),XA=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),ZA=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).major})),QA=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).minor})),$A=W(((e,t)=>{let n=GA();t.exports=(e,t)=>new n(e,t).patch})),ej=W(((e,t)=>{let n=KA();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),tj=W(((e,t)=>{let n=GA();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),nj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(t,e,r)})),rj=W(((e,t)=>{let n=tj();t.exports=(e,t)=>n(e,t,!0)})),ij=W(((e,t)=>{let n=GA();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),aj=W(((e,t)=>{let n=ij();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),oj=W(((e,t)=>{let n=ij();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),sj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)>0})),cj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)<0})),lj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)===0})),uj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)!==0})),dj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)>=0})),fj=W(((e,t)=>{let n=tj();t.exports=(e,t,r)=>n(e,t,r)<=0})),pj=W(((e,t)=>{let n=lj(),r=uj(),i=sj(),a=dj(),o=cj(),s=fj();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),mj=W(((e,t)=>{let n=GA(),r=KA(),{safeRe:i,t:a}=HA();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),hj=W(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),gj=W(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(hj()),i=UA(),a=_j(),o=VA(),s=GA(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=HA(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=BA(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),_j=W(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=UA(),{safeRe:i,t:a}=HA(),o=pj(),s=VA(),c=GA(),l=gj()})),vj=W(((e,t)=>{let n=gj();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),yj=W(((e,t)=>{let n=gj();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),bj=W(((e,t)=>{let n=GA(),r=gj();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),xj=W(((e,t)=>{let n=GA(),r=gj();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Sj=W(((e,t)=>{let n=GA(),r=gj(),i=sj();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Cj=W(((e,t)=>{let n=gj();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),wj=W(((e,t)=>{let n=GA(),r=_j(),{ANY:i}=r,a=gj(),o=vj(),s=sj(),c=cj(),l=fj(),u=dj();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Tj=W(((e,t)=>{let n=wj();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ej=W(((e,t)=>{let n=wj();t.exports=(e,t,r)=>n(e,t,`<`,r)})),Dj=W(((e,t)=>{let n=gj();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Oj=W(((e,t)=>{let n=vj(),r=tj();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),kj=W(((e,t)=>{let n=gj(),r=_j(),{ANY:i}=r,a=vj(),o=tj(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Aj=W(((e,t)=>{let n=HA(),r=BA(),i=GA(),a=WA();t.exports={parse:KA(),valid:qA(),clean:JA(),inc:YA(),diff:XA(),major:ZA(),minor:QA(),patch:$A(),prerelease:ej(),compare:tj(),rcompare:nj(),compareLoose:rj(),compareBuild:ij(),sort:aj(),rsort:oj(),gt:sj(),lt:cj(),eq:lj(),neq:uj(),gte:dj(),lte:fj(),cmp:pj(),coerce:mj(),Comparator:_j(),Range:gj(),satisfies:vj(),toComparators:yj(),maxSatisfying:bj(),minSatisfying:xj(),minVersion:Sj(),validRange:Cj(),outside:wj(),gtr:Tj(),ltr:Ej(),intersects:Dj(),simplifyRange:Oj(),subset:kj(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))();let jj=null;function Mj(e){let t=(0,Aj.prerelease)(e);return t&&t.length>0&&typeof t[0]==`string`?t[0]:`latest`}function Nj(){let e=process.env.npm_command;if(e===`exec`||e===`dlx`)return!0;let t=process.argv[1]??``;return!!/_npx[/\\]|[/\\]dlx[/\\]|\.cache[/\\]/.test(t)}function Pj(){let e=process.env.npm_config_user_agent;if(e){let t=e.split(`/`)[0];if(t===`yarn`||t===`pnpm`||t===`bun`||t===`npm`)return t}let t=process.argv[1]??``;return t.includes(`yarn`)?`yarn`:t.includes(`pnpm`)?`pnpm`:t.includes(`bun`)?`bun`:`npm`}async function Fj(e){let t=Date.now();if(jj&&t-jj.timestamp<6e4)return jj.tags;let n=await fetch(`https://registry.npmjs.org/${e}`,{signal:AbortSignal.timeout(1e4),headers:{accept:`application/json`}});if(!n.ok)throw Error(`Registry returned ${n.status}`);let r=(await n.json())[`dist-tags`]??{};return jj={tags:r,timestamp:t},r}async function Ij(e){let t=Mj(e),n=Pj(),r=Nj(),i=(await Fj(Ae.publishName))[t];return!i&&t!==`latest`||!i||i===e?null:{currentVersion:e,latestVersion:i,tag:t,packageManager:n,isEphemeral:r}}function Lj(){return`${ke.binName} upgrade`}function Rj(e){let t=`${Ae.publishName}@${e.tag}`;switch(e.packageManager){case`yarn`:return`yarn global add ${t}`;case`pnpm`:return`pnpm add -g ${t}`;case`bun`:return`bun add -g ${t}`;default:return`npm install -g ${t}`}}function zj(e){try{return l(Rj(e),{stdio:`pipe`}),!0}catch{return!1}}const Bj=C.join(r(),ke.configDirName,ke.logsDirName),Vj=C.join(Bj,`cli.log`);let Hj=!1;function Uj(){if(!Hj)try{g(Bj)||_(Bj,{recursive:!0}),Hj=!0}catch{}}function Wj(e){return e.length===0?``:` `+e.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}function Gj(e,t,n){Uj();let r=`[${new Date().toISOString()}] [${e}] ${t instanceof Error?`${t.message}${t.stack?`
12508
12508
  `+t.stack:``}`:String(t)}${Wj(n)}\n`;try{m(Vj,r)}catch{}}const Kj={error(e,...t){Gj(`ERROR`,e,t)},warn(e,...t){Gj(`WARN`,e,t)},info(e,...t){Gj(`INFO`,e,t)},debug(...e){Gj(`DEBUG`,e[0]??``,e.slice(1))},trace(e,...t){Gj(`TRACE`,e,t)}},qj=new Set,Jj=new Set,Yj=new Set;let Xj=!1,Zj=!1,Qj=null,$j;async function eM(e){let t=e.map(e=>new Promise(t=>{let n=`writableLength`in e?e.writableLength:0;if((`bufferSize`in e?e.bufferSize:n)===0){t();return}let r=e.write.bind(e),i=!1,a=()=>{let n=`writableLength`in e?e.writableLength:0;(`bufferSize`in e?e.bufferSize:n)===0&&!i&&(i=!0,e.write=r,t())};e.once(`drain`,a),e.write(``,`utf-8`,()=>{a()}),e.write=function(){return!1}}));await Promise.all(t)}async function tM(e,t,n,r){if(Xj)return;r?.debug?.(`Executing exit handlers`,{shouldManuallyExit:e,isSynchronous:t,signal:n,asyncCallbacks:qj.size,syncCallbacks:Jj.size}),Xj=!0,qj.size>0&&t&&console.error([`SYNCHRONOUS TERMINATION NOTICE:`,`When explicitly exiting the process via process.exit or via a parent process,`,`asynchronous tasks in your exitHooks will not run. Either remove these tasks,`,`use gracefulExit() instead of process.exit(), or ensure your parent process`,`sends a SIGINT to the process running this code.`].join(` `));let i=0;n>0?i=128+n:$j===void 0?(typeof U.exitCode==`number`||typeof U.exitCode==`string`)&&(i=Number(U.exitCode)):i=$j;let a=(t=!1)=>{(t||e)&&(Qj?Qj.call(U,i):U.exit(i))};for(let e of Jj)try{e(i)}catch(e){console.error(`Error in synchronous exit hook:`,e)}if(t){a();return}let o=[],s=0;for(let[e,t]of qj)s=Math.max(s,t),o.push(Promise.resolve(e(i)).catch(e=>{console.error(`Error in asynchronous exit hook:`,e)}));let c=Array.from(Yj);c.length>0&&o.push(eM(c));let l=setTimeout(()=>{a(!0)},s);try{await Promise.all(o),clearTimeout(l),a()}catch(e){clearTimeout(l),console.error(`Error during exit cleanup:`,e),a(!0)}}function nM(){Zj||(Zj=!0,U.once(`beforeExit`,()=>{tM(!0,!1,-128)}),U.once(`SIGINT`,()=>{tM(!0,!1,2)}),U.once(`SIGTERM`,()=>{tM(!0,!1,15)}),U.once(`exit`,()=>{tM(!1,!0,0)}),U.on(`message`,e=>{e===`shutdown`&&tM(!0,!0,-128)}),Qj||(Qj=U.exit.bind(U),U.exit=function(e){if($j===void 0&&($j=e??0),qj.size===0&&Yj.size===0){if(Qj){Qj(e??0);return}U.exit(e??0)}tM(!0,!1,-128).catch(e=>{console.error(`Error during exit:`,e),Qj?Qj(1):U.exit(1)})}))}function rM(e,t){if(typeof e!=`function`)throw TypeError(`callback must be a function`);if(Xj)throw Error(`Cannot install exit hook while exit handlers are running`);t?.logger?.debug?.(`Registering exit hook`,{wait:t?.wait,hasStreams:t?.streams!==void 0}),nM();let n=t?.wait??0,r=t?.streams??[U.stdout,U.stderr];if(n>0){let t=[e,n];qj.add(t);for(let e of r)Yj.add(e);return()=>{qj.delete(t);for(let e of r)Yj.delete(e)}}return Jj.add(e),()=>{Jj.delete(e)}}function iM(e){e!==void 0&&(U.exitCode=e),tM(!0,!1,-128)}async function aM(){let e=await rA.create();return{apiClient:new Oe(e,{error:(e,...t)=>Kj.error(e,...t),debug:(...e)=>Kj.debug(...e),warn:(e,...t)=>Kj.warn(e,...t)}),authManager:e}}function oM(e){process.stdout.write(JSON.stringify(e)+`
12509
12509
  `)}async function sM(e,t){if(!e.isAuthenticated()){try{if((await t.getUserInfo())?.result?.email)return}catch{}console.error(`Error: Not authenticated. Please set ${ke.envPrefix}API_KEY environment variable.`),console.error(`You can obtain your API key by visiting: https://abacus.ai/app/abacusai-cli`),console.error(`\nUsage: ${ke.envPrefix}API_KEY=your_key_here abacusai --print "your prompt"`),process.exit(1)}}function cM(e,t){let n=e=>{let n=e.toLowerCase();if(n===t)return 1e3;if(n.startsWith(t))return 900;let r=0,i=-1;for(let e of t){let t=n.indexOf(e,i+1);if(t===-1)return 0;r+=100-(t-i),i=t}return r+=Math.max(0,50-n.length),r},r=null,i=0;for(let t of e){let e=Math.max(n(t.name??``),n(t.llmName));e>i&&(i=e,r=t.llmName)}return i>=100?r:null}async function lM(e,t){let n=(await e.listLLMModels())?.result??[];return n.length||(console.error(`Error: No models available. Check your API key and connection.`),process.exit(1)),t?cM(n,t.toLowerCase())||(console.error(`Warning: Model "${t}" not found. Using default: ${n[0].llmName}`),n[0].llmName):n[0].llmName}async function uM(e,t){if(e?.resume)return e.resume;if(e?.continue)try{return((await t.getConversationsList(`CODE_LLM_AGENT`))?.result??[]).sort((e,t)=>{let n=e.lastEventCreatedAt?new Date(e.lastEventCreatedAt).getTime():0;return(t.lastEventCreatedAt?new Date(t.lastEventCreatedAt).getTime():0)-n})[0]?.deploymentConversationId}catch{}return e?.conversationId}async function dM({agentArgs:e}){let{apiClient:t,authManager:n}=await aM();Ij(zA).then(e=>{if(e){let t=e.isEphemeral?`\nUpdate available: ${e.currentVersion} → ${e.latestVersion} (${e.tag})\n`:`\nUpdate available: ${e.currentVersion} → ${e.latestVersion} (${e.tag}). Run: ${Lj()}\n`;process.stderr.write(t)}}).catch(()=>{}),await sM(n,t);let r=process.cwd(),i=new Gk({cwd:r});await i.load();let a=i.get(`baseUrl`);if(a){try{new URL(a)}catch{console.error(`Invalid baseUrl: ${a}`),process.exit(1)}t.setUrl(a),t.resetEndpoints(),await t.getApiEndpoint()}let o=e?.[`output-format`]??`text`,s=await lM(t,e?.model),c=xl.Yolo,l=e?.[`permission-mode`];if(l)switch(l){case`normal`:c=xl.Normal;break;case`accept-edits`:c=xl.AcceptEdits;break;case`plan`:c=xl.PlanMode;break;default:c=xl.Yolo;break}let u=new Lk({allowedDirectories:[r,...e?.[`add-dir`]?.map(e=>C.isAbsolute(e)?e:C.resolve(r,e))??[]],primaryWorkspace:r,apiClient:t,mode:c,model:s,permissionProvider:new Rk,config:i,isPrintMode:!0,enablePromptRewrite:!1,supportsThoughtStreaming:!0,cliAllowedTools:e?.[`allowed-tools`],cliDisallowedTools:e?.[`disallowed-tools`]});rM(async()=>{u.stop(),await new Promise(e=>setTimeout(e,200))},{wait:1e3});let d=await uM(e,t);d&&await u.loadConversation(d);let f=e?.prompt??``;process.env.DEEPAGENT_HIGH_QUALITY===`true`&&(f=`
12510
12510
  IMPORTANT INSTRUCTIONS: Your task is to follow the <task_description> EXACTLY and verify the solution within the FIXED TIME LIMIT.
@@ -12821,7 +12821,7 @@ $$`:`${e}$$`},D3=e=>T3(e)%2==0?e:E3(e),O3=(e,t,n)=>{if(e.substring(t+2).includes
12821
12821
  `);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(M3.test(i)&&!n.match(N3)){let t=r.split(`
12822
12822
  `).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(P3.test(i)&&!n.match(F3)){let t=r.split(`
12823
12823
  `).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},L3=e=>{let t=e.match(I4);if(t){let n=t[2];if(!n||L4.test(n))return e;let r=e.lastIndexOf(t[1]);if(w4(e,r)||D4(e,r))return e;if(e.match(W4)?.length%2==1)return`${e}~~`}else{let t=e.match(U4);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(w4(e,n)||D4(e,n))return e;if(e.match(W4)?.length%2==1)return`${e}~`}}return e},R3=e=>e!==!1,z3={COMPARISON_OPERATORS:-10,HTML_TAGS:-5,SETEXT_HEADINGS:0,LINKS:10,BOLD_ITALIC:20,BOLD:30,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,DEFAULT:100},B3=[{handler:{name:`comparisonOperators`,handle:k4,priority:z3.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:b3,priority:z3.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:I3,priority:z3.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:j3,priority:z3.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)},{handler:{name:`boldItalic`,handle:v3,priority:z3.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:s3,priority:z3.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:l3,priority:z3.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:d3,priority:z3.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:h3,priority:z3.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:C3,priority:z3.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:L3,priority:z3.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:D3,priority:z3.KATEX},optionKey:`katex`}],V3=e=>{let t=e?.linkMode??`protocol`;return B3.filter(({handler:t,optionKey:n})=>t.name===`links`?R3(e?.links)||R3(e?.images):R3(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:C4(S4({},e),{handle:e=>j3(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},H3=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=V3(t),i=(t?.handlers??[]).map(e=>({handler:C4(S4({},e),{priority:e.priority??z3.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n};function U3(e){if(!e)return!1;let t=e.toLowerCase().trim();return t===`mermaid`||t===`mmd`}function W3(e){try{return ZV(e)}catch{return null}}function G3({children:e,language:t}){if(U3(t)){let t=W3(e||``);if(t!==null)return(0,X.jsx)(Q,{paddingX:1,flexDirection:`row`,alignSelf:`flex-start`,children:(0,X.jsx)($,{children:t})})}let n=e;if(t&&(0,NK.supportsLanguage)(t))try{n=(0,NK.highlight)(e||``,{language:t})}catch{}return(0,X.jsx)(Q,{paddingX:1,flexDirection:`row`,alignSelf:`flex-start`,children:(0,X.jsx)($,{children:n})})}G3.displayName=`CodeBlock`;function K3({href:e,children:t}){let{colors:n}=UL(),r=`\x1b]8;;${e}\x07`;return(0,X.jsx)($,{color:n.link,underline:!0,transform:e=>`${r}${e}]8;;`,children:t})}K3.displayName=`Link`;function q3(e){return`text`in e&&typeof e.text==`string`?e.text:`tokens`in e&&Array.isArray(e.tokens)?e.tokens.map(e=>q3(e)).join(``):``}function J3(e){return`checked`in e&&typeof e.checked==`boolean`}function Y3(e,t,n=!1){return e?e.map((e,r)=>(0,X.jsx)(Z.Fragment,{children:X3(e,t,n)},r)):null}function X3(e,t,n=!1){let r=e=>n?(0,X.jsx)($,{dimColor:!0,italic:!0,children:e}):e;switch(e.type){case`strong`:return(0,X.jsx)($,{bold:!0,children:Y3(e.tokens,t,n)});case`em`:return(0,X.jsx)($,{italic:!0,children:Y3(e.tokens,t,n)});case`del`:return(0,X.jsx)($,{strikethrough:!0,children:Y3(e.tokens,t,n)});case`codespan`:return r((0,X.jsx)($,{color:t.primary,dimColor:!0,children:e.text}));case`link`:return r((0,X.jsx)(K3,{href:e.href,children:q3(e)}));case`image`:{let t=e,n=t.text||t.href;return r((0,X.jsxs)($,{dimColor:!0,children:[n,` `,t.href!==n&&`(${t.href})`]}))}case`checkbox`:{let n=J3(e)&&e.checked===!0;return r((0,X.jsx)($,{color:t.secondary,children:n?`[✓]`:`[ ]`}))}case`text`:return e.tokens?Y3(e.tokens,t,n):r(e.text);case`br`:return`
12824
- `;default:return r(q3(e))}}function Z3(e,t,n=0,r=!1){switch(e.type){case`heading`:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{bold:!0,color:e.depth<=2?t.primary:t.secondary,dimColor:e.depth>2,children:Y3(e.tokens,t,r)})},`heading-${e.depth}`);case`paragraph`:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{children:Y3(e.tokens,t,r)})},`paragraph`);case`code`:return(0,X.jsx)(G3,{language:e.lang,children:e.text},`code`);case`blockquote`:return(0,X.jsx)(Q,{borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`double`,borderColor:t.border,paddingLeft:1,flexDirection:`column`,children:e.tokens?.map((e,r)=>(0,X.jsx)(Q,{children:Z3(e,t,n,!0)},r))},`blockquote`);case`list`:return(0,X.jsx)(Q,{flexDirection:`column`,children:e.items.map((i,a)=>{let o=e.ordered?(Number(e.start)||1)+a:null,s=i.task===!0,c=i.checked===!0,l=i.tokens?.filter(e=>e.type!==`checkbox`)||[];return(0,X.jsxs)(Q,{flexDirection:`row`,children:[(0,X.jsx)($,{color:t.secondary,dimColor:!0,children:s?c?`[✓] `:`[ ] `:o===null?`• `:`${o}. `}),(0,X.jsx)(Q,{flexGrow:1,flexDirection:`column`,children:l.map((e,i)=>(0,X.jsx)(Q,{children:Z3(e,t,n+1,r)},i))})]},a)})},`list`);case`table`:{let n=e,i=n.header.map((e,t)=>{let r=q3(e).length;for(let e of n.rows)r=Math.max(r,q3(e[t]).length);return Math.max(r,3)});return(0,X.jsxs)(Q,{flexDirection:`column`,children:[(0,X.jsx)(Q,{flexDirection:`row`,borderTop:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,borderColor:t.border,alignSelf:`flex-start`,children:n.header.map((e,a)=>{let o=n.align?.[a]||null;return(0,X.jsx)(Q,{width:i[a]+2,paddingX:1,justifyContent:o===`center`?`center`:o===`right`?`flex-end`:`flex-start`,children:(0,X.jsx)($,{bold:!0,color:t.primary,children:Y3(e.tokens,t,r)})},a)})}),n.rows.map((e,a)=>(0,X.jsx)(Q,{flexDirection:`row`,children:e.map((e,a)=>{let o=n.align?.[a]||null;return(0,X.jsx)(Q,{width:i[a]+2,paddingX:1,justifyContent:o===`center`?`center`:o===`right`?`flex-end`:`flex-start`,children:(0,X.jsx)($,{children:Y3(e.tokens,t,r)})},a)})},a))]},`table`)}case`hr`:return(0,X.jsx)(Q,{children:(0,X.jsx)($,{dimColor:!0,children:`─`.repeat(50)})},`hr`);case`space`:return null;default:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{children:X3(e,t,r)})})}}function Q3({children:e}){let{colors:t}=UL(),n=(0,Z.useDeferredValue)(e),r=e!==n,i=(0,Z.useMemo)(()=>{try{let e=H3(n);return m4.lexer(e,{gfm:!0,breaks:!0})}catch{return[]}},[n]),a=(0,Z.useMemo)(()=>{let e=[],n=i.length;return i.forEach((r,i)=>{let a=i===n-1;if(r.type===`space`){e.push((0,X.jsx)(Q,{height:1},`space-${i}`));return}e.push((0,X.jsx)(Q,{flexDirection:`column`,children:Z3(r,t)},i)),r.type===`heading`&&!a&&e.push((0,X.jsx)(Q,{height:1},`heading-space-${i}`))}),e},[i,t]);return(0,X.jsxs)(Q,{flexDirection:`column`,children:[r&&(0,X.jsx)(Q,{children:(0,X.jsx)($,{dimColor:!0,children:`Rendering markdown...`})}),a]})}Q3.displayName=`Markdown`;const $3=`baking.beaming.booping.bouncing.brewing.bubbling.chasing.churning.coalescing.conjuring.cooking.crafting.crunching.cuddling.dancing.dazzling.discovering.doodling.dreaming.drifting.enchanting.exploring.finding.floating.fluttering.foraging.forging.frolicking.gathering.giggling.gliding.greeting.growing.hatching.herding.honking.hopping.hugging.humming.imagining.inventing.jingling.juggling.jumping.kindling.knitting.launching.leaping.mapping.marinating.meandering.mixing.moseying.munching.napping.nibbling.noodling.orbiting.painting.percolating.petting.plotting.pondering.popping.prancing.purring.puzzling.questing.riding.roaming.rolling.sauteeing.scribbling.seeking.shimmying.singing.skipping.sleeping.snacking.sniffing.snuggling.soaring.sparking.spinning.splashing.sprouting.squishing.stargazing.stirring.strolling.swimming.swinging.tickling.tinkering.toasting.tumbling.twirling.waddling.wandering.watching.weaving.whistling.wibbling.wiggling.wishing.wobbling.wondering.yawning.zooming.adventuring.assembling.ballooning.befriending.blinking.blossoming.browsing.burrowing.capering.cartwheeling.celebrating.charging.cheering.chuckling.clambering.clapping.climbing.confettifying.connecting.contemplating.cuddling.curating.dabbling.daydreaming.delighting.detecting.doodling.doodling.drizzling.echoing.edging.elucidating.fiddling.flapping.flickering.flipping.formulating.gallivanting.gamboling.gesticulating.harmonizing.hiding.hitchhiking.hopping.illuminating.investigating.jamming.kaleidoscoping.leapfrogging.levitating.listening.lounging.marveling.mimicking.murmuring.mystifying.narrating.nestling.nuzzling.orchestrating.peeking.perambulating.perusing.pirouetting.plopping.poking.prepping.processing.purring.questing.quipping.quizzing.rambling.relishing.reveling.romping.scampering.scanning.scheming.scribbling.shuffling.skedaddling.snoozing.snuggling.spinning.squeaking.squirming.stalking.star-jumping.strolling.swirling.tapping.tasting.tiptoeing.toddling.traversing.tripping.tuning.unfolding.unraveling.updating.vibing.wandering.whirling.whizzing.wiggling.winking.wobbling.wondering.yodeling.yondering.zipping.zizzling.zoning`.split(`.`);function e6(e){return e.charAt(0).toUpperCase()+e.slice(1)}function t6(){return $3[Math.floor(Math.random()*$3.length)]}var n6=class{startTime;constructor(){this.startTime=performance.now()}getElapsedSeconds(){return(performance.now()-this.startTime)/1e3}getElapsedMs(){return performance.now()-this.startTime}getFormattedDuration(){return r6(this.getElapsedMs())}reset(){this.startTime=performance.now()}};function r6(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),(i>0||a.length===0)&&a.push(`${i}s`),a.join(` `)}function i6(e){let t=uQ[e.name];if(!t)return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsxs)($,{color:`red`,children:[`Unknown tool: `,e.name]})});let n;n=e.result?.rejected?(()=>{try{return JSON.parse(e.result.content)}catch{return{}}})().reason===`interrupted`?`interrupted`:`rejected`:e.result?`success`:e.parsedResult?.phase===`error`?`error`:`executing`;let r=e.input??{},i=``;try{i=t.getHeaderParams(r)}catch{}try{return t.renderUI(r,n,e.parsedResult,e.displayData)}catch(n){let r=n instanceof Error?n.message:String(n);return console.error(`Error rendering tool ${e.name}:`,r),(0,X.jsxs)(Q,{flexDirection:`column`,children:[(0,X.jsx)(zK,{name:t.displayName,params:i,status:`error`}),(0,X.jsx)(BK,{color:`red`,children:`Error rendering tool`})]})}}const a6=(0,Z.memo)(({char:e,color:t})=>{let[n,r]=(0,Z.useState)(!0);return(0,Z.useEffect)(()=>{let e=setInterval(()=>{(0,Z.startTransition)(()=>{r(e=>!e)})},500);return()=>clearInterval(e)},[]),(0,X.jsx)($,{color:t,children:n?e:` `})});a6.displayName=`BlinkingIndicator`;const o6=(0,Z.memo)(e=>{let{type:t,segment:n,isSpinny:r=!1,source:i}=e;if(t!==`text`)throw Error(`Can only render text segments, got ${t}`);let a=(0,Z.useMemo)(()=>KQ(n),[n]);return a?.trim()?i===`user`?(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:`white`,children:`❯`}),(0,X.jsx)($,{dimColor:!0,italic:!0,children:a})]}):r?(0,X.jsx)(Q,{flexDirection:`row`,alignItems:`center`,gap:1,children:(0,X.jsx)(S1,{text:a})}):(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:`white`,children:`⏺`}),(0,X.jsx)(Q3,{children:a.trimStart()})]})}):null});o6.displayName=`TextSegment`;const s6=(0,Z.memo)(e=>{let{segment:t,thinkingStartTime:n,thinkingEndTime:r}=e,{colors:i}=UL(),a=(0,Z.useMemo)(()=>KQ(t),[t]),o=(0,Z.useMemo)(()=>n&&r?`thought for ${r6(r-n)}`:null,[n,r]);return(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,alignItems:`flex-start`,children:[(0,X.jsx)($,{color:i.textSubtle,children:`✳`}),(0,X.jsxs)(Q,{flexDirection:`column`,gap:0,children:[o&&(0,X.jsxs)($,{dimColor:!0,children:[`(`,o,`)`]}),a&&(0,X.jsx)($,{color:i.textSubtle,wrap:`wrap`,children:a})]})]})});s6.displayName=`ExpandedThinkingSegment`;const c6=5e3,l6=(0,Z.memo)(e=>{let{isSpinny:t=!1,thinkingStartTime:n,thinkingEndTime:r}=e,[i,a]=(0,Z.useState)(performance.now()),[o,s]=(0,Z.useState)(!1);if((0,Z.useEffect)(()=>{if(!t||!n)return;let e=setInterval(()=>{(0,Z.startTransition)(()=>a(performance.now()))},1e3);return()=>clearInterval(e)},[t,n]),(0,Z.useEffect)(()=>{if(t||!r)return;let e=setTimeout(()=>s(!0),2e3);return()=>clearTimeout(e)},[t,r]),o)return null;let c=(0,Z.useMemo)(()=>{if(t){if(!n)return`thinking...`;let e=i-n;return e<c6?`thinking...`:`thinking for ${r6(e)}`}if(n&&r){let e=r-n;return e<c6?`thought`:`thought for ${r6(e)}`}return`thinking...`},[n,r,t,i]);return(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,alignItems:`flex-start`,children:[t?(0,X.jsx)(a6,{char:`●`,color:`cyan`}):(0,X.jsx)($,{color:`green`,children:`●`}),(0,X.jsx)($,{dimColor:!0,children:c})]})});l6.displayName=`ThinkingSegment`;const u6=(0,Z.memo)(e=>{let{toolUseRequest:t,toolUseResult:n,toolDisplayData:r,parsedResult:i}=e;return t?Array.isArray(t)?(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>(0,X.jsx)(i6,{...e,result:n,displayData:r,parsedResult:i},e.id??t))}):(0,X.jsx)(i6,{...t,result:n,displayData:r,parsedResult:i}):null});u6.displayName=`ToolCallSegment`;const d6=(0,Z.memo)(e=>{let{type:t,segment:n,title:r,isSpinny:i=!1}=e,{colors:a}=UL(),o=(0,Z.useRef)(t6());if(t!==`collapsible_component`)throw Error(`Can only render collapsible component segments, got ${t}`);let s=(0,Z.useMemo)(()=>KQ(n),[n]);if(!s&&!r)throw Error(`Collapsible component segment must have content or title`);let c=r||e6(o.current);return(0,X.jsxs)(Q,{borderStyle:s?`single`:void 0,borderColor:a.border,flexDirection:`column`,alignItems:`flex-start`,gap:1,children:[c&&(0,X.jsx)(Q,{flexDirection:`row`,alignItems:`center`,gap:1,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(S1,{text:`${c}...`}),(0,X.jsx)($,{dimColor:!0,children:`(esc to interrupt)`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{children:` `}),(0,X.jsx)($,{color:a.textMuted,children:c})]})}),s&&(0,X.jsx)(Q3,{children:s})]})});d6.displayName=`CollapsibleComponentSegment`;const f6=(0,Z.memo)(e=>{let{type:t,message:n,severity:r=`info`,actions:i,flashKey:a}=e,{colors:o}=UL();if(t!==`code_llm_notification`)throw Error(`Can only render notification segments, got ${t}`);let[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(a);if((0,Z.useEffect)(()=>{if(a!==l.current&&a!=null){l.current=a,c(!0);let e=setTimeout(()=>c(!1),600);return()=>clearTimeout(e)}},[a]),!n)throw Error(`Notification segment must have message`);let u=(0,Z.useMemo)(()=>r===`info`||r===`success`||r===`error`||r===`warning`?r:`info`,[r]),d=(0,Z.useMemo)(()=>{switch(u){case`info`:return o.info;case`success`:return o.success;case`warning`:return o.warning;case`error`:return o.error;default:return o.info}},[u,o]),f=e=>e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().split(` `).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `),p=(0,Z.useMemo)(()=>(i||[]).filter(e=>e.link),[i]);return(0,X.jsxs)(Q,{flexDirection:`column`,gap:0,children:[(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:d,children:s?`◉`:`●`}),(0,X.jsx)($,{color:d,bold:s,inverse:s,children:s?` ${n} `:n})]}),p.length>0&&(0,X.jsx)(Q,{marginLeft:2,flexDirection:`row`,gap:1,children:p.map((e,t)=>(0,X.jsxs)(Z.Fragment,{children:[t>0&&(0,X.jsx)($,{children:` | `}),(0,X.jsx)($,{color:`cyan`,underline:!0,children:f(e.type)})]},t))})]})});f6.displayName=`NotificationSegment`;const p6=(0,Z.memo)(({segment:e})=>{switch(e.type){case`text`:return(0,X.jsx)(o6,{...e});case`thinking`:return(0,X.jsx)(l6,{...e});case`code_llm_tool_call`:return(0,X.jsx)(u6,{...e});case`collapsible_component`:return(0,X.jsx)(d6,{...e});case`code_llm_agent_tool_request`:return(0,X.jsx)(u6,{...e});case`code_llm_notification`:return(0,X.jsx)(f6,{...e});default:return null}});p6.displayName=`SegmentBase`;function m6(e,t){return(0,X.jsx)(f6,{id:`error-fallback`,status:`completed`,source:`bot`,type:`code_llm_notification`,message:e.message,severity:`error`})}function h6({segment:e}){return(0,X.jsx)(P0,{fallback:m6,children:(0,X.jsx)(p6,{segment:e})})}const g6=(0,Z.memo)(({snapshot:e,onClose:t})=>{let{colors:n}=UL();return fI((e,n)=>{(n.ctrl||n.super)&&e===`o`&&t(),n.escape&&t()}),(0,X.jsxs)(Q,{flexDirection:`column`,gap:1,children:[(0,X.jsx)(Q,{flexDirection:`column`,gap:1,paddingBottom:1,width:`95%`,children:(0,Z.useMemo)(()=>e.filter(e=>!e.temp&&!e.isSpinny),[e]).map(e=>(0,X.jsx)(_6,{segment:e},e.id))}),(0,X.jsxs)(Q,{borderStyle:`single`,borderColor:n.border,paddingLeft:1,paddingRight:1,flexDirection:`row`,gap:2,children:[(0,X.jsx)($,{color:n.textMuted,children:`expanded view`}),(0,X.jsx)($,{dimColor:!0,children:`ctrl+o or esc to collapse`})]})]})});g6.displayName=`ExpandedView`;const _6=(0,Z.memo)(({segment:e})=>e.type===`thinking`?(0,X.jsx)(s6,{...e}):(0,X.jsx)(h6,{segment:e}));_6.displayName=`ExpandedSegment`;var v6=W(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.tinycolor=r())})(e,(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=/^\s+/,n=/\s+$/;function r(e,t){if(e||=``,t||={},e instanceof r)return e;if(!(this instanceof r))return new r(e,t);var n=i(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4;return .2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=O(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=c(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=c(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=o(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=o(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?`hsl(`+t+`, `+n+`%, `+r+`%)`:`hsla(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHex:function(e){return u(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return d(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return`#`+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?`rgb(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`)`:`rgba(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`, `+this._roundA+`)`},toPercentageRgb:function(){return{r:Math.round(k(this._r,255)*100)+`%`,g:Math.round(k(this._g,255)*100)+`%`,b:Math.round(k(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(k(this._r,255)*100)+`%, `+Math.round(k(this._g,255)*100)+`%, `+Math.round(k(this._b,255)*100)+`%)`:`rgba(`+Math.round(k(this._r,255)*100)+`%, `+Math.round(k(this._g,255)*100)+`%, `+Math.round(k(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:E[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+f(this._r,this._g,this._b,this._a),n=t,i=this._gradientType?`GradientType = 1, `:``;if(e){var a=r(e);n=`#`+f(a._r,a._g,a._b,a._a)}return`progid:DXImageTransform.Microsoft.gradient(`+i+`startColorstr=`+t+`,endColorstr=`+n+`)`},toString:function(e){var t=!!e;e||=this._format;var n=!1,r=this._a<1&&this._a>=0;return!t&&r&&(e===`hex`||e===`hex6`||e===`hex3`||e===`hex4`||e===`hex8`||e===`name`)?e===`name`&&this._a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(h,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(w,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(x,[3])},tetrad:function(){return this._applyCombination(x,[4])}},r.fromRatio=function(t,n){if(e(t)==`object`){var i={};for(var a in t)t.hasOwnProperty(a)&&(a===`a`?i[a]=t[a]:i[a]=F(t[a]));t=i}return r(t,n)};function i(t){var n={r:0,g:0,b:0},r=1,i=null,o=null,c=null,u=!1,d=!1;return typeof t==`string`&&(t=B(t)),e(t)==`object`&&(z(t.r)&&z(t.g)&&z(t.b)?(n=a(t.r,t.g,t.b),u=!0,d=String(t.r).substr(-1)===`%`?`prgb`:`rgb`):z(t.h)&&z(t.s)&&z(t.v)?(i=F(t.s),o=F(t.v),n=l(t.h,i,o),u=!0,d=`hsv`):z(t.h)&&z(t.s)&&z(t.l)&&(i=F(t.s),c=F(t.l),n=s(t.h,i,c),u=!0,d=`hsl`),t.hasOwnProperty(`a`)&&(r=t.a)),r=O(r),{ok:u,format:t.format||d,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function a(e,t,n){return{r:k(e,255)*255,g:k(t,255)*255,b:k(n,255)*255}}function o(e,t,n){e=k(e,255),t=k(t,255),n=k(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r==i)a=o=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,l:s}}function s(e,t,n){var r,i,a;e=k(e,360),t=k(t,100),n=k(n,100);function o(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(t===0)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function c(e,t,n){e=k(e,255),t=k(t,255),n=k(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=r,c=r-i;if(o=r===0?0:c/r,r==i)a=0;else{switch(r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,v:s}}function l(e,t,n){e=k(e,360)*6,t=k(t,100),n=k(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function u(e,t,n,r){var i=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function d(e,t,n,r,i){var a=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16)),P(I(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function f(e,t,n,r){return[P(I(r)),P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16))].join(``)}r.equals=function(e,t){return!e||!t?!1:r(e).toRgbString()==r(t).toRgbString()},r.random=function(){return r.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function p(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.s-=t/100,n.s=A(n.s),r(n)}function m(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.s+=t/100,n.s=A(n.s),r(n)}function h(e){return r(e).desaturate(100)}function g(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.l+=t/100,n.l=A(n.l),r(n)}function _(e,t){t=t===0?0:t||10;var n=r(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),r(n)}function v(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.l-=t/100,n.l=A(n.l),r(n)}function y(e,t){var n=r(e).toHsl(),i=(n.h+t)%360;return n.h=i<0?360+i:i,r(n)}function b(e){var t=r(e).toHsl();return t.h=(t.h+180)%360,r(t)}function x(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=r(e).toHsl(),i=[r(e)],a=360/t,o=1;o<t;o++)i.push(r({h:(n.h+o*a)%360,s:n.s,l:n.l}));return i}function S(e){var t=r(e).toHsl(),n=t.h;return[r(e),r({h:(n+72)%360,s:t.s,l:t.l}),r({h:(n+216)%360,s:t.s,l:t.l})]}function C(e,t,n){t||=6,n||=30;var i=r(e).toHsl(),a=360/n,o=[r(e)];for(i.h=(i.h-(a*t>>1)+720)%360;--t;)i.h=(i.h+a)%360,o.push(r(i));return o}function w(e,t){t||=6;for(var n=r(e).toHsv(),i=n.h,a=n.s,o=n.v,s=[],c=1/t;t--;)s.push(r({h:i,s:a,v:o})),o=(o+c)%1;return s}r.mix=function(e,t,n){n=n===0?0:n||50;var i=r(e).toRgb(),a=r(t).toRgb(),o=n/100;return r({r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a})},r.readability=function(e,t){var n=r(e),i=r(t);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},r.isReadable=function(e,t,n){var i=r.readability(e,t),a,o=!1;switch(a=V(n),a.level+a.size){case`AAsmall`:case`AAAlarge`:o=i>=4.5;break;case`AAlarge`:o=i>=3;break;case`AAAsmall`:o=i>=7;break}return o},r.mostReadable=function(e,t,n){var i=null,a=0,o,s,c,l;n||={},s=n.includeFallbackColors,c=n.level,l=n.size;for(var u=0;u<t.length;u++)o=r.readability(e,t[u]),o>a&&(a=o,i=r(t[u]));return r.isReadable(e,i,{level:c,size:l})||!s?i:(n.includeFallbackColors=!1,r.mostReadable(e,[`#fff`,`#000`],n))};var T=r.names={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`0ff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000`,blanchedalmond:`ffebcd`,blue:`00f`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,burntsienna:`ea7e5d`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`0ff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`f0f`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`789`,lightslategrey:`789`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`0f0`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`f0f`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`f00`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`fff`,whitesmoke:`f5f5f5`,yellow:`ff0`,yellowgreen:`9acd32`},E=r.hexNames=D(T);function D(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function O(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function k(e,t){M(e)&&(e=`100%`);var n=N(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function A(e){return Math.min(1,Math.max(0,e))}function j(e){return parseInt(e,16)}function M(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function N(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function P(e){return e.length==1?`0`+e:``+e}function F(e){return e<=1&&(e=e*100+`%`),e}function I(e){return Math.round(parseFloat(e)*255).toString(16)}function L(e){return j(e)/255}var R=function(){var e=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,t=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`,n=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`;return{CSS_UNIT:new RegExp(e),rgb:RegExp(`rgb`+t),rgba:RegExp(`rgba`+n),hsl:RegExp(`hsl`+t),hsla:RegExp(`hsla`+n),hsv:RegExp(`hsv`+t),hsva:RegExp(`hsva`+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function z(e){return!!R.CSS_UNIT.exec(e)}function B(e){e=e.replace(t,``).replace(n,``).toLowerCase();var r=!1;if(T[e])e=T[e],r=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var i;return(i=R.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=R.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=R.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=R.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=R.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=R.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=R.hex8.exec(e))?{r:j(i[1]),g:j(i[2]),b:j(i[3]),a:L(i[4]),format:r?`name`:`hex8`}:(i=R.hex6.exec(e))?{r:j(i[1]),g:j(i[2]),b:j(i[3]),format:r?`name`:`hex`}:(i=R.hex4.exec(e))?{r:j(i[1]+``+i[1]),g:j(i[2]+``+i[2]),b:j(i[3]+``+i[3]),a:L(i[4]+``+i[4]),format:r?`name`:`hex8`}:(i=R.hex3.exec(e))?{r:j(i[1]+``+i[1]),g:j(i[2]+``+i[2]),b:j(i[3]+``+i[3]),format:r?`name`:`hex`}:!1}function V(e){var t,n;return e||={level:`AA`,size:`small`},t=(e.level||`AA`).toUpperCase(),n=(e.size||`small`).toLowerCase(),t!==`AA`&&t!==`AAA`&&(t=`AA`),n!==`small`&&n!==`large`&&(n=`small`),{level:t,size:n}}return r}))})),y6=W(((e,t)=>{let n=v6(),r={r:256,g:256,b:256,a:1},i={h:360,s:1,v:1,a:1};function a(e,t,n){let r={};for(let i in e)e.hasOwnProperty(i)&&(r[i]=n===0?0:(t[i]-e[i])/n);return r}function o(e,t,n,r){let i={};for(let a in t)t.hasOwnProperty(a)&&(i[a]=e[a]*n+t[a],i[a]=i[a]<0?i[a]+r[a]:r[a]===1?i[a]:i[a]%r[a]);return i}function s(e,t,i){let s=e.color.toRgb(),c=a(s,t.color.toRgb(),i),l=[e.color];for(let e=1;e<i;e++){let t=o(c,s,e,r);l.push(n(t))}return l}function c(e,t,r,c){let l=e.color.toHsv(),u=t.color.toHsv();if(l.s===0||u.s===0)return s(e,t,r);let d;if(typeof c==`boolean`)d=c;else{let e=l.h<u.h&&u.h-l.h<180||l.h>u.h&&l.h-u.h>180;d=c===`long`&&e||c===`short`&&!e}let f=a(l,u,r),p=[e.color],m;m=l.h<=u.h&&!d||l.h>=u.h&&d?u.h-l.h:d?360-u.h+l.h:360-l.h+u.h,f.h=(-1)**(d?1:0)*Math.abs(m)/r;for(let e=1;e<r;e++){let t=o(f,l,e,i);p.push(n(t))}return p}function l(e,t){let n=e.length;if(t=parseInt(t,10),isNaN(t)||t<2)throw Error(`Invalid number of steps (< 2)`);if(t<n)throw Error(`Number of steps cannot be inferior to number of stops`);let r=[];for(let i=1;i<n;i++){let n=(t-1)*(e[i].pos-e[i-1].pos);r.push(Math.max(1,Math.round(n)))}let i=1;for(let e=n-1;e--;)i+=r[e];for(;i!==t;)if(i<t){let e=Math.min.apply(null,r);r[r.indexOf(e)]++,i++}else{let e=Math.max.apply(null,r);r[r.indexOf(e)]--,i--}return r}function u(e,t,r,i){if(t<0||t>1)throw Error(`Position must be between 0 and 1`);let s,c;for(let n=0,r=e.length;n<r-1;n++)if(t>=e[n].pos&&t<e[n+1].pos){s=e[n],c=e[n+1];break}return s||=c=e[e.length-1],n(o(a(s.color[r](),c.color[r](),(c.pos-s.pos)*100),s.color[r](),(t-s.pos)*100,i))}var d=class e{constructor(e){if(e.length<2)throw Error(`Invalid number of stops (< 2)`);let t=e[0].pos!==void 0,r=e.length,i=-1,a=!1;this.stops=e.map((e,o)=>{let s=e.pos!==void 0;if(t^s)throw Error(`Cannot mix positionned and not posionned color stops`);if(s){let t=e.color!==void 0;if(!t&&(a||o===0||o===r-1))throw Error(`Cannot define two consecutive position-only stops`);if(a=!t,e={color:t?n(e.color):null,colorLess:!t,pos:e.pos},e.pos<0||e.pos>1)throw Error(`Color stops positions must be between 0 and 1`);if(e.pos<i)throw Error(`Color stops positions are not ordered`);i=e.pos}else e={color:n(e.color===void 0?e:e.color),pos:o/(r-1)};return e}),this.stops[0].pos!==0&&(this.stops.unshift({color:this.stops[0].color,pos:0}),r++),this.stops[r-1].pos!==1&&this.stops.push({color:this.stops[r-1].color,pos:1})}reverse(){let t=[];return this.stops.forEach(function(e){t.push({color:e.color,pos:1-e.pos})}),new e(t.reverse())}loop(){let t=[],n=[];return this.stops.forEach(e=>{t.push({color:e.color,pos:e.pos/2})}),this.stops.slice(0,-1).forEach(e=>{n.push({color:e.color,pos:1-e.pos/2})}),new e(t.concat(n.reverse()))}rgb(e){let t=l(this.stops,e),n=[];this.stops.forEach((e,t)=>{e.colorLess&&(e.color=s(this.stops[t-1],this.stops[t+1],2)[1])});for(let e=0,r=this.stops.length;e<r-1;e++){let r=s(this.stops[e],this.stops[e+1],t[e]);n.splice(n.length,0,...r)}return n.push(this.stops[this.stops.length-1].color),n}hsv(e,t){let n=l(this.stops,e),r=[];this.stops.forEach((e,n)=>{e.colorLess&&(e.color=c(this.stops[n-1],this.stops[n+1],2,t)[1])});for(let e=0,i=this.stops.length;e<i-1;e++){let i=c(this.stops[e],this.stops[e+1],n[e],t);r.splice(r.length,0,...i)}return r.push(this.stops[this.stops.length-1].color),r}css(e,t){e||=`linear`,t||=e===`linear`?`to right`:`ellipse at center`;let n=e+`-gradient(`+t;return this.stops.forEach(function(e){n+=`, `+(e.colorLess?``:e.color.toRgbString()+` `)+e.pos*100+`%`}),n+=`)`,n}rgbAt(e){return u(this.stops,e,`toRgb`,r)}hsvAt(e){return u(this.stops,e,`toHsv`,i)}};t.exports=function(e){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw Error(`"stops" is not an array`);e=arguments[0]}else e=Array.prototype.slice.call(arguments);return new d(e)}})),b6=ve({atlas:()=>k6,cristal:()=>A6,default:()=>S6,fruit:()=>I6,instagram:()=>L6,mind:()=>M6,morning:()=>N6,multiline:()=>T6,passion:()=>F6,pastel:()=>V6,rainbow:()=>B6,retro:()=>R6,summer:()=>z6,teen:()=>j6,vice:()=>P6}),x6=be(y6(),1);const S6=(...e)=>{let t,n;if(e.length===0)throw Error(`Missing gradient colors`);if(Array.isArray(e[0]))t=(0,x6.default)(e[0]),n=E6(e[1]);else{if(e.length===1)throw Error(`Expected an array of colors, received ${JSON.stringify(e[0])}`);t=(0,x6.default)(...e)}let r=(e,r)=>w6(e?e.toString():``,t,r??n);return r.multiline=(e,r)=>T6(e?e.toString():``,t,r??n),r},C6=(e,t,n)=>t.interpolation?.toLowerCase()===`hsv`?e.hsv(n,t.hsvSpin?.toLowerCase()||!1):e.rgb(n);function w6(e,t,n){let r=C6(t,E6(n),Math.max(e.replace(/\s/g,``).length,t.stops.length)),i=``;for(let t of e)i+=t.match(/\s/g)?t:RA.hex(r.shift()?.toHex()||`#000`)(t);return i}function T6(e,t,n){let r=E6(n),i=e.split(`
12824
+ `;default:return r(q3(e))}}function Z3(e,t,n=0,r=!1){switch(e.type){case`heading`:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{bold:!0,color:e.depth<=2?t.primary:t.secondary,dimColor:e.depth>2,children:Y3(e.tokens,t,r)})},`heading-${e.depth}`);case`paragraph`:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{children:Y3(e.tokens,t,r)})},`paragraph`);case`code`:return(0,X.jsx)(G3,{language:e.lang,children:e.text},`code`);case`blockquote`:return(0,X.jsx)(Q,{borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`double`,borderColor:t.border,paddingLeft:1,flexDirection:`column`,children:e.tokens?.map((e,r)=>(0,X.jsx)(Q,{children:Z3(e,t,n,!0)},r))},`blockquote`);case`list`:return(0,X.jsx)(Q,{flexDirection:`column`,children:e.items.map((i,a)=>{let o=e.ordered?(Number(e.start)||1)+a:null,s=i.task===!0,c=i.checked===!0,l=i.tokens?.filter(e=>e.type!==`checkbox`)||[];return(0,X.jsxs)(Q,{flexDirection:`row`,children:[(0,X.jsx)($,{color:t.secondary,dimColor:!0,children:s?c?`[✓] `:`[ ] `:o===null?`• `:`${o}. `}),(0,X.jsx)(Q,{flexGrow:1,flexDirection:`column`,children:l.map((e,i)=>(0,X.jsx)(Q,{children:Z3(e,t,n+1,r)},i))})]},a)})},`list`);case`table`:{let n=e,i=n.header.map((e,t)=>{let r=q3(e).length;for(let e of n.rows)r=Math.max(r,q3(e[t]).length);return Math.max(r,3)});return(0,X.jsxs)(Q,{flexDirection:`column`,children:[(0,X.jsx)(Q,{flexDirection:`row`,borderTop:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,borderColor:t.border,alignSelf:`flex-start`,children:n.header.map((e,a)=>{let o=n.align?.[a]||null;return(0,X.jsx)(Q,{width:i[a]+2,paddingX:1,justifyContent:o===`center`?`center`:o===`right`?`flex-end`:`flex-start`,children:(0,X.jsx)($,{bold:!0,color:t.primary,children:Y3(e.tokens,t,r)})},a)})}),n.rows.map((e,a)=>(0,X.jsx)(Q,{flexDirection:`row`,children:e.map((e,a)=>{let o=n.align?.[a]||null;return(0,X.jsx)(Q,{width:i[a]+2,paddingX:1,justifyContent:o===`center`?`center`:o===`right`?`flex-end`:`flex-start`,children:(0,X.jsx)($,{children:Y3(e.tokens,t,r)})},a)})},a))]},`table`)}case`hr`:return(0,X.jsx)(Q,{children:(0,X.jsx)($,{dimColor:!0,children:`─`.repeat(50)})},`hr`);case`space`:return null;default:return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsx)($,{children:X3(e,t,r)})})}}function Q3({children:e}){let{colors:t}=UL(),n=(0,Z.useMemo)(()=>{try{let t=H3(e);return m4.lexer(t,{gfm:!0,breaks:!0})}catch{return[]}},[e]);return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,Z.useMemo)(()=>{let e=[],r=n.length;return n.forEach((n,i)=>{let a=i===r-1;if(n.type===`space`){e.push((0,X.jsx)(Q,{height:1},`space-${i}`));return}e.push((0,X.jsx)(Q,{flexDirection:`column`,children:Z3(n,t)},i)),n.type===`heading`&&!a&&e.push((0,X.jsx)(Q,{height:1},`heading-space-${i}`))}),e},[n,t])})}Q3.displayName=`Markdown`;const $3=`baking.beaming.booping.bouncing.brewing.bubbling.chasing.churning.coalescing.conjuring.cooking.crafting.crunching.cuddling.dancing.dazzling.discovering.doodling.dreaming.drifting.enchanting.exploring.finding.floating.fluttering.foraging.forging.frolicking.gathering.giggling.gliding.greeting.growing.hatching.herding.honking.hopping.hugging.humming.imagining.inventing.jingling.juggling.jumping.kindling.knitting.launching.leaping.mapping.marinating.meandering.mixing.moseying.munching.napping.nibbling.noodling.orbiting.painting.percolating.petting.plotting.pondering.popping.prancing.purring.puzzling.questing.riding.roaming.rolling.sauteeing.scribbling.seeking.shimmying.singing.skipping.sleeping.snacking.sniffing.snuggling.soaring.sparking.spinning.splashing.sprouting.squishing.stargazing.stirring.strolling.swimming.swinging.tickling.tinkering.toasting.tumbling.twirling.waddling.wandering.watching.weaving.whistling.wibbling.wiggling.wishing.wobbling.wondering.yawning.zooming.adventuring.assembling.ballooning.befriending.blinking.blossoming.browsing.burrowing.capering.cartwheeling.celebrating.charging.cheering.chuckling.clambering.clapping.climbing.confettifying.connecting.contemplating.cuddling.curating.dabbling.daydreaming.delighting.detecting.doodling.doodling.drizzling.echoing.edging.elucidating.fiddling.flapping.flickering.flipping.formulating.gallivanting.gamboling.gesticulating.harmonizing.hiding.hitchhiking.hopping.illuminating.investigating.jamming.kaleidoscoping.leapfrogging.levitating.listening.lounging.marveling.mimicking.murmuring.mystifying.narrating.nestling.nuzzling.orchestrating.peeking.perambulating.perusing.pirouetting.plopping.poking.prepping.processing.purring.questing.quipping.quizzing.rambling.relishing.reveling.romping.scampering.scanning.scheming.scribbling.shuffling.skedaddling.snoozing.snuggling.spinning.squeaking.squirming.stalking.star-jumping.strolling.swirling.tapping.tasting.tiptoeing.toddling.traversing.tripping.tuning.unfolding.unraveling.updating.vibing.wandering.whirling.whizzing.wiggling.winking.wobbling.wondering.yodeling.yondering.zipping.zizzling.zoning`.split(`.`);function e6(e){return e.charAt(0).toUpperCase()+e.slice(1)}function t6(){return $3[Math.floor(Math.random()*$3.length)]}var n6=class{startTime;constructor(){this.startTime=performance.now()}getElapsedSeconds(){return(performance.now()-this.startTime)/1e3}getElapsedMs(){return performance.now()-this.startTime}getFormattedDuration(){return r6(this.getElapsedMs())}reset(){this.startTime=performance.now()}};function r6(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),(i>0||a.length===0)&&a.push(`${i}s`),a.join(` `)}function i6(e){let t=uQ[e.name];if(!t)return(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsxs)($,{color:`red`,children:[`Unknown tool: `,e.name]})});let n;n=e.result?.rejected?(()=>{try{return JSON.parse(e.result.content)}catch{return{}}})().reason===`interrupted`?`interrupted`:`rejected`:e.result?`success`:e.parsedResult?.phase===`error`?`error`:`executing`;let r=e.input??{},i=``;try{i=t.getHeaderParams(r)}catch{}try{return t.renderUI(r,n,e.parsedResult,e.displayData)}catch(n){let r=n instanceof Error?n.message:String(n);return console.error(`Error rendering tool ${e.name}:`,r),(0,X.jsxs)(Q,{flexDirection:`column`,children:[(0,X.jsx)(zK,{name:t.displayName,params:i,status:`error`}),(0,X.jsx)(BK,{color:`red`,children:`Error rendering tool`})]})}}const a6=(0,Z.memo)(({char:e,color:t})=>{let[n,r]=(0,Z.useState)(!0);return(0,Z.useEffect)(()=>{let e=setInterval(()=>{(0,Z.startTransition)(()=>{r(e=>!e)})},500);return()=>clearInterval(e)},[]),(0,X.jsx)($,{color:t,children:n?e:` `})});a6.displayName=`BlinkingIndicator`;const o6=(0,Z.memo)(e=>{let{type:t,segment:n,isSpinny:r=!1,source:i}=e;if(t!==`text`)throw Error(`Can only render text segments, got ${t}`);let a=(0,Z.useMemo)(()=>KQ(n),[n]);return a?.trim()?i===`user`?(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:`white`,children:`❯`}),(0,X.jsx)($,{dimColor:!0,italic:!0,children:a})]}):r?(0,X.jsx)(Q,{flexDirection:`row`,alignItems:`center`,gap:1,children:(0,X.jsx)(S1,{text:a})}):(0,X.jsx)(Q,{flexDirection:`column`,children:(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:`white`,children:`⏺`}),(0,X.jsx)(Q3,{children:a.trimStart()})]})}):null});o6.displayName=`TextSegment`;const s6=(0,Z.memo)(e=>{let{segment:t,thinkingStartTime:n,thinkingEndTime:r}=e,{colors:i}=UL(),a=(0,Z.useMemo)(()=>KQ(t),[t]),o=(0,Z.useMemo)(()=>n&&r?`thought for ${r6(r-n)}`:null,[n,r]);return(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,alignItems:`flex-start`,children:[(0,X.jsx)($,{color:i.textSubtle,children:`✳`}),(0,X.jsxs)(Q,{flexDirection:`column`,gap:0,children:[o&&(0,X.jsxs)($,{dimColor:!0,children:[`(`,o,`)`]}),a&&(0,X.jsx)($,{color:i.textSubtle,wrap:`wrap`,children:a})]})]})});s6.displayName=`ExpandedThinkingSegment`;const c6=5e3,l6=(0,Z.memo)(e=>{let{isSpinny:t=!1,thinkingStartTime:n,thinkingEndTime:r}=e,[i,a]=(0,Z.useState)(performance.now()),[o,s]=(0,Z.useState)(!1);if((0,Z.useEffect)(()=>{if(!t||!n)return;let e=setInterval(()=>{(0,Z.startTransition)(()=>a(performance.now()))},1e3);return()=>clearInterval(e)},[t,n]),(0,Z.useEffect)(()=>{if(t||!r)return;let e=setTimeout(()=>s(!0),2e3);return()=>clearTimeout(e)},[t,r]),o)return null;let c=(0,Z.useMemo)(()=>{if(t){if(!n)return`thinking...`;let e=i-n;return e<c6?`thinking...`:`thinking for ${r6(e)}`}if(n&&r){let e=r-n;return e<c6?`thought`:`thought for ${r6(e)}`}return`thinking...`},[n,r,t,i]);return(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,alignItems:`flex-start`,children:[t?(0,X.jsx)(a6,{char:`●`,color:`cyan`}):(0,X.jsx)($,{color:`green`,children:`●`}),(0,X.jsx)($,{dimColor:!0,children:c})]})});l6.displayName=`ThinkingSegment`;const u6=(0,Z.memo)(e=>{let{toolUseRequest:t,toolUseResult:n,toolDisplayData:r,parsedResult:i}=e;return t?Array.isArray(t)?(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>(0,X.jsx)(i6,{...e,result:n,displayData:r,parsedResult:i},e.id??t))}):(0,X.jsx)(i6,{...t,result:n,displayData:r,parsedResult:i}):null});u6.displayName=`ToolCallSegment`;const d6=(0,Z.memo)(e=>{let{type:t,segment:n,title:r,isSpinny:i=!1}=e,{colors:a}=UL(),o=(0,Z.useRef)(t6());if(t!==`collapsible_component`)throw Error(`Can only render collapsible component segments, got ${t}`);let s=(0,Z.useMemo)(()=>KQ(n),[n]);if(!s&&!r)throw Error(`Collapsible component segment must have content or title`);let c=r||e6(o.current);return(0,X.jsxs)(Q,{borderStyle:s?`single`:void 0,borderColor:a.border,flexDirection:`column`,alignItems:`flex-start`,gap:1,children:[c&&(0,X.jsx)(Q,{flexDirection:`row`,alignItems:`center`,gap:1,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(S1,{text:`${c}...`}),(0,X.jsx)($,{dimColor:!0,children:`(esc to interrupt)`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{children:` `}),(0,X.jsx)($,{color:a.textMuted,children:c})]})}),s&&(0,X.jsx)(Q3,{children:s})]})});d6.displayName=`CollapsibleComponentSegment`;const f6=(0,Z.memo)(e=>{let{type:t,message:n,severity:r=`info`,actions:i,flashKey:a}=e,{colors:o}=UL();if(t!==`code_llm_notification`)throw Error(`Can only render notification segments, got ${t}`);let[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(a);if((0,Z.useEffect)(()=>{if(a!==l.current&&a!=null){l.current=a,c(!0);let e=setTimeout(()=>c(!1),600);return()=>clearTimeout(e)}},[a]),!n)throw Error(`Notification segment must have message`);let u=(0,Z.useMemo)(()=>r===`info`||r===`success`||r===`error`||r===`warning`?r:`info`,[r]),d=(0,Z.useMemo)(()=>{switch(u){case`info`:return o.info;case`success`:return o.success;case`warning`:return o.warning;case`error`:return o.error;default:return o.info}},[u,o]),f=e=>e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().split(` `).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `),p=(0,Z.useMemo)(()=>(i||[]).filter(e=>e.link),[i]);return(0,X.jsxs)(Q,{flexDirection:`column`,gap:0,children:[(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,children:[(0,X.jsx)($,{color:d,children:s?`◉`:`●`}),(0,X.jsx)($,{color:d,bold:s,inverse:s,children:s?` ${n} `:n})]}),p.length>0&&(0,X.jsx)(Q,{marginLeft:2,flexDirection:`row`,gap:1,children:p.map((e,t)=>(0,X.jsxs)(Z.Fragment,{children:[t>0&&(0,X.jsx)($,{children:` | `}),(0,X.jsx)($,{color:`cyan`,underline:!0,children:f(e.type)})]},t))})]})});f6.displayName=`NotificationSegment`;const p6=(0,Z.memo)(({segment:e})=>{switch(e.type){case`text`:return(0,X.jsx)(o6,{...e});case`thinking`:return(0,X.jsx)(l6,{...e});case`code_llm_tool_call`:return(0,X.jsx)(u6,{...e});case`collapsible_component`:return(0,X.jsx)(d6,{...e});case`code_llm_agent_tool_request`:return(0,X.jsx)(u6,{...e});case`code_llm_notification`:return(0,X.jsx)(f6,{...e});default:return null}});p6.displayName=`SegmentBase`;function m6(e,t){return(0,X.jsx)(f6,{id:`error-fallback`,status:`completed`,source:`bot`,type:`code_llm_notification`,message:e.message,severity:`error`})}function h6({segment:e}){return(0,X.jsx)(P0,{fallback:m6,children:(0,X.jsx)(p6,{segment:e})})}const g6=(0,Z.memo)(({snapshot:e,onClose:t})=>{let{colors:n}=UL();return fI((e,n)=>{(n.ctrl||n.super)&&e===`o`&&t(),n.escape&&t()}),(0,X.jsxs)(Q,{flexDirection:`column`,gap:1,children:[(0,X.jsx)(Q,{flexDirection:`column`,gap:1,paddingBottom:1,width:`95%`,children:(0,Z.useMemo)(()=>e.filter(e=>!e.temp&&!e.isSpinny),[e]).map(e=>(0,X.jsx)(_6,{segment:e},e.id))}),(0,X.jsxs)(Q,{borderStyle:`single`,borderColor:n.border,paddingLeft:1,paddingRight:1,flexDirection:`row`,gap:2,children:[(0,X.jsx)($,{color:n.textMuted,children:`expanded view`}),(0,X.jsx)($,{dimColor:!0,children:`ctrl+o or esc to collapse`})]})]})});g6.displayName=`ExpandedView`;const _6=(0,Z.memo)(({segment:e})=>e.type===`thinking`?(0,X.jsx)(s6,{...e}):(0,X.jsx)(h6,{segment:e}));_6.displayName=`ExpandedSegment`;var v6=W(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.tinycolor=r())})(e,(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=/^\s+/,n=/\s+$/;function r(e,t){if(e||=``,t||={},e instanceof r)return e;if(!(this instanceof r))return new r(e,t);var n=i(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255,i=t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4;return .2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=O(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=c(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=c(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?`hsv(`+t+`, `+n+`%, `+r+`%)`:`hsva(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHsl:function(){var e=o(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=o(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?`hsl(`+t+`, `+n+`%, `+r+`%)`:`hsla(`+t+`, `+n+`%, `+r+`%, `+this._roundA+`)`},toHex:function(e){return u(this._r,this._g,this._b,e)},toHexString:function(e){return`#`+this.toHex(e)},toHex8:function(e){return d(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return`#`+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?`rgb(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`)`:`rgba(`+Math.round(this._r)+`, `+Math.round(this._g)+`, `+Math.round(this._b)+`, `+this._roundA+`)`},toPercentageRgb:function(){return{r:Math.round(k(this._r,255)*100)+`%`,g:Math.round(k(this._g,255)*100)+`%`,b:Math.round(k(this._b,255)*100)+`%`,a:this._a}},toPercentageRgbString:function(){return this._a==1?`rgb(`+Math.round(k(this._r,255)*100)+`%, `+Math.round(k(this._g,255)*100)+`%, `+Math.round(k(this._b,255)*100)+`%)`:`rgba(`+Math.round(k(this._r,255)*100)+`%, `+Math.round(k(this._g,255)*100)+`%, `+Math.round(k(this._b,255)*100)+`%, `+this._roundA+`)`},toName:function(){return this._a===0?`transparent`:this._a<1?!1:E[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t=`#`+f(this._r,this._g,this._b,this._a),n=t,i=this._gradientType?`GradientType = 1, `:``;if(e){var a=r(e);n=`#`+f(a._r,a._g,a._b,a._a)}return`progid:DXImageTransform.Microsoft.gradient(`+i+`startColorstr=`+t+`,endColorstr=`+n+`)`},toString:function(e){var t=!!e;e||=this._format;var n=!1,r=this._a<1&&this._a>=0;return!t&&r&&(e===`hex`||e===`hex6`||e===`hex3`||e===`hex4`||e===`hex8`||e===`name`)?e===`name`&&this._a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return r(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(h,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(w,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(x,[3])},tetrad:function(){return this._applyCombination(x,[4])}},r.fromRatio=function(t,n){if(e(t)==`object`){var i={};for(var a in t)t.hasOwnProperty(a)&&(a===`a`?i[a]=t[a]:i[a]=F(t[a]));t=i}return r(t,n)};function i(t){var n={r:0,g:0,b:0},r=1,i=null,o=null,c=null,u=!1,d=!1;return typeof t==`string`&&(t=B(t)),e(t)==`object`&&(z(t.r)&&z(t.g)&&z(t.b)?(n=a(t.r,t.g,t.b),u=!0,d=String(t.r).substr(-1)===`%`?`prgb`:`rgb`):z(t.h)&&z(t.s)&&z(t.v)?(i=F(t.s),o=F(t.v),n=l(t.h,i,o),u=!0,d=`hsv`):z(t.h)&&z(t.s)&&z(t.l)&&(i=F(t.s),c=F(t.l),n=s(t.h,i,c),u=!0,d=`hsl`),t.hasOwnProperty(`a`)&&(r=t.a)),r=O(r),{ok:u,format:t.format||d,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function a(e,t,n){return{r:k(e,255)*255,g:k(t,255)*255,b:k(n,255)*255}}function o(e,t,n){e=k(e,255),t=k(t,255),n=k(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=(r+i)/2;if(r==i)a=o=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,l:s}}function s(e,t,n){var r,i,a;e=k(e,360),t=k(t,100),n=k(n,100);function o(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(t===0)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function c(e,t,n){e=k(e,255),t=k(t,255),n=k(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a,o,s=r,c=r-i;if(o=r===0?0:c/r,r==i)a=0;else{switch(r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4;break}a/=6}return{h:a,s:o,v:s}}function l(e,t,n){e=k(e,360)*6,t=k(t,100),n=k(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function u(e,t,n,r){var i=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function d(e,t,n,r,i){var a=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16)),P(I(r))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function f(e,t,n,r){return[P(I(r)),P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(n).toString(16))].join(``)}r.equals=function(e,t){return!e||!t?!1:r(e).toRgbString()==r(t).toRgbString()},r.random=function(){return r.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function p(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.s-=t/100,n.s=A(n.s),r(n)}function m(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.s+=t/100,n.s=A(n.s),r(n)}function h(e){return r(e).desaturate(100)}function g(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.l+=t/100,n.l=A(n.l),r(n)}function _(e,t){t=t===0?0:t||10;var n=r(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),r(n)}function v(e,t){t=t===0?0:t||10;var n=r(e).toHsl();return n.l-=t/100,n.l=A(n.l),r(n)}function y(e,t){var n=r(e).toHsl(),i=(n.h+t)%360;return n.h=i<0?360+i:i,r(n)}function b(e){var t=r(e).toHsl();return t.h=(t.h+180)%360,r(t)}function x(e,t){if(isNaN(t)||t<=0)throw Error(`Argument to polyad must be a positive number`);for(var n=r(e).toHsl(),i=[r(e)],a=360/t,o=1;o<t;o++)i.push(r({h:(n.h+o*a)%360,s:n.s,l:n.l}));return i}function S(e){var t=r(e).toHsl(),n=t.h;return[r(e),r({h:(n+72)%360,s:t.s,l:t.l}),r({h:(n+216)%360,s:t.s,l:t.l})]}function C(e,t,n){t||=6,n||=30;var i=r(e).toHsl(),a=360/n,o=[r(e)];for(i.h=(i.h-(a*t>>1)+720)%360;--t;)i.h=(i.h+a)%360,o.push(r(i));return o}function w(e,t){t||=6;for(var n=r(e).toHsv(),i=n.h,a=n.s,o=n.v,s=[],c=1/t;t--;)s.push(r({h:i,s:a,v:o})),o=(o+c)%1;return s}r.mix=function(e,t,n){n=n===0?0:n||50;var i=r(e).toRgb(),a=r(t).toRgb(),o=n/100;return r({r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a})},r.readability=function(e,t){var n=r(e),i=r(t);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},r.isReadable=function(e,t,n){var i=r.readability(e,t),a,o=!1;switch(a=V(n),a.level+a.size){case`AAsmall`:case`AAAlarge`:o=i>=4.5;break;case`AAlarge`:o=i>=3;break;case`AAAsmall`:o=i>=7;break}return o},r.mostReadable=function(e,t,n){var i=null,a=0,o,s,c,l;n||={},s=n.includeFallbackColors,c=n.level,l=n.size;for(var u=0;u<t.length;u++)o=r.readability(e,t[u]),o>a&&(a=o,i=r(t[u]));return r.isReadable(e,i,{level:c,size:l})||!s?i:(n.includeFallbackColors=!1,r.mostReadable(e,[`#fff`,`#000`],n))};var T=r.names={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`0ff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000`,blanchedalmond:`ffebcd`,blue:`00f`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,burntsienna:`ea7e5d`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`0ff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`f0f`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`789`,lightslategrey:`789`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`0f0`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`f0f`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`f00`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`fff`,whitesmoke:`f5f5f5`,yellow:`ff0`,yellowgreen:`9acd32`},E=r.hexNames=D(T);function D(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function O(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function k(e,t){M(e)&&(e=`100%`);var n=N(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function A(e){return Math.min(1,Math.max(0,e))}function j(e){return parseInt(e,16)}function M(e){return typeof e==`string`&&e.indexOf(`.`)!=-1&&parseFloat(e)===1}function N(e){return typeof e==`string`&&e.indexOf(`%`)!=-1}function P(e){return e.length==1?`0`+e:``+e}function F(e){return e<=1&&(e=e*100+`%`),e}function I(e){return Math.round(parseFloat(e)*255).toString(16)}function L(e){return j(e)/255}var R=function(){var e=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,t=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`,n=`[\\s|\\(]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)[,|\\s]+(`+e+`)\\s*\\)?`;return{CSS_UNIT:new RegExp(e),rgb:RegExp(`rgb`+t),rgba:RegExp(`rgba`+n),hsl:RegExp(`hsl`+t),hsla:RegExp(`hsla`+n),hsv:RegExp(`hsv`+t),hsva:RegExp(`hsva`+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function z(e){return!!R.CSS_UNIT.exec(e)}function B(e){e=e.replace(t,``).replace(n,``).toLowerCase();var r=!1;if(T[e])e=T[e],r=!0;else if(e==`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var i;return(i=R.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=R.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=R.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=R.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=R.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=R.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=R.hex8.exec(e))?{r:j(i[1]),g:j(i[2]),b:j(i[3]),a:L(i[4]),format:r?`name`:`hex8`}:(i=R.hex6.exec(e))?{r:j(i[1]),g:j(i[2]),b:j(i[3]),format:r?`name`:`hex`}:(i=R.hex4.exec(e))?{r:j(i[1]+``+i[1]),g:j(i[2]+``+i[2]),b:j(i[3]+``+i[3]),a:L(i[4]+``+i[4]),format:r?`name`:`hex8`}:(i=R.hex3.exec(e))?{r:j(i[1]+``+i[1]),g:j(i[2]+``+i[2]),b:j(i[3]+``+i[3]),format:r?`name`:`hex`}:!1}function V(e){var t,n;return e||={level:`AA`,size:`small`},t=(e.level||`AA`).toUpperCase(),n=(e.size||`small`).toLowerCase(),t!==`AA`&&t!==`AAA`&&(t=`AA`),n!==`small`&&n!==`large`&&(n=`small`),{level:t,size:n}}return r}))})),y6=W(((e,t)=>{let n=v6(),r={r:256,g:256,b:256,a:1},i={h:360,s:1,v:1,a:1};function a(e,t,n){let r={};for(let i in e)e.hasOwnProperty(i)&&(r[i]=n===0?0:(t[i]-e[i])/n);return r}function o(e,t,n,r){let i={};for(let a in t)t.hasOwnProperty(a)&&(i[a]=e[a]*n+t[a],i[a]=i[a]<0?i[a]+r[a]:r[a]===1?i[a]:i[a]%r[a]);return i}function s(e,t,i){let s=e.color.toRgb(),c=a(s,t.color.toRgb(),i),l=[e.color];for(let e=1;e<i;e++){let t=o(c,s,e,r);l.push(n(t))}return l}function c(e,t,r,c){let l=e.color.toHsv(),u=t.color.toHsv();if(l.s===0||u.s===0)return s(e,t,r);let d;if(typeof c==`boolean`)d=c;else{let e=l.h<u.h&&u.h-l.h<180||l.h>u.h&&l.h-u.h>180;d=c===`long`&&e||c===`short`&&!e}let f=a(l,u,r),p=[e.color],m;m=l.h<=u.h&&!d||l.h>=u.h&&d?u.h-l.h:d?360-u.h+l.h:360-l.h+u.h,f.h=(-1)**(d?1:0)*Math.abs(m)/r;for(let e=1;e<r;e++){let t=o(f,l,e,i);p.push(n(t))}return p}function l(e,t){let n=e.length;if(t=parseInt(t,10),isNaN(t)||t<2)throw Error(`Invalid number of steps (< 2)`);if(t<n)throw Error(`Number of steps cannot be inferior to number of stops`);let r=[];for(let i=1;i<n;i++){let n=(t-1)*(e[i].pos-e[i-1].pos);r.push(Math.max(1,Math.round(n)))}let i=1;for(let e=n-1;e--;)i+=r[e];for(;i!==t;)if(i<t){let e=Math.min.apply(null,r);r[r.indexOf(e)]++,i++}else{let e=Math.max.apply(null,r);r[r.indexOf(e)]--,i--}return r}function u(e,t,r,i){if(t<0||t>1)throw Error(`Position must be between 0 and 1`);let s,c;for(let n=0,r=e.length;n<r-1;n++)if(t>=e[n].pos&&t<e[n+1].pos){s=e[n],c=e[n+1];break}return s||=c=e[e.length-1],n(o(a(s.color[r](),c.color[r](),(c.pos-s.pos)*100),s.color[r](),(t-s.pos)*100,i))}var d=class e{constructor(e){if(e.length<2)throw Error(`Invalid number of stops (< 2)`);let t=e[0].pos!==void 0,r=e.length,i=-1,a=!1;this.stops=e.map((e,o)=>{let s=e.pos!==void 0;if(t^s)throw Error(`Cannot mix positionned and not posionned color stops`);if(s){let t=e.color!==void 0;if(!t&&(a||o===0||o===r-1))throw Error(`Cannot define two consecutive position-only stops`);if(a=!t,e={color:t?n(e.color):null,colorLess:!t,pos:e.pos},e.pos<0||e.pos>1)throw Error(`Color stops positions must be between 0 and 1`);if(e.pos<i)throw Error(`Color stops positions are not ordered`);i=e.pos}else e={color:n(e.color===void 0?e:e.color),pos:o/(r-1)};return e}),this.stops[0].pos!==0&&(this.stops.unshift({color:this.stops[0].color,pos:0}),r++),this.stops[r-1].pos!==1&&this.stops.push({color:this.stops[r-1].color,pos:1})}reverse(){let t=[];return this.stops.forEach(function(e){t.push({color:e.color,pos:1-e.pos})}),new e(t.reverse())}loop(){let t=[],n=[];return this.stops.forEach(e=>{t.push({color:e.color,pos:e.pos/2})}),this.stops.slice(0,-1).forEach(e=>{n.push({color:e.color,pos:1-e.pos/2})}),new e(t.concat(n.reverse()))}rgb(e){let t=l(this.stops,e),n=[];this.stops.forEach((e,t)=>{e.colorLess&&(e.color=s(this.stops[t-1],this.stops[t+1],2)[1])});for(let e=0,r=this.stops.length;e<r-1;e++){let r=s(this.stops[e],this.stops[e+1],t[e]);n.splice(n.length,0,...r)}return n.push(this.stops[this.stops.length-1].color),n}hsv(e,t){let n=l(this.stops,e),r=[];this.stops.forEach((e,n)=>{e.colorLess&&(e.color=c(this.stops[n-1],this.stops[n+1],2,t)[1])});for(let e=0,i=this.stops.length;e<i-1;e++){let i=c(this.stops[e],this.stops[e+1],n[e],t);r.splice(r.length,0,...i)}return r.push(this.stops[this.stops.length-1].color),r}css(e,t){e||=`linear`,t||=e===`linear`?`to right`:`ellipse at center`;let n=e+`-gradient(`+t;return this.stops.forEach(function(e){n+=`, `+(e.colorLess?``:e.color.toRgbString()+` `)+e.pos*100+`%`}),n+=`)`,n}rgbAt(e){return u(this.stops,e,`toRgb`,r)}hsvAt(e){return u(this.stops,e,`toHsv`,i)}};t.exports=function(e){if(arguments.length===1){if(!Array.isArray(arguments[0]))throw Error(`"stops" is not an array`);e=arguments[0]}else e=Array.prototype.slice.call(arguments);return new d(e)}})),b6=ve({atlas:()=>k6,cristal:()=>A6,default:()=>S6,fruit:()=>I6,instagram:()=>L6,mind:()=>M6,morning:()=>N6,multiline:()=>T6,passion:()=>F6,pastel:()=>V6,rainbow:()=>B6,retro:()=>R6,summer:()=>z6,teen:()=>j6,vice:()=>P6}),x6=be(y6(),1);const S6=(...e)=>{let t,n;if(e.length===0)throw Error(`Missing gradient colors`);if(Array.isArray(e[0]))t=(0,x6.default)(e[0]),n=E6(e[1]);else{if(e.length===1)throw Error(`Expected an array of colors, received ${JSON.stringify(e[0])}`);t=(0,x6.default)(...e)}let r=(e,r)=>w6(e?e.toString():``,t,r??n);return r.multiline=(e,r)=>T6(e?e.toString():``,t,r??n),r},C6=(e,t,n)=>t.interpolation?.toLowerCase()===`hsv`?e.hsv(n,t.hsvSpin?.toLowerCase()||!1):e.rgb(n);function w6(e,t,n){let r=C6(t,E6(n),Math.max(e.replace(/\s/g,``).length,t.stops.length)),i=``;for(let t of e)i+=t.match(/\s/g)?t:RA.hex(r.shift()?.toHex()||`#000`)(t);return i}function T6(e,t,n){let r=E6(n),i=e.split(`
12825
12825
  `),a=C6(t,r,Math.max(...i.map(e=>e.length),t.stops.length)),o=[];for(let e of i){let t=a.slice(0),n=``;for(let r of e)n+=RA.hex(t.shift()?.toHex()||`#000`)(r);o.push(n)}return o.join(`
12826
12826
  `)}function E6(e){let t={interpolation:`rgb`,hsvSpin:`short`,...e};if(e!==void 0&&typeof e!=`object`)throw TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof e}\``);if(typeof t.interpolation!=`string`)throw TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof t.interpolation}\``);if(t.interpolation.toLowerCase()===`hsv`&&typeof t.hsvSpin!=`string`)throw TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof t.hsvSpin}\``);return t}const D6={atlas:{colors:[`#feac5e`,`#c779d0`,`#4bc0c8`],options:{}},cristal:{colors:[`#bdfff3`,`#4ac29a`],options:{}},teen:{colors:[`#77a1d3`,`#79cbca`,`#e684ae`],options:{}},mind:{colors:[`#473b7b`,`#3584a7`,`#30d2be`],options:{}},morning:{colors:[`#ff5f6d`,`#ffc371`],options:{interpolation:`hsv`}},vice:{colors:[`#5ee7df`,`#b490ca`],options:{interpolation:`hsv`}},passion:{colors:[`#f43b47`,`#453a94`],options:{}},fruit:{colors:[`#ff4e50`,`#f9d423`],options:{}},instagram:{colors:[`#833ab4`,`#fd1d1d`,`#fcb045`],options:{}},retro:{colors:[`#3f51b1`,`#5a55ae`,`#7b5fac`,`#8f6aae`,`#a86aa4`,`#cc6b8e`,`#f18271`,`#f3a469`,`#f7c978`],options:{}},summer:{colors:[`#fdbb2d`,`#22c1c3`],options:{}},rainbow:{colors:[`#ff0000`,`#ff0100`],options:{interpolation:`hsv`,hsvSpin:`long`}},pastel:{colors:[`#74ebd5`,`#74ecd5`],options:{interpolation:`hsv`,hsvSpin:`long`}}};function O6(e){let t=t=>S6(...e.colors)(t,e.options);return t.multiline=(t=``)=>S6(...e.colors).multiline(t,e.options),t}const k6=O6(D6.atlas),A6=O6(D6.cristal),j6=O6(D6.teen),M6=O6(D6.mind),N6=O6(D6.morning),P6=O6(D6.vice),F6=O6(D6.passion),I6=O6(D6.fruit),L6=O6(D6.instagram),R6=O6(D6.retro),z6=O6(D6.summer),B6=O6(D6.rainbow),V6=O6(D6.pastel);S6.atlas=k6,S6.cristal=A6,S6.teen=j6,S6.mind=M6,S6.morning=N6,S6.vice=P6,S6.passion=F6,S6.fruit=I6,S6.instagram=L6,S6.retro=R6,S6.summer=z6,S6.rainbow=B6,S6.pastel=V6;const H6=(0,Z.memo)(e=>{let t=(0,Z.useMemo)(()=>e.name?b6[e.name]:S6(...e.colors),[e.name,e.colors]);return(0,X.jsx)($,{transform:e=>t.multiline(ZQ(e)),children:e.children})});H6.displayName=`Gradient`;const U6=(0,Z.memo)(()=>{let{width:e}=vQ(),{colors:t}=UL(),n=(0,Z.useMemo)(()=>[t.gradientStart,t.gradientMid,t.gradientEnd],[t]);return e<=50?(0,X.jsxs)(Q,{flexDirection:`row`,gap:1,flexWrap:`wrap`,children:[(0,X.jsx)(H6,{colors:n,children:(0,X.jsx)($,{children:`Abacus AI`})}),(0,X.jsxs)($,{color:t.textMuted,children:[`v`,zA]})]}):(0,X.jsxs)(Q,{flexDirection:`column`,children:[(0,X.jsx)(H6,{colors:n,children:(0,X.jsx)($,{children:` ▗▄▖ ▗▄▄▖ ▗▄▖ ▗▄▄▖▗▖ ▗▖ ▗▄▄▖ ▗▄▖ ▗▄▄▄▖ ▗▄▄▖▗▖ ▗▄▄▄▖
12827
12827
  ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌▐▌ ▐▌ ▐▌ █ ▐▌ ▐▌ █
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abacus-ai/cli",
3
- "version": "2.0.0-canary.8",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "abacusai": "dist/index.mjs"