@psnext/slingcli 2.4.20260520-4 → 2.4.20260520-5
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/slingshot/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var uO=Object.create;var Qh=Object.defineProperty;var dO=Object.getOwnPropertyDescriptor;var pO=Object.getOwnPropertyNames;var mO=Object.getPrototypeOf,hO=Object.prototype.hasOwnProperty;var zu=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Be=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ei=(t,e)=>{for(var n in e)Qh(t,n,{get:e[n],enumerable:!0})},gO=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of pO(e))!hO.call(t,s)&&s!==n&&Qh(t,s,{get:()=>e[s],enumerable:!(i=dO(e,s))||i.enumerable});return t};var fO=(t,e,n)=>(n=t!=null?uO(mO(t)):{},gO(e||!t||!t.__esModule?Qh(n,"default",{value:t,enumerable:!0}):n,t));function hn(t){if(process.versions?.bun&&!(typeof process>"u")&&!(Object.keys(process.env).length>0)){if(ed===null){ed=new Map;try{let{readFileSync:e}=zu("node:fs"),n=e("/proc/self/environ","utf-8");for(let i of n.split("\0")){let s=i.indexOf("=");s>0&&ed.set(i.slice(0,s),i.slice(s+1))}}catch{}}return ed.get(t)}}function AO(){if($c===null){if(!td||!og||!rg)return typeof process<"u"&&(process.versions?.node||process.versions?.bun)||($c=!1),!1;let t=process.env.GOOGLE_APPLICATION_CREDENTIALS||hn("GOOGLE_APPLICATION_CREDENTIALS");t?$c=td(t):$c=td(rg(og(),".config","gcloud","application_default_credentials.json"))}return $c}function OO(t){if(t==="github-copilot")return["COPILOT_GITHUB_TOKEN"];if(t==="anthropic")return["ANTHROPIC_OAUTH_TOKEN","ANTHROPIC_API_KEY"];let n={openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",deepseek:"DEEPSEEK_API_KEY",google:"GEMINI_API_KEY","google-vertex":"GOOGLE_CLOUD_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_CN_API_KEY",moonshotai:"MOONSHOT_API_KEY","moonshotai-cn":"MOONSHOT_API_KEY",huggingface:"HF_TOKEN",fireworks:"FIREWORKS_API_KEY",together:"TOGETHER_API_KEY",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY","cloudflare-workers-ai":"CLOUDFLARE_API_KEY","cloudflare-ai-gateway":"CLOUDFLARE_API_KEY",xiaomi:"XIAOMI_API_KEY","xiaomi-token-plan-cn":"XIAOMI_TOKEN_PLAN_CN_API_KEY","xiaomi-token-plan-ams":"XIAOMI_TOKEN_PLAN_AMS_API_KEY","xiaomi-token-plan-sgp":"XIAOMI_TOKEN_PLAN_SGP_API_KEY"}[t];return n?[n]:void 0}function Sw(t){let e=OO(t);if(!e)return;let n=e.filter(i=>!!process.env[i]||!!hn(i));return n.length>0?n:void 0}function Ke(t){let e=Sw(t);if(e?.[0])return process.env[e[0]]||hn(e[0]);if(t==="google-vertex"){let n=AO(),i=!!(process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT||hn("GOOGLE_CLOUD_PROJECT")||hn("GCLOUD_PROJECT")),s=!!(process.env.GOOGLE_CLOUD_LOCATION||hn("GOOGLE_CLOUD_LOCATION"));if(n&&i&&s)return"<authenticated>"}if(t==="amazon-bedrock"&&(process.env.AWS_PROFILE||process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY||process.env.AWS_BEARER_TOKEN_BEDROCK||process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI||process.env.AWS_WEB_IDENTITY_TOKEN_FILE||hn("AWS_PROFILE")||hn("AWS_ACCESS_KEY_ID")&&hn("AWS_SECRET_ACCESS_KEY")||hn("AWS_BEARER_TOKEN_BEDROCK")||hn("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI")||hn("AWS_CONTAINER_CREDENTIALS_FULL_URI")||hn("AWS_WEB_IDENTITY_TOKEN_FILE")))return"<authenticated>"}var td,og,rg,sg,PO,_O,EO,ed,$c,Gn=Be(()=>{"use strict";td=null,og=null,rg=null,sg=t=>import(t),PO="node:fs",_O="node:os",EO="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(sg(PO).then(t=>{td=t.existsSync}),sg(_O).then(t=>{og=t.homedir}),sg(EO).then(t=>{rg=t.join}));ed=null;$c=null});function gn(t){let e={};for(let[n,i]of t.entries())e[n]=i;return e}var eo=Be(()=>{"use strict"});function fe(t){return t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}var Oi=Be(()=>{"use strict"});var kw={};Ei(kw,{generateImagesOpenRouter:()=>DO});import FO from"openai";function $O(t,e,n){return new FO({apiKey:e,baseURL:t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:{...t.headers,...n}})}function BO(t,e){let n=e.input.map(i=>i.type==="text"?{type:"text",text:fe(i.text)}:{type:"image_url",image_url:{url:`data:${i.mimeType};base64,${i.data}`}});return{model:t.id,messages:[{role:"user",content:n}],stream:!1,modalities:t.output.includes("text")?["image","text"]:["image"]}}function NO(t,e){let n=t.prompt_tokens||0,i=t.prompt_tokens_details?.cached_tokens||0,s=t.prompt_tokens_details?.cache_write_tokens||0,o=s>0?Math.max(0,i-s):i,r=Math.max(0,n-o-s),a=t.completion_tokens||0,c={input:r,output:a,cacheRead:o,cacheWrite:s,totalTokens:r+a+o+s,cost:{input:e.cost.input/1e6*r,output:e.cost.output/1e6*a,cacheRead:e.cost.cacheRead/1e6*o,cacheWrite:e.cost.cacheWrite/1e6*s,total:0}};return c.cost.total=c.cost.input+c.cost.output+c.cost.cacheRead+c.cost.cacheWrite,c}var DO,Mw=Be(()=>{"use strict";Gn();eo();Oi();DO=async(t,e,n)=>{let i={api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let s=n?.apiKey||Ke(t.provider);if(!s)throw new Error(`No API key available for provider: ${t.provider}`);let o=$O(t,s,n?.headers),r=BO(t,e),a=await n?.onPayload?.(r,t);a!==void 0&&(r=a);let c={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},...n?.maxRetries!==void 0?{maxRetries:n.maxRetries}:{}},{data:l,response:d}=await o.chat.completions.create(r,c).withResponse();await n?.onResponse?.({status:d.status,headers:gn(d.headers)},t);let u=l;i.responseId=u.id,u.usage&&(i.usage=NO(u.usage,t));let p=u.choices[0];if(p){let m=p.message.content;typeof m=="string"&&m.length>0&&i.output.push({type:"text",text:m});for(let g of p.message.images??[]){let h=typeof g.image_url=="string"?g.image_url:g.image_url?.url;if(!h?.startsWith("data:"))continue;let f=h.match(/^data:([^;]+);base64,(.+)$/);f&&i.output.push({type:"image",mimeType:f[1],data:f[2]})}}return i}catch(s){return i.stopReason=n?.signal?.aborted?"aborted":"error",i.errorMessage=s instanceof Error?s.message:JSON.stringify(s),i}}});var Rw,Pw=Be(()=>{"use strict";Rw={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-7":{id:"anthropic.claude-opus-4-7",name:"Claude Opus 4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"au.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"au.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-opus-4-6-v1":{id:"au.anthropic.claude-opus-4-6-v1",name:"AU Anthropic Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:16.5,output:82.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"au.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-sonnet-4-6":{id:"au.anthropic.claude-sonnet-4-6",name:"AU Anthropic Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:128e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-7":{id:"eu.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-7":{id:"global.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"jp.anthropic.claude-opus-4-7":{id:"jp.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"jp.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"jp.anthropic.claude-sonnet-4-6":{id:"jp.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax.minimax-m2.5":{id:"minimax.minimax-m2.5",name:"MiniMax M2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:98304},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-super-3-120b":{id:"nvidia.nemotron-super-3-120b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-coder-next":{id:"qwen.qwen3-coder-next",name:"Qwen3 Coder Next",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-7":{id:"us.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"us.deepseek.r1-v1:0":{id:"us.deepseek.r1-v1:0",name:"DeepSeek-R1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"us.meta.llama4-maverick-17b-instruct-v1:0":{id:"us.meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"us.meta.llama4-scout-17b-instruct-v1:0":{id:"us.meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"zai.glm-5":{id:"zai.glm-5",name:"GLM-5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:101376}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.69,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3.1-8b":{id:"llama3.1-8b",name:"Llama 3.1 8B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8e3},"qwen-3-235b-a22b-instruct-2507":{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen 3 235B Instruct",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:32e3},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4e4}},"cloudflare-ai-gateway":{"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-haiku":{id:"claude-3-haiku",name:"Claude Haiku 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus":{id:"claude-3-opus",name:"Claude Opus 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet":{id:"claude-3-sonnet",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3.5-haiku":{id:"claude-3.5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3.5-sonnet":{id:"claude-3.5-sonnet",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4":{id:"claude-opus-4",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"workers-ai/@cf/moonshotai/kimi-k2.5":{id:"workers-ai/@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/moonshotai/kimi-k2.6":{id:"workers-ai/@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/nvidia/nemotron-3-120b-a12b":{id:"workers-ai/@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/zai-org/glm-4.7-flash":{id:"workers-ai/@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},"cloudflare-workers-ai":{"@cf/google/gemma-4-26b-a4b-it":{id:"@cf/google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"@cf/meta/llama-4-scout-17b-16e-instruct":{id:"@cf/meta/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text","image"],cost:{input:.27,output:.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/moonshotai/kimi-k2.5":{id:"@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/moonshotai/kimi-k2.6":{id:"@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/nvidia/nemotron-3-120b-a12b":{id:"@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/openai/gpt-oss-120b":{id:"@cf/openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/openai/gpt-oss-20b":{id:"@cf/openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.2,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/zai-org/glm-4.7-flash":{id:"@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},deepseek:{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1e6,maxTokens:384e3}},fireworks:{"accounts/fireworks/models/deepseek-v3p1":{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"accounts/fireworks/models/deepseek-v3p2":{id:"accounts/fireworks/models/deepseek-v3p2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:16e4,maxTokens:16e4},"accounts/fireworks/models/deepseek-v4-flash":{id:"accounts/fireworks/models/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/deepseek-v4-pro":{id:"accounts/fireworks/models/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/glm-4p5":{id:"accounts/fireworks/models/glm-4p5",name:"GLM 4.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.55,output:2.19,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"accounts/fireworks/models/glm-4p5-air":{id:"accounts/fireworks/models/glm-4p5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"accounts/fireworks/models/glm-4p7":{id:"accounts/fireworks/models/glm-4p7",name:"GLM 4.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.3,cacheWrite:0},contextWindow:198e3,maxTokens:198e3},"accounts/fireworks/models/glm-5":{id:"accounts/fireworks/models/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.5,cacheWrite:0},contextWindow:202752,maxTokens:131072},"accounts/fireworks/models/glm-5p1":{id:"accounts/fireworks/models/glm-5p1",name:"GLM 5.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/models/gpt-oss-120b":{id:"accounts/fireworks/models/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/gpt-oss-20b":{id:"accounts/fireworks/models/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/kimi-k2-instruct":{id:"accounts/fireworks/models/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"accounts/fireworks/models/kimi-k2-thinking":{id:"accounts/fireworks/models/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.3,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"accounts/fireworks/models/kimi-k2p5":{id:"accounts/fireworks/models/kimi-k2p5",name:"Kimi K2.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"accounts/fireworks/models/kimi-k2p6":{id:"accounts/fireworks/models/kimi-k2p6",name:"Kimi K2.6",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/minimax-m2p1":{id:"accounts/fireworks/models/minimax-m2p1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:2e5,maxTokens:2e5},"accounts/fireworks/models/minimax-m2p5":{id:"accounts/fireworks/models/minimax-m2p5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/minimax-m2p7":{id:"accounts/fireworks/models/minimax-m2p7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/qwen3p6-plus":{id:"accounts/fireworks/models/qwen3p6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.1,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"accounts/fireworks/routers/kimi-k2p5-turbo":{id:"accounts/fireworks/routers/kimi-k2p5-turbo",name:"Kimi K2.5 Turbo",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3}},"github-copilot":{"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:64e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3}},google:{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite":{id:"gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemma-4-26b-a4b-it":{id:"gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-31b-it":{id:"gemma-4-31b-it",name:"Gemma 4 31B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"deepseek-r1-distill-llama-70b":{id:"deepseek-r1-distill-llama-70b",name:"DeepSeek R1 Distill Llama 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.75,output:.99,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma2-9b-it":{id:"gemma2-9b-it",name:"Gemma 2 9B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"groq/compound":{id:"groq/compound",name:"Compound",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"groq/compound-mini":{id:"groq/compound-mini",name:"Compound Mini",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B Instant",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B Versatile",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3-70b-8192":{id:"llama3-70b-8192",name:"Llama 3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama3-8b-8192":{id:"llama3-8b-8192",name:"Llama 3 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"meta-llama/llama-4-maverick-17b-128e-instruct":{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"mistral-saba-24b":{id:"mistral-saba-24b",name:"Mistral Saba 24B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.79,output:.79,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"moonshotai/kimi-k2-instruct":{id:"moonshotai/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-instruct-0905":{id:"moonshotai/kimi-k2-instruct-0905",name:"Kimi K2 Instruct 0905",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"Safety GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen-qwq-32b":{id:"qwen-qwq-32b",name:"Qwen QwQ 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.39,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"default"},input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.145,cacheWrite:0},contextWindow:1048576,maxTokens:393216},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi-K2.6",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{"kimi-for-coding":{id:"kimi-for-coding",name:"Kimi For Coding",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},"minimax-cn":{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2604":{id:"mistral-medium-2604",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-3.5":{id:"mistral-medium-3.5",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-2603":{id:"mistral-small-2603",name:"Mistral Small 4",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},moonshotai:{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144}},"moonshotai-cn":{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144}},openai:{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none"},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek-v4-flash-free":{id:"deepseek-v4-flash-free",name:"DeepSeek V4 Flash Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.5-free":{id:"minimax-m2.5-free",name:"MiniMax M2.5 Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-super-free":{id:"nemotron-3-super-free",name:"Nemotron 3 Super Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:128e3},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536},"qwen3.6-plus-free":{id:"qwen3.6-plus-free",name:"Qwen3.6 Plus Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536}},"opencode-go":{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:32768},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202752,maxTokens:32768},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo V2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:128e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:65536},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen"},reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen"},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"alibaba/tongyi-deepresearch-30b-a3b":{id:"alibaba/tongyi-deepresearch-30b-a3b",name:"Tongyi DeepResearch 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:.09,cacheWrite:0},contextWindow:131072,maxTokens:131072},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.6-fast":{id:"anthropic/claude-opus-4.6-fast",name:"Anthropic: Claude Opus 4.6 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Anthropic: Claude Opus 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7-fast":{id:"anthropic/claude-opus-4.7-fast",name:"Anthropic: Claude Opus 4.7 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Arcee AI: Trinity Large Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Arcee AI: Trinity Large Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.22,output:.85,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:262144},"arcee-ai/trinity-large-thinking:free":{id:"arcee-ai/trinity-large-thinking:free",name:"Arcee AI: Trinity Large Thinking (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8e4},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"baidu/cobuddy:free":{id:"baidu/cobuddy:free",name:"Baidu Qianfan: CoBuddy (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"baidu/ernie-4.5-21b-a3b":{id:"baidu/ernie-4.5-21b-a3b",name:"Baidu: ERNIE 4.5 21B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8e3},"baidu/ernie-4.5-vl-28b-a3b":{id:"baidu/ernie-4.5-vl-28b-a3b",name:"Baidu: ERNIE 4.5 VL 28B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8e3},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.32,output:.8899999999999999,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.7899999999999999,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.1500000000000004,cacheRead:.35,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.252,output:.378,cacheRead:.0252,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek: DeepSeek V4 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.112,output:.224,cacheRead:.022,cacheWrite:0},contextWindow:1048576,maxTokens:4096},"deepseek/deepseek-v4-flash:free":{id:"deepseek/deepseek-v4-flash:free",name:"DeepSeek: DeepSeek V4 Flash (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek: DeepSeek V4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.0-flash-001":{id:"google/gemini-2.0-flash-001",name:"Google: Gemini 2.0 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1e6,maxTokens:8192},"google/gemini-2.0-flash-lite-001":{id:"google/gemini-2.0-flash-lite-001",name:"Google: Gemini 2.0 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Google: Gemini 3.1 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048756,maxTokens:65536},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Google: Gemini 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemma-3-12b-it":{id:"google/gemma-3-12b-it",name:"Google: Gemma 3 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.04,output:.13,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-3-27b-it":{id:"google/gemma-3-27b-it",name:"Google: Gemma 3 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Google: Gemma 4 26B A4B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.06,output:.33,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"google/gemma-4-26b-a4b-it:free":{id:"google/gemma-4-26b-a4b-it:free",name:"Google: Gemma 4 26B A4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Google: Gemma 4 31B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.12,output:.37,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"google/gemma-4-31b-it:free":{id:"google/gemma-4-31b-it:free",name:"Google: Gemma 4 31B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"ibm-granite/granite-4.1-8b":{id:"ibm-granite/granite-4.1-8b",name:"IBM: Granite 4.1 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.049999999999999996,output:.09999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inclusionai/ling-2.6-1t":{id:"inclusionai/ling-2.6-1t",name:"inclusionAI: Ling-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ling-2.6-flash":{id:"inclusionai/ling-2.6-flash",name:"inclusionAI: Ling-2.6-flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.01,output:.03,cacheRead:.002,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ring-2.6-1t":{id:"inclusionai/ring-2.6-1t",name:"inclusionAI: Ring-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kwaipilot: KAT-Coder-Pro V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:8e4},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.049999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1e7,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.95,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:1.15,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5:free":{id:"minimax/minimax-m2.5:free",name:"MiniMax: MiniMax M2.5 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:8192},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27899999999999997,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/devstral-medium":{id:"mistralai/devstral-medium",name:"Mistral: Devstral Medium",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/devstral-small":{id:"mistralai/devstral-small",name:"Mistral: Devstral Small 1.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.19999999999999998,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2411":{id:"mistralai/mistral-large-2411",name:"Mistral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3-5":{id:"mistralai/mistral-medium-3-5",name:"Mistral: Mistral Medium 3.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/pixtral-large-2411":{id:"mistralai/pixtral-large-2411",name:"Mistral: Pixtral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5700000000000001,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"MoonshotAI: Kimi K2.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.73,output:3.49,cacheRead:.25,cacheWrite:0},contextWindow:262144,maxTokens:262142},"nex-agi/deepseek-v3.1-nex-n1":{id:"nex-agi/deepseek-v3.1-nex-n1",name:"Nex AGI: DeepSeek V3.1 Nex N1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.135,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:163840},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:228e3},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",name:"NVIDIA: Nemotron 3 Nano Omni (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:262144},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"NVIDIA: Nemotron Nano 9B V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.04,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-0314":{id:"openai/gpt-4-0314",name:"OpenAI: GPT-4 (older v0314)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-1106-preview":{id:"openai/gpt-4-1106-preview",name:"OpenAI: GPT-4 Turbo (older v1106)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:4096},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-audio-preview":{id:"openai/gpt-4o-audio-preview",name:"OpenAI: GPT-4o Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:4e5,maxTokens:4096},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.03,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"OpenAI: GPT-5.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"OpenAI: GPT-5.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-audio":{id:"openai/gpt-audio",name:"OpenAI: GPT Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-audio-mini":{id:"openai/gpt-audio-mini",name:"OpenAI: GPT Audio Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-chat-latest":{id:"openai/gpt-chat-latest",name:"OpenAI: GPT Chat Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.18,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.03,output:.14,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"openrouter/owl-alpha":{id:"openrouter/owl-alpha",name:"Owl Alpha",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048756,maxTokens:262144},"poolside/laguna-m.1:free":{id:"poolside/laguna-m.1:free",name:"Poolside: Laguna M.1 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"poolside/laguna-xs.2:free":{id:"poolside/laguna-xs.2:free",name:"Poolside: Laguna XS.2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.36,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen-2.5-7b-instruct":{id:"qwen/qwen-2.5-7b-instruct",name:"Qwen: Qwen2.5 7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052000000000000005,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.24,cacheRead:0,cacheWrite:0},contextWindow:131702,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.45499999999999996,output:1.8199999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.071,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.14950000000000002,output:1.495,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:2e4},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.39999999999999997,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1.7999999999999998,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:.24375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.11,output:.7999999999999999,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:.8125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:.975},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.10400000000000001,output:.41600000000000004,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13899999999999998,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39,output:2.34,cacheRead:.195,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.04,output:.15,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:81920},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:.08125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-20260420":{id:"qwen/qwen3.5-plus-20260420",name:"Qwen: Qwen3.5 Plus 2026-04-20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.7999999999999998,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-27b":{id:"qwen/qwen3.6-27b",name:"Qwen: Qwen3.6 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.32,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:81920},"qwen/qwen3.6-35b-a3b":{id:"qwen/qwen3.6-35b-a3b",name:"Qwen: Qwen3.6 35B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.149,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3.6-flash":{id:"qwen/qwen3.6-flash",name:"Qwen: Qwen3.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1875,output:1.125,cacheRead:0,cacheWrite:.234375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-max-preview":{id:"qwen/qwen3.6-max-preview",name:"Qwen: Qwen3.6 Max Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.04,output:6.24,cacheRead:0,cacheWrite:1.3},contextWindow:262144,maxTokens:65536},"qwen/qwen3.6-plus":{id:"qwen/qwen3.6-plus",name:"Qwen: Qwen3.6 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.325,output:1.95,cacheRead:0,cacheWrite:.40625},contextWindow:1e6,maxTokens:65536},"rekaai/reka-edge":{id:"rekaai/reka-edge",name:"Reka Edge",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3-euryale-70b":{id:"sao10k/l3-euryale-70b",name:"Sao10k: Llama 3 Euryale 70B v2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.48,output:1.48,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"tencent/hy3-preview":{id:"tencent/hy3-preview",name:"Tencent: Hy3 preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06599999999999999,output:.26,cacheRead:.029,cacheWrite:0},contextWindow:262144,maxTokens:262144},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.16999999999999998,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-4.20":{id:"x-ai/grok-4.20",name:"xAI: Grok 4.20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-4.3":{id:"x-ai/grok-4.3",name:"xAI: Grok 4.3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-omni":{id:"xiaomi/mimo-v2-omni",name:"Xiaomi: MiMo-V2-Omni",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"Xiaomi: MiMo-V2-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"Xiaomi: MiMo-V2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"Xiaomi: MiMo-V2.5-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"z-ai/glm-4-32b":{id:"z-ai/glm-4-32b",name:"Z.ai: GLM 4 32B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.13,output:.85,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air:free":{id:"z-ai/glm-4.5-air:free",name:"Z.ai: GLM 4.5 Air (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:96e3},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.43,output:1.74,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:24e3},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:1.75,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:202752,maxTokens:16384},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"Z.ai: GLM 5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:202800,maxTokens:202800},"z-ai/glm-5v-turbo":{id:"z-ai/glm-5v-turbo",name:"Z.ai: GLM 5V Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202752,maxTokens:131072},"~anthropic/claude-haiku-latest":{id:"~anthropic/claude-haiku-latest",name:"Anthropic Claude Haiku Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"~anthropic/claude-opus-latest":{id:"~anthropic/claude-opus-latest",name:"Anthropic: Claude Opus Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-sonnet-latest":{id:"~anthropic/claude-sonnet-latest",name:"Anthropic Claude Sonnet Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"~google/gemini-flash-latest":{id:"~google/gemini-flash-latest",name:"Google Gemini Flash Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"~google/gemini-pro-latest":{id:"~google/gemini-pro-latest",name:"Google Gemini Pro Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"~moonshotai/kimi-latest":{id:"~moonshotai/kimi-latest",name:"MoonshotAI Kimi Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.73,output:3.49,cacheRead:.25,cacheWrite:0},contextWindow:262144,maxTokens:262142},"~openai/gpt-latest":{id:"~openai/gpt-latest",name:"OpenAI GPT Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"~openai/gpt-mini-latest":{id:"~openai/gpt-mini-latest",name:"OpenAI GPT Mini Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},together:{"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:202752,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Instruct-2507-tput":{id:"Qwen/Qwen3-235B-A22B-Instruct-2507-tput",name:"Qwen3 235B A22B Instruct 2507 FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",name:"Qwen3 Coder 480B A35B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3-Coder-Next-FP8":{id:"Qwen/Qwen3-Coder-Next-FP8",name:"Qwen3 Coder Next FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5 397B A17B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:13e4},"Qwen/Qwen3.6-Plus":{id:"Qwen/Qwen3.6-Plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"deepseek-ai/DeepSeek-V3":{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.25,output:1.25,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"deepseek-ai/DeepSeek-V3-1":{id:"deepseek-ai/DeepSeek-V3-1",name:"DeepSeek V3.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.6,output:1.7,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:null},input:["text"],cost:{input:2.1,output:4.4,cacheRead:.2,cacheWrite:0},contextWindow:512e3,maxTokens:384e3},"essentialai/Rnj-1-Instruct":{id:"essentialai/Rnj-1-Instruct",name:"Rnj-1 Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"google/gemma-4-31B-it":{id:"google/gemma-4-31B-it",name:"Gemma 4 31B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.2,output:.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"meta-llama/Llama-3.3-70B-Instruct-Turbo":{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.88,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.5,output:2.8,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi K2.6",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1.2,output:4.5,cacheRead:.2,cacheWrite:0},contextWindow:262144,maxTokens:131e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.4,output:4.4,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3 235B A22b Instruct 2507",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:.6,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.08,output:.29,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.16,output:.64,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"alibaba/qwen-3.6-max-preview":{id:"alibaba/qwen-3.6-max-preview",name:"Qwen 3.6 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.3,output:7.8,cacheRead:.26,cacheWrite:1.625},contextWindow:24e4,maxTokens:64e3},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.5,output:7.5,cacheRead:.3,cacheWrite:0},contextWindow:262144,maxTokens:65536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.6-27b":{id:"alibaba/qwen3.6-27b",name:"Qwen 3.6 27B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3.5999999999999996,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.6-plus":{id:"alibaba/qwen3.6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.09999999999999999,cacheWrite:.625},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Trinity Large Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262100,maxTokens:8e4},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.77,output:.77,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek-V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:163840,maxTokens:8192},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"google/gemini-2.0-flash":{id:"google/gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite":{id:"google/gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.13,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Gemma 4 31B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.14,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kat Coder Pro V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.9700000000000001,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16999999999999998,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"Minimax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-medium-3.5":{id:"mistral/mistral-medium-3.5",name:"Mistral Medium Latest",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5700000000000001,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-thinking-turbo":{id:"moonshotai/kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-turbo":{id:"moonshotai/kimi-k2-turbo",name:"Kimi K2 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.22999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"GPT 5.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"GPT 5.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.20-multi-agent":{id:"xai/grok-4.20-multi-agent",name:"Grok 4.20 Multi-Agent",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning":{id:"xai/grok-4.20-non-reasoning",name:"Grok 4.20 Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning":{id:"xai/grok-4.20-reasoning",name:"Grok 4.20 Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.3":{id:"xai/grok-4.3",name:"Grok 4.3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"MiMo M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:105e4,maxTokens:131100},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:105e4,maxTokens:131e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:2.25,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.1999999999999997,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5.1":{id:"zai/glm-5.1",name:"GLM 5.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:64e3},"zai/glm-5v-turbo":{id:"zai/glm-5v-turbo",name:"GLM 5V Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:128e3}},xai:{"grok-2":{id:"grok-2",name:"Grok 2",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-1212":{id:"grok-2-1212",name:"Grok 2 (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-latest":{id:"grok-2-latest",name:"Grok 2 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-vision":{id:"grok-2-vision",name:"Grok 2 Vision",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-1212":{id:"grok-2-vision-1212",name:"Grok 2 Vision (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-latest":{id:"grok-2-vision-latest",name:"Grok 2 Vision Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.3":{id:"grok-4.3",name:"Grok 4.3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-beta":{id:"grok-beta",name:"Grok Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:131072,maxTokens:4096},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:8192},"grok-vision-beta":{id:"grok-vision-beta",name:"Grok Vision Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:8192,maxTokens:4096}},xiaomi:{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-ams":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-cn":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-sgp":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},zai:{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}}});function cg(){return Array.from(ag.keys())}function lg(t){let e=ag.get(t);return e?Array.from(e.values()):[]}function fn(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function _w(t){return t.reasoning?Bc.filter(e=>{let n=t.thinkingLevelMap?.[e];return n===null?!1:e==="xhigh"?n!==void 0:!0}):["off"]}function Rt(t,e){let n=_w(t);if(n.includes(e))return e;let i=Bc.indexOf(e);if(i===-1)return n[0]??"off";for(let s=i;s<Bc.length;s++){let o=Bc[s];if(n.includes(o))return o}for(let s=i-1;s>=0;s--){let o=Bc[s];if(n.includes(o))return o}return n[0]??"off"}function Kn(t,e){return!t||!e?!1:t.id===e.id&&t.provider===e.provider}var ag,Bc,In=Be(()=>{"use strict";Pw();ag=new Map;for(let[t,e]of Object.entries(Rw)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);ag.set(t,n)}Bc=["off","minimal","low","medium","high","xhigh"]});var ug,nt,Rn=Be(()=>{"use strict";ug=class{constructor(e,n){this.queue=[];this.waiting=[];this.done=!1;this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(i=>{this.resolveFinalResult=i})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{let e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}},nt=class extends ug{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}});import{parse as Ew}from"partial-json";function zO(t){let e=t.codePointAt(0);return e!==void 0&&e>=0&&e<=31}function VO(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
1
|
+
var uO=Object.create;var Qh=Object.defineProperty;var dO=Object.getOwnPropertyDescriptor;var pO=Object.getOwnPropertyNames;var mO=Object.getPrototypeOf,hO=Object.prototype.hasOwnProperty;var zu=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Be=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ei=(t,e)=>{for(var n in e)Qh(t,n,{get:e[n],enumerable:!0})},gO=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of pO(e))!hO.call(t,s)&&s!==n&&Qh(t,s,{get:()=>e[s],enumerable:!(i=dO(e,s))||i.enumerable});return t};var fO=(t,e,n)=>(n=t!=null?uO(mO(t)):{},gO(e||!t||!t.__esModule?Qh(n,"default",{value:t,enumerable:!0}):n,t));function hn(t){if(process.versions?.bun&&!(typeof process>"u")&&!(Object.keys(process.env).length>0)){if(ed===null){ed=new Map;try{let{readFileSync:e}=zu("node:fs"),n=e("/proc/self/environ","utf-8");for(let i of n.split("\0")){let s=i.indexOf("=");s>0&&ed.set(i.slice(0,s),i.slice(s+1))}}catch{}}return ed.get(t)}}function AO(){if($c===null){if(!td||!og||!rg)return typeof process<"u"&&(process.versions?.node||process.versions?.bun)||($c=!1),!1;let t=process.env.GOOGLE_APPLICATION_CREDENTIALS||hn("GOOGLE_APPLICATION_CREDENTIALS");t?$c=td(t):$c=td(rg(og(),".config","gcloud","application_default_credentials.json"))}return $c}function OO(t){if(t==="github-copilot")return["COPILOT_GITHUB_TOKEN"];if(t==="anthropic")return["ANTHROPIC_OAUTH_TOKEN","ANTHROPIC_API_KEY"];let n={openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",deepseek:"DEEPSEEK_API_KEY",google:"GEMINI_API_KEY","google-vertex":"GOOGLE_CLOUD_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_CN_API_KEY",moonshotai:"MOONSHOT_API_KEY","moonshotai-cn":"MOONSHOT_API_KEY",huggingface:"HF_TOKEN",fireworks:"FIREWORKS_API_KEY",together:"TOGETHER_API_KEY",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY","cloudflare-workers-ai":"CLOUDFLARE_API_KEY","cloudflare-ai-gateway":"CLOUDFLARE_API_KEY",xiaomi:"XIAOMI_API_KEY","xiaomi-token-plan-cn":"XIAOMI_TOKEN_PLAN_CN_API_KEY","xiaomi-token-plan-ams":"XIAOMI_TOKEN_PLAN_AMS_API_KEY","xiaomi-token-plan-sgp":"XIAOMI_TOKEN_PLAN_SGP_API_KEY"}[t];return n?[n]:void 0}function Sw(t){let e=OO(t);if(!e)return;let n=e.filter(i=>!!process.env[i]||!!hn(i));return n.length>0?n:void 0}function Ke(t){let e=Sw(t);if(e?.[0])return process.env[e[0]]||hn(e[0]);if(t==="google-vertex"){let n=AO(),i=!!(process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT||hn("GOOGLE_CLOUD_PROJECT")||hn("GCLOUD_PROJECT")),s=!!(process.env.GOOGLE_CLOUD_LOCATION||hn("GOOGLE_CLOUD_LOCATION"));if(n&&i&&s)return"<authenticated>"}if(t==="amazon-bedrock"&&(process.env.AWS_PROFILE||process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY||process.env.AWS_BEARER_TOKEN_BEDROCK||process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI||process.env.AWS_WEB_IDENTITY_TOKEN_FILE||hn("AWS_PROFILE")||hn("AWS_ACCESS_KEY_ID")&&hn("AWS_SECRET_ACCESS_KEY")||hn("AWS_BEARER_TOKEN_BEDROCK")||hn("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI")||hn("AWS_CONTAINER_CREDENTIALS_FULL_URI")||hn("AWS_WEB_IDENTITY_TOKEN_FILE")))return"<authenticated>"}var td,og,rg,sg,PO,_O,EO,ed,$c,Gn=Be(()=>{"use strict";td=null,og=null,rg=null,sg=t=>import(t),PO="node:fs",_O="node:os",EO="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(sg(PO).then(t=>{td=t.existsSync}),sg(_O).then(t=>{og=t.homedir}),sg(EO).then(t=>{rg=t.join}));ed=null;$c=null});function gn(t){let e={};for(let[n,i]of t.entries())e[n]=i;return e}var eo=Be(()=>{"use strict"});function fe(t){return t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}var Oi=Be(()=>{"use strict"});var kw={};Ei(kw,{generateImagesOpenRouter:()=>DO});import FO from"openai";function $O(t,e,n){return new FO({apiKey:e,baseURL:t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:{...t.headers,...n}})}function BO(t,e){let n=e.input.map(i=>i.type==="text"?{type:"text",text:fe(i.text)}:{type:"image_url",image_url:{url:`data:${i.mimeType};base64,${i.data}`}});return{model:t.id,messages:[{role:"user",content:n}],stream:!1,modalities:t.output.includes("text")?["image","text"]:["image"]}}function NO(t,e){let n=t.prompt_tokens||0,i=t.prompt_tokens_details?.cached_tokens||0,s=t.prompt_tokens_details?.cache_write_tokens||0,o=s>0?Math.max(0,i-s):i,r=Math.max(0,n-o-s),a=t.completion_tokens||0,c={input:r,output:a,cacheRead:o,cacheWrite:s,totalTokens:r+a+o+s,cost:{input:e.cost.input/1e6*r,output:e.cost.output/1e6*a,cacheRead:e.cost.cacheRead/1e6*o,cacheWrite:e.cost.cacheWrite/1e6*s,total:0}};return c.cost.total=c.cost.input+c.cost.output+c.cost.cacheRead+c.cost.cacheWrite,c}var DO,Mw=Be(()=>{"use strict";Gn();eo();Oi();DO=async(t,e,n)=>{let i={api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let s=n?.apiKey||Ke(t.provider);if(!s)throw new Error(`No API key available for provider: ${t.provider}`);let o=$O(t,s,n?.headers),r=BO(t,e),a=await n?.onPayload?.(r,t);a!==void 0&&(r=a);let c={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},...n?.maxRetries!==void 0?{maxRetries:n.maxRetries}:{}},{data:l,response:d}=await o.chat.completions.create(r,c).withResponse();await n?.onResponse?.({status:d.status,headers:gn(d.headers)},t);let u=l;i.responseId=u.id,u.usage&&(i.usage=NO(u.usage,t));let p=u.choices[0];if(p){let m=p.message.content;typeof m=="string"&&m.length>0&&i.output.push({type:"text",text:m});for(let g of p.message.images??[]){let h=typeof g.image_url=="string"?g.image_url:g.image_url?.url;if(!h?.startsWith("data:"))continue;let f=h.match(/^data:([^;]+);base64,(.+)$/);f&&i.output.push({type:"image",mimeType:f[1],data:f[2]})}}return i}catch(s){return i.stopReason=n?.signal?.aborted?"aborted":"error",i.errorMessage=s instanceof Error?s.message:JSON.stringify(s),i}}});var Rw,Pw=Be(()=>{"use strict";Rw={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-7":{id:"anthropic.claude-opus-4-7",name:"Claude Opus 4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"au.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"au.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-opus-4-6-v1":{id:"au.anthropic.claude-opus-4-6-v1",name:"AU Anthropic Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:16.5,output:82.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"au.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-sonnet-4-6":{id:"au.anthropic.claude-sonnet-4-6",name:"AU Anthropic Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:128e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-7":{id:"eu.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-7":{id:"global.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"jp.anthropic.claude-opus-4-7":{id:"jp.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"jp.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"jp.anthropic.claude-sonnet-4-6":{id:"jp.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax.minimax-m2.5":{id:"minimax.minimax-m2.5",name:"MiniMax M2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:98304},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-super-3-120b":{id:"nvidia.nemotron-super-3-120b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-coder-next":{id:"qwen.qwen3-coder-next",name:"Qwen3 Coder Next",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-7":{id:"us.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"us.deepseek.r1-v1:0":{id:"us.deepseek.r1-v1:0",name:"DeepSeek-R1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"us.meta.llama4-maverick-17b-instruct-v1:0":{id:"us.meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"us.meta.llama4-scout-17b-instruct-v1:0":{id:"us.meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"zai.glm-5":{id:"zai.glm-5",name:"GLM-5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:101376}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.69,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3.1-8b":{id:"llama3.1-8b",name:"Llama 3.1 8B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8e3},"qwen-3-235b-a22b-instruct-2507":{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen 3 235B Instruct",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:32e3},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4e4}},"cloudflare-ai-gateway":{"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-haiku":{id:"claude-3-haiku",name:"Claude Haiku 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus":{id:"claude-3-opus",name:"Claude Opus 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet":{id:"claude-3-sonnet",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3.5-haiku":{id:"claude-3.5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3.5-sonnet":{id:"claude-3.5-sonnet",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4":{id:"claude-opus-4",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"workers-ai/@cf/moonshotai/kimi-k2.5":{id:"workers-ai/@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/moonshotai/kimi-k2.6":{id:"workers-ai/@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/nvidia/nemotron-3-120b-a12b":{id:"workers-ai/@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/zai-org/glm-4.7-flash":{id:"workers-ai/@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},"cloudflare-workers-ai":{"@cf/google/gemma-4-26b-a4b-it":{id:"@cf/google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"@cf/meta/llama-4-scout-17b-16e-instruct":{id:"@cf/meta/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text","image"],cost:{input:.27,output:.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/moonshotai/kimi-k2.5":{id:"@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/moonshotai/kimi-k2.6":{id:"@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/nvidia/nemotron-3-120b-a12b":{id:"@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/openai/gpt-oss-120b":{id:"@cf/openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/openai/gpt-oss-20b":{id:"@cf/openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.2,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/zai-org/glm-4.7-flash":{id:"@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},deepseek:{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1e6,maxTokens:384e3}},fireworks:{"accounts/fireworks/models/deepseek-v3p1":{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"accounts/fireworks/models/deepseek-v3p2":{id:"accounts/fireworks/models/deepseek-v3p2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:16e4,maxTokens:16e4},"accounts/fireworks/models/deepseek-v4-flash":{id:"accounts/fireworks/models/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/deepseek-v4-pro":{id:"accounts/fireworks/models/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/glm-4p5":{id:"accounts/fireworks/models/glm-4p5",name:"GLM 4.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.55,output:2.19,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"accounts/fireworks/models/glm-4p5-air":{id:"accounts/fireworks/models/glm-4p5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"accounts/fireworks/models/glm-4p7":{id:"accounts/fireworks/models/glm-4p7",name:"GLM 4.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.3,cacheWrite:0},contextWindow:198e3,maxTokens:198e3},"accounts/fireworks/models/glm-5":{id:"accounts/fireworks/models/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.5,cacheWrite:0},contextWindow:202752,maxTokens:131072},"accounts/fireworks/models/glm-5p1":{id:"accounts/fireworks/models/glm-5p1",name:"GLM 5.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/models/gpt-oss-120b":{id:"accounts/fireworks/models/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/gpt-oss-20b":{id:"accounts/fireworks/models/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/kimi-k2-instruct":{id:"accounts/fireworks/models/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"accounts/fireworks/models/kimi-k2-thinking":{id:"accounts/fireworks/models/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.3,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"accounts/fireworks/models/kimi-k2p5":{id:"accounts/fireworks/models/kimi-k2p5",name:"Kimi K2.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"accounts/fireworks/models/kimi-k2p6":{id:"accounts/fireworks/models/kimi-k2p6",name:"Kimi K2.6",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/minimax-m2p1":{id:"accounts/fireworks/models/minimax-m2p1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:2e5,maxTokens:2e5},"accounts/fireworks/models/minimax-m2p5":{id:"accounts/fireworks/models/minimax-m2p5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/minimax-m2p7":{id:"accounts/fireworks/models/minimax-m2p7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/qwen3p6-plus":{id:"accounts/fireworks/models/qwen3p6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.1,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"accounts/fireworks/routers/kimi-k2p5-turbo":{id:"accounts/fireworks/routers/kimi-k2p5-turbo",name:"Kimi K2.5 Turbo",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3}},"github-copilot":{"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:64e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3}},google:{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite":{id:"gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemma-4-26b-a4b-it":{id:"gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-31b-it":{id:"gemma-4-31b-it",name:"Gemma 4 31B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"deepseek-r1-distill-llama-70b":{id:"deepseek-r1-distill-llama-70b",name:"DeepSeek R1 Distill Llama 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.75,output:.99,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma2-9b-it":{id:"gemma2-9b-it",name:"Gemma 2 9B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"groq/compound":{id:"groq/compound",name:"Compound",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"groq/compound-mini":{id:"groq/compound-mini",name:"Compound Mini",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B Instant",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B Versatile",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3-70b-8192":{id:"llama3-70b-8192",name:"Llama 3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama3-8b-8192":{id:"llama3-8b-8192",name:"Llama 3 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"meta-llama/llama-4-maverick-17b-128e-instruct":{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"mistral-saba-24b":{id:"mistral-saba-24b",name:"Mistral Saba 24B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.79,output:.79,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"moonshotai/kimi-k2-instruct":{id:"moonshotai/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-instruct-0905":{id:"moonshotai/kimi-k2-instruct-0905",name:"Kimi K2 Instruct 0905",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"Safety GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen-qwq-32b":{id:"qwen-qwq-32b",name:"Qwen QwQ 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.39,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"default"},input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.145,cacheWrite:0},contextWindow:1048576,maxTokens:393216},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi-K2.6",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{"kimi-for-coding":{id:"kimi-for-coding",name:"Kimi For Coding",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},"minimax-cn":{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2604":{id:"mistral-medium-2604",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-3.5":{id:"mistral-medium-3.5",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-2603":{id:"mistral-small-2603",name:"Mistral Small 4",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},moonshotai:{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144}},"moonshotai-cn":{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144}},openai:{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none"},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek-v4-flash-free":{id:"deepseek-v4-flash-free",name:"DeepSeek V4 Flash Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.5-free":{id:"minimax-m2.5-free",name:"MiniMax M2.5 Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-super-free":{id:"nemotron-3-super-free",name:"Nemotron 3 Super Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:128e3},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536},"qwen3.6-plus-free":{id:"qwen3.6-plus-free",name:"Qwen3.6 Plus Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536}},"opencode-go":{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:32768},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202752,maxTokens:32768},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo V2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:128e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:65536},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen"},reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen"},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"alibaba/tongyi-deepresearch-30b-a3b":{id:"alibaba/tongyi-deepresearch-30b-a3b",name:"Tongyi DeepResearch 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:.09,cacheWrite:0},contextWindow:131072,maxTokens:131072},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.6-fast":{id:"anthropic/claude-opus-4.6-fast",name:"Anthropic: Claude Opus 4.6 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Anthropic: Claude Opus 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7-fast":{id:"anthropic/claude-opus-4.7-fast",name:"Anthropic: Claude Opus 4.7 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Arcee AI: Trinity Large Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Arcee AI: Trinity Large Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.22,output:.85,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:262144},"arcee-ai/trinity-large-thinking:free":{id:"arcee-ai/trinity-large-thinking:free",name:"Arcee AI: Trinity Large Thinking (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8e4},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"baidu/cobuddy:free":{id:"baidu/cobuddy:free",name:"Baidu Qianfan: CoBuddy (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"baidu/ernie-4.5-21b-a3b":{id:"baidu/ernie-4.5-21b-a3b",name:"Baidu: ERNIE 4.5 21B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8e3},"baidu/ernie-4.5-vl-28b-a3b":{id:"baidu/ernie-4.5-vl-28b-a3b",name:"Baidu: ERNIE 4.5 VL 28B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8e3},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.32,output:.8899999999999999,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.7899999999999999,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.1500000000000004,cacheRead:.35,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.252,output:.378,cacheRead:.0252,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek: DeepSeek V4 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.112,output:.224,cacheRead:.022,cacheWrite:0},contextWindow:1048576,maxTokens:4096},"deepseek/deepseek-v4-flash:free":{id:"deepseek/deepseek-v4-flash:free",name:"DeepSeek: DeepSeek V4 Flash (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek: DeepSeek V4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.0-flash-001":{id:"google/gemini-2.0-flash-001",name:"Google: Gemini 2.0 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1e6,maxTokens:8192},"google/gemini-2.0-flash-lite-001":{id:"google/gemini-2.0-flash-lite-001",name:"Google: Gemini 2.0 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Google: Gemini 3.1 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048756,maxTokens:65536},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Google: Gemini 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemma-3-12b-it":{id:"google/gemma-3-12b-it",name:"Google: Gemma 3 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.04,output:.13,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-3-27b-it":{id:"google/gemma-3-27b-it",name:"Google: Gemma 3 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Google: Gemma 4 26B A4B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.06,output:.33,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"google/gemma-4-26b-a4b-it:free":{id:"google/gemma-4-26b-a4b-it:free",name:"Google: Gemma 4 26B A4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Google: Gemma 4 31B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.12,output:.37,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"google/gemma-4-31b-it:free":{id:"google/gemma-4-31b-it:free",name:"Google: Gemma 4 31B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"ibm-granite/granite-4.1-8b":{id:"ibm-granite/granite-4.1-8b",name:"IBM: Granite 4.1 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.049999999999999996,output:.09999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inclusionai/ling-2.6-1t":{id:"inclusionai/ling-2.6-1t",name:"inclusionAI: Ling-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ling-2.6-flash":{id:"inclusionai/ling-2.6-flash",name:"inclusionAI: Ling-2.6-flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.01,output:.03,cacheRead:.002,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ring-2.6-1t":{id:"inclusionai/ring-2.6-1t",name:"inclusionAI: Ring-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kwaipilot: KAT-Coder-Pro V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:8e4},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.049999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1e7,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.95,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:1.15,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5:free":{id:"minimax/minimax-m2.5:free",name:"MiniMax: MiniMax M2.5 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:8192},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27899999999999997,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/devstral-medium":{id:"mistralai/devstral-medium",name:"Mistral: Devstral Medium",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/devstral-small":{id:"mistralai/devstral-small",name:"Mistral: Devstral Small 1.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.19999999999999998,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2411":{id:"mistralai/mistral-large-2411",name:"Mistral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3-5":{id:"mistralai/mistral-medium-3-5",name:"Mistral: Mistral Medium 3.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/pixtral-large-2411":{id:"mistralai/pixtral-large-2411",name:"Mistral: Pixtral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5700000000000001,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"MoonshotAI: Kimi K2.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.73,output:3.49,cacheRead:.25,cacheWrite:0},contextWindow:262144,maxTokens:262142},"nex-agi/deepseek-v3.1-nex-n1":{id:"nex-agi/deepseek-v3.1-nex-n1",name:"Nex AGI: DeepSeek V3.1 Nex N1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.135,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:163840},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:228e3},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",name:"NVIDIA: Nemotron 3 Nano Omni (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:262144},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"NVIDIA: Nemotron Nano 9B V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.04,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-0314":{id:"openai/gpt-4-0314",name:"OpenAI: GPT-4 (older v0314)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-1106-preview":{id:"openai/gpt-4-1106-preview",name:"OpenAI: GPT-4 Turbo (older v1106)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:4096},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-audio-preview":{id:"openai/gpt-4o-audio-preview",name:"OpenAI: GPT-4o Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:4e5,maxTokens:4096},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.03,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"OpenAI: GPT-5.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"OpenAI: GPT-5.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-audio":{id:"openai/gpt-audio",name:"OpenAI: GPT Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-audio-mini":{id:"openai/gpt-audio-mini",name:"OpenAI: GPT Audio Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-chat-latest":{id:"openai/gpt-chat-latest",name:"OpenAI: GPT Chat Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.18,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.03,output:.14,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"openrouter/owl-alpha":{id:"openrouter/owl-alpha",name:"Owl Alpha",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048756,maxTokens:262144},"poolside/laguna-m.1:free":{id:"poolside/laguna-m.1:free",name:"Poolside: Laguna M.1 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"poolside/laguna-xs.2:free":{id:"poolside/laguna-xs.2:free",name:"Poolside: Laguna XS.2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.36,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen-2.5-7b-instruct":{id:"qwen/qwen-2.5-7b-instruct",name:"Qwen: Qwen2.5 7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052000000000000005,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.24,cacheRead:0,cacheWrite:0},contextWindow:131702,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.45499999999999996,output:1.8199999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.071,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.14950000000000002,output:1.495,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:2e4},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.39999999999999997,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1.7999999999999998,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:.24375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.11,output:.7999999999999999,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:.8125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:.975},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.10400000000000001,output:.41600000000000004,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13899999999999998,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39,output:2.34,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.04,output:.15,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:81920},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:.08125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-20260420":{id:"qwen/qwen3.5-plus-20260420",name:"Qwen: Qwen3.5 Plus 2026-04-20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.7999999999999998,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-27b":{id:"qwen/qwen3.6-27b",name:"Qwen: Qwen3.6 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.32,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:81920},"qwen/qwen3.6-35b-a3b":{id:"qwen/qwen3.6-35b-a3b",name:"Qwen: Qwen3.6 35B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.149,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3.6-flash":{id:"qwen/qwen3.6-flash",name:"Qwen: Qwen3.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1875,output:1.125,cacheRead:0,cacheWrite:.234375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-max-preview":{id:"qwen/qwen3.6-max-preview",name:"Qwen: Qwen3.6 Max Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.04,output:6.24,cacheRead:0,cacheWrite:1.3},contextWindow:262144,maxTokens:65536},"qwen/qwen3.6-plus":{id:"qwen/qwen3.6-plus",name:"Qwen: Qwen3.6 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.325,output:1.95,cacheRead:0,cacheWrite:.40625},contextWindow:1e6,maxTokens:65536},"rekaai/reka-edge":{id:"rekaai/reka-edge",name:"Reka Edge",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3-euryale-70b":{id:"sao10k/l3-euryale-70b",name:"Sao10k: Llama 3 Euryale 70B v2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.48,output:1.48,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"tencent/hy3-preview":{id:"tencent/hy3-preview",name:"Tencent: Hy3 preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06599999999999999,output:.26,cacheRead:.029,cacheWrite:0},contextWindow:262144,maxTokens:262144},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.16999999999999998,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-4.20":{id:"x-ai/grok-4.20",name:"xAI: Grok 4.20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-4.3":{id:"x-ai/grok-4.3",name:"xAI: Grok 4.3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-omni":{id:"xiaomi/mimo-v2-omni",name:"Xiaomi: MiMo-V2-Omni",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"Xiaomi: MiMo-V2-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"Xiaomi: MiMo-V2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"Xiaomi: MiMo-V2.5-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"z-ai/glm-4-32b":{id:"z-ai/glm-4-32b",name:"Z.ai: GLM 4 32B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.13,output:.85,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air:free":{id:"z-ai/glm-4.5-air:free",name:"Z.ai: GLM 4.5 Air (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:96e3},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.43,output:1.74,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:131072,maxTokens:24e3},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:1.75,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:202752,maxTokens:16384},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"Z.ai: GLM 5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:202800,maxTokens:202800},"z-ai/glm-5v-turbo":{id:"z-ai/glm-5v-turbo",name:"Z.ai: GLM 5V Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202752,maxTokens:131072},"~anthropic/claude-haiku-latest":{id:"~anthropic/claude-haiku-latest",name:"Anthropic Claude Haiku Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"~anthropic/claude-opus-latest":{id:"~anthropic/claude-opus-latest",name:"Anthropic: Claude Opus Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-sonnet-latest":{id:"~anthropic/claude-sonnet-latest",name:"Anthropic Claude Sonnet Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"~google/gemini-flash-latest":{id:"~google/gemini-flash-latest",name:"Google Gemini Flash Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"~google/gemini-pro-latest":{id:"~google/gemini-pro-latest",name:"Google Gemini Pro Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"~moonshotai/kimi-latest":{id:"~moonshotai/kimi-latest",name:"MoonshotAI Kimi Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.73,output:3.49,cacheRead:.25,cacheWrite:0},contextWindow:262144,maxTokens:262142},"~openai/gpt-latest":{id:"~openai/gpt-latest",name:"OpenAI GPT Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"~openai/gpt-mini-latest":{id:"~openai/gpt-mini-latest",name:"OpenAI GPT Mini Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},together:{"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:202752,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Instruct-2507-tput":{id:"Qwen/Qwen3-235B-A22B-Instruct-2507-tput",name:"Qwen3 235B A22B Instruct 2507 FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",name:"Qwen3 Coder 480B A35B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3-Coder-Next-FP8":{id:"Qwen/Qwen3-Coder-Next-FP8",name:"Qwen3 Coder Next FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5 397B A17B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:13e4},"Qwen/Qwen3.6-Plus":{id:"Qwen/Qwen3.6-Plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"deepseek-ai/DeepSeek-V3":{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.25,output:1.25,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"deepseek-ai/DeepSeek-V3-1":{id:"deepseek-ai/DeepSeek-V3-1",name:"DeepSeek V3.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.6,output:1.7,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:null},input:["text"],cost:{input:2.1,output:4.4,cacheRead:.2,cacheWrite:0},contextWindow:512e3,maxTokens:384e3},"essentialai/Rnj-1-Instruct":{id:"essentialai/Rnj-1-Instruct",name:"Rnj-1 Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"google/gemma-4-31B-it":{id:"google/gemma-4-31B-it",name:"Gemma 4 31B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.2,output:.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"meta-llama/Llama-3.3-70B-Instruct-Turbo":{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.88,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.5,output:2.8,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi K2.6",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1.2,output:4.5,cacheRead:.2,cacheWrite:0},contextWindow:262144,maxTokens:131e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.4,output:4.4,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3 235B A22b Instruct 2507",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:.6,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.08,output:.29,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.16,output:.64,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"alibaba/qwen-3.6-max-preview":{id:"alibaba/qwen-3.6-max-preview",name:"Qwen 3.6 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.3,output:7.8,cacheRead:.26,cacheWrite:1.625},contextWindow:24e4,maxTokens:64e3},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.5,output:7.5,cacheRead:.3,cacheWrite:0},contextWindow:262144,maxTokens:65536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.6-27b":{id:"alibaba/qwen3.6-27b",name:"Qwen 3.6 27B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3.5999999999999996,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.6-plus":{id:"alibaba/qwen3.6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.09999999999999999,cacheWrite:.625},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Trinity Large Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262100,maxTokens:8e4},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.77,output:.77,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek-V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:163840,maxTokens:8192},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"google/gemini-2.0-flash":{id:"google/gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite":{id:"google/gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.13,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Gemma 4 31B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.14,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kat Coder Pro V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.9700000000000001,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16999999999999998,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"Minimax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-medium-3.5":{id:"mistral/mistral-medium-3.5",name:"Mistral Medium Latest",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5700000000000001,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-thinking-turbo":{id:"moonshotai/kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-turbo":{id:"moonshotai/kimi-k2-turbo",name:"Kimi K2 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.22999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"GPT 5.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"GPT 5.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.20-multi-agent":{id:"xai/grok-4.20-multi-agent",name:"Grok 4.20 Multi-Agent",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning":{id:"xai/grok-4.20-non-reasoning",name:"Grok 4.20 Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning":{id:"xai/grok-4.20-reasoning",name:"Grok 4.20 Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.3":{id:"xai/grok-4.3",name:"Grok 4.3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"MiMo M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:105e4,maxTokens:131100},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:105e4,maxTokens:131e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:2.25,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.1999999999999997,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5.1":{id:"zai/glm-5.1",name:"GLM 5.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:64e3},"zai/glm-5v-turbo":{id:"zai/glm-5v-turbo",name:"GLM 5V Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:128e3}},xai:{"grok-2":{id:"grok-2",name:"Grok 2",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-1212":{id:"grok-2-1212",name:"Grok 2 (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-latest":{id:"grok-2-latest",name:"Grok 2 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-vision":{id:"grok-2-vision",name:"Grok 2 Vision",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-1212":{id:"grok-2-vision-1212",name:"Grok 2 Vision (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-latest":{id:"grok-2-vision-latest",name:"Grok 2 Vision Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.3":{id:"grok-4.3",name:"Grok 4.3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-beta":{id:"grok-beta",name:"Grok Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:131072,maxTokens:4096},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:8192},"grok-vision-beta":{id:"grok-vision-beta",name:"Grok Vision Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:8192,maxTokens:4096}},xiaomi:{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-ams":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-cn":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-sgp":{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},zai:{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}}});function cg(){return Array.from(ag.keys())}function lg(t){let e=ag.get(t);return e?Array.from(e.values()):[]}function fn(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function _w(t){return t.reasoning?Bc.filter(e=>{let n=t.thinkingLevelMap?.[e];return n===null?!1:e==="xhigh"?n!==void 0:!0}):["off"]}function Rt(t,e){let n=_w(t);if(n.includes(e))return e;let i=Bc.indexOf(e);if(i===-1)return n[0]??"off";for(let s=i;s<Bc.length;s++){let o=Bc[s];if(n.includes(o))return o}for(let s=i-1;s>=0;s--){let o=Bc[s];if(n.includes(o))return o}return n[0]??"off"}function Kn(t,e){return!t||!e?!1:t.id===e.id&&t.provider===e.provider}var ag,Bc,In=Be(()=>{"use strict";Pw();ag=new Map;for(let[t,e]of Object.entries(Rw)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);ag.set(t,n)}Bc=["off","minimal","low","medium","high","xhigh"]});var ug,nt,Rn=Be(()=>{"use strict";ug=class{constructor(e,n){this.queue=[];this.waiting=[];this.done=!1;this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(i=>{this.resolveFinalResult=i})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{let e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}},nt=class extends ug{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}});import{parse as Ew}from"partial-json";function zO(t){let e=t.codePointAt(0);return e!==void 0&&e>=0&&e<=31}function VO(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
2
2
|
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function Aw(t){let e="",n=!1;for(let i=0;i<t.length;i++){let s=t[i];if(!n){e+=s,s==='"'&&(n=!0);continue}if(s==='"'){e+=s,n=!1;continue}if(s==="\\"){let o=t[i+1];if(o===void 0){e+="\\\\";continue}if(o==="u"){let r=t.slice(i+2,i+6);if(/^[0-9a-fA-F]{4}$/.test(r)){e+=`\\u${r}`,i+=5;continue}}if(HO.has(o)){e+=`\\${o}`,i+=1;continue}e+="\\\\";continue}e+=zO(s)?VO(s):s}return e}function dg(t){try{return JSON.parse(t)}catch(e){let n=Aw(t);if(n!==t)return JSON.parse(n);throw e}}function Gt(t){if(!t||t.trim()==="")return{};try{return dg(t)}catch{try{return Ew(t)??{}}catch{try{return Ew(Aw(t))??{}}catch{return{}}}}}var HO,zr=Be(()=>{"use strict";HO=new Set(['"',"\\","/","b","f","n","r","t","u"])});function nd(t){return t==="cloudflare-workers-ai"||t==="cloudflare-ai-gateway"}function Vr(t){let e=t.baseUrl;return e.includes("{")?e.replace(/\{([A-Z_][A-Z0-9_]*)\}/g,(i,s)=>{let o=process.env[s];if(!o)throw new Error(`${s} is required for provider ${t.provider} but is not set.`);return o}):e}var id=Be(()=>{"use strict"});function JO(t){let e=t[t.length-1];return e&&e.role!=="user"?"agent":"user"}function Jr(t){return t.some(e=>e.role==="user"&&Array.isArray(e.content)?e.content.some(n=>n.type==="image"):e.role==="toolResult"&&Array.isArray(e.content)?e.content.some(n=>n.type==="image"):!1)}function Qr(t){let e={"X-Initiator":JO(t.messages),"Openai-Intent":"conversation-edits"};return t.hasImages&&(e["Copilot-Vision-Request"]="true"),e}var sd=Be(()=>{"use strict"});function Pt(t,e,n){return{temperature:e?.temperature,maxTokens:e?.maxTokens,signal:e?.signal,apiKey:n||e?.apiKey,transport:e?.transport,cacheRetention:e?.cacheRetention,sessionId:e?.sessionId,headers:e?.headers,onPayload:e?.onPayload,onResponse:e?.onResponse,timeoutMs:e?.timeoutMs,maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,metadata:e?.metadata}}function QO(t){return t==="xhigh"?"high":t}function Ow(t,e,n,i){let o={...{minimal:1024,low:2048,medium:8192,high:16384},...i},r=1024,a=QO(n),c=o[a],l=t===void 0?e:Math.min(t+c,e);return l<=c&&(c=Math.max(0,l-r)),{maxTokens:l,thinkingBudget:c}}var Li=Be(()=>{"use strict"});function Lw(t,e){let n=[],i=!1;for(let s of t){if(s.type==="image"){i||n.push({type:"text",text:e}),i=!0;continue}n.push(s),i=s.text===e}return n}function ZO(t,e){return e.input.includes("image")?t:t.map(n=>n.role==="user"&&Array.isArray(n.content)?{...n,content:Lw(n.content,YO)}:n.role==="toolResult"?{...n,content:Lw(n.content,XO)}:n)}function ci(t,e,n){let i=new Map,o=ZO(t,e).map(d=>{if(d.role==="user")return d;if(d.role==="toolResult"){let u=i.get(d.toolCallId);return u&&u!==d.toolCallId?{...d,toolCallId:u}:d}if(d.role==="assistant"){let u=d,p=u.provider===e.provider&&u.api===e.api&&u.model===e.id,m=u.content.flatMap(g=>{if(g.type==="thinking")return g.redacted?p?g:[]:p&&g.thinkingSignature?g:!g.thinking||g.thinking.trim()===""?[]:p?g:{type:"text",text:g.thinking};if(g.type==="text")return p?g:{type:"text",text:g.text};if(g.type==="toolCall"){let h=g,f=h;if(!p&&h.thoughtSignature&&(f={...h},delete f.thoughtSignature),!p&&n){let x=n(h.id,e,u);x!==h.id&&(i.set(h.id,x),f={...f,id:x})}return f}return g});return{...u,content:m}}return d}),r=[],a=[],c=new Set,l=()=>{if(a.length>0){for(let d of a)c.has(d.id)||r.push({role:"toolResult",toolCallId:d.id,toolName:d.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});a=[],c=new Set}};for(let d=0;d<o.length;d++){let u=o[d];if(u.role==="assistant"){l();let p=u;if(p.stopReason==="error"||p.stopReason==="aborted")continue;let m=p.content.filter(g=>g.type==="toolCall");m.length>0&&(a=m,c=new Set),r.push(u)}else u.role==="toolResult"?(c.add(u.toolCallId),r.push(u)):(u.role==="user"&&l(),r.push(u))}return l(),r}var YO,XO,Yr=Be(()=>{"use strict";YO="(image omitted: model does not support images)",XO="(tool image omitted: model does not support images)"});var $w={};Ei($w,{streamAnthropic:()=>cd,streamSimpleAnthropic:()=>p2});import od from"@anthropic-ai/sdk";function Uw(t){return t||(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long"?"long":"short")}function e2(t,e){let n=Uw(e);if(n==="none")return{retention:n};let i=n==="long"&&ld(t).supportsLongCacheRetention?"1h":void 0;return{retention:n,cacheControl:{type:"ephemeral",...i&&{ttl:i}}}}function Ww(t){if(!t.some(s=>s.type==="image"))return fe(t.map(s=>s.text).join(`
|
|
3
3
|
`));let n=t.map(s=>s.type==="text"?{type:"text",text:fe(s.text)}:{type:"image",source:{type:"base64",media_type:s.mimeType,data:s.data}});return n.some(s=>s.type==="text")||n.unshift({type:"text",text:"(see attached image)"}),n}function ld(t){let e=t.provider==="fireworks",n=t.provider==="cloudflare-ai-gateway"&&t.baseUrl.includes("anthropic");return{supportsEagerToolInputStreaming:t.compat?.supportsEagerToolInputStreaming??!e,supportsLongCacheRetention:t.compat?.supportsLongCacheRetention??!e,sendSessionAffinityHeaders:t.compat?.sendSessionAffinityHeaders??!!(e||n),supportsCacheControlOnTools:t.compat?.supportsCacheControlOnTools??!e}}function rd(...t){let e={};for(let n of t)n&&Object.assign(e,n);return e}function Dw(t){if(!t.event&&t.data.length===0)return null;let e={event:t.event,data:t.data.join(`
|
|
4
4
|
`),raw:[...t.raw]};return t.event=null,t.data=[],t.raw=[],e}function pg(t,e){if(t==="")return Dw(e);if(e.raw.push(t),t.startsWith(":"))return null;let n=t.indexOf(":"),i=n===-1?t:t.slice(0,n),s=n===-1?"":t.slice(n+1);return s.startsWith(" ")&&(s=s.slice(1)),i==="event"?e.event=s:i==="data"&&e.data.push(s),null}function c2(t){let e=t.indexOf("\r"),n=t.indexOf(`
|
|
@@ -28,7 +28,7 @@ var uO=Object.create;var Qh=Object.defineProperty;var dO=Object.getOwnPropertyDe
|
|
|
28
28
|
`);l.content=[{type:"text",text:f},...d]}else{u.length>0&&(l.content=u);let f=p[0].thinkingSignature;t.provider==="opencode-go"&&f==="reasoning"&&(f="reasoning_content"),f&&f.length>0&&(l[f]=p.map(x=>x.thinking).join(`
|
|
29
29
|
`))}else u.length>0&&(l.content=u);let m=c.content.filter(g9);if(m.length>0){l.tool_calls=m.map(x=>({id:x.id,type:"function",function:{name:x.name,arguments:JSON.stringify(x.arguments)}}));let f=m.filter(x=>x.thoughtSignature).map(x=>{try{return JSON.parse(x.thoughtSignature)}catch{return null}}).filter(Boolean);f.length>0&&(l.reasoning_details=f)}n.requiresReasoningContentOnAssistantMessages&&t.reasoning&&l.reasoning_content===void 0&&(l.reasoning_content="");let g=l.content;if(!(g!=null&&g.length>0)&&!l.tool_calls)continue;i.push(l)}else if(c.role==="toolResult"){let l=[],d=a;for(;d<o.length&&o[d].role==="toolResult";d++){let u=o[d],p=u.content.filter(PS).map(f=>f.text).join(`
|
|
30
30
|
`),m=u.content.some(f=>f.type==="image"),g=p.length>0,h={role:"tool",content:fe(g?p:"(see attached image)"),tool_call_id:u.toolCallId};if(n.requiresToolResultName&&u.toolName&&(h.name=u.toolName),i.push(h),m&&t.input.includes("image"))for(let f of u.content)f9(f)&&l.push({type:"image_url",image_url:{url:`data:${f.mimeType};base64,${f.data}`}})}a=d-1,l.length>0?(n.requiresAssistantAfterToolResult&&i.push({role:"assistant",content:"I have processed the tool results."}),i.push({role:"user",content:[{type:"text",text:"Attached image(s) from tool result:"},...l]}),r="user"):r="toolResult";continue}r=c.role}return i}function I9(t,e){return t.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.parameters,...e.supportsStrictMode!==!1&&{strict:!1}}}))}function _S(t,e){let n=t.prompt_tokens||0,i=t.prompt_tokens_details?.cached_tokens??t.prompt_cache_hit_tokens??0,s=t.prompt_tokens_details?.cache_write_tokens||0,o=Math.max(0,n-i-s),r=t.completion_tokens||0,a={input:o,output:r,cacheRead:i,cacheWrite:s,totalTokens:o+r+i+s,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}};return fn(e,a),a}function R9(t){if(t===null)return{stopReason:"stop"};switch(t){case"stop":case"end":return{stopReason:"stop"};case"length":return{stopReason:"length"};case"function_call":case"tool_calls":return{stopReason:"toolUse"};case"content_filter":return{stopReason:"error",errorMessage:"Provider finish_reason: content_filter"};case"network_error":return{stopReason:"error",errorMessage:"Provider finish_reason: network_error"};default:return{stopReason:"error",errorMessage:`Provider finish_reason: ${t}`}}}function P9(t){let e=t.provider,n=t.baseUrl,i=e==="zai"||n.includes("api.z.ai"),s=e==="together"||n.includes("api.together.ai")||n.includes("api.together.xyz"),o=e==="moonshotai"||e==="moonshotai-cn"||n.includes("api.moonshot."),r=e==="cloudflare-workers-ai"||n.includes("api.cloudflare.com"),a=e==="cloudflare-ai-gateway"||n.includes("gateway.ai.cloudflare.com"),c=e==="cerebras"||n.includes("cerebras.ai")||e==="xai"||n.includes("api.x.ai")||s||n.includes("chutes.ai")||n.includes("deepseek.com")||i||o||e==="opencode"||n.includes("opencode.ai")||r||a,l=n.includes("chutes.ai")||o||a||s,d=e==="xai"||n.includes("api.x.ai"),u=e==="deepseek"||n.includes("deepseek.com"),p=e==="openrouter"&&t.id.startsWith("anthropic/")?"anthropic":void 0;return{supportsStore:!c,supportsDeveloperRole:!c,supportsReasoningEffort:!d&&!i&&!o&&!s&&!a,supportsUsageInStreaming:!0,maxTokensField:l?"max_tokens":"max_completion_tokens",requiresToolResultName:!1,requiresAssistantAfterToolResult:!1,requiresThinkingAsText:!1,requiresReasoningContentOnAssistantMessages:u,thinkingFormat:u?"deepseek":i?"zai":s?"together":e==="openrouter"||n.includes("openrouter.ai")?"openrouter":"openai",openRouterRouting:{},vercelGatewayRouting:{},zaiToolStream:!1,supportsStrictMode:!o&&!s&&!a,cacheControlFormat:p,sendSessionAffinityHeaders:!1,supportsLongCacheRetention:!(s||r||a)}}function Rg(t){let e=P9(t);return t.compat?{supportsStore:t.compat.supportsStore??e.supportsStore,supportsDeveloperRole:t.compat.supportsDeveloperRole??e.supportsDeveloperRole,supportsReasoningEffort:t.compat.supportsReasoningEffort??e.supportsReasoningEffort,supportsUsageInStreaming:t.compat.supportsUsageInStreaming??e.supportsUsageInStreaming,maxTokensField:t.compat.maxTokensField??e.maxTokensField,requiresToolResultName:t.compat.requiresToolResultName??e.requiresToolResultName,requiresAssistantAfterToolResult:t.compat.requiresAssistantAfterToolResult??e.requiresAssistantAfterToolResult,requiresThinkingAsText:t.compat.requiresThinkingAsText??e.requiresThinkingAsText,requiresReasoningContentOnAssistantMessages:t.compat.requiresReasoningContentOnAssistantMessages??e.requiresReasoningContentOnAssistantMessages,thinkingFormat:t.compat.thinkingFormat??e.thinkingFormat,openRouterRouting:t.compat.openRouterRouting??{},vercelGatewayRouting:t.compat.vercelGatewayRouting??e.vercelGatewayRouting,zaiToolStream:t.compat.zaiToolStream??e.zaiToolStream,supportsStrictMode:t.compat.supportsStrictMode??e.supportsStrictMode,cacheControlFormat:t.compat.cacheControlFormat??e.cacheControlFormat,sendSessionAffinityHeaders:t.compat.sendSessionAffinityHeaders??e.sendSessionAffinityHeaders,supportsLongCacheRetention:t.compat.supportsLongCacheRetention??e.supportsLongCacheRetention}:e}var AS,b9,US=Be(()=>{"use strict";Gn();In();Rn();eo();zr();Oi();id();sd();Nc();Li();Yr();AS=(t,e,n)=>{let i=new nt;return(async()=>{let s={role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=n?.apiKey||Ke(t.provider)||"",r=Rg(t),a=ES(n?.cacheRetention),c=a==="none"?void 0:n?.sessionId,l=x9(t,e,o,n?.headers,c,r),d=y9(t,e,n,r,a),u=await n?.onPayload?.(d,t);u!==void 0&&(d=u);let p={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},...n?.maxRetries!==void 0?{maxRetries:n.maxRetries}:{}},{data:m,response:g}=await l.chat.completions.create(d,p).withResponse();await n?.onResponse?.({status:g.status,headers:gn(g.headers)},t),i.push({type:"start",partial:s});let h=null,f=null,x=!1,y=new Map,w=new Map,P=s.content,_=M=>P.indexOf(M),R=M=>{let I=_(M);I!==-1&&(M.type==="text"?i.push({type:"text_end",contentIndex:I,content:M.text,partial:s}):M.type==="thinking"?i.push({type:"thinking_end",contentIndex:I,content:M.thinking,partial:s}):M.type==="toolCall"&&(M.arguments=Gt(M.partialArgs),delete M.partialArgs,delete M.streamIndex,i.push({type:"toolcall_end",contentIndex:I,toolCall:M,partial:s})))},L=()=>(h||(h={type:"text",text:""},P.push(h),i.push({type:"text_start",contentIndex:_(h),partial:s})),h),E=M=>(f||(f={type:"thinking",thinking:"",thinkingSignature:M},P.push(f),i.push({type:"thinking_start",contentIndex:_(f),partial:s})),f),W=M=>{let I=typeof M.index=="number"?M.index:void 0,O=I!==void 0?y.get(I):void 0;return!O&&M.id&&(O=w.get(M.id)),O||(O={type:"toolCall",id:M.id||"",name:M.function?.name||"",arguments:{},partialArgs:"",streamIndex:I},I!==void 0&&y.set(I,O),M.id&&w.set(M.id,O),P.push(O),i.push({type:"toolcall_start",contentIndex:_(O),partial:s})),I!==void 0&&O.streamIndex===void 0&&(O.streamIndex=I,y.set(I,O)),M.id&&w.set(M.id,O),O};for await(let M of m){if(!M||typeof M!="object")continue;s.responseId||=M.id,typeof M.model=="string"&&M.model.length>0&&M.model!==t.id&&(s.responseModel||=M.model),M.usage&&(s.usage=_S(M.usage,t));let I=Array.isArray(M.choices)?M.choices[0]:void 0;if(I){if(!M.usage&&I.usage&&(s.usage=_S(I.usage,t)),I.finish_reason){let O=R9(I.finish_reason);s.stopReason=O.stopReason,O.errorMessage&&(s.errorMessage=O.errorMessage),x=!0}if(I.delta){if(I.delta.content!==null&&I.delta.content!==void 0&&I.delta.content.length>0){let G=L();G.text+=I.delta.content,i.push({type:"text_delta",contentIndex:_(G),delta:I.delta.content,partial:s})}let O=["reasoning_content","reasoning","reasoning_text"],F=I.delta,N=null;for(let G of O){let Z=F[G];if(typeof Z=="string"&&Z.length>0){N=G;break}}if(N){let G=F[N];if(typeof G=="string"&&G.length>0){let Z=t.provider==="opencode-go"&&N==="reasoning"?"reasoning_content":N,de=E(Z);de.thinking+=G,i.push({type:"thinking_delta",contentIndex:_(de),delta:G,partial:s})}}if(I?.delta?.tool_calls)for(let G of I.delta.tool_calls){let Z=W(G);!Z.id&&G.id&&(Z.id=G.id,w.set(G.id,Z)),!Z.name&&G.function?.name&&(Z.name=G.function.name);let de="";G.function?.arguments&&(de=G.function.arguments,Z.partialArgs=(Z.partialArgs??"")+G.function.arguments,Z.arguments=Gt(Z.partialArgs)),i.push({type:"toolcall_delta",contentIndex:_(Z),delta:de,partial:s})}let H=I.delta.reasoning_details;if(H&&Array.isArray(H)){for(let G of H)if(G.type==="reasoning.encrypted"&&G.id&&G.data){let Z=s.content.find(de=>de.type==="toolCall"&&de.id===G.id);Z&&(Z.thoughtSignature=JSON.stringify(G))}}}}}for(let M of P)R(M);if(n?.signal?.aborted)throw new Error("Request was aborted");if(s.stopReason==="aborted")throw new Error("Request was aborted");if(s.stopReason==="error")throw new Error(s.errorMessage||"Provider returned an error stop reason");if(!x)throw new Error("Stream ended without finish_reason");i.push({type:"done",reason:s.stopReason,message:s}),i.end()}catch(o){for(let a of s.content)delete a.index,delete a.partialArgs,delete a.streamIndex;s.stopReason=n?.signal?.aborted?"aborted":"error",s.errorMessage=o instanceof Error?o.message:JSON.stringify(o);let r=o?.error?.metadata?.raw;r&&(s.errorMessage+=`
|
|
31
|
-
${r}`),i.push({type:"error",reason:s.stopReason,error:s}),i.end()}})(),i},b9=(t,e,n)=>{let i=n?.apiKey||Ke(t.provider);if(!i)throw new Error(`No API key for provider: ${t.provider}`);let s=Pt(t,n,i),o=n?.reasoning?Rt(t,n.reasoning):void 0,r=o==="off"?void 0:o,a=n?.toolChoice;return AS(t,e,{...s,reasoningEffort:r,toolChoice:a})}});var BS={};Ei(BS,{streamOpenAIResponses:()=>$S,streamSimpleOpenAIResponses:()=>L9});import _9 from"openai";function FS(t){return t||(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long"?"long":"short")}function DS(t){return{sendSessionIdHeader:t.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:t.compat?.supportsLongCacheRetention??!0}}function A9(t,e){return e==="long"&&t.supportsLongCacheRetention?"24h":void 0}function O9(t){if(t instanceof Error){let e=t.status,n=typeof e=="number"?e:void 0;return n!==void 0?`OpenAI API error (${n}): ${t.message}`:t.message}try{return JSON.stringify(t)}catch{return String(t)}}function W9(t,e,n,i,s){if(!n){if(!process.env.OPENAI_API_KEY)throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");n=process.env.OPENAI_API_KEY}let o=DS(t),r={...t.headers};if(t.provider==="github-copilot"){let c=Jr(e.messages),l=Qr({messages:e.messages,hasImages:c});Object.assign(r,l)}s&&(o.sendSessionIdHeader&&(r.session_id=s),r["x-client-request-id"]=s),i&&Object.assign(r,i);let a=t.provider==="cloudflare-ai-gateway"?{...r,Authorization:r.Authorization??null,"cf-aig-authorization":`Bearer ${n}`}:r;return new _9({apiKey:n,baseURL:nd(t.provider)?Vr(t):t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:a})}function U9(t,e,n){let i=to(t,e,E9),s=FS(n?.cacheRetention),o=DS(t),r={model:t.id,input:i,stream:!0,prompt_cache_key:s==="none"?void 0:ys(n?.sessionId),prompt_cache_retention:A9(o,s),store:!1};if(n?.maxTokens&&(r.max_output_tokens=n?.maxTokens),n?.temperature!==void 0&&(r.temperature=n?.temperature),n?.serviceTier!==void 0&&(r.service_tier=n.serviceTier),e.tools&&e.tools.length>0&&(r.tools=Xr(e.tools)),t.reasoning)if(n?.reasoningEffort||n?.reasoningSummary){let a=n?.reasoningEffort?t.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort:"medium";r.reasoning={effort:a,summary:n?.reasoningSummary||"auto"},r.include=["reasoning.encrypted_content"]}else t.provider!=="github-copilot"&&t.thinkingLevelMap?.off!==null&&(r.reasoning={effort:t.thinkingLevelMap?.off??"none"});return r}function F9(t,e){switch(e){case"flex":return .5;case"priority":return t.id==="gpt-5.5"?2.5:2;default:return 1}}function D9(t,e,n){let i=F9(n,e);i!==1&&(t.cost.input*=i,t.cost.output*=i,t.cost.cacheRead*=i,t.cost.cacheWrite*=i,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite)}var E9,$S,L9,NS=Be(()=>{"use strict";Gn();In();Rn();eo();id();sd();Nc();ud();Li();E9=new Set(["openai","openai-codex","opencode"]);$S=(t,e,n)=>{let i=new nt;return(async()=>{let s={role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=n?.apiKey||Ke(t.provider)||"",a=FS(n?.cacheRetention)==="none"?void 0:n?.sessionId,c=W9(t,e,o,n?.headers,a),l=U9(t,e,n),d=await n?.onPayload?.(l,t);d!==void 0&&(l=d);let u={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},...n?.maxRetries!==void 0?{maxRetries:n.maxRetries}:{}},{data:p,response:m}=await c.responses.create(l,u).withResponse();if(await n?.onResponse?.({status:m.status,headers:gn(m.headers)},t),i.push({type:"start",partial:s}),await no(p,s,i,t,{serviceTier:n?.serviceTier,applyServiceTierPricing:(g,h)=>D9(g,h,t)}),n?.signal?.aborted)throw new Error("Request was aborted");if(s.stopReason==="aborted"||s.stopReason==="error")throw new Error("An unknown error occurred");i.push({type:"done",reason:s.stopReason,message:s}),i.end()}catch(o){for(let r of s.content)delete r.index,delete r.partialJson;s.stopReason=n?.signal?.aborted?"aborted":"error",s.errorMessage=O9(o),i.push({type:"error",reason:s.stopReason,error:s}),i.end()}})(),i},L9=(t,e,n)=>{let i=n?.apiKey||Ke(t.provider);if(!i)throw new Error(`No API key for provider: ${t.provider}`);let s=Pt(t,n,i),o=n?.reasoning?Rt(t,n.reasoning):void 0;return $S(t,e,{...s,reasoningEffort:o==="off"?void 0:o})}});var Ut=T(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.HasPropertyKey=oj;xt.IsAsyncIterator=rj;xt.IsArray=Ub;xt.IsBigInt=aj;xt.IsBoolean=cj;xt.IsDate=lj;xt.IsFunction=uj;xt.IsIterator=dj;xt.IsNull=pj;xt.IsNumber=mj;xt.IsObject=Fb;xt.IsRegExp=hj;xt.IsString=gj;xt.IsSymbol=fj;xt.IsUint8Array=Db;xt.IsUndefined=bj;function oj(t,e){return e in t}function rj(t){return Fb(t)&&!Ub(t)&&!Db(t)&&Symbol.asyncIterator in t}function Ub(t){return Array.isArray(t)}function aj(t){return typeof t=="bigint"}function cj(t){return typeof t=="boolean"}function lj(t){return t instanceof globalThis.Date}function uj(t){return typeof t=="function"}function dj(t){return Fb(t)&&!Ub(t)&&!Db(t)&&Symbol.iterator in t}function pj(t){return t===null}function mj(t){return typeof t=="number"}function Fb(t){return typeof t=="object"&&t!==null}function hj(t){return t instanceof globalThis.RegExp}function gj(t){return typeof t=="string"}function fj(t){return typeof t=="symbol"}function Db(t){return t instanceof globalThis.Uint8Array}function bj(t){return t===void 0}});var tn=T(Qi=>{"use strict";var xj=Qi&&Qi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yj=Qi&&Qi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),vj=Qi&&Qi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&xj(n,e,i[s]);return yj(n,e),n}})();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.Clone=Mj;var lu=vj(Ut());function wj(t){return t.map(e=>Cm(e))}function Sj(t){return new Date(t.getTime())}function Cj(t){return new Uint8Array(t)}function Tj(t){return new RegExp(t.source,t.flags)}function kj(t){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=Cm(t[n]);for(let n of Object.getOwnPropertySymbols(t))e[n]=Cm(t[n]);return e}function Cm(t){return lu.IsArray(t)?wj(t):lu.IsDate(t)?Sj(t):lu.IsUint8Array(t)?Cj(t):lu.IsRegExp(t)?Tj(t):lu.IsObject(t)?kj(t):t}function Mj(t){return Cm(t)}});var km=T(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});Tm.CloneRest=Ij;Tm.CloneType=qI;var jI=tn();function Ij(t){return t.map(e=>qI(e))}function qI(t,e){return e===void 0?(0,jI.Clone)(t):(0,jI.Clone)({...e,...t})}});var $b=T($s=>{"use strict";var Rj=$s&&$s.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),GI=$s&&$s.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Rj(e,t,n)};Object.defineProperty($s,"__esModule",{value:!0});GI(km(),$s);GI(tn(),$s)});var eR=T(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.IsAsyncIterator=Pj;ke.IsIterator=_j;ke.IsStandardObject=Ej;ke.IsInstanceObject=Aj;ke.IsPromise=Oj;ke.IsDate=Lj;ke.IsMap=Wj;ke.IsSet=Uj;ke.IsRegExp=Fj;ke.IsTypedArray=Dj;ke.IsInt8Array=$j;ke.IsUint8Array=Bj;ke.IsUint8ClampedArray=Nj;ke.IsInt16Array=jj;ke.IsUint16Array=qj;ke.IsInt32Array=Gj;ke.IsUint32Array=Kj;ke.IsFloat32Array=Hj;ke.IsFloat64Array=zj;ke.IsBigInt64Array=Vj;ke.IsBigUint64Array=Jj;ke.HasPropertyKey=Qj;ke.IsObject=uu;ke.IsArray=KI;ke.IsUndefined=HI;ke.IsNull=zI;ke.IsBoolean=VI;ke.IsNumber=JI;ke.IsInteger=Yj;ke.IsBigInt=QI;ke.IsString=YI;ke.IsFunction=XI;ke.IsSymbol=ZI;ke.IsValueType=Xj;function Pj(t){return uu(t)&&globalThis.Symbol.asyncIterator in t}function _j(t){return uu(t)&&globalThis.Symbol.iterator in t}function Ej(t){return uu(t)&&(globalThis.Object.getPrototypeOf(t)===Object.prototype||globalThis.Object.getPrototypeOf(t)===null)}function Aj(t){return uu(t)&&!KI(t)&&XI(t.constructor)&&t.constructor.name!=="Object"}function Oj(t){return t instanceof globalThis.Promise}function Lj(t){return t instanceof Date&&globalThis.Number.isFinite(t.getTime())}function Wj(t){return t instanceof globalThis.Map}function Uj(t){return t instanceof globalThis.Set}function Fj(t){return t instanceof globalThis.RegExp}function Dj(t){return globalThis.ArrayBuffer.isView(t)}function $j(t){return t instanceof globalThis.Int8Array}function Bj(t){return t instanceof globalThis.Uint8Array}function Nj(t){return t instanceof globalThis.Uint8ClampedArray}function jj(t){return t instanceof globalThis.Int16Array}function qj(t){return t instanceof globalThis.Uint16Array}function Gj(t){return t instanceof globalThis.Int32Array}function Kj(t){return t instanceof globalThis.Uint32Array}function Hj(t){return t instanceof globalThis.Float32Array}function zj(t){return t instanceof globalThis.Float64Array}function Vj(t){return t instanceof globalThis.BigInt64Array}function Jj(t){return t instanceof globalThis.BigUint64Array}function Qj(t,e){return e in t}function uu(t){return t!==null&&typeof t=="object"}function KI(t){return globalThis.Array.isArray(t)&&!globalThis.ArrayBuffer.isView(t)}function HI(t){return t===void 0}function zI(t){return t===null}function VI(t){return typeof t=="boolean"}function JI(t){return typeof t=="number"}function Yj(t){return globalThis.Number.isInteger(t)}function QI(t){return typeof t=="bigint"}function YI(t){return typeof t=="string"}function XI(t){return typeof t=="function"}function ZI(t){return typeof t=="symbol"}function Xj(t){return QI(t)||VI(t)||zI(t)||JI(t)||YI(t)||ZI(t)||HI(t)}});var tR=T(Wo=>{"use strict";var Zj=Wo&&Wo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),eq=Wo&&Wo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Zj(e,t,n)};Object.defineProperty(Wo,"__esModule",{value:!0});eq(eR(),Wo)});var iR=T(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});Im.TypeSystemPolicy=void 0;var Mm=tR(),nR;(function(t){t.InstanceMode="default",t.ExactOptionalPropertyTypes=!1,t.AllowArrayObject=!1,t.AllowNaN=!1,t.AllowNullVoid=!1;function e(r,a){return t.ExactOptionalPropertyTypes?a in r:r[a]!==void 0}t.IsExactOptionalProperty=e;function n(r){let a=(0,Mm.IsObject)(r);return t.AllowArrayObject?a:a&&!(0,Mm.IsArray)(r)}t.IsObjectLike=n;function i(r){return n(r)&&!(r instanceof Date)&&!(r instanceof Uint8Array)}t.IsRecordLike=i;function s(r){return t.AllowNaN?(0,Mm.IsNumber)(r):Number.isFinite(r)}t.IsNumberLike=s;function o(r){let a=(0,Mm.IsUndefined)(r);return t.AllowNullVoid?a||r===null:a}t.IsVoidLike=o})(nR||(Im.TypeSystemPolicy=nR={}))});var sR=T(Yi=>{"use strict";var tq=Yi&&Yi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),nq=Yi&&Yi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),iq=Yi&&Yi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&tq(n,e,i[s]);return nq(n,e),n}})();Object.defineProperty(Yi,"__esModule",{value:!0});Yi.Immutable=Rm;var du=iq(Ut());function sq(t){return globalThis.Object.freeze(t).map(e=>Rm(e))}function oq(t){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=Rm(t[n]);for(let n of Object.getOwnPropertySymbols(t))e[n]=Rm(t[n]);return globalThis.Object.freeze(e)}function Rm(t){return du.IsArray(t)?sq(t):du.IsDate(t)?t:du.IsUint8Array(t)?t:du.IsRegExp(t)?t:du.IsObject(t)?oq(t):t}});var le=T(Bb=>{"use strict";Object.defineProperty(Bb,"__esModule",{value:!0});Bb.CreateType=lq;var rq=iR(),aq=sR(),cq=tn();function lq(t,e){let n=e!==void 0?{...e,...t}:t;switch(rq.TypeSystemPolicy.InstanceMode){case"freeze":return(0,aq.Immutable)(n);case"clone":return(0,cq.Clone)(n);default:return n}}});var Xi=T(Uo=>{"use strict";var uq=Uo&&Uo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dq=Uo&&Uo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uq(e,t,n)};Object.defineProperty(Uo,"__esModule",{value:!0});dq(le(),Uo)});var oR=T(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.TypeBoxError=void 0;var Nb=class extends Error{constructor(e){super(e)}};Pm.TypeBoxError=Nb});var xi=T(Fo=>{"use strict";var pq=Fo&&Fo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mq=Fo&&Fo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pq(e,t,n)};Object.defineProperty(Fo,"__esModule",{value:!0});mq(oR(),Fo)});var pu=T(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.Kind=Fn.Hint=Fn.OptionalKind=Fn.ReadonlyKind=Fn.TransformKind=void 0;Fn.TransformKind=Symbol.for("TypeBox.Transform");Fn.ReadonlyKind=Symbol.for("TypeBox.Readonly");Fn.OptionalKind=Symbol.for("TypeBox.Optional");Fn.Hint=Symbol.for("TypeBox.Hint");Fn.Kind=Symbol.for("TypeBox.Kind")});var re=T(Do=>{"use strict";var hq=Do&&Do.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gq=Do&&Do.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hq(e,t,n)};Object.defineProperty(Do,"__esModule",{value:!0});gq(pu(),Do)});var Me=T(oe=>{"use strict";var fq=oe&&oe.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),bq=oe&&oe.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),xq=oe&&oe.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&fq(n,e,i[s]);return bq(n,e),n}})();Object.defineProperty(oe,"__esModule",{value:!0});oe.IsReadonly=yq;oe.IsOptional=vq;oe.IsAny=rR;oe.IsArgument=aR;oe.IsArray=cR;oe.IsAsyncIterator=lR;oe.IsBigInt=uR;oe.IsBoolean=dR;oe.IsComputed=pR;oe.IsConstructor=mR;oe.IsDate=hR;oe.IsFunction=gR;oe.IsImport=wq;oe.IsInteger=fR;oe.IsProperties=Sq;oe.IsIntersect=bR;oe.IsIterator=xR;oe.IsKindOf=Se;oe.IsLiteralString=Cq;oe.IsLiteralNumber=Tq;oe.IsLiteralBoolean=kq;oe.IsLiteralValue=Mq;oe.IsLiteral=mu;oe.IsMappedKey=yR;oe.IsMappedResult=vR;oe.IsNever=wR;oe.IsNot=SR;oe.IsNull=CR;oe.IsNumber=TR;oe.IsObject=kR;oe.IsPromise=MR;oe.IsRecord=IR;oe.IsRecursive=Iq;oe.IsRef=RR;oe.IsRegExp=PR;oe.IsString=_R;oe.IsSymbol=ER;oe.IsTemplateLiteral=AR;oe.IsThis=OR;oe.IsTransform=Rq;oe.IsTuple=LR;oe.IsUndefined=WR;oe.IsUnion=UR;oe.IsUint8Array=FR;oe.IsUnknown=DR;oe.IsUnsafe=$R;oe.IsVoid=BR;oe.IsKind=NR;oe.IsSchema=Pq;var nn=xq(Ut()),Zi=re();function yq(t){return nn.IsObject(t)&&t[Zi.ReadonlyKind]==="Readonly"}function vq(t){return nn.IsObject(t)&&t[Zi.OptionalKind]==="Optional"}function rR(t){return Se(t,"Any")}function aR(t){return Se(t,"Argument")}function cR(t){return Se(t,"Array")}function lR(t){return Se(t,"AsyncIterator")}function uR(t){return Se(t,"BigInt")}function dR(t){return Se(t,"Boolean")}function pR(t){return Se(t,"Computed")}function mR(t){return Se(t,"Constructor")}function hR(t){return Se(t,"Date")}function gR(t){return Se(t,"Function")}function wq(t){return Se(t,"Import")}function fR(t){return Se(t,"Integer")}function Sq(t){return nn.IsObject(t)}function bR(t){return Se(t,"Intersect")}function xR(t){return Se(t,"Iterator")}function Se(t,e){return nn.IsObject(t)&&Zi.Kind in t&&t[Zi.Kind]===e}function Cq(t){return mu(t)&&nn.IsString(t.const)}function Tq(t){return mu(t)&&nn.IsNumber(t.const)}function kq(t){return mu(t)&&nn.IsBoolean(t.const)}function Mq(t){return nn.IsBoolean(t)||nn.IsNumber(t)||nn.IsString(t)}function mu(t){return Se(t,"Literal")}function yR(t){return Se(t,"MappedKey")}function vR(t){return Se(t,"MappedResult")}function wR(t){return Se(t,"Never")}function SR(t){return Se(t,"Not")}function CR(t){return Se(t,"Null")}function TR(t){return Se(t,"Number")}function kR(t){return Se(t,"Object")}function MR(t){return Se(t,"Promise")}function IR(t){return Se(t,"Record")}function Iq(t){return nn.IsObject(t)&&Zi.Hint in t&&t[Zi.Hint]==="Recursive"}function RR(t){return Se(t,"Ref")}function PR(t){return Se(t,"RegExp")}function _R(t){return Se(t,"String")}function ER(t){return Se(t,"Symbol")}function AR(t){return Se(t,"TemplateLiteral")}function OR(t){return Se(t,"This")}function Rq(t){return nn.IsObject(t)&&Zi.TransformKind in t}function LR(t){return Se(t,"Tuple")}function WR(t){return Se(t,"Undefined")}function UR(t){return Se(t,"Union")}function FR(t){return Se(t,"Uint8Array")}function DR(t){return Se(t,"Unknown")}function $R(t){return Se(t,"Unsafe")}function BR(t){return Se(t,"Void")}function NR(t){return nn.IsObject(t)&&Zi.Kind in t&&nn.IsString(t[Zi.Kind])}function Pq(t){return rR(t)||aR(t)||cR(t)||dR(t)||uR(t)||lR(t)||pR(t)||mR(t)||hR(t)||gR(t)||fR(t)||bR(t)||xR(t)||mu(t)||yR(t)||vR(t)||wR(t)||SR(t)||CR(t)||TR(t)||kR(t)||MR(t)||IR(t)||RR(t)||PR(t)||_R(t)||ER(t)||AR(t)||OR(t)||LR(t)||WR(t)||UR(t)||FR(t)||DR(t)||$R(t)||BR(t)||NR(t)}});var _P=T(ie=>{"use strict";var _q=ie&&ie.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Eq=ie&&ie.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Aq=ie&&ie.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&_q(n,e,i[s]);return Eq(n,e),n}})();Object.defineProperty(ie,"__esModule",{value:!0});ie.TypeGuardUnknownTypeError=void 0;ie.IsReadonly=Fq;ie.IsOptional=Dq;ie.IsAny=KR;ie.IsArgument=HR;ie.IsArray=zR;ie.IsAsyncIterator=VR;ie.IsBigInt=JR;ie.IsBoolean=QR;ie.IsComputed=YR;ie.IsConstructor=XR;ie.IsDate=ZR;ie.IsFunction=eP;ie.IsImport=$q;ie.IsInteger=tP;ie.IsProperties=_m;ie.IsIntersect=nP;ie.IsIterator=iP;ie.IsKindOf=Ce;ie.IsLiteralString=sP;ie.IsLiteralNumber=oP;ie.IsLiteralBoolean=Bq;ie.IsLiteral=gu;ie.IsLiteralValue=rP;ie.IsMappedKey=aP;ie.IsMappedResult=cP;ie.IsNever=lP;ie.IsNot=uP;ie.IsNull=dP;ie.IsNumber=pP;ie.IsObject=mP;ie.IsPromise=hP;ie.IsRecord=gP;ie.IsRecursive=Nq;ie.IsRef=fP;ie.IsRegExp=bP;ie.IsString=xP;ie.IsSymbol=yP;ie.IsTemplateLiteral=vP;ie.IsThis=wP;ie.IsTransform=SP;ie.IsTuple=CP;ie.IsUndefined=TP;ie.IsUnionLiteral=jq;ie.IsUnion=Kb;ie.IsUint8Array=kP;ie.IsUnknown=MP;ie.IsUnsafe=IP;ie.IsVoid=RP;ie.IsKind=PP;ie.IsSchema=yt;var se=Aq(Ut()),yi=re(),Oq=xi(),jb=class extends Oq.TypeBoxError{};ie.TypeGuardUnknownTypeError=jb;var Lq=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function jR(t){try{return new RegExp(t),!0}catch{return!1}}function qb(t){if(!se.IsString(t))return!1;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function qR(t){return Gb(t)||yt(t)}function hu(t){return se.IsUndefined(t)||se.IsBigInt(t)}function $e(t){return se.IsUndefined(t)||se.IsNumber(t)}function Gb(t){return se.IsUndefined(t)||se.IsBoolean(t)}function We(t){return se.IsUndefined(t)||se.IsString(t)}function Wq(t){return se.IsUndefined(t)||se.IsString(t)&&qb(t)&&jR(t)}function Uq(t){return se.IsUndefined(t)||se.IsString(t)&&qb(t)}function GR(t){return se.IsUndefined(t)||yt(t)}function Fq(t){return se.IsObject(t)&&t[yi.ReadonlyKind]==="Readonly"}function Dq(t){return se.IsObject(t)&&t[yi.OptionalKind]==="Optional"}function KR(t){return Ce(t,"Any")&&We(t.$id)}function HR(t){return Ce(t,"Argument")&&se.IsNumber(t.index)}function zR(t){return Ce(t,"Array")&&t.type==="array"&&We(t.$id)&&yt(t.items)&&$e(t.minItems)&&$e(t.maxItems)&&Gb(t.uniqueItems)&&GR(t.contains)&&$e(t.minContains)&&$e(t.maxContains)}function VR(t){return Ce(t,"AsyncIterator")&&t.type==="AsyncIterator"&&We(t.$id)&&yt(t.items)}function JR(t){return Ce(t,"BigInt")&&t.type==="bigint"&&We(t.$id)&&hu(t.exclusiveMaximum)&&hu(t.exclusiveMinimum)&&hu(t.maximum)&&hu(t.minimum)&&hu(t.multipleOf)}function QR(t){return Ce(t,"Boolean")&&t.type==="boolean"&&We(t.$id)}function YR(t){return Ce(t,"Computed")&&se.IsString(t.target)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))}function XR(t){return Ce(t,"Constructor")&&t.type==="Constructor"&&We(t.$id)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))&&yt(t.returns)}function ZR(t){return Ce(t,"Date")&&t.type==="Date"&&We(t.$id)&&$e(t.exclusiveMaximumTimestamp)&&$e(t.exclusiveMinimumTimestamp)&&$e(t.maximumTimestamp)&&$e(t.minimumTimestamp)&&$e(t.multipleOfTimestamp)}function eP(t){return Ce(t,"Function")&&t.type==="Function"&&We(t.$id)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))&&yt(t.returns)}function $q(t){return Ce(t,"Import")&&se.HasPropertyKey(t,"$defs")&&se.IsObject(t.$defs)&&_m(t.$defs)&&se.HasPropertyKey(t,"$ref")&&se.IsString(t.$ref)&&t.$ref in t.$defs}function tP(t){return Ce(t,"Integer")&&t.type==="integer"&&We(t.$id)&&$e(t.exclusiveMaximum)&&$e(t.exclusiveMinimum)&&$e(t.maximum)&&$e(t.minimum)&&$e(t.multipleOf)}function _m(t){return se.IsObject(t)&&Object.entries(t).every(([e,n])=>qb(e)&&yt(n))}function nP(t){return Ce(t,"Intersect")&&!(se.IsString(t.type)&&t.type!=="object")&&se.IsArray(t.allOf)&&t.allOf.every(e=>yt(e)&&!SP(e))&&We(t.type)&&(Gb(t.unevaluatedProperties)||GR(t.unevaluatedProperties))&&We(t.$id)}function iP(t){return Ce(t,"Iterator")&&t.type==="Iterator"&&We(t.$id)&&yt(t.items)}function Ce(t,e){return se.IsObject(t)&&yi.Kind in t&&t[yi.Kind]===e}function sP(t){return gu(t)&&se.IsString(t.const)}function oP(t){return gu(t)&&se.IsNumber(t.const)}function Bq(t){return gu(t)&&se.IsBoolean(t.const)}function gu(t){return Ce(t,"Literal")&&We(t.$id)&&rP(t.const)}function rP(t){return se.IsBoolean(t)||se.IsNumber(t)||se.IsString(t)}function aP(t){return Ce(t,"MappedKey")&&se.IsArray(t.keys)&&t.keys.every(e=>se.IsNumber(e)||se.IsString(e))}function cP(t){return Ce(t,"MappedResult")&&_m(t.properties)}function lP(t){return Ce(t,"Never")&&se.IsObject(t.not)&&Object.getOwnPropertyNames(t.not).length===0}function uP(t){return Ce(t,"Not")&&yt(t.not)}function dP(t){return Ce(t,"Null")&&t.type==="null"&&We(t.$id)}function pP(t){return Ce(t,"Number")&&t.type==="number"&&We(t.$id)&&$e(t.exclusiveMaximum)&&$e(t.exclusiveMinimum)&&$e(t.maximum)&&$e(t.minimum)&&$e(t.multipleOf)}function mP(t){return Ce(t,"Object")&&t.type==="object"&&We(t.$id)&&_m(t.properties)&&qR(t.additionalProperties)&&$e(t.minProperties)&&$e(t.maxProperties)}function hP(t){return Ce(t,"Promise")&&t.type==="Promise"&&We(t.$id)&&yt(t.item)}function gP(t){return Ce(t,"Record")&&t.type==="object"&&We(t.$id)&&qR(t.additionalProperties)&&se.IsObject(t.patternProperties)&&(e=>{let n=Object.getOwnPropertyNames(e.patternProperties);return n.length===1&&jR(n[0])&&se.IsObject(e.patternProperties)&&yt(e.patternProperties[n[0]])})(t)}function Nq(t){return se.IsObject(t)&&yi.Hint in t&&t[yi.Hint]==="Recursive"}function fP(t){return Ce(t,"Ref")&&We(t.$id)&&se.IsString(t.$ref)}function bP(t){return Ce(t,"RegExp")&&We(t.$id)&&se.IsString(t.source)&&se.IsString(t.flags)&&$e(t.maxLength)&&$e(t.minLength)}function xP(t){return Ce(t,"String")&&t.type==="string"&&We(t.$id)&&$e(t.minLength)&&$e(t.maxLength)&&Wq(t.pattern)&&Uq(t.format)}function yP(t){return Ce(t,"Symbol")&&t.type==="symbol"&&We(t.$id)}function vP(t){return Ce(t,"TemplateLiteral")&&t.type==="string"&&se.IsString(t.pattern)&&t.pattern[0]==="^"&&t.pattern[t.pattern.length-1]==="$"}function wP(t){return Ce(t,"This")&&We(t.$id)&&se.IsString(t.$ref)}function SP(t){return se.IsObject(t)&&yi.TransformKind in t}function CP(t){return Ce(t,"Tuple")&&t.type==="array"&&We(t.$id)&&se.IsNumber(t.minItems)&&se.IsNumber(t.maxItems)&&t.minItems===t.maxItems&&(se.IsUndefined(t.items)&&se.IsUndefined(t.additionalItems)&&t.minItems===0||se.IsArray(t.items)&&t.items.every(e=>yt(e)))}function TP(t){return Ce(t,"Undefined")&&t.type==="undefined"&&We(t.$id)}function jq(t){return Kb(t)&&t.anyOf.every(e=>sP(e)||oP(e))}function Kb(t){return Ce(t,"Union")&&We(t.$id)&&se.IsObject(t)&&se.IsArray(t.anyOf)&&t.anyOf.every(e=>yt(e))}function kP(t){return Ce(t,"Uint8Array")&&t.type==="Uint8Array"&&We(t.$id)&&$e(t.minByteLength)&&$e(t.maxByteLength)}function MP(t){return Ce(t,"Unknown")&&We(t.$id)}function IP(t){return Ce(t,"Unsafe")}function RP(t){return Ce(t,"Void")&&t.type==="void"&&We(t.$id)}function PP(t){return se.IsObject(t)&&yi.Kind in t&&se.IsString(t[yi.Kind])&&!Lq.includes(t[yi.Kind])}function yt(t){return se.IsObject(t)&&(KR(t)||HR(t)||zR(t)||QR(t)||JR(t)||VR(t)||YR(t)||XR(t)||ZR(t)||eP(t)||tP(t)||nP(t)||iP(t)||gu(t)||aP(t)||cP(t)||lP(t)||uP(t)||dP(t)||pP(t)||mP(t)||hP(t)||gP(t)||fP(t)||bP(t)||xP(t)||yP(t)||vP(t)||wP(t)||CP(t)||TP(t)||Kb(t)||kP(t)||MP(t)||IP(t)||RP(t)||PP(t))}});var zb=T(sn=>{"use strict";var qq=sn&&sn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Gq=sn&&sn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Hb=sn&&sn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&qq(n,e,i[s]);return Gq(n,e),n}})();Object.defineProperty(sn,"__esModule",{value:!0});sn.ValueGuard=sn.TypeGuard=sn.KindGuard=void 0;sn.KindGuard=Hb(Me());sn.TypeGuard=Hb(_P());sn.ValueGuard=Hb(Ut())});var EP=T(Vb=>{"use strict";Object.defineProperty(Vb,"__esModule",{value:!0});Vb.Increment=Kq;function Kq(t){return(parseInt(t)+1).toString()}});var AP=T($o=>{"use strict";var Hq=$o&&$o.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),zq=$o&&$o.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Hq(e,t,n)};Object.defineProperty($o,"__esModule",{value:!0});zq(EP(),$o)});var OP=T(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.PatternNeverExact=Ze.PatternStringExact=Ze.PatternNumberExact=Ze.PatternBooleanExact=Ze.PatternNever=Ze.PatternString=Ze.PatternNumber=Ze.PatternBoolean=void 0;Ze.PatternBoolean="(true|false)";Ze.PatternNumber="(0|[1-9][0-9]*)";Ze.PatternString="(.*)";Ze.PatternNever="(?!.*)";Ze.PatternBooleanExact=`^${Ze.PatternBoolean}$`;Ze.PatternNumberExact=`^${Ze.PatternNumber}$`;Ze.PatternStringExact=`^${Ze.PatternString}$`;Ze.PatternNeverExact=`^${Ze.PatternNever}$`});var fu=T(Bo=>{"use strict";var Vq=Bo&&Bo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Jq=Bo&&Bo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Vq(e,t,n)};Object.defineProperty(Bo,"__esModule",{value:!0});Jq(OP(),Bo)});var LP=T(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.Entries=Qq;Bs.Clear=Yq;Bs.Delete=Xq;Bs.Has=Zq;Bs.Set=e7;Bs.Get=t7;var lc=new Map;function Qq(){return new Map(lc)}function Yq(){return lc.clear()}function Xq(t){return lc.delete(t)}function Zq(t){return lc.has(t)}function e7(t,e){lc.set(t,e)}function t7(t){return lc.get(t)}});var WP=T(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Entries=n7;Ns.Clear=i7;Ns.Delete=s7;Ns.Has=o7;Ns.Set=r7;Ns.Get=a7;var uc=new Map;function n7(){return new Map(uc)}function i7(){return uc.clear()}function s7(t){return uc.delete(t)}function o7(t){return uc.has(t)}function r7(t,e){uc.set(t,e)}function a7(t){return uc.get(t)}});var FP=T(Dn=>{"use strict";var c7=Dn&&Dn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),l7=Dn&&Dn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),UP=Dn&&Dn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&c7(n,e,i[s]);return l7(n,e),n}})();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.TypeRegistry=Dn.FormatRegistry=void 0;Dn.FormatRegistry=UP(LP());Dn.TypeRegistry=UP(WP())});var BP=T(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.SetIncludes=DP;vi.SetIsSubset=u7;vi.SetDistinct=d7;vi.SetIntersect=$P;vi.SetUnion=p7;vi.SetComplement=m7;vi.SetIntersectMany=g7;vi.SetUnionMany=f7;function DP(t,e){return t.includes(e)}function u7(t,e){return t.every(n=>DP(e,n))}function d7(t){return[...new Set(t)]}function $P(t,e){return t.filter(n=>e.includes(n))}function p7(t,e){return[...t,...e]}function m7(t,e){return t.filter(n=>!e.includes(n))}function h7(t,e){return t.reduce((n,i)=>$P(n,i),e)}function g7(t){return t.length===1?t[0]:t.length>1?h7(t.slice(1),t[0]):[]}function f7(t){let e=[];for(let n of t)e.push(...n);return e}});var bu=T(No=>{"use strict";var b7=No&&No.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),x7=No&&No.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&b7(e,t,n)};Object.defineProperty(No,"__esModule",{value:!0});x7(BP(),No)});var NP=T(Jb=>{"use strict";Object.defineProperty(Jb,"__esModule",{value:!0});Jb.Any=w7;var y7=Xi(),v7=re();function w7(t){return(0,y7.CreateType)({[v7.Kind]:"Any"},t)}});var dc=T(jo=>{"use strict";var S7=jo&&jo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),C7=jo&&jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&S7(e,t,n)};Object.defineProperty(jo,"__esModule",{value:!0});C7(NP(),jo)});var jP=T(Qb=>{"use strict";Object.defineProperty(Qb,"__esModule",{value:!0});Qb.Array=M7;var T7=le(),k7=re();function M7(t,e){return(0,T7.CreateType)({[k7.Kind]:"Array",type:"array",items:t},e)}});var pc=T(qo=>{"use strict";var I7=qo&&qo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),R7=qo&&qo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&I7(e,t,n)};Object.defineProperty(qo,"__esModule",{value:!0});R7(jP(),qo)});var qP=T(Yb=>{"use strict";Object.defineProperty(Yb,"__esModule",{value:!0});Yb.Argument=E7;var P7=le(),_7=re();function E7(t){return(0,P7.CreateType)({[_7.Kind]:"Argument",index:t})}});var Em=T(Go=>{"use strict";var A7=Go&&Go.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),O7=Go&&Go.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&A7(e,t,n)};Object.defineProperty(Go,"__esModule",{value:!0});O7(qP(),Go)});var GP=T(Xb=>{"use strict";Object.defineProperty(Xb,"__esModule",{value:!0});Xb.AsyncIterator=U7;var L7=re(),W7=le();function U7(t,e){return(0,W7.CreateType)({[L7.Kind]:"AsyncIterator",type:"AsyncIterator",items:t},e)}});var mc=T(Ko=>{"use strict";var F7=Ko&&Ko.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),D7=Ko&&Ko.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&F7(e,t,n)};Object.defineProperty(Ko,"__esModule",{value:!0});D7(GP(),Ko)});var KP=T(Zb=>{"use strict";Object.defineProperty(Zb,"__esModule",{value:!0});Zb.Computed=N7;var $7=Xi(),B7=pu();function N7(t,e,n){return(0,$7.CreateType)({[B7.Kind]:"Computed",target:t,parameters:e},n)}});var js=T(Ho=>{"use strict";var j7=Ho&&Ho.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),q7=Ho&&Ho.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&j7(e,t,n)};Object.defineProperty(Ho,"__esModule",{value:!0});q7(KP(),Ho)});var Am=T(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.Discard=K7;function G7(t,e){let{[e]:n,...i}=t;return i}function K7(t,e){return e.reduce((n,i)=>G7(n,i),t)}});var es=T(zo=>{"use strict";var H7=zo&&zo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),z7=zo&&zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&H7(e,t,n)};Object.defineProperty(zo,"__esModule",{value:!0});z7(Am(),zo)});var HP=T(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:!0});tx.Never=Q7;var V7=le(),J7=re();function Q7(t){return(0,V7.CreateType)({[J7.Kind]:"Never",not:{}},t)}});var vt=T(Vo=>{"use strict";var Y7=Vo&&Vo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),X7=Vo&&Vo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Y7(e,t,n)};Object.defineProperty(Vo,"__esModule",{value:!0});X7(HP(),Vo)});var zP=T(nx=>{"use strict";Object.defineProperty(nx,"__esModule",{value:!0});nx.MappedKey=tG;var Z7=le(),eG=re();function tG(t){return(0,Z7.CreateType)({[eG.Kind]:"MappedKey",keys:t})}});var sx=T(ix=>{"use strict";Object.defineProperty(ix,"__esModule",{value:!0});ix.MappedResult=sG;var nG=le(),iG=re();function sG(t){return(0,nG.CreateType)({[iG.Kind]:"MappedResult",properties:t})}});var VP=T(ox=>{"use strict";Object.defineProperty(ox,"__esModule",{value:!0});ox.Constructor=aG;var oG=le(),rG=re();function aG(t,e,n){return(0,oG.CreateType)({[rG.Kind]:"Constructor",type:"Constructor",parameters:t,returns:e},n)}});var hc=T(Jo=>{"use strict";var cG=Jo&&Jo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),lG=Jo&&Jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&cG(e,t,n)};Object.defineProperty(Jo,"__esModule",{value:!0});lG(VP(),Jo)});var JP=T(rx=>{"use strict";Object.defineProperty(rx,"__esModule",{value:!0});rx.Function=pG;var uG=le(),dG=re();function pG(t,e,n){return(0,uG.CreateType)({[dG.Kind]:"Function",type:"Function",parameters:t,returns:e},n)}});var qs=T(Qo=>{"use strict";var mG=Qo&&Qo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),hG=Qo&&Qo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mG(e,t,n)};Object.defineProperty(Qo,"__esModule",{value:!0});hG(JP(),Qo)});var cx=T(ax=>{"use strict";Object.defineProperty(ax,"__esModule",{value:!0});ax.UnionCreate=bG;var gG=le(),fG=re();function bG(t,e){return(0,gG.CreateType)({[fG.Kind]:"Union",anyOf:t},e)}});var ZP=T(lx=>{"use strict";Object.defineProperty(lx,"__esModule",{value:!0});lx.UnionEvaluated=MG;var xG=le(),yG=re(),vG=es(),wG=vt(),SG=wi(),QP=cx(),XP=Me();function CG(t){return t.some(e=>(0,XP.IsOptional)(e))}function YP(t){return t.map(e=>(0,XP.IsOptional)(e)?TG(e):e)}function TG(t){return(0,vG.Discard)(t,[yG.OptionalKind])}function kG(t,e){return CG(t)?(0,SG.Optional)((0,QP.UnionCreate)(YP(t),e)):(0,QP.UnionCreate)(YP(t),e)}function MG(t,e){return t.length===1?(0,xG.CreateType)(t[0],e):t.length===0?(0,wG.Never)(e):kG(t,e)}});var t_=T(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var KRe=re()});var n_=T(ux=>{"use strict";Object.defineProperty(ux,"__esModule",{value:!0});ux.Union=_G;var IG=vt(),RG=le(),PG=cx();function _G(t,e){return t.length===0?(0,IG.Never)(e):t.length===1?(0,RG.CreateType)(t[0],e):(0,PG.UnionCreate)(t,e)}});var it=T(ts=>{"use strict";var EG=ts&&ts.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dx=ts&&ts.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&EG(e,t,n)};Object.defineProperty(ts,"__esModule",{value:!0});dx(ZP(),ts);dx(t_(),ts);dx(n_(),ts)});var Om=T(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.TemplateLiteralParserError=void 0;gc.TemplateLiteralParse=Yo;gc.TemplateLiteralParseExact=BG;var AG=xi(),xu=class extends AG.TypeBoxError{};gc.TemplateLiteralParserError=xu;function OG(t){return t.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function px(t,e,n){return t[e]===n&&t.charCodeAt(e-1)!==92}function ns(t,e){return px(t,e,"(")}function yu(t,e){return px(t,e,")")}function i_(t,e){return px(t,e,"|")}function LG(t){if(!(ns(t,0)&&yu(t,t.length-1)))return!1;let e=0;for(let n=0;n<t.length;n++)if(ns(t,n)&&(e+=1),yu(t,n)&&(e-=1),e===0&&n!==t.length-1)return!1;return!0}function WG(t){return t.slice(1,t.length-1)}function UG(t){let e=0;for(let n=0;n<t.length;n++)if(ns(t,n)&&(e+=1),yu(t,n)&&(e-=1),i_(t,n)&&e===0)return!0;return!1}function FG(t){for(let e=0;e<t.length;e++)if(ns(t,e))return!0;return!1}function DG(t){let[e,n]=[0,0],i=[];for(let o=0;o<t.length;o++)if(ns(t,o)&&(e+=1),yu(t,o)&&(e-=1),i_(t,o)&&e===0){let r=t.slice(n,o);r.length>0&&i.push(Yo(r)),n=o+1}let s=t.slice(n);return s.length>0&&i.push(Yo(s)),i.length===0?{type:"const",const:""}:i.length===1?i[0]:{type:"or",expr:i}}function $G(t){function e(s,o){if(!ns(s,o))throw new xu("TemplateLiteralParser: Index must point to open parens");let r=0;for(let a=o;a<s.length;a++)if(ns(s,a)&&(r+=1),yu(s,a)&&(r-=1),r===0)return[o,a];throw new xu("TemplateLiteralParser: Unclosed group parens in expression")}function n(s,o){for(let r=o;r<s.length;r++)if(ns(s,r))return[o,r];return[o,s.length]}let i=[];for(let s=0;s<t.length;s++)if(ns(t,s)){let[o,r]=e(t,s),a=t.slice(o,r+1);i.push(Yo(a)),s=r}else{let[o,r]=n(t,s),a=t.slice(o,r);a.length>0&&i.push(Yo(a)),s=r-1}return i.length===0?{type:"const",const:""}:i.length===1?i[0]:{type:"and",expr:i}}function Yo(t){return LG(t)?Yo(WG(t)):UG(t)?DG(t):FG(t)?$G(t):{type:"const",const:OG(t)}}function BG(t){return Yo(t.slice(1,t.length-1))}});var mx=T(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.TemplateLiteralFiniteError=void 0;fc.IsTemplateLiteralExpressionFinite=Wm;fc.IsTemplateLiteralFinite=HG;var NG=Om(),jG=xi(),Lm=class extends jG.TypeBoxError{};fc.TemplateLiteralFiniteError=Lm;function qG(t){return t.type==="or"&&t.expr.length===2&&t.expr[0].type==="const"&&t.expr[0].const==="0"&&t.expr[1].type==="const"&&t.expr[1].const==="[1-9][0-9]*"}function GG(t){return t.type==="or"&&t.expr.length===2&&t.expr[0].type==="const"&&t.expr[0].const==="true"&&t.expr[1].type==="const"&&t.expr[1].const==="false"}function KG(t){return t.type==="const"&&t.const===".*"}function Wm(t){return qG(t)||KG(t)?!1:GG(t)?!0:t.type==="and"?t.expr.every(e=>Wm(e)):t.type==="or"?t.expr.every(e=>Wm(e)):t.type==="const"?!0:(()=>{throw new Lm("Unknown expression type")})()}function HG(t){let e=(0,NG.TemplateLiteralParseExact)(t.pattern);return Wm(e)}});var hx=T(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.TemplateLiteralGenerateError=void 0;bc.TemplateLiteralExpressionGenerate=Fm;bc.TemplateLiteralGenerate=ZG;var zG=mx(),VG=Om(),JG=xi(),Um=class extends JG.TypeBoxError{};bc.TemplateLiteralGenerateError=Um;function*s_(t){if(t.length===1)return yield*t[0];for(let e of t[0])for(let n of s_(t.slice(1)))yield`${e}${n}`}function*QG(t){return yield*s_(t.expr.map(e=>[...Fm(e)]))}function*YG(t){for(let e of t.expr)yield*Fm(e)}function*XG(t){return yield t.const}function*Fm(t){return t.type==="and"?yield*QG(t):t.type==="or"?yield*YG(t):t.type==="const"?yield*XG(t):(()=>{throw new Um("Unknown expression")})()}function ZG(t){let e=(0,VG.TemplateLiteralParseExact)(t.pattern);return(0,zG.IsTemplateLiteralExpressionFinite)(e)?[...Fm(e)]:[]}});var o_=T(gx=>{"use strict";Object.defineProperty(gx,"__esModule",{value:!0});gx.Literal=nK;var eK=le(),tK=re();function nK(t,e){return(0,eK.CreateType)({[tK.Kind]:"Literal",const:t,type:typeof t},e)}});var Ft=T(Xo=>{"use strict";var iK=Xo&&Xo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sK=Xo&&Xo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&iK(e,t,n)};Object.defineProperty(Xo,"__esModule",{value:!0});sK(o_(),Xo)});var r_=T(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:!0});fx.Boolean=aK;var oK=re(),rK=Xi();function aK(t){return(0,rK.CreateType)({[oK.Kind]:"Boolean",type:"boolean"},t)}});var vu=T(Zo=>{"use strict";var cK=Zo&&Zo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),lK=Zo&&Zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&cK(e,t,n)};Object.defineProperty(Zo,"__esModule",{value:!0});lK(r_(),Zo)});var a_=T(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:!0});bx.BigInt=pK;var uK=re(),dK=Xi();function pK(t){return(0,dK.CreateType)({[uK.Kind]:"BigInt",type:"bigint"},t)}});var xc=T(er=>{"use strict";var mK=er&&er.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),hK=er&&er.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mK(e,t,n)};Object.defineProperty(er,"__esModule",{value:!0});hK(a_(),er)});var c_=T(xx=>{"use strict";Object.defineProperty(xx,"__esModule",{value:!0});xx.Number=bK;var gK=le(),fK=re();function bK(t){return(0,gK.CreateType)({[fK.Kind]:"Number",type:"number"},t)}});var Gs=T(tr=>{"use strict";var xK=tr&&tr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yK=tr&&tr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xK(e,t,n)};Object.defineProperty(tr,"__esModule",{value:!0});yK(c_(),tr)});var l_=T(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:!0});yx.String=SK;var vK=le(),wK=re();function SK(t){return(0,vK.CreateType)({[wK.Kind]:"String",type:"string"},t)}});var ir=T(nr=>{"use strict";var CK=nr&&nr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),TK=nr&&nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&CK(e,t,n)};Object.defineProperty(nr,"__esModule",{value:!0});TK(l_(),nr)});var Sx=T(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:!0});wx.TemplateLiteralSyntax=OK;var wu=Ft(),kK=vu(),MK=xc(),IK=Gs(),RK=ir(),PK=it(),_K=vt();function*EK(t){let e=t.trim().replace(/"|'/g,"");return e==="boolean"?yield(0,kK.Boolean)():e==="number"?yield(0,IK.Number)():e==="bigint"?yield(0,MK.BigInt)():e==="string"?yield(0,RK.String)():yield(()=>{let n=e.split("|").map(i=>(0,wu.Literal)(i.trim()));return n.length===0?(0,_K.Never)():n.length===1?n[0]:(0,PK.UnionEvaluated)(n)})()}function*AK(t){if(t[1]!=="{"){let e=(0,wu.Literal)("$"),n=vx(t.slice(1));return yield*[e,...n]}for(let e=2;e<t.length;e++)if(t[e]==="}"){let n=EK(t.slice(2,e)),i=vx(t.slice(e+1));return yield*[...n,...i]}yield(0,wu.Literal)(t)}function*vx(t){for(let e=0;e<t.length;e++)if(t[e]==="$"){let n=(0,wu.Literal)(t.slice(0,e)),i=AK(t.slice(e));return yield*[n,...i]}yield(0,wu.Literal)(t)}function OK(t){return[...vx(t)]}});var Cx=T(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.TemplateLiteralPatternError=void 0;Cu.TemplateLiteralPattern=FK;var Su=fu(),LK=re(),WK=xi(),Ks=Me(),Dm=class extends WK.TypeBoxError{};Cu.TemplateLiteralPatternError=Dm;function UK(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u_(t,e){return(0,Ks.IsTemplateLiteral)(t)?t.pattern.slice(1,t.pattern.length-1):(0,Ks.IsUnion)(t)?`(${t.anyOf.map(n=>u_(n,e)).join("|")})`:(0,Ks.IsNumber)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsInteger)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsBigInt)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsString)(t)?`${e}${Su.PatternString}`:(0,Ks.IsLiteral)(t)?`${e}${UK(t.const.toString())}`:(0,Ks.IsBoolean)(t)?`${e}${Su.PatternBoolean}`:(()=>{throw new Dm(`Unexpected Kind '${t[LK.Kind]}'`)})()}function FK(t){return`^${t.map(e=>u_(e,"")).join("")}$`}});var d_=T(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});Tx.TemplateLiteralToUnion=NK;var DK=it(),$K=Ft(),BK=hx();function NK(t){let n=(0,BK.TemplateLiteralGenerate)(t).map(i=>(0,$K.Literal)(i));return(0,DK.UnionEvaluated)(n)}});var m_=T(kx=>{"use strict";Object.defineProperty(kx,"__esModule",{value:!0});kx.TemplateLiteral=HK;var jK=le(),qK=Sx(),p_=Cx(),GK=Ut(),KK=re();function HK(t,e){let n=(0,GK.IsString)(t)?(0,p_.TemplateLiteralPattern)((0,qK.TemplateLiteralSyntax)(t)):(0,p_.TemplateLiteralPattern)(t);return(0,jK.CreateType)({[KK.Kind]:"TemplateLiteral",type:"string",pattern:n},e)}});var Si=T(Sn=>{"use strict";var zK=Sn&&Sn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sr=Sn&&Sn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&zK(e,t,n)};Object.defineProperty(Sn,"__esModule",{value:!0});sr(mx(),Sn);sr(hx(),Sn);sr(Sx(),Sn);sr(Om(),Sn);sr(Cx(),Sn);sr(d_(),Sn);sr(m_(),Sn)});var $m=T(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:!0});Mx.IndexPropertyKeys=h_;var VK=Si(),Tu=Me();function JK(t){return(0,VK.TemplateLiteralGenerate)(t).map(n=>n.toString())}function QK(t){let e=[];for(let n of t)e.push(...h_(n));return e}function YK(t){return[t.toString()]}function h_(t){return[...new Set((0,Tu.IsTemplateLiteral)(t)?JK(t):(0,Tu.IsUnion)(t)?QK(t.anyOf):(0,Tu.IsLiteral)(t)?YK(t.const):(0,Tu.IsNumber)(t)?["[number]"]:(0,Tu.IsInteger)(t)?["[number]"]:[])]}});var Rx=T(Ix=>{"use strict";Object.defineProperty(Ix,"__esModule",{value:!0});Ix.IndexFromMappedResult=iH;var XK=ot(),ZK=$m(),eH=ti();function tH(t,e,n){let i={};for(let s of Object.getOwnPropertyNames(e))i[s]=(0,eH.Index)(t,(0,ZK.IndexPropertyKeys)(e[s]),n);return i}function nH(t,e,n){return tH(t,e.properties,n)}function iH(t,e,n){let i=nH(t,e,n);return(0,XK.MappedResult)(i)}});var Nm=T(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.IndexFromPropertyKey=_x;yc.IndexFromPropertyKeys=x_;yc.IndexFromComputed=bH;yc.Index=xH;var sH=le(),oH=xi(),f_=js(),Bm=vt(),rH=Cn(),Px=it(),aH=$m(),cH=Ex(),lH=Rx(),on=Me();function b_(t,e){return t.map(n=>_x(n,e))}function uH(t){return t.filter(e=>!(0,on.IsNever)(e))}function dH(t,e){return(0,rH.IntersectEvaluated)(uH(b_(t,e)))}function pH(t){return t.some(e=>(0,on.IsNever)(e))?[]:t}function mH(t,e){return(0,Px.UnionEvaluated)(pH(b_(t,e)))}function hH(t,e){return e in t?t[e]:e==="[number]"?(0,Px.UnionEvaluated)(t):(0,Bm.Never)()}function gH(t,e){return e==="[number]"?t:(0,Bm.Never)()}function fH(t,e){return e in t?t[e]:(0,Bm.Never)()}function _x(t,e){return(0,on.IsIntersect)(t)?dH(t.allOf,e):(0,on.IsUnion)(t)?mH(t.anyOf,e):(0,on.IsTuple)(t)?hH(t.items??[],e):(0,on.IsArray)(t)?gH(t.items,e):(0,on.IsObject)(t)?fH(t.properties,e):(0,Bm.Never)()}function x_(t,e){return e.map(n=>_x(t,n))}function g_(t,e){return(0,Px.UnionEvaluated)(x_(t,e))}function bH(t,e){return(0,f_.Computed)("Index",[t,e])}function xH(t,e,n){if((0,on.IsRef)(t)||(0,on.IsRef)(e)){let i="Index types using Ref parameters require both Type and Key to be of TSchema";if(!(0,on.IsSchema)(t)||!(0,on.IsSchema)(e))throw new oH.TypeBoxError(i);return(0,f_.Computed)("Index",[t,e])}return(0,on.IsMappedResult)(e)?(0,lH.IndexFromMappedResult)(t,e,n):(0,on.IsMappedKey)(e)?(0,cH.IndexFromMappedKey)(t,e,n):(0,sH.CreateType)((0,on.IsSchema)(e)?g_(t,(0,aH.IndexPropertyKeys)(e)):g_(t,e),n)}});var Ex=T(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});Ax.IndexFromMappedKey=kH;var yH=Nm(),vH=ot(),wH=tn();function SH(t,e,n){return{[e]:(0,yH.Index)(t,[e],(0,wH.Clone)(n))}}function CH(t,e,n){return e.reduce((i,s)=>({...i,...SH(t,s,n)}),{})}function TH(t,e,n){return CH(t,e.keys,n)}function kH(t,e,n){let i=TH(t,e,n);return(0,vH.MappedResult)(i)}});var ti=T(Ci=>{"use strict";var MH=Ci&&Ci.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),jm=Ci&&Ci.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&MH(e,t,n)};Object.defineProperty(Ci,"__esModule",{value:!0});jm(Ex(),Ci);jm(Rx(),Ci);jm($m(),Ci);jm(Nm(),Ci)});var y_=T(Ox=>{"use strict";Object.defineProperty(Ox,"__esModule",{value:!0});Ox.Iterator=PH;var IH=le(),RH=re();function PH(t,e){return(0,IH.CreateType)({[RH.Kind]:"Iterator",type:"Iterator",items:t},e)}});var vc=T(or=>{"use strict";var _H=or&&or.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),EH=or&&or.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_H(e,t,n)};Object.defineProperty(or,"__esModule",{value:!0});EH(y_(),or)});var w_=T(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.Object=void 0;var AH=le(),v_=re(),OH=Me();function LH(t){return globalThis.Object.keys(t).filter(e=>!(0,OH.IsOptional)(t[e]))}function WH(t,e){let n=LH(t),i=n.length>0?{[v_.Kind]:"Object",type:"object",required:n,properties:t}:{[v_.Kind]:"Object",type:"object",properties:t};return(0,AH.CreateType)(i,e)}qm.Object=WH});var rn=T(rr=>{"use strict";var UH=rr&&rr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),FH=rr&&rr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&UH(e,t,n)};Object.defineProperty(rr,"__esModule",{value:!0});FH(w_(),rr)});var S_=T(Lx=>{"use strict";Object.defineProperty(Lx,"__esModule",{value:!0});Lx.Promise=BH;var DH=le(),$H=re();function BH(t,e){return(0,DH.CreateType)({[$H.Kind]:"Promise",type:"Promise",item:t},e)}});var ku=T(ar=>{"use strict";var NH=ar&&ar.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),jH=ar&&ar.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&NH(e,t,n)};Object.defineProperty(ar,"__esModule",{value:!0});jH(S_(),ar)});var Ux=T(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.Readonly=JH;var C_=le(),T_=re(),qH=es(),GH=Fx(),KH=Me();function HH(t){return(0,C_.CreateType)((0,qH.Discard)(t,[T_.ReadonlyKind]))}function zH(t){return(0,C_.CreateType)({...t,[T_.ReadonlyKind]:"Readonly"})}function VH(t,e){return e===!1?HH(t):zH(t)}function JH(t,e){let n=e??!0;return(0,KH.IsMappedResult)(t)?(0,GH.ReadonlyFromMappedResult)(t,n):VH(t,n)}});var Fx=T(Dx=>{"use strict";Object.defineProperty(Dx,"__esModule",{value:!0});Dx.ReadonlyFromMappedResult=ez;var QH=ot(),YH=Ux();function XH(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,YH.Readonly)(t[i],e);return n}function ZH(t,e){return XH(t.properties,e)}function ez(t,e){let n=ZH(t,e);return(0,QH.MappedResult)(n)}});var zs=T(Hs=>{"use strict";var tz=Hs&&Hs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),k_=Hs&&Hs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&tz(e,t,n)};Object.defineProperty(Hs,"__esModule",{value:!0});k_(Fx(),Hs);k_(Ux(),Hs)});var I_=T($x=>{"use strict";Object.defineProperty($x,"__esModule",{value:!0});$x.Tuple=iz;var nz=le(),M_=re();function iz(t,e){return(0,nz.CreateType)(t.length>0?{[M_.Kind]:"Tuple",type:"array",items:t,additionalItems:!1,minItems:t.length,maxItems:t.length}:{[M_.Kind]:"Tuple",type:"array",minItems:t.length,maxItems:t.length},e)}});var is=T(cr=>{"use strict";var sz=cr&&cr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),oz=cr&&cr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&sz(e,t,n)};Object.defineProperty(cr,"__esModule",{value:!0});oz(I_(),cr)});var O_=T(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.MappedFunctionReturnType=A_;Gm.Mapped=kz;var Bx=re(),R_=es(),rz=pc(),az=mc(),cz=hc(),lz=qs(),uz=ti(),dz=Cn(),pz=vc(),P_=Ft(),__=rn(),mz=wi(),hz=ku(),gz=zs(),fz=is(),bz=it(),xz=bu(),yz=sx(),Dt=Me();function E_(t,e){return t in e?$n(t,e[t]):(0,yz.MappedResult)(e)}function vz(t){return{[t]:(0,P_.Literal)(t)}}function wz(t){let e={};for(let n of t)e[n]=(0,P_.Literal)(n);return e}function Sz(t,e){return(0,xz.SetIncludes)(e,t)?vz(t):wz(e)}function Cz(t,e){let n=Sz(t,e);return E_(t,n)}function Mu(t,e){return e.map(n=>$n(t,n))}function Tz(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(e))n[i]=$n(t,e[i]);return n}function $n(t,e){let n={...e};return(0,Dt.IsOptional)(e)?(0,mz.Optional)($n(t,(0,R_.Discard)(e,[Bx.OptionalKind]))):(0,Dt.IsReadonly)(e)?(0,gz.Readonly)($n(t,(0,R_.Discard)(e,[Bx.ReadonlyKind]))):(0,Dt.IsMappedResult)(e)?E_(t,e.properties):(0,Dt.IsMappedKey)(e)?Cz(t,e.keys):(0,Dt.IsConstructor)(e)?(0,cz.Constructor)(Mu(t,e.parameters),$n(t,e.returns),n):(0,Dt.IsFunction)(e)?(0,lz.Function)(Mu(t,e.parameters),$n(t,e.returns),n):(0,Dt.IsAsyncIterator)(e)?(0,az.AsyncIterator)($n(t,e.items),n):(0,Dt.IsIterator)(e)?(0,pz.Iterator)($n(t,e.items),n):(0,Dt.IsIntersect)(e)?(0,dz.Intersect)(Mu(t,e.allOf),n):(0,Dt.IsUnion)(e)?(0,bz.Union)(Mu(t,e.anyOf),n):(0,Dt.IsTuple)(e)?(0,fz.Tuple)(Mu(t,e.items??[]),n):(0,Dt.IsObject)(e)?(0,__.Object)(Tz(t,e.properties),n):(0,Dt.IsArray)(e)?(0,rz.Array)($n(t,e.items),n):(0,Dt.IsPromise)(e)?(0,hz.Promise)($n(t,e.item),n):e}function A_(t,e){let n={};for(let i of t)n[i]=$n(i,e);return n}function kz(t,e,n){let i=(0,Dt.IsSchema)(t)?(0,uz.IndexPropertyKeys)(t):t,s=e({[Bx.Kind]:"MappedKey",keys:i}),o=A_(i,s);return(0,__.Object)(o,n)}});var ot=T(ss=>{"use strict";var Mz=ss&&ss.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Nx=ss&&ss.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Mz(e,t,n)};Object.defineProperty(ss,"__esModule",{value:!0});Nx(zP(),ss);Nx(sx(),ss);Nx(O_(),ss)});var qx=T(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:!0});jx.Optional=Oz;var L_=le(),W_=re(),Iz=es(),Rz=Gx(),Pz=Me();function _z(t){return(0,L_.CreateType)((0,Iz.Discard)(t,[W_.OptionalKind]))}function Ez(t){return(0,L_.CreateType)({...t,[W_.OptionalKind]:"Optional"})}function Az(t,e){return e===!1?_z(t):Ez(t)}function Oz(t,e){let n=e??!0;return(0,Pz.IsMappedResult)(t)?(0,Rz.OptionalFromMappedResult)(t,n):Az(t,n)}});var Gx=T(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.OptionalFromMappedResult=Dz;var Lz=ot(),Wz=qx();function Uz(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,Wz.Optional)(t[i],e);return n}function Fz(t,e){return Uz(t.properties,e)}function Dz(t,e){let n=Fz(t,e);return(0,Lz.MappedResult)(n)}});var wi=T(Vs=>{"use strict";var $z=Vs&&Vs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),U_=Vs&&Vs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$z(e,t,n)};Object.defineProperty(Vs,"__esModule",{value:!0});U_(Gx(),Vs);U_(qx(),Vs)});var Vx=T(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:!0});zx.IntersectCreate=Nz;var Bz=le(),F_=re(),Hx=Me();function Nz(t,e={}){let n=t.every(s=>(0,Hx.IsObject)(s)),i=(0,Hx.IsSchema)(e.unevaluatedProperties)?{unevaluatedProperties:e.unevaluatedProperties}:{};return(0,Bz.CreateType)(e.unevaluatedProperties===!1||(0,Hx.IsSchema)(e.unevaluatedProperties)||n?{...i,[F_.Kind]:"Intersect",type:"object",allOf:t}:{...i,[F_.Kind]:"Intersect",allOf:t},e)}});var B_=T(Qx=>{"use strict";Object.defineProperty(Qx,"__esModule",{value:!0});Qx.IntersectEvaluated=Qz;var jz=re(),qz=le(),Gz=es(),Kz=vt(),Hz=wi(),D_=Vx(),Jx=Me();function zz(t){return t.every(e=>(0,Jx.IsOptional)(e))}function Vz(t){return(0,Gz.Discard)(t,[jz.OptionalKind])}function $_(t){return t.map(e=>(0,Jx.IsOptional)(e)?Vz(e):e)}function Jz(t,e){return zz(t)?(0,Hz.Optional)((0,D_.IntersectCreate)($_(t),e)):(0,D_.IntersectCreate)($_(t),e)}function Qz(t,e={}){if(t.length===1)return(0,qz.CreateType)(t[0],e);if(t.length===0)return(0,Kz.Never)(e);if(t.some(n=>(0,Jx.IsTransform)(n)))throw new Error("Cannot intersect transform types");return Jz(t,e)}});var j_=T(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var UPe=re()});var q_=T(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:!0});Yx.Intersect=tV;var Yz=le(),Xz=vt(),Zz=Vx(),eV=Me();function tV(t,e){if(t.length===1)return(0,Yz.CreateType)(t[0],e);if(t.length===0)return(0,Xz.Never)(e);if(t.some(n=>(0,eV.IsTransform)(n)))throw new Error("Cannot intersect transform types");return(0,Zz.IntersectCreate)(t,e)}});var Cn=T(os=>{"use strict";var nV=os&&os.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Xx=os&&os.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&nV(e,t,n)};Object.defineProperty(os,"__esModule",{value:!0});Xx(B_(),os);Xx(j_(),os);Xx(q_(),os)});var G_=T(Zx=>{"use strict";Object.defineProperty(Zx,"__esModule",{value:!0});Zx.Ref=rV;var iV=xi(),sV=le(),oV=re();function rV(...t){let[e,n]=typeof t[0]=="string"?[t[0],t[1]]:[t[0].$id,t[1]];if(typeof e!="string")throw new iV.TypeBoxError("Ref: $ref must be a string");return(0,sV.CreateType)({[oV.Kind]:"Ref",$ref:e},n)}});var Js=T(lr=>{"use strict";var aV=lr&&lr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cV=lr&&lr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aV(e,t,n)};Object.defineProperty(lr,"__esModule",{value:!0});cV(G_(),lr)});var H_=T(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.Awaited=ty;var lV=le(),ey=js(),uV=Cn(),dV=it(),pV=Js(),Iu=Me();function mV(t,e){return(0,ey.Computed)("Awaited",[(0,ey.Computed)(t,e)])}function hV(t){return(0,ey.Computed)("Awaited",[(0,pV.Ref)(t)])}function gV(t){return(0,uV.Intersect)(K_(t))}function fV(t){return(0,dV.Union)(K_(t))}function bV(t){return ty(t)}function K_(t){return t.map(e=>ty(e))}function ty(t,e){return(0,lV.CreateType)((0,Iu.IsComputed)(t)?mV(t.target,t.parameters):(0,Iu.IsIntersect)(t)?gV(t.allOf):(0,Iu.IsUnion)(t)?fV(t.anyOf):(0,Iu.IsPromise)(t)?bV(t.item):(0,Iu.IsRef)(t)?hV(t.$ref):t,e)}});var Ru=T(ur=>{"use strict";var xV=ur&&ur.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yV=ur&&ur.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xV(e,t,n)};Object.defineProperty(ur,"__esModule",{value:!0});yV(H_(),ur)});var Hm=T(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.KeyOfPropertyKeys=sy;Km.KeyOfPattern=MV;var z_=bu(),wc=Me();function V_(t){let e=[];for(let n of t)e.push(sy(n));return e}function vV(t){let e=V_(t);return(0,z_.SetUnionMany)(e)}function wV(t){let e=V_(t);return(0,z_.SetIntersectMany)(e)}function SV(t){return t.map((e,n)=>n.toString())}function CV(t){return["[number]"]}function TV(t){return globalThis.Object.getOwnPropertyNames(t)}function kV(t){return iy?globalThis.Object.getOwnPropertyNames(t).map(n=>n[0]==="^"&&n[n.length-1]==="$"?n.slice(1,n.length-1):n):[]}function sy(t){return(0,wc.IsIntersect)(t)?vV(t.allOf):(0,wc.IsUnion)(t)?wV(t.anyOf):(0,wc.IsTuple)(t)?SV(t.items??[]):(0,wc.IsArray)(t)?CV(t.items):(0,wc.IsObject)(t)?TV(t.properties):(0,wc.IsRecord)(t)?kV(t.patternProperties):[]}var iy=!1;function MV(t){iy=!0;let e=sy(t);return iy=!1,`^(${e.map(i=>`(${i})`).join("|")})$`}});var ay=T(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.KeyOfPropertyKeysToRest=J_;zm.KeyOf=FV;var IV=le(),RV=Ft(),PV=Gs(),ry=js(),_V=Js(),EV=Hm(),AV=it(),OV=cy(),oy=Me();function LV(t,e){return(0,ry.Computed)("KeyOf",[(0,ry.Computed)(t,e)])}function WV(t){return(0,ry.Computed)("KeyOf",[(0,_V.Ref)(t)])}function UV(t,e){let n=(0,EV.KeyOfPropertyKeys)(t),i=J_(n),s=(0,AV.UnionEvaluated)(i);return(0,IV.CreateType)(s,e)}function J_(t){return t.map(e=>e==="[number]"?(0,PV.Number)():(0,RV.Literal)(e))}function FV(t,e){return(0,oy.IsComputed)(t)?LV(t.target,t.parameters):(0,oy.IsRef)(t)?WV(t.$ref):(0,oy.IsMappedResult)(t)?(0,OV.KeyOfFromMappedResult)(t,e):UV(t,e)}});var cy=T(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.KeyOfFromMappedResult=qV;var DV=ot(),$V=ay(),BV=tn();function NV(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,$V.KeyOf)(t[i],(0,BV.Clone)(e));return n}function jV(t,e){return NV(t.properties,e)}function qV(t,e){let n=jV(t,e);return(0,DV.MappedResult)(n)}});var Q_=T(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});uy.KeyOfPropertyEntries=HV;var GV=Nm(),KV=Hm();function HV(t){let e=(0,KV.KeyOfPropertyKeys)(t),n=(0,GV.IndexFromPropertyKeys)(t,e);return e.map((i,s)=>[e[s],n[s]])}});var Sc=T(Ti=>{"use strict";var zV=Ti&&Ti.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Vm=Ti&&Ti.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&zV(e,t,n)};Object.defineProperty(Ti,"__esModule",{value:!0});Vm(cy(),Ti);Vm(Q_(),Ti);Vm(Hm(),Ti);Vm(ay(),Ti)});var Y_=T(dy=>{"use strict";Object.defineProperty(dy,"__esModule",{value:!0});dy.Composite=sJ;var VV=Cn(),JV=ti(),QV=Sc(),YV=rn(),XV=bu(),ZV=Me();function eJ(t){let e=[];for(let n of t)e.push(...(0,QV.KeyOfPropertyKeys)(n));return(0,XV.SetDistinct)(e)}function tJ(t){return t.filter(e=>!(0,ZV.IsNever)(e))}function nJ(t,e){let n=[];for(let i of t)n.push(...(0,JV.IndexFromPropertyKeys)(i,[e]));return tJ(n)}function iJ(t,e){let n={};for(let i of e)n[i]=(0,VV.IntersectEvaluated)(nJ(t,i));return n}function sJ(t,e){let n=eJ(t),i=iJ(t,n);return(0,YV.Object)(i,e)}});var Jm=T(dr=>{"use strict";var oJ=dr&&dr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),rJ=dr&&dr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oJ(e,t,n)};Object.defineProperty(dr,"__esModule",{value:!0});rJ(Y_(),dr)});var X_=T(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.Date=lJ;var aJ=re(),cJ=le();function lJ(t){return(0,cJ.CreateType)({[aJ.Kind]:"Date",type:"Date"},t)}});var Pu=T(pr=>{"use strict";var uJ=pr&&pr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dJ=pr&&pr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uJ(e,t,n)};Object.defineProperty(pr,"__esModule",{value:!0});dJ(X_(),pr)});var Z_=T(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});my.Null=hJ;var pJ=le(),mJ=re();function hJ(t){return(0,pJ.CreateType)({[mJ.Kind]:"Null",type:"null"},t)}});var _u=T(mr=>{"use strict";var gJ=mr&&mr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),fJ=mr&&mr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&gJ(e,t,n)};Object.defineProperty(mr,"__esModule",{value:!0});fJ(Z_(),mr)});var eE=T(hy=>{"use strict";Object.defineProperty(hy,"__esModule",{value:!0});hy.Symbol=yJ;var bJ=le(),xJ=re();function yJ(t){return(0,bJ.CreateType)({[xJ.Kind]:"Symbol",type:"symbol"},t)}});var Eu=T(hr=>{"use strict";var vJ=hr&&hr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),wJ=hr&&hr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&vJ(e,t,n)};Object.defineProperty(hr,"__esModule",{value:!0});wJ(eE(),hr)});var tE=T(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.Undefined=TJ;var SJ=le(),CJ=re();function TJ(t){return(0,SJ.CreateType)({[CJ.Kind]:"Undefined",type:"undefined"},t)}});var Au=T(gr=>{"use strict";var kJ=gr&&gr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),MJ=gr&&gr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&kJ(e,t,n)};Object.defineProperty(gr,"__esModule",{value:!0});MJ(tE(),gr)});var nE=T(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});fy.Uint8Array=PJ;var IJ=le(),RJ=re();function PJ(t){return(0,IJ.CreateType)({[RJ.Kind]:"Uint8Array",type:"Uint8Array"},t)}});var Ou=T(fr=>{"use strict";var _J=fr&&fr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),EJ=fr&&fr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_J(e,t,n)};Object.defineProperty(fr,"__esModule",{value:!0});EJ(nE(),fr)});var iE=T(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.Unknown=LJ;var AJ=le(),OJ=re();function LJ(t){return(0,AJ.CreateType)({[OJ.Kind]:"Unknown"},t)}});var xr=T(br=>{"use strict";var WJ=br&&br.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),UJ=br&&br.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WJ(e,t,n)};Object.defineProperty(br,"__esModule",{value:!0});UJ(iE(),br)});var rE=T(wy=>{"use strict";Object.defineProperty(wy,"__esModule",{value:!0});wy.Const=JJ;var sE=dc(),FJ=xc(),DJ=Pu(),$J=qs(),xy=Ft(),BJ=_u(),oE=rn(),NJ=Eu(),jJ=is(),yy=zs(),qJ=Au(),GJ=Ou(),KJ=xr(),HJ=Xi(),an=Ut();function zJ(t){return t.map(e=>vy(e,!1))}function VJ(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,yy.Readonly)(vy(t[n],!1));return e}function Qm(t,e){return e===!0?t:(0,yy.Readonly)(t)}function vy(t,e){return(0,an.IsAsyncIterator)(t)||(0,an.IsIterator)(t)?Qm((0,sE.Any)(),e):(0,an.IsArray)(t)?(0,yy.Readonly)((0,jJ.Tuple)(zJ(t))):(0,an.IsUint8Array)(t)?(0,GJ.Uint8Array)():(0,an.IsDate)(t)?(0,DJ.Date)():(0,an.IsObject)(t)?Qm((0,oE.Object)(VJ(t)),e):(0,an.IsFunction)(t)?Qm((0,$J.Function)([],(0,KJ.Unknown)()),e):(0,an.IsUndefined)(t)?(0,qJ.Undefined)():(0,an.IsNull)(t)?(0,BJ.Null)():(0,an.IsSymbol)(t)?(0,NJ.Symbol)():(0,an.IsBigInt)(t)?(0,FJ.BigInt)():(0,an.IsNumber)(t)||(0,an.IsBoolean)(t)||(0,an.IsString)(t)?(0,xy.Literal)(t):(0,oE.Object)({})}function JJ(t,e){return(0,HJ.CreateType)(vy(t,!0),e)}});var Ym=T(yr=>{"use strict";var QJ=yr&&yr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),YJ=yr&&yr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&QJ(e,t,n)};Object.defineProperty(yr,"__esModule",{value:!0});YJ(rE(),yr)});var aE=T(rs=>{"use strict";var XJ=rs&&rs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),ZJ=rs&&rs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),eQ=rs&&rs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&XJ(n,e,i[s]);return ZJ(n,e),n}})();Object.defineProperty(rs,"__esModule",{value:!0});rs.ConstructorParameters=sQ;var tQ=is(),nQ=vt(),iQ=eQ(Me());function sQ(t,e){return iQ.IsConstructor(t)?(0,tQ.Tuple)(t.parameters,e):(0,nQ.Never)(e)}});var Xm=T(vr=>{"use strict";var oQ=vr&&vr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),rQ=vr&&vr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oQ(e,t,n)};Object.defineProperty(vr,"__esModule",{value:!0});rQ(aE(),vr)});var cE=T(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});Sy.Enum=dQ;var aQ=Ft(),cQ=re(),lQ=it(),uQ=Ut();function dQ(t,e){if((0,uQ.IsUndefined)(t))throw new Error("Enum undefined or empty");let n=globalThis.Object.getOwnPropertyNames(t).filter(o=>isNaN(o)).map(o=>t[o]),s=[...new Set(n)].map(o=>(0,aQ.Literal)(o));return(0,lQ.Union)(s,{...e,[cQ.Hint]:"Enum"})}});var Zm=T(wr=>{"use strict";var pQ=wr&&wr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mQ=wr&&wr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pQ(e,t,n)};Object.defineProperty(wr,"__esModule",{value:!0});mQ(cE(),wr)});var _y=T(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.ExtendsResult=Sr.ExtendsResolverError=void 0;Sr.ExtendsCheck=nY;var lE=dc(),hQ=qs(),Iy=Gs(),Ty=ir(),gQ=xr(),uE=Si(),Cc=fu(),gE=re(),fQ=xi(),k=zb(),eh=class extends fQ.TypeBoxError{};Sr.ExtendsResolverError=eh;var B;(function(t){t[t.Union=0]="Union",t[t.True=1]="True",t[t.False=2]="False"})(B||(Sr.ExtendsResult=B={}));function Bn(t){return t===B.False?t:B.True}function Tc(t){throw new eh(t)}function rt(t){return k.TypeGuard.IsNever(t)||k.TypeGuard.IsIntersect(t)||k.TypeGuard.IsUnion(t)||k.TypeGuard.IsUnknown(t)||k.TypeGuard.IsAny(t)}function at(t,e){return k.TypeGuard.IsNever(e)?xE(t,e):k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsUnknown(e)?SE(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):Tc("StructuralRight")}function Ry(t,e){return B.True}function bQ(t,e){return k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)&&e.anyOf.some(n=>k.TypeGuard.IsAny(n)||k.TypeGuard.IsUnknown(n))?B.True:k.TypeGuard.IsUnion(e)?B.Union:k.TypeGuard.IsUnknown(e)||k.TypeGuard.IsAny(e)?B.True:B.Union}function xQ(t,e){return k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:k.TypeGuard.IsNever(t)?B.True:B.False}function yQ(t,e){return k.TypeGuard.IsObject(e)&&nh(e)?B.True:rt(e)?at(t,e):k.TypeGuard.IsArray(e)?Bn(Ue(t.items,e.items)):B.False}function vQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsAsyncIterator(e)?Bn(Ue(t.items,e.items)):B.False}function wQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsBigInt(e)?B.True:B.False}function fE(t,e){return k.TypeGuard.IsLiteralBoolean(t)||k.TypeGuard.IsBoolean(t)?B.True:B.False}function SQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsBoolean(e)?B.True:B.False}function CQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsConstructor(e)?t.parameters.length>e.parameters.length?B.False:t.parameters.every((n,i)=>Bn(Ue(e.parameters[i],n))===B.True)?Bn(Ue(t.returns,e.returns)):B.False:B.False}function TQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsDate(e)?B.True:B.False}function kQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsFunction(e)?t.parameters.length>e.parameters.length?B.False:t.parameters.every((n,i)=>Bn(Ue(e.parameters[i],n))===B.True)?Bn(Ue(t.returns,e.returns)):B.False:B.False}function bE(t,e){return k.TypeGuard.IsLiteral(t)&&k.ValueGuard.IsNumber(t.const)||k.TypeGuard.IsNumber(t)||k.TypeGuard.IsInteger(t)?B.True:B.False}function MQ(t,e){return k.TypeGuard.IsInteger(e)||k.TypeGuard.IsNumber(e)?B.True:rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):B.False}function th(t,e){return e.allOf.every(n=>Ue(t,n)===B.True)?B.True:B.False}function IQ(t,e){return t.allOf.some(n=>Ue(n,e)===B.True)?B.True:B.False}function RQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsIterator(e)?Bn(Ue(t.items,e.items)):B.False}function PQ(t,e){return k.TypeGuard.IsLiteral(e)&&e.const===t.const?B.True:rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsString(e)?wE(t,e):k.TypeGuard.IsNumber(e)?yE(t,e):k.TypeGuard.IsInteger(e)?bE(t,e):k.TypeGuard.IsBoolean(e)?fE(t,e):B.False}function xE(t,e){return B.False}function _Q(t,e){return B.True}function dE(t){let[e,n]=[t,0];for(;k.TypeGuard.IsNot(e);)e=e.not,n+=1;return n%2===0?e:(0,gQ.Unknown)()}function EQ(t,e){return k.TypeGuard.IsNot(t)?Ue(dE(t),e):k.TypeGuard.IsNot(e)?Ue(t,dE(e)):Tc("Invalid fallthrough for Not")}function AQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsNull(e)?B.True:B.False}function yE(t,e){return k.TypeGuard.IsLiteralNumber(t)||k.TypeGuard.IsNumber(t)||k.TypeGuard.IsInteger(t)?B.True:B.False}function OQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsInteger(e)||k.TypeGuard.IsNumber(e)?B.True:B.False}function cn(t,e){return Object.getOwnPropertyNames(t.properties).length===e}function pE(t){return nh(t)}function mE(t){return cn(t,0)||cn(t,1)&&"description"in t.properties&&k.TypeGuard.IsUnion(t.properties.description)&&t.properties.description.anyOf.length===2&&(k.TypeGuard.IsString(t.properties.description.anyOf[0])&&k.TypeGuard.IsUndefined(t.properties.description.anyOf[1])||k.TypeGuard.IsString(t.properties.description.anyOf[1])&&k.TypeGuard.IsUndefined(t.properties.description.anyOf[0]))}function Cy(t){return cn(t,0)}function hE(t){return cn(t,0)}function LQ(t){return cn(t,0)}function WQ(t){return cn(t,0)}function UQ(t){return nh(t)}function FQ(t){let e=(0,Iy.Number)();return cn(t,0)||cn(t,1)&&"length"in t.properties&&Bn(Ue(t.properties.length,e))===B.True}function DQ(t){return cn(t,0)}function nh(t){let e=(0,Iy.Number)();return cn(t,0)||cn(t,1)&&"length"in t.properties&&Bn(Ue(t.properties.length,e))===B.True}function $Q(t){let e=(0,hQ.Function)([(0,lE.Any)()],(0,lE.Any)());return cn(t,0)||cn(t,1)&&"then"in t.properties&&Bn(Ue(t.properties.then,e))===B.True}function vE(t,e){return Ue(t,e)===B.False||k.TypeGuard.IsOptional(t)&&!k.TypeGuard.IsOptional(e)?B.False:B.True}function Et(t,e){return k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:k.TypeGuard.IsNever(t)||k.TypeGuard.IsLiteralString(t)&&pE(e)||k.TypeGuard.IsLiteralNumber(t)&&Cy(e)||k.TypeGuard.IsLiteralBoolean(t)&&hE(e)||k.TypeGuard.IsSymbol(t)&&mE(e)||k.TypeGuard.IsBigInt(t)&&LQ(e)||k.TypeGuard.IsString(t)&&pE(e)||k.TypeGuard.IsSymbol(t)&&mE(e)||k.TypeGuard.IsNumber(t)&&Cy(e)||k.TypeGuard.IsInteger(t)&&Cy(e)||k.TypeGuard.IsBoolean(t)&&hE(e)||k.TypeGuard.IsUint8Array(t)&&UQ(e)||k.TypeGuard.IsDate(t)&&WQ(e)||k.TypeGuard.IsConstructor(t)&&DQ(e)||k.TypeGuard.IsFunction(t)&&FQ(e)?B.True:k.TypeGuard.IsRecord(t)&&k.TypeGuard.IsString(ky(t))?e[gE.Hint]==="Record"?B.True:B.False:k.TypeGuard.IsRecord(t)&&k.TypeGuard.IsNumber(ky(t))?cn(e,0)?B.True:B.False:B.False}function BQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsObject(e)?(()=>{for(let n of Object.getOwnPropertyNames(e.properties)){if(!(n in t.properties)&&!k.TypeGuard.IsOptional(e.properties[n]))return B.False;if(k.TypeGuard.IsOptional(e.properties[n]))return B.True;if(vE(t.properties[n],e.properties[n])===B.False)return B.False}return B.True})():B.False}function NQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)&&$Q(e)?B.True:k.TypeGuard.IsPromise(e)?Bn(Ue(t.item,e.item)):B.False}function ky(t){return Cc.PatternNumberExact in t.patternProperties?(0,Iy.Number)():Cc.PatternStringExact in t.patternProperties?(0,Ty.String)():Tc("Unknown record key pattern")}function My(t){return Cc.PatternNumberExact in t.patternProperties?t.patternProperties[Cc.PatternNumberExact]:Cc.PatternStringExact in t.patternProperties?t.patternProperties[Cc.PatternStringExact]:Tc("Unable to get record value schema")}function Nn(t,e){let[n,i]=[ky(e),My(e)];return k.TypeGuard.IsLiteralString(t)&&k.TypeGuard.IsNumber(n)&&Bn(Ue(t,i))===B.True?B.True:k.TypeGuard.IsUint8Array(t)&&k.TypeGuard.IsNumber(n)||k.TypeGuard.IsString(t)&&k.TypeGuard.IsNumber(n)||k.TypeGuard.IsArray(t)&&k.TypeGuard.IsNumber(n)?Ue(t,i):k.TypeGuard.IsObject(t)?(()=>{for(let s of Object.getOwnPropertyNames(t.properties))if(vE(i,t.properties[s])===B.False)return B.False;return B.True})():B.False}function jQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Ue(My(t),My(e)):B.False}function qQ(t,e){let n=k.TypeGuard.IsRegExp(t)?(0,Ty.String)():t,i=k.TypeGuard.IsRegExp(e)?(0,Ty.String)():e;return Ue(n,i)}function wE(t,e){return k.TypeGuard.IsLiteral(t)&&k.ValueGuard.IsString(t.const)||k.TypeGuard.IsString(t)?B.True:B.False}function GQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsString(e)?B.True:B.False}function KQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsSymbol(e)?B.True:B.False}function HQ(t,e){return k.TypeGuard.IsTemplateLiteral(t)?Ue((0,uE.TemplateLiteralToUnion)(t),e):k.TypeGuard.IsTemplateLiteral(e)?Ue(t,(0,uE.TemplateLiteralToUnion)(e)):Tc("Invalid fallthrough for TemplateLiteral")}function zQ(t,e){return k.TypeGuard.IsArray(e)&&t.items!==void 0&&t.items.every(n=>Ue(n,e.items)===B.True)}function VQ(t,e){return k.TypeGuard.IsNever(t)?B.True:k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:B.False}function JQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)&&nh(e)||k.TypeGuard.IsArray(e)&&zQ(t,e)?B.True:k.TypeGuard.IsTuple(e)?k.ValueGuard.IsUndefined(t.items)&&!k.ValueGuard.IsUndefined(e.items)||!k.ValueGuard.IsUndefined(t.items)&&k.ValueGuard.IsUndefined(e.items)?B.False:k.ValueGuard.IsUndefined(t.items)&&!k.ValueGuard.IsUndefined(e.items)||t.items.every((n,i)=>Ue(n,e.items[i])===B.True)?B.True:B.False:B.False}function QQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsUint8Array(e)?B.True:B.False}function YQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsVoid(e)?eY(t,e):k.TypeGuard.IsUndefined(e)?B.True:B.False}function Py(t,e){return e.anyOf.some(n=>Ue(t,n)===B.True)?B.True:B.False}function XQ(t,e){return t.anyOf.every(n=>Ue(n,e)===B.True)?B.True:B.False}function SE(t,e){return B.True}function ZQ(t,e){return k.TypeGuard.IsNever(e)?xE(t,e):k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):k.TypeGuard.IsString(e)?wE(t,e):k.TypeGuard.IsNumber(e)?yE(t,e):k.TypeGuard.IsInteger(e)?bE(t,e):k.TypeGuard.IsBoolean(e)?fE(t,e):k.TypeGuard.IsArray(e)?xQ(t,e):k.TypeGuard.IsTuple(e)?VQ(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsUnknown(e)?B.True:B.False}function eY(t,e){return k.TypeGuard.IsUndefined(t)||k.TypeGuard.IsUndefined(t)?B.True:B.False}function tY(t,e){return k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsUnknown(e)?SE(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsVoid(e)?B.True:B.False}function Ue(t,e){return k.TypeGuard.IsTemplateLiteral(t)||k.TypeGuard.IsTemplateLiteral(e)?HQ(t,e):k.TypeGuard.IsRegExp(t)||k.TypeGuard.IsRegExp(e)?qQ(t,e):k.TypeGuard.IsNot(t)||k.TypeGuard.IsNot(e)?EQ(t,e):k.TypeGuard.IsAny(t)?bQ(t,e):k.TypeGuard.IsArray(t)?yQ(t,e):k.TypeGuard.IsBigInt(t)?wQ(t,e):k.TypeGuard.IsBoolean(t)?SQ(t,e):k.TypeGuard.IsAsyncIterator(t)?vQ(t,e):k.TypeGuard.IsConstructor(t)?CQ(t,e):k.TypeGuard.IsDate(t)?TQ(t,e):k.TypeGuard.IsFunction(t)?kQ(t,e):k.TypeGuard.IsInteger(t)?MQ(t,e):k.TypeGuard.IsIntersect(t)?IQ(t,e):k.TypeGuard.IsIterator(t)?RQ(t,e):k.TypeGuard.IsLiteral(t)?PQ(t,e):k.TypeGuard.IsNever(t)?_Q(t,e):k.TypeGuard.IsNull(t)?AQ(t,e):k.TypeGuard.IsNumber(t)?OQ(t,e):k.TypeGuard.IsObject(t)?BQ(t,e):k.TypeGuard.IsRecord(t)?jQ(t,e):k.TypeGuard.IsString(t)?GQ(t,e):k.TypeGuard.IsSymbol(t)?KQ(t,e):k.TypeGuard.IsTuple(t)?JQ(t,e):k.TypeGuard.IsPromise(t)?NQ(t,e):k.TypeGuard.IsUint8Array(t)?QQ(t,e):k.TypeGuard.IsUndefined(t)?YQ(t,e):k.TypeGuard.IsUnion(t)?XQ(t,e):k.TypeGuard.IsUnknown(t)?ZQ(t,e):k.TypeGuard.IsVoid(t)?tY(t,e):Tc(`Unknown left type operand '${t[gE.Kind]}'`)}function nY(t,e){return Ue(t,e)}});var Ay=T(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ExtendsFromMappedResult=cY;var iY=ot(),sY=ih(),oY=tn();function rY(t,e,n,i,s){let o={};for(let r of globalThis.Object.getOwnPropertyNames(t))o[r]=(0,sY.Extends)(t[r],e,n,i,(0,oY.Clone)(s));return o}function aY(t,e,n,i,s){return rY(t.properties,e,n,i,s)}function cY(t,e,n,i,s){let o=aY(t,e,n,i,s);return(0,iY.MappedResult)(o)}});var ih=T(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});Ly.Extends=mY;var CE=le(),lY=it(),Oy=_y(),uY=Wy(),dY=Ay(),TE=Me();function pY(t,e,n,i){let s=(0,Oy.ExtendsCheck)(t,e);return s===Oy.ExtendsResult.Union?(0,lY.Union)([n,i]):s===Oy.ExtendsResult.True?n:i}function mY(t,e,n,i,s){return(0,TE.IsMappedResult)(t)?(0,dY.ExtendsFromMappedResult)(t,e,n,i,s):(0,TE.IsMappedKey)(t)?(0,CE.CreateType)((0,uY.ExtendsFromMappedKey)(t,e,n,i,s)):(0,CE.CreateType)(pY(t,e,n,i),s)}});var Wy=T(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});Uy.ExtendsFromMappedKey=wY;var hY=ot(),gY=Ft(),fY=ih(),bY=tn();function xY(t,e,n,i,s){return{[t]:(0,fY.Extends)((0,gY.Literal)(t),e,n,i,(0,bY.Clone)(s))}}function yY(t,e,n,i,s){return t.reduce((o,r)=>({...o,...xY(r,e,n,i,s)}),{})}function vY(t,e,n,i,s){return yY(t.keys,e,n,i,s)}function wY(t,e,n,i,s){let o=vY(t,e,n,i,s);return(0,hY.MappedResult)(o)}});var kE=T(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:!0});Fy.ExtendsUndefinedCheck=oh;var sh=re();function SY(t){return t.allOf.every(e=>oh(e))}function CY(t){return t.anyOf.some(e=>oh(e))}function TY(t){return!oh(t.not)}function oh(t){return t[sh.Kind]==="Intersect"?SY(t):t[sh.Kind]==="Union"?CY(t):t[sh.Kind]==="Not"?TY(t):t[sh.Kind]==="Undefined"}});var kc=T(ni=>{"use strict";var kY=ni&&ni.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Lu=ni&&ni.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&kY(e,t,n)};Object.defineProperty(ni,"__esModule",{value:!0});Lu(_y(),ni);Lu(Wy(),ni);Lu(Ay(),ni);Lu(kE(),ni);Lu(ih(),ni)});var $y=T(Dy=>{"use strict";Object.defineProperty(Dy,"__esModule",{value:!0});Dy.ExcludeFromTemplateLiteral=RY;var MY=rh(),IY=Si();function RY(t,e){return(0,MY.Exclude)((0,IY.TemplateLiteralToUnion)(t),e)}});var rh=T(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});jy.Exclude=LY;var By=le(),PY=it(),_Y=vt(),ah=kc(),EY=qy(),AY=$y(),Ny=Me();function OY(t,e){let n=t.filter(i=>(0,ah.ExtendsCheck)(i,e)===ah.ExtendsResult.False);return n.length===1?n[0]:(0,PY.Union)(n)}function LY(t,e,n={}){return(0,Ny.IsTemplateLiteral)(t)?(0,By.CreateType)((0,AY.ExcludeFromTemplateLiteral)(t,e),n):(0,Ny.IsMappedResult)(t)?(0,By.CreateType)((0,EY.ExcludeFromMappedResult)(t,e),n):(0,By.CreateType)((0,Ny.IsUnion)(t)?OY(t.anyOf,e):(0,ah.ExtendsCheck)(t,e)!==ah.ExtendsResult.False?(0,_Y.Never)():t,n)}});var qy=T(Gy=>{"use strict";Object.defineProperty(Gy,"__esModule",{value:!0});Gy.ExcludeFromMappedResult=$Y;var WY=ot(),UY=rh();function FY(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,UY.Exclude)(t[i],e);return n}function DY(t,e){return FY(t.properties,e)}function $Y(t,e){let n=DY(t,e);return(0,WY.MappedResult)(n)}});var ch=T(as=>{"use strict";var BY=as&&as.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ky=as&&as.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&BY(e,t,n)};Object.defineProperty(as,"__esModule",{value:!0});Ky(qy(),as);Ky($y(),as);Ky(rh(),as)});var zy=T(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.ExtractFromTemplateLiteral=qY;var NY=lh(),jY=Si();function qY(t,e){return(0,NY.Extract)((0,jY.TemplateLiteralToUnion)(t),e)}});var lh=T(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});Qy.Extract=JY;var Vy=le(),GY=it(),KY=vt(),uh=kc(),HY=Yy(),zY=zy(),Jy=Me();function VY(t,e){let n=t.filter(i=>(0,uh.ExtendsCheck)(i,e)!==uh.ExtendsResult.False);return n.length===1?n[0]:(0,GY.Union)(n)}function JY(t,e,n){return(0,Jy.IsTemplateLiteral)(t)?(0,Vy.CreateType)((0,zY.ExtractFromTemplateLiteral)(t,e),n):(0,Jy.IsMappedResult)(t)?(0,Vy.CreateType)((0,HY.ExtractFromMappedResult)(t,e),n):(0,Vy.CreateType)((0,Jy.IsUnion)(t)?VY(t.anyOf,e):(0,uh.ExtendsCheck)(t,e)!==uh.ExtendsResult.False?t:(0,KY.Never)(),n)}});var Yy=T(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.ExtractFromMappedResult=eX;var QY=ot(),YY=lh();function XY(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,YY.Extract)(t[i],e);return n}function ZY(t,e){return XY(t.properties,e)}function eX(t,e){let n=ZY(t,e);return(0,QY.MappedResult)(n)}});var dh=T(cs=>{"use strict";var tX=cs&&cs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Zy=cs&&cs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&tX(e,t,n)};Object.defineProperty(cs,"__esModule",{value:!0});Zy(Yy(),cs);Zy(zy(),cs);Zy(lh(),cs)});var ME=T(ls=>{"use strict";var nX=ls&&ls.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),iX=ls&&ls.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),sX=ls&&ls.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&nX(n,e,i[s]);return iX(n,e),n}})();Object.defineProperty(ls,"__esModule",{value:!0});ls.InstanceType=cX;var oX=le(),rX=vt(),aX=sX(Me());function cX(t,e){return aX.IsConstructor(t)?(0,oX.CreateType)(t.returns,e):(0,rX.Never)(e)}});var ph=T(Cr=>{"use strict";var lX=Cr&&Cr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),uX=Cr&&Cr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&lX(e,t,n)};Object.defineProperty(Cr,"__esModule",{value:!0});uX(ME(),Cr)});var IE=T(ev=>{"use strict";Object.defineProperty(ev,"__esModule",{value:!0});ev.ReadonlyOptional=mX;var dX=zs(),pX=wi();function mX(t){return(0,dX.Readonly)((0,pX.Optional)(t))}});var Wu=T(Tr=>{"use strict";var hX=Tr&&Tr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gX=Tr&&Tr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hX(e,t,n)};Object.defineProperty(Tr,"__esModule",{value:!0});gX(IE(),Tr)});var AE=T(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.Record=AX;Mc.RecordPattern=nv;Mc.RecordKey=OX;Mc.RecordValue=LX;var fX=le(),PE=re(),bX=vt(),xX=Gs(),_E=rn(),RE=ir(),yX=it(),vX=Si(),kr=fu(),EE=ti(),wX=Ut(),ki=Me();function Mr(t,e,n){return(0,fX.CreateType)({[PE.Kind]:"Record",type:"object",patternProperties:{[t]:e}},n)}function tv(t,e,n){let i={};for(let s of t)i[s]=e;return(0,_E.Object)(i,{...n,[PE.Hint]:"Record"})}function SX(t,e,n){return(0,vX.IsTemplateLiteralFinite)(t)?tv((0,EE.IndexPropertyKeys)(t),e,n):Mr(t.pattern,e,n)}function CX(t,e,n){return tv((0,EE.IndexPropertyKeys)((0,yX.Union)(t)),e,n)}function TX(t,e,n){return tv([t.toString()],e,n)}function kX(t,e,n){return Mr(t.source,e,n)}function MX(t,e,n){let i=(0,wX.IsUndefined)(t.pattern)?kr.PatternStringExact:t.pattern;return Mr(i,e,n)}function IX(t,e,n){return Mr(kr.PatternStringExact,e,n)}function RX(t,e,n){return Mr(kr.PatternNeverExact,e,n)}function PX(t,e,n){return(0,_E.Object)({true:e,false:e},n)}function _X(t,e,n){return Mr(kr.PatternNumberExact,e,n)}function EX(t,e,n){return Mr(kr.PatternNumberExact,e,n)}function AX(t,e,n={}){return(0,ki.IsUnion)(t)?CX(t.anyOf,e,n):(0,ki.IsTemplateLiteral)(t)?SX(t,e,n):(0,ki.IsLiteral)(t)?TX(t.const,e,n):(0,ki.IsBoolean)(t)?PX(t,e,n):(0,ki.IsInteger)(t)?_X(t,e,n):(0,ki.IsNumber)(t)?EX(t,e,n):(0,ki.IsRegExp)(t)?kX(t,e,n):(0,ki.IsString)(t)?MX(t,e,n):(0,ki.IsAny)(t)?IX(t,e,n):(0,ki.IsNever)(t)?RX(t,e,n):(0,bX.Never)(n)}function nv(t){return globalThis.Object.getOwnPropertyNames(t.patternProperties)[0]}function OX(t){let e=nv(t);return e===kr.PatternStringExact?(0,RE.String)():e===kr.PatternNumberExact?(0,xX.Number)():(0,RE.String)({pattern:e})}function LX(t){return t.patternProperties[nv(t)]}});var Ic=T(Ir=>{"use strict";var WX=Ir&&Ir.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),UX=Ir&&Ir.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WX(e,t,n)};Object.defineProperty(Ir,"__esModule",{value:!0});UX(AE(),Ir)});var LE=T(Mi=>{"use strict";var FX=Mi&&Mi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),DX=Mi&&Mi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),OE=Mi&&Mi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&FX(n,e,i[s]);return DX(n,e),n}})();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.FromTypes=Rc;Mi.Instantiate=rZ;var $X=km(),BX=xr(),NX=Wu(),jX=zs(),qX=wi(),GX=rn(),iv=Ic(),KX=OE(Ut()),ln=OE(Me());function HX(t,e){return e.parameters=Rc(t,e.parameters),e.returns=ii(t,e.returns),e}function zX(t,e){return e.parameters=Rc(t,e.parameters),e.returns=ii(t,e.returns),e}function VX(t,e){return e.allOf=Rc(t,e.allOf),e}function JX(t,e){return e.anyOf=Rc(t,e.anyOf),e}function QX(t,e){return KX.IsUndefined(e.items)||(e.items=Rc(t,e.items)),e}function YX(t,e){return e.items=ii(t,e.items),e}function XX(t,e){return e.items=ii(t,e.items),e}function ZX(t,e){return e.items=ii(t,e.items),e}function eZ(t,e){return e.item=ii(t,e.item),e}function tZ(t,e){let n=oZ(t,e.properties);return{...e,...(0,GX.Object)(n)}}function nZ(t,e){let n=ii(t,(0,iv.RecordKey)(e)),i=ii(t,(0,iv.RecordValue)(e)),s=(0,iv.Record)(n,i);return{...e,...s}}function iZ(t,e){return e.index in t?t[e.index]:(0,BX.Unknown)()}function sZ(t,e){let n=ln.IsReadonly(e),i=ln.IsOptional(e),s=ii(t,e);return n&&i?(0,NX.ReadonlyOptional)(s):n&&!i?(0,jX.Readonly)(s):!n&&i?(0,qX.Optional)(s):s}function oZ(t,e){return globalThis.Object.getOwnPropertyNames(e).reduce((n,i)=>({...n,[i]:sZ(t,e[i])}),{})}function Rc(t,e){return e.map(n=>ii(t,n))}function ii(t,e){return ln.IsConstructor(e)?HX(t,e):ln.IsFunction(e)?zX(t,e):ln.IsIntersect(e)?VX(t,e):ln.IsUnion(e)?JX(t,e):ln.IsTuple(e)?QX(t,e):ln.IsArray(e)?YX(t,e):ln.IsAsyncIterator(e)?XX(t,e):ln.IsIterator(e)?ZX(t,e):ln.IsPromise(e)?eZ(t,e):ln.IsObject(e)?tZ(t,e):ln.IsRecord(e)?nZ(t,e):ln.IsArgument(e)?iZ(t,e):e}function rZ(t,e){return ii(e,(0,$X.CloneType)(t))}});var mh=T(Rr=>{"use strict";var aZ=Rr&&Rr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cZ=Rr&&Rr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aZ(e,t,n)};Object.defineProperty(Rr,"__esModule",{value:!0});cZ(LE(),Rr)});var WE=T(sv=>{"use strict";Object.defineProperty(sv,"__esModule",{value:!0});sv.Integer=dZ;var lZ=le(),uZ=re();function dZ(t){return(0,lZ.CreateType)({[uZ.Kind]:"Integer",type:"integer"},t)}});var hh=T(Pr=>{"use strict";var pZ=Pr&&Pr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mZ=Pr&&Pr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pZ(e,t,n)};Object.defineProperty(Pr,"__esModule",{value:!0});mZ(WE(),Pr)});var rv=T(ov=>{"use strict";Object.defineProperty(ov,"__esModule",{value:!0});ov.IntrinsicFromMappedKey=wZ;var hZ=ot(),gZ=_r(),fZ=Ft(),bZ=tn();function xZ(t,e,n){return{[t]:(0,gZ.Intrinsic)((0,fZ.Literal)(t),e,(0,bZ.Clone)(n))}}function yZ(t,e,n){return t.reduce((s,o)=>({...s,...xZ(o,e,n)}),{})}function vZ(t,e,n){return yZ(t.keys,e,n)}function wZ(t,e,n){let i=vZ(t,e,n);return(0,hZ.MappedResult)(i)}});var _r=T(av=>{"use strict";Object.defineProperty(av,"__esModule",{value:!0});av.Intrinsic=BE;var SZ=le(),gh=Si(),CZ=rv(),UE=Ft(),FE=it(),fh=Me();function TZ(t){let[e,n]=[t.slice(0,1),t.slice(1)];return[e.toLowerCase(),n].join("")}function kZ(t){let[e,n]=[t.slice(0,1),t.slice(1)];return[e.toUpperCase(),n].join("")}function MZ(t){return t.toUpperCase()}function IZ(t){return t.toLowerCase()}function RZ(t,e,n){let i=(0,gh.TemplateLiteralParseExact)(t.pattern);if(!(0,gh.IsTemplateLiteralExpressionFinite)(i))return{...t,pattern:DE(t.pattern,e)};let r=[...(0,gh.TemplateLiteralExpressionGenerate)(i)].map(l=>(0,UE.Literal)(l)),a=$E(r,e),c=(0,FE.Union)(a);return(0,gh.TemplateLiteral)([c],n)}function DE(t,e){return typeof t=="string"?e==="Uncapitalize"?TZ(t):e==="Capitalize"?kZ(t):e==="Uppercase"?MZ(t):e==="Lowercase"?IZ(t):t:t.toString()}function $E(t,e){return t.map(n=>BE(n,e))}function BE(t,e,n={}){return(0,fh.IsMappedKey)(t)?(0,CZ.IntrinsicFromMappedKey)(t,e,n):(0,fh.IsTemplateLiteral)(t)?RZ(t,e,n):(0,fh.IsUnion)(t)?(0,FE.Union)($E(t.anyOf,e),n):(0,fh.IsLiteral)(t)?(0,UE.Literal)(DE(t.const,e),n):(0,SZ.CreateType)(t,n)}});var NE=T(cv=>{"use strict";Object.defineProperty(cv,"__esModule",{value:!0});cv.Capitalize=_Z;var PZ=_r();function _Z(t,e={}){return(0,PZ.Intrinsic)(t,"Capitalize",e)}});var jE=T(lv=>{"use strict";Object.defineProperty(lv,"__esModule",{value:!0});lv.Lowercase=AZ;var EZ=_r();function AZ(t,e={}){return(0,EZ.Intrinsic)(t,"Lowercase",e)}});var qE=T(uv=>{"use strict";Object.defineProperty(uv,"__esModule",{value:!0});uv.Uncapitalize=LZ;var OZ=_r();function LZ(t,e={}){return(0,OZ.Intrinsic)(t,"Uncapitalize",e)}});var GE=T(dv=>{"use strict";Object.defineProperty(dv,"__esModule",{value:!0});dv.Uppercase=UZ;var WZ=_r();function UZ(t,e={}){return(0,WZ.Intrinsic)(t,"Uppercase",e)}});var bh=T(jn=>{"use strict";var FZ=jn&&jn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Pc=jn&&jn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&FZ(e,t,n)};Object.defineProperty(jn,"__esModule",{value:!0});Pc(NE(),jn);Pc(rv(),jn);Pc(_r(),jn);Pc(jE(),jn);Pc(qE(),jn);Pc(GE(),jn)});var mv=T(pv=>{"use strict";Object.defineProperty(pv,"__esModule",{value:!0});pv.OmitFromMappedResult=qZ;var DZ=ot(),$Z=xh(),BZ=tn();function NZ(t,e,n){let i={};for(let s of globalThis.Object.getOwnPropertyNames(t))i[s]=(0,$Z.Omit)(t[s],e,(0,BZ.Clone)(n));return i}function jZ(t,e,n){return NZ(t.properties,e,n)}function qZ(t,e,n){let i=jZ(t,e,n);return(0,DZ.MappedResult)(i)}});var xh=T(fv=>{"use strict";Object.defineProperty(fv,"__esModule",{value:!0});fv.Omit=oee;var GZ=le(),KZ=Am(),HZ=pu(),hv=js(),zZ=Ft(),VZ=ti(),JZ=Cn(),KE=it(),HE=rn(),QZ=bv(),YZ=mv(),us=Me(),XZ=Ut();function ZZ(t,e){return t.map(n=>gv(n,e))}function eee(t,e){return t.map(n=>gv(n,e))}function tee(t,e){let{[e]:n,...i}=t;return i}function nee(t,e){return e.reduce((n,i)=>tee(n,i),t)}function iee(t,e,n){let i=(0,KZ.Discard)(t,[HZ.TransformKind,"$id","required","properties"]),s=nee(n,e);return(0,HE.Object)(s,i)}function see(t){let e=t.reduce((n,i)=>(0,us.IsLiteralValue)(i)?[...n,(0,zZ.Literal)(i)]:n,[]);return(0,KE.Union)(e)}function gv(t,e){return(0,us.IsIntersect)(t)?(0,JZ.Intersect)(ZZ(t.allOf,e)):(0,us.IsUnion)(t)?(0,KE.Union)(eee(t.anyOf,e)):(0,us.IsObject)(t)?iee(t,e,t.properties):(0,HE.Object)({})}function oee(t,e,n){let i=(0,XZ.IsArray)(e)?see(e):e,s=(0,us.IsSchema)(e)?(0,VZ.IndexPropertyKeys)(e):e,o=(0,us.IsRef)(t),r=(0,us.IsRef)(e);return(0,us.IsMappedResult)(t)?(0,YZ.OmitFromMappedResult)(t,s,n):(0,us.IsMappedKey)(e)?(0,QZ.OmitFromMappedKey)(t,e,n):o&&r?(0,hv.Computed)("Omit",[t,i],n):!o&&r?(0,hv.Computed)("Omit",[t,i],n):o&&!r?(0,hv.Computed)("Omit",[t,i],n):(0,GZ.CreateType)({...gv(t,s),...n})}});var bv=T(xv=>{"use strict";Object.defineProperty(xv,"__esModule",{value:!0});xv.OmitFromMappedKey=pee;var ree=ot(),aee=xh(),cee=tn();function lee(t,e,n){return{[e]:(0,aee.Omit)(t,[e],(0,cee.Clone)(n))}}function uee(t,e,n){return e.reduce((i,s)=>({...i,...lee(t,s,n)}),{})}function dee(t,e,n){return uee(t,e.keys,n)}function pee(t,e,n){let i=dee(t,e,n);return(0,ree.MappedResult)(i)}});var Uu=T(ds=>{"use strict";var mee=ds&&ds.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yv=ds&&ds.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mee(e,t,n)};Object.defineProperty(ds,"__esModule",{value:!0});yv(bv(),ds);yv(mv(),ds);yv(xh(),ds)});var wv=T(vv=>{"use strict";Object.defineProperty(vv,"__esModule",{value:!0});vv.PickFromMappedResult=yee;var hee=ot(),gee=yh(),fee=tn();function bee(t,e,n){let i={};for(let s of globalThis.Object.getOwnPropertyNames(t))i[s]=(0,gee.Pick)(t[s],e,(0,fee.Clone)(n));return i}function xee(t,e,n){return bee(t.properties,e,n)}function yee(t,e,n){let i=xee(t,e,n);return(0,hee.MappedResult)(i)}});var yh=T(Tv=>{"use strict";Object.defineProperty(Tv,"__esModule",{value:!0});Tv.Pick=Lee;var vee=le(),wee=Am(),Sv=js(),See=Cn(),Cee=Ft(),zE=rn(),VE=it(),Tee=ti(),kee=pu(),ps=Me(),Mee=Ut(),Iee=kv(),Ree=wv();function Pee(t,e){return t.map(n=>Cv(n,e))}function _ee(t,e){return t.map(n=>Cv(n,e))}function Eee(t,e){let n={};for(let i of e)i in t&&(n[i]=t[i]);return n}function Aee(t,e,n){let i=(0,wee.Discard)(t,[kee.TransformKind,"$id","required","properties"]),s=Eee(n,e);return(0,zE.Object)(s,i)}function Oee(t){let e=t.reduce((n,i)=>(0,ps.IsLiteralValue)(i)?[...n,(0,Cee.Literal)(i)]:n,[]);return(0,VE.Union)(e)}function Cv(t,e){return(0,ps.IsIntersect)(t)?(0,See.Intersect)(Pee(t.allOf,e)):(0,ps.IsUnion)(t)?(0,VE.Union)(_ee(t.anyOf,e)):(0,ps.IsObject)(t)?Aee(t,e,t.properties):(0,zE.Object)({})}function Lee(t,e,n){let i=(0,Mee.IsArray)(e)?Oee(e):e,s=(0,ps.IsSchema)(e)?(0,Tee.IndexPropertyKeys)(e):e,o=(0,ps.IsRef)(t),r=(0,ps.IsRef)(e);return(0,ps.IsMappedResult)(t)?(0,Ree.PickFromMappedResult)(t,s,n):(0,ps.IsMappedKey)(e)?(0,Iee.PickFromMappedKey)(t,e,n):o&&r?(0,Sv.Computed)("Pick",[t,i],n):!o&&r?(0,Sv.Computed)("Pick",[t,i],n):o&&!r?(0,Sv.Computed)("Pick",[t,i],n):(0,vee.CreateType)({...Cv(t,s),...n})}});var kv=T(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});Mv.PickFromMappedKey=Nee;var Wee=ot(),Uee=yh(),Fee=tn();function Dee(t,e,n){return{[e]:(0,Uee.Pick)(t,[e],(0,Fee.Clone)(n))}}function $ee(t,e,n){return e.reduce((i,s)=>({...i,...Dee(t,s,n)}),{})}function Bee(t,e,n){return $ee(t,e.keys,n)}function Nee(t,e,n){let i=Bee(t,e,n);return(0,Wee.MappedResult)(i)}});var Fu=T(ms=>{"use strict";var jee=ms&&ms.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Iv=ms&&ms.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jee(e,t,n)};Object.defineProperty(ms,"__esModule",{value:!0});Iv(kv(),ms);Iv(wv(),ms);Iv(yh(),ms)});var Pv=T(hs=>{"use strict";var qee=hs&&hs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Gee=hs&&hs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Kee=hs&&hs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&qee(n,e,i[s]);return Gee(n,e),n}})();Object.defineProperty(hs,"__esModule",{value:!0});hs.Partial=ste;var Hee=le(),Rv=js(),zee=wi(),QE=rn(),Vee=Cn(),Jee=it(),Qee=Js(),Yee=es(),Xee=re(),Zee=_v(),$t=Kee(Me());function ete(t,e){return(0,Rv.Computed)("Partial",[(0,Rv.Computed)(t,e)])}function tte(t){return(0,Rv.Computed)("Partial",[(0,Qee.Ref)(t)])}function nte(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,zee.Optional)(t[n]);return e}function ite(t,e){let n=(0,Yee.Discard)(t,[Xee.TransformKind,"$id","required","properties"]),i=nte(e);return(0,QE.Object)(i,n)}function JE(t){return t.map(e=>YE(e))}function YE(t){return $t.IsComputed(t)?ete(t.target,t.parameters):$t.IsRef(t)?tte(t.$ref):$t.IsIntersect(t)?(0,Vee.Intersect)(JE(t.allOf)):$t.IsUnion(t)?(0,Jee.Union)(JE(t.anyOf)):$t.IsObject(t)?ite(t,t.properties):$t.IsBigInt(t)||$t.IsBoolean(t)||$t.IsInteger(t)||$t.IsLiteral(t)||$t.IsNull(t)||$t.IsNumber(t)||$t.IsString(t)||$t.IsSymbol(t)||$t.IsUndefined(t)?t:(0,QE.Object)({})}function ste(t,e){return $t.IsMappedResult(t)?(0,Zee.PartialFromMappedResult)(t,e):(0,Hee.CreateType)({...YE(t),...e})}});var _v=T(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.PartialFromMappedResult=ute;var ote=ot(),rte=Pv(),ate=tn();function cte(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,rte.Partial)(t[i],(0,ate.Clone)(e));return n}function lte(t,e){return cte(t.properties,e)}function ute(t,e){let n=lte(t,e);return(0,ote.MappedResult)(n)}});var Du=T(Qs=>{"use strict";var dte=Qs&&Qs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),XE=Qs&&Qs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&dte(e,t,n)};Object.defineProperty(Qs,"__esModule",{value:!0});XE(_v(),Qs);XE(Pv(),Qs)});var Ov=T(gs=>{"use strict";var pte=gs&&gs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mte=gs&&gs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),hte=gs&&gs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&pte(n,e,i[s]);return mte(n,e),n}})();Object.defineProperty(gs,"__esModule",{value:!0});gs.Required=Tte;var gte=le(),Av=js(),eA=rn(),fte=Cn(),bte=it(),xte=Js(),tA=re(),nA=es(),yte=Lv(),Bt=hte(Me());function vte(t,e){return(0,Av.Computed)("Required",[(0,Av.Computed)(t,e)])}function wte(t){return(0,Av.Computed)("Required",[(0,xte.Ref)(t)])}function Ste(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,nA.Discard)(t[n],[tA.OptionalKind]);return e}function Cte(t,e){let n=(0,nA.Discard)(t,[tA.TransformKind,"$id","required","properties"]),i=Ste(e);return(0,eA.Object)(i,n)}function ZE(t){return t.map(e=>iA(e))}function iA(t){return Bt.IsComputed(t)?vte(t.target,t.parameters):Bt.IsRef(t)?wte(t.$ref):Bt.IsIntersect(t)?(0,fte.Intersect)(ZE(t.allOf)):Bt.IsUnion(t)?(0,bte.Union)(ZE(t.anyOf)):Bt.IsObject(t)?Cte(t,t.properties):Bt.IsBigInt(t)||Bt.IsBoolean(t)||Bt.IsInteger(t)||Bt.IsLiteral(t)||Bt.IsNull(t)||Bt.IsNumber(t)||Bt.IsString(t)||Bt.IsSymbol(t)||Bt.IsUndefined(t)?t:(0,eA.Object)({})}function Tte(t,e){return Bt.IsMappedResult(t)?(0,yte.RequiredFromMappedResult)(t,e):(0,gte.CreateType)({...iA(t),...e})}});var Lv=T(Wv=>{"use strict";Object.defineProperty(Wv,"__esModule",{value:!0});Wv.RequiredFromMappedResult=Pte;var kte=ot(),Mte=Ov();function Ite(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,Mte.Required)(t[i],e);return n}function Rte(t,e){return Ite(t.properties,e)}function Pte(t,e){let n=Rte(t,e);return(0,kte.MappedResult)(n)}});var $u=T(Ys=>{"use strict";var _te=Ys&&Ys.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sA=Ys&&Ys.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_te(e,t,n)};Object.defineProperty(Ys,"__esModule",{value:!0});sA(Lv(),Ys);sA(Ov(),Ys)});var cA=T(si=>{"use strict";var Ete=si&&si.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ate=si&&si.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ote=si&&si.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Ete(n,e,i[s]);return Ate(n,e),n}})();Object.defineProperty(si,"__esModule",{value:!0});si.FromType=dn;si.ComputeType=aA;si.ComputeModuleProperties=bne;var un=Xi(),Lte=$b(),oA=es(),Wte=pc(),Ute=Ru(),Fte=mc(),Dte=hc(),$te=ti(),Bte=qs(),Nte=Cn(),jte=vc(),qte=Sc(),Gte=rn(),Kte=Uu(),Hte=Fu(),Uv=vt(),zte=Du(),rA=Ic(),Vte=$u(),Jte=is(),Qte=it(),vh=re(),Mt=Ote(Me());function Yte(t,e){return e.map(n=>Mt.IsRef(n)?Fv(t,n.$ref):dn(t,n))}function Fv(t,e){return e in t?Mt.IsRef(t[e])?Fv(t,t[e].$ref):dn(t,t[e]):(0,Uv.Never)()}function Xte(t){return(0,Ute.Awaited)(t[0])}function Zte(t){return(0,$te.Index)(t[0],t[1])}function ene(t){return(0,qte.KeyOf)(t[0])}function tne(t){return(0,zte.Partial)(t[0])}function nne(t){return(0,Kte.Omit)(t[0],t[1])}function ine(t){return(0,Hte.Pick)(t[0],t[1])}function sne(t){return(0,Vte.Required)(t[0])}function one(t,e,n){let i=Yte(t,n);return e==="Awaited"?Xte(i):e==="Index"?Zte(i):e==="KeyOf"?ene(i):e==="Partial"?tne(i):e==="Omit"?nne(i):e==="Pick"?ine(i):e==="Required"?sne(i):(0,Uv.Never)()}function rne(t,e){return(0,Wte.Array)(dn(t,e))}function ane(t,e){return(0,Fte.AsyncIterator)(dn(t,e))}function cne(t,e,n){return(0,Dte.Constructor)(Bu(t,e),dn(t,n))}function lne(t,e,n){return(0,Bte.Function)(Bu(t,e),dn(t,n))}function une(t,e){return(0,Nte.Intersect)(Bu(t,e))}function dne(t,e){return(0,jte.Iterator)(dn(t,e))}function pne(t,e){return(0,Gte.Object)(globalThis.Object.keys(e).reduce((n,i)=>({...n,[i]:dn(t,e[i])}),{}))}function mne(t,e){let[n,i]=[dn(t,(0,rA.RecordValue)(e)),(0,rA.RecordPattern)(e)],s=(0,Lte.CloneType)(e);return s.patternProperties[i]=n,s}function hne(t,e){return Mt.IsRef(e)?{...Fv(t,e.$ref),[vh.TransformKind]:e[vh.TransformKind]}:e}function gne(t,e){return(0,Jte.Tuple)(Bu(t,e))}function fne(t,e){return(0,Qte.Union)(Bu(t,e))}function Bu(t,e){return e.map(n=>dn(t,n))}function dn(t,e){return Mt.IsOptional(e)?(0,un.CreateType)(dn(t,(0,oA.Discard)(e,[vh.OptionalKind])),e):Mt.IsReadonly(e)?(0,un.CreateType)(dn(t,(0,oA.Discard)(e,[vh.ReadonlyKind])),e):Mt.IsTransform(e)?(0,un.CreateType)(hne(t,e),e):Mt.IsArray(e)?(0,un.CreateType)(rne(t,e.items),e):Mt.IsAsyncIterator(e)?(0,un.CreateType)(ane(t,e.items),e):Mt.IsComputed(e)?(0,un.CreateType)(one(t,e.target,e.parameters)):Mt.IsConstructor(e)?(0,un.CreateType)(cne(t,e.parameters,e.returns),e):Mt.IsFunction(e)?(0,un.CreateType)(lne(t,e.parameters,e.returns),e):Mt.IsIntersect(e)?(0,un.CreateType)(une(t,e.allOf),e):Mt.IsIterator(e)?(0,un.CreateType)(dne(t,e.items),e):Mt.IsObject(e)?(0,un.CreateType)(pne(t,e.properties),e):Mt.IsRecord(e)?(0,un.CreateType)(mne(t,e)):Mt.IsTuple(e)?(0,un.CreateType)(gne(t,e.items||[]),e):Mt.IsUnion(e)?(0,un.CreateType)(fne(t,e.anyOf),e):e}function aA(t,e){return e in t?dn(t,t[e]):(0,Uv.Never)()}function bne(t){return globalThis.Object.getOwnPropertyNames(t).reduce((e,n)=>({...e,[n]:aA(t,n)}),{})}});var uA=T(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.TModule=void 0;Nu.Module=vne;var lA=Xi(),xne=re(),yne=cA(),wh=class{constructor(e){let n=(0,yne.ComputeModuleProperties)(e),i=this.WithIdentifiers(n);this.$defs=i}Import(e,n){let i={...this.$defs,[e]:(0,lA.CreateType)(this.$defs[e],n)};return(0,lA.CreateType)({[xne.Kind]:"Import",$defs:i,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((n,i)=>({...n,[i]:{...e[i],$id:i}}),{})}};Nu.TModule=wh;function vne(t){return new wh(t)}});var Sh=T(Er=>{"use strict";var wne=Er&&Er.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Sne=Er&&Er.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&wne(e,t,n)};Object.defineProperty(Er,"__esModule",{value:!0});Sne(uA(),Er)});var dA=T(Dv=>{"use strict";Object.defineProperty(Dv,"__esModule",{value:!0});Dv.Not=kne;var Cne=le(),Tne=re();function kne(t,e){return(0,Cne.CreateType)({[Tne.Kind]:"Not",not:t},e)}});var Ch=T(Ar=>{"use strict";var Mne=Ar&&Ar.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ine=Ar&&Ar.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Mne(e,t,n)};Object.defineProperty(Ar,"__esModule",{value:!0});Ine(dA(),Ar)});var pA=T(fs=>{"use strict";var Rne=fs&&fs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Pne=fs&&fs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),_ne=fs&&fs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Rne(n,e,i[s]);return Pne(n,e),n}})();Object.defineProperty(fs,"__esModule",{value:!0});fs.Parameters=Lne;var Ene=is(),Ane=vt(),One=_ne(Me());function Lne(t,e){return One.IsFunction(t)?(0,Ene.Tuple)(t.parameters,e):(0,Ane.Never)()}});var Th=T(Or=>{"use strict";var Wne=Or&&Or.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Une=Or&&Or.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Wne(e,t,n)};Object.defineProperty(Or,"__esModule",{value:!0});Une(pA(),Or)});var hA=T($v=>{"use strict";Object.defineProperty($v,"__esModule",{value:!0});$v.Recursive=Nne;var Fne=km(),Dne=le(),$ne=Ut(),mA=re(),Bne=0;function Nne(t,e={}){(0,$ne.IsUndefined)(e.$id)&&(e.$id=`T${Bne++}`);let n=(0,Fne.CloneType)(t({[mA.Kind]:"This",$ref:`${e.$id}`}));return n.$id=e.$id,(0,Dne.CreateType)({[mA.Hint]:"Recursive",...n},e)}});var kh=T(Lr=>{"use strict";var jne=Lr&&Lr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),qne=Lr&&Lr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jne(e,t,n)};Object.defineProperty(Lr,"__esModule",{value:!0});qne(hA(),Lr)});var gA=T(Bv=>{"use strict";Object.defineProperty(Bv,"__esModule",{value:!0});Bv.RegExp=zne;var Gne=le(),Kne=Ut(),Hne=re();function zne(t,e){let n=(0,Kne.IsString)(t)?new globalThis.RegExp(t):t;return(0,Gne.CreateType)({[Hne.Kind]:"RegExp",type:"RegExp",source:n.source,flags:n.flags},e)}});var Mh=T(Wr=>{"use strict";var Vne=Wr&&Wr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Jne=Wr&&Wr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Vne(e,t,n)};Object.defineProperty(Wr,"__esModule",{value:!0});Jne(gA(),Wr)});var fA=T(jv=>{"use strict";Object.defineProperty(jv,"__esModule",{value:!0});jv.Rest=Yne;var Nv=Me();function Qne(t){return(0,Nv.IsIntersect)(t)?t.allOf:(0,Nv.IsUnion)(t)?t.anyOf:(0,Nv.IsTuple)(t)?t.items??[]:[]}function Yne(t){return Qne(t)}});var Ih=T(Ur=>{"use strict";var Xne=Ur&&Ur.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Zne=Ur&&Ur.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Xne(e,t,n)};Object.defineProperty(Ur,"__esModule",{value:!0});Zne(fA(),Ur)});var bA=T(bs=>{"use strict";var eie=bs&&bs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),tie=bs&&bs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),nie=bs&&bs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&eie(n,e,i[s]);return tie(n,e),n}})();Object.defineProperty(bs,"__esModule",{value:!0});bs.ReturnType=rie;var iie=le(),sie=vt(),oie=nie(Me());function rie(t,e){return oie.IsFunction(t)?(0,iie.CreateType)(t.returns,e):(0,sie.Never)(e)}});var Rh=T(Fr=>{"use strict";var aie=Fr&&Fr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cie=Fr&&Fr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aie(e,t,n)};Object.defineProperty(Fr,"__esModule",{value:!0});cie(bA(),Fr)});var yA=T(xA=>{"use strict";Object.defineProperty(xA,"__esModule",{value:!0})});var wA=T(vA=>{"use strict";Object.defineProperty(vA,"__esModule",{value:!0});var SEe=re()});var CA=T(Xs=>{"use strict";var lie=Xs&&Xs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),SA=Xs&&Xs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&lie(e,t,n)};Object.defineProperty(Xs,"__esModule",{value:!0});SA(yA(),Xs);SA(wA(),Xs)});var kA=T(TA=>{"use strict";Object.defineProperty(TA,"__esModule",{value:!0})});var MA=T(Dr=>{"use strict";var uie=Dr&&Dr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),die=Dr&&Dr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uie(e,t,n)};Object.defineProperty(Dr,"__esModule",{value:!0});die(kA(),Dr)});var IA=T($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.TransformEncodeBuilder=$r.TransformDecodeBuilder=void 0;$r.Transform=mie;var Ph=re(),pie=Me(),_h=class{constructor(e){this.schema=e}Decode(e){return new Eh(this.schema,e)}};$r.TransformDecodeBuilder=_h;var Eh=class{constructor(e,n){this.schema=e,this.decode=n}EncodeTransform(e,n){let o={Encode:r=>n[Ph.TransformKind].Encode(e(r)),Decode:r=>this.decode(n[Ph.TransformKind].Decode(r))};return{...n,[Ph.TransformKind]:o}}EncodeSchema(e,n){let i={Decode:this.decode,Encode:e};return{...n,[Ph.TransformKind]:i}}Encode(e){return(0,pie.IsTransform)(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};$r.TransformEncodeBuilder=Eh;function mie(t){return new _h(t)}});var Ah=T(Br=>{"use strict";var hie=Br&&Br.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gie=Br&&Br.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hie(e,t,n)};Object.defineProperty(Br,"__esModule",{value:!0});gie(IA(),Br)});var PA=T(qv=>{"use strict";Object.defineProperty(qv,"__esModule",{value:!0});qv.Unsafe=bie;var fie=le(),RA=re();function bie(t={}){return(0,fie.CreateType)({[RA.Kind]:t[RA.Kind]??"Unsafe"},t)}});var Oh=T(Nr=>{"use strict";var xie=Nr&&Nr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yie=Nr&&Nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xie(e,t,n)};Object.defineProperty(Nr,"__esModule",{value:!0});yie(PA(),Nr)});var _A=T(Gv=>{"use strict";Object.defineProperty(Gv,"__esModule",{value:!0});Gv.Void=Sie;var vie=le(),wie=re();function Sie(t){return(0,vie.CreateType)({[wie.Kind]:"Void",type:"void"},t)}});var Lh=T(jr=>{"use strict";var Cie=jr&&jr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Tie=jr&&jr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Cie(e,t,n)};Object.defineProperty(jr,"__esModule",{value:!0});Tie(_A(),jr)});var Hv=T(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.JsonTypeBuilder=void 0;var kie=dc(),Mie=pc(),Iie=vu(),Rie=Jm(),Pie=Ym(),_ie=Zm(),Eie=ch(),Aie=kc(),Oie=dh(),Lie=ti(),Wie=hh(),Uie=Cn(),Wh=bh(),Fie=Sc(),Die=Ft(),$ie=ot(),Bie=vt(),Nie=Ch(),jie=_u(),qie=Sh(),Gie=Gs(),Kie=rn(),Hie=Uu(),zie=wi(),Vie=Du(),Jie=Fu(),Qie=zs(),Yie=Wu(),Xie=Ic(),Zie=kh(),ese=Js(),tse=$u(),nse=Ih(),ise=ir(),sse=Si(),ose=Ah(),rse=is(),ase=it(),cse=xr(),lse=Oh(),Kv=class{ReadonlyOptional(e){return(0,Yie.ReadonlyOptional)(e)}Readonly(e,n){return(0,Qie.Readonly)(e,n??!0)}Optional(e,n){return(0,zie.Optional)(e,n??!0)}Any(e){return(0,kie.Any)(e)}Array(e,n){return(0,Mie.Array)(e,n)}Boolean(e){return(0,Iie.Boolean)(e)}Capitalize(e,n){return(0,Wh.Capitalize)(e,n)}Composite(e,n){return(0,Rie.Composite)(e,n)}Const(e,n){return(0,Pie.Const)(e,n)}Enum(e,n){return(0,_ie.Enum)(e,n)}Exclude(e,n,i){return(0,Eie.Exclude)(e,n,i)}Extends(e,n,i,s,o){return(0,Aie.Extends)(e,n,i,s,o)}Extract(e,n,i){return(0,Oie.Extract)(e,n,i)}Index(e,n,i){return(0,Lie.Index)(e,n,i)}Integer(e){return(0,Wie.Integer)(e)}Intersect(e,n){return(0,Uie.Intersect)(e,n)}KeyOf(e,n){return(0,Fie.KeyOf)(e,n)}Literal(e,n){return(0,Die.Literal)(e,n)}Lowercase(e,n){return(0,Wh.Lowercase)(e,n)}Mapped(e,n,i){return(0,$ie.Mapped)(e,n,i)}Module(e){return(0,qie.Module)(e)}Never(e){return(0,Bie.Never)(e)}Not(e,n){return(0,Nie.Not)(e,n)}Null(e){return(0,jie.Null)(e)}Number(e){return(0,Gie.Number)(e)}Object(e,n){return(0,Kie.Object)(e,n)}Omit(e,n,i){return(0,Hie.Omit)(e,n,i)}Partial(e,n){return(0,Vie.Partial)(e,n)}Pick(e,n,i){return(0,Jie.Pick)(e,n,i)}Record(e,n,i){return(0,Xie.Record)(e,n,i)}Recursive(e,n){return(0,Zie.Recursive)(e,n)}Ref(...e){return(0,ese.Ref)(e[0],e[1])}Required(e,n){return(0,tse.Required)(e,n)}Rest(e){return(0,nse.Rest)(e)}String(e){return(0,ise.String)(e)}TemplateLiteral(e,n){return(0,sse.TemplateLiteral)(e,n)}Transform(e){return(0,ose.Transform)(e)}Tuple(e,n){return(0,rse.Tuple)(e,n)}Uncapitalize(e,n){return(0,Wh.Uncapitalize)(e,n)}Union(e,n){return(0,ase.Union)(e,n)}Unknown(e){return(0,cse.Unknown)(e)}Unsafe(e){return(0,lse.Unsafe)(e)}Uppercase(e,n){return(0,Wh.Uppercase)(e,n)}};Uh.JsonTypeBuilder=Kv});var EA=T($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.Rest=$.Required=$.RegExp=$.Ref=$.Recursive=$.Record=$.ReadonlyOptional=$.Readonly=$.Promise=$.Pick=$.Partial=$.Parameters=$.Optional=$.Omit=$.Object=$.Number=$.Null=$.Not=$.Never=$.Module=$.Mapped=$.Literal=$.KeyOf=$.Iterator=$.Uppercase=$.Lowercase=$.Uncapitalize=$.Capitalize=$.Intersect=$.Integer=$.Instantiate=$.InstanceType=$.Index=$.Function=$.Extract=$.Extends=$.Exclude=$.Enum=$.Date=$.ConstructorParameters=$.Constructor=$.Const=$.Composite=$.Boolean=$.BigInt=$.Awaited=$.AsyncIterator=$.Array=$.Argument=$.Any=void 0;$.Void=$.Unsafe=$.Unknown=$.Union=$.Undefined=$.Uint8Array=$.Tuple=$.Transform=$.TemplateLiteral=$.Symbol=$.String=$.ReturnType=void 0;var use=dc();Object.defineProperty($,"Any",{enumerable:!0,get:function(){return use.Any}});var dse=Em();Object.defineProperty($,"Argument",{enumerable:!0,get:function(){return dse.Argument}});var pse=pc();Object.defineProperty($,"Array",{enumerable:!0,get:function(){return pse.Array}});var mse=mc();Object.defineProperty($,"AsyncIterator",{enumerable:!0,get:function(){return mse.AsyncIterator}});var hse=Ru();Object.defineProperty($,"Awaited",{enumerable:!0,get:function(){return hse.Awaited}});var gse=xc();Object.defineProperty($,"BigInt",{enumerable:!0,get:function(){return gse.BigInt}});var fse=vu();Object.defineProperty($,"Boolean",{enumerable:!0,get:function(){return fse.Boolean}});var bse=Jm();Object.defineProperty($,"Composite",{enumerable:!0,get:function(){return bse.Composite}});var xse=Ym();Object.defineProperty($,"Const",{enumerable:!0,get:function(){return xse.Const}});var yse=hc();Object.defineProperty($,"Constructor",{enumerable:!0,get:function(){return yse.Constructor}});var vse=Xm();Object.defineProperty($,"ConstructorParameters",{enumerable:!0,get:function(){return vse.ConstructorParameters}});var wse=Pu();Object.defineProperty($,"Date",{enumerable:!0,get:function(){return wse.Date}});var Sse=Zm();Object.defineProperty($,"Enum",{enumerable:!0,get:function(){return Sse.Enum}});var Cse=ch();Object.defineProperty($,"Exclude",{enumerable:!0,get:function(){return Cse.Exclude}});var Tse=kc();Object.defineProperty($,"Extends",{enumerable:!0,get:function(){return Tse.Extends}});var kse=dh();Object.defineProperty($,"Extract",{enumerable:!0,get:function(){return kse.Extract}});var Mse=qs();Object.defineProperty($,"Function",{enumerable:!0,get:function(){return Mse.Function}});var Ise=ti();Object.defineProperty($,"Index",{enumerable:!0,get:function(){return Ise.Index}});var Rse=ph();Object.defineProperty($,"InstanceType",{enumerable:!0,get:function(){return Rse.InstanceType}});var Pse=mh();Object.defineProperty($,"Instantiate",{enumerable:!0,get:function(){return Pse.Instantiate}});var _se=hh();Object.defineProperty($,"Integer",{enumerable:!0,get:function(){return _se.Integer}});var Ese=Cn();Object.defineProperty($,"Intersect",{enumerable:!0,get:function(){return Ese.Intersect}});var Fh=bh();Object.defineProperty($,"Capitalize",{enumerable:!0,get:function(){return Fh.Capitalize}});Object.defineProperty($,"Uncapitalize",{enumerable:!0,get:function(){return Fh.Uncapitalize}});Object.defineProperty($,"Lowercase",{enumerable:!0,get:function(){return Fh.Lowercase}});Object.defineProperty($,"Uppercase",{enumerable:!0,get:function(){return Fh.Uppercase}});var Ase=vc();Object.defineProperty($,"Iterator",{enumerable:!0,get:function(){return Ase.Iterator}});var Ose=Sc();Object.defineProperty($,"KeyOf",{enumerable:!0,get:function(){return Ose.KeyOf}});var Lse=Ft();Object.defineProperty($,"Literal",{enumerable:!0,get:function(){return Lse.Literal}});var Wse=ot();Object.defineProperty($,"Mapped",{enumerable:!0,get:function(){return Wse.Mapped}});var Use=Sh();Object.defineProperty($,"Module",{enumerable:!0,get:function(){return Use.Module}});var Fse=vt();Object.defineProperty($,"Never",{enumerable:!0,get:function(){return Fse.Never}});var Dse=Ch();Object.defineProperty($,"Not",{enumerable:!0,get:function(){return Dse.Not}});var $se=_u();Object.defineProperty($,"Null",{enumerable:!0,get:function(){return $se.Null}});var Bse=Gs();Object.defineProperty($,"Number",{enumerable:!0,get:function(){return Bse.Number}});var Nse=rn();Object.defineProperty($,"Object",{enumerable:!0,get:function(){return Nse.Object}});var jse=Uu();Object.defineProperty($,"Omit",{enumerable:!0,get:function(){return jse.Omit}});var qse=wi();Object.defineProperty($,"Optional",{enumerable:!0,get:function(){return qse.Optional}});var Gse=Th();Object.defineProperty($,"Parameters",{enumerable:!0,get:function(){return Gse.Parameters}});var Kse=Du();Object.defineProperty($,"Partial",{enumerable:!0,get:function(){return Kse.Partial}});var Hse=Fu();Object.defineProperty($,"Pick",{enumerable:!0,get:function(){return Hse.Pick}});var zse=ku();Object.defineProperty($,"Promise",{enumerable:!0,get:function(){return zse.Promise}});var Vse=zs();Object.defineProperty($,"Readonly",{enumerable:!0,get:function(){return Vse.Readonly}});var Jse=Wu();Object.defineProperty($,"ReadonlyOptional",{enumerable:!0,get:function(){return Jse.ReadonlyOptional}});var Qse=Ic();Object.defineProperty($,"Record",{enumerable:!0,get:function(){return Qse.Record}});var Yse=kh();Object.defineProperty($,"Recursive",{enumerable:!0,get:function(){return Yse.Recursive}});var Xse=Js();Object.defineProperty($,"Ref",{enumerable:!0,get:function(){return Xse.Ref}});var Zse=Mh();Object.defineProperty($,"RegExp",{enumerable:!0,get:function(){return Zse.RegExp}});var eoe=$u();Object.defineProperty($,"Required",{enumerable:!0,get:function(){return eoe.Required}});var toe=Ih();Object.defineProperty($,"Rest",{enumerable:!0,get:function(){return toe.Rest}});var noe=Rh();Object.defineProperty($,"ReturnType",{enumerable:!0,get:function(){return noe.ReturnType}});var ioe=ir();Object.defineProperty($,"String",{enumerable:!0,get:function(){return ioe.String}});var soe=Eu();Object.defineProperty($,"Symbol",{enumerable:!0,get:function(){return soe.Symbol}});var ooe=Si();Object.defineProperty($,"TemplateLiteral",{enumerable:!0,get:function(){return ooe.TemplateLiteral}});var roe=Ah();Object.defineProperty($,"Transform",{enumerable:!0,get:function(){return roe.Transform}});var aoe=is();Object.defineProperty($,"Tuple",{enumerable:!0,get:function(){return aoe.Tuple}});var coe=Ou();Object.defineProperty($,"Uint8Array",{enumerable:!0,get:function(){return coe.Uint8Array}});var loe=Au();Object.defineProperty($,"Undefined",{enumerable:!0,get:function(){return loe.Undefined}});var uoe=it();Object.defineProperty($,"Union",{enumerable:!0,get:function(){return uoe.Union}});var doe=xr();Object.defineProperty($,"Unknown",{enumerable:!0,get:function(){return doe.Unknown}});var poe=Oh();Object.defineProperty($,"Unsafe",{enumerable:!0,get:function(){return poe.Unsafe}});var moe=Lh();Object.defineProperty($,"Void",{enumerable:!0,get:function(){return moe.Void}})});var AA=T(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.JavaScriptTypeBuilder=void 0;var hoe=Hv(),goe=Em(),foe=mc(),boe=Ru(),xoe=xc(),yoe=hc(),voe=Xm(),woe=Pu(),Soe=qs(),Coe=ph(),Toe=mh(),koe=vc(),Moe=Th(),Ioe=ku(),Roe=Mh(),Poe=Rh(),_oe=Eu(),Eoe=Ou(),Aoe=Au(),Ooe=Lh(),zv=class extends hoe.JsonTypeBuilder{Argument(e){return(0,goe.Argument)(e)}AsyncIterator(e,n){return(0,foe.AsyncIterator)(e,n)}Awaited(e,n){return(0,boe.Awaited)(e,n)}BigInt(e){return(0,xoe.BigInt)(e)}ConstructorParameters(e,n){return(0,voe.ConstructorParameters)(e,n)}Constructor(e,n,i){return(0,yoe.Constructor)(e,n,i)}Date(e={}){return(0,woe.Date)(e)}Function(e,n,i){return(0,Soe.Function)(e,n,i)}InstanceType(e,n){return(0,Coe.InstanceType)(e,n)}Instantiate(e,n){return(0,Toe.Instantiate)(e,n)}Iterator(e,n){return(0,koe.Iterator)(e,n)}Parameters(e,n){return(0,Moe.Parameters)(e,n)}Promise(e,n){return(0,Ioe.Promise)(e,n)}RegExp(e,n){return(0,Roe.RegExp)(e,n)}ReturnType(e,n){return(0,Poe.ReturnType)(e,n)}Symbol(e){return(0,_oe.Symbol)(e)}Undefined(e){return(0,Aoe.Undefined)(e)}Uint8Array(e){return(0,Eoe.Uint8Array)(e)}Void(e){return(0,Ooe.Void)(e)}};Dh.JavaScriptTypeBuilder=zv});var OA=T(pn=>{"use strict";var Loe=pn&&pn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Woe=pn&&pn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Uoe=pn&&pn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Loe(n,e,i[s]);return Woe(n,e),n}})();Object.defineProperty(pn,"__esModule",{value:!0});pn.Type=pn.JavaScriptTypeBuilder=pn.JsonTypeBuilder=void 0;var Foe=Hv();Object.defineProperty(pn,"JsonTypeBuilder",{enumerable:!0,get:function(){return Foe.JsonTypeBuilder}});var Doe=Uoe(EA()),$oe=AA();Object.defineProperty(pn,"JavaScriptTypeBuilder",{enumerable:!0,get:function(){return $oe.JavaScriptTypeBuilder}});var Boe=Doe;pn.Type=Boe});var LA=T(z=>{"use strict";var Noe=z&&z.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Q=z&&z.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Noe(e,t,n)};Object.defineProperty(z,"__esModule",{value:!0});Q($b(),z);Q(Xi(),z);Q(xi(),z);Q(zb(),z);Q(AP(),z);Q(fu(),z);Q(FP(),z);Q(bu(),z);Q(re(),z);Q(dc(),z);Q(pc(),z);Q(Em(),z);Q(mc(),z);Q(Ru(),z);Q(xc(),z);Q(vu(),z);Q(Jm(),z);Q(Ym(),z);Q(hc(),z);Q(Xm(),z);Q(Pu(),z);Q(Zm(),z);Q(ch(),z);Q(kc(),z);Q(dh(),z);Q(qs(),z);Q(ti(),z);Q(ph(),z);Q(mh(),z);Q(hh(),z);Q(Cn(),z);Q(vc(),z);Q(bh(),z);Q(Sc(),z);Q(Ft(),z);Q(Sh(),z);Q(ot(),z);Q(vt(),z);Q(Ch(),z);Q(_u(),z);Q(Gs(),z);Q(rn(),z);Q(Uu(),z);Q(wi(),z);Q(Th(),z);Q(Du(),z);Q(Fu(),z);Q(ku(),z);Q(zs(),z);Q(Wu(),z);Q(Ic(),z);Q(kh(),z);Q(Js(),z);Q(Mh(),z);Q($u(),z);Q(Ih(),z);Q(Rh(),z);Q(CA(),z);Q(MA(),z);Q(ir(),z);Q(Eu(),z);Q(Si(),z);Q(Ah(),z);Q(is(),z);Q(Ou(),z);Q(Au(),z);Q(it(),z);Q(xr(),z);Q(Oh(),z);Q(Lh(),z);Q(OA(),z)});import{randomBytes as CB}from"node:crypto";import{accessSync as mre,constants as hre,existsSync as Xh,readFileSync as vO,realpathSync as gre}from"fs";import{homedir as Uc}from"os";import{basename as xre,dirname as Ju,join as mt,resolve as Zh,sep as yre,win32 as vre}from"path";import{fileURLToPath as wO}from"url";import{spawn as bO,spawnSync as xO}from"node:child_process";import uw from"cross-spawn";var yO=100;function Vu(t,e,n){return process.platform==="win32"?uw(t,e,n):bO(t,e,n)}function Hr(t,e,n){return process.platform==="win32"?uw.sync(t,e,n):xO(t,e,n)}function Yh(t){return new Promise((e,n)=>{let i=!1,s=!1,o=null,r,a=t.stdout===null,c=t.stderr===null,l=()=>{r&&(clearTimeout(r),r=void 0),t.removeListener("error",g),t.removeListener("exit",h),t.removeListener("close",f),t.stdout?.removeListener("end",p),t.stderr?.removeListener("end",m)},d=x=>{i||(i=!0,l(),t.stdout?.destroy(),t.stderr?.destroy(),e(x))},u=()=>{!s||i||a&&c&&d(o)},p=()=>{a=!0,u()},m=()=>{c=!0,u()},g=x=>{i||(i=!0,l(),n(x))},h=x=>{s=!0,o=x,u(),i||(r=setTimeout(()=>d(x),yO))},f=x=>{d(x)};t.stdout?.once("end",p),t.stderr?.once("end",m),t.once("error",g),t.once("exit",h),t.once("close",f)})}var SO=wO(import.meta.url),dw=Ju(SO),Qu=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),Cre=!!process.versions.bun;function ai(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?Uc():t.startsWith("~/")?Uc()+t.slice(1):t;if(Qu)return Ju(process.execPath);let e=dw;for(;e!==Ju(e);){if(Xh(mt(e,"package.json")))return e;e=Ju(e)}return dw}function eg(){if(Qu)return mt(ai(),"theme");let t=ai(),e=Xh(mt(t,"src"))?"src":"dist";return mt(t,e,"modes","interactive","theme")}function CO(){return mt(ai(),"package.json")}function tg(){return Zh(mt(ai(),"README.md"))}function Yu(){return Zh(mt(ai(),"docs"))}function Xu(){return Zh(mt(ai(),"CHANGELOG.md"))}function TO(){if(Qu)return mt(ai(),"assets");let t=ai(),e=Xh(mt(t,"src"))?"src":"dist";return mt(t,e,"modes","interactive","assets")}function pw(t){return mt(TO(),t)}var Zu=JSON.parse(vO(CO(),"utf-8")),mw=Zu.piConfig?.name,kO=Zu.name||"@earendil-works/pi-coding-agent",Ot=mw||"pi",ng=mw?Ot:"\u03C0",St=Zu.piConfig?.configDir||".pi",Ai=Zu.version||"0.0.0",hw=`${Ot.toUpperCase()}_CODING_AGENT_DIR`,gw=`${Ot.toUpperCase()}_CODING_AGENT_SESSION_DIR`;function fw(t){return t==="~"?Uc():t.startsWith("~/")?Uc()+t.slice(1):t}var MO="https://pi.dev/session/";function bw(t){return`${process.env.PI_SHARE_VIEWER_URL||MO}#${t}`}function Le(){let t=process.env[hw];return t?fw(t):mt(Uc(),St,"agent")}function Fc(){return mt(Le(),"themes")}function ig(){return mt(Le(),"auth.json")}function Dc(){return mt(Le(),"bin")}function xw(){return mt(Le(),"sessions")}function yw(){return mt(Le(),`${Ot}-debug.log`)}import{Type as nle}from"typebox";var vw=new Map;function IO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function RO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function Mn(t,e){vw.set(t.api,{provider:{api:t.api,stream:IO(t.api,t.stream),streamSimple:RO(t.api,t.streamSimple)},sourceId:e})}function ww(t){return vw.get(t)?.provider}Gn();var Cw={openrouter:{"black-forest-labs/flux.2-flex":{id:"black-forest-labs/flux.2-flex",name:"Black Forest Labs: FLUX.2 Flex",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-klein-4b":{id:"black-forest-labs/flux.2-klein-4b",name:"Black Forest Labs: FLUX.2 Klein 4B",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-max":{id:"black-forest-labs/flux.2-max",name:"Black Forest Labs: FLUX.2 Max",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-pro":{id:"black-forest-labs/flux.2-pro",name:"Black Forest Labs: FLUX.2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"bytedance-seed/seedream-4.5":{id:"bytedance-seed/seedream-4.5",name:"ByteDance Seed: Seedream 4.5",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"google/gemini-2.5-flash-image":{id:"google/gemini-2.5-flash-image",name:"Google: Nano Banana (Gemini 2.5 Flash Image)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334}},"google/gemini-3-pro-image-preview":{id:"google/gemini-3-pro-image-preview",name:"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375}},"google/gemini-3.1-flash-image-preview":{id:"google/gemini-3.1-flash-image-preview",name:"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0}},"openai/gpt-5-image":{id:"openai/gpt-5-image",name:"OpenAI: GPT-5 Image",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:10,output:10,cacheRead:1.25,cacheWrite:0}},"openai/gpt-5-image-mini":{id:"openai/gpt-5-image-mini",name:"OpenAI: GPT-5 Image Mini",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2.5,output:2,cacheRead:.25,cacheWrite:0}},"openai/gpt-5.4-image-2":{id:"openai/gpt-5.4-image-2",name:"OpenAI: GPT-5.4 Image 2",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:8,output:15,cacheRead:2,cacheWrite:0}},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0}},"recraft/recraft-v3":{id:"recraft/recraft-v3",name:"Recraft: Recraft V3",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4":{id:"recraft/recraft-v4",name:"Recraft: Recraft V4",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro":{id:"recraft/recraft-v4-pro",name:"Recraft: Recraft V4 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro-vector":{id:"recraft/recraft-v4-pro-vector",name:"Recraft: Recraft V4 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-vector":{id:"recraft/recraft-v4-vector",name:"Recraft: Recraft V4 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1":{id:"recraft/recraft-v4.1",name:"Recraft: Recraft V4.1",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro":{id:"recraft/recraft-v4.1-pro",name:"Recraft: Recraft V4.1 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro-vector":{id:"recraft/recraft-v4.1-pro-vector",name:"Recraft: Recraft V4.1 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility":{id:"recraft/recraft-v4.1-utility",name:"Recraft: Recraft V4.1 Utility",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility-pro":{id:"recraft/recraft-v4.1-utility-pro",name:"Recraft: Recraft V4.1 Utility Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-vector":{id:"recraft/recraft-v4.1-vector",name:"Recraft: Recraft V4.1 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast":{id:"sourceful/riverflow-v2-fast",name:"Sourceful: Riverflow V2 Fast",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast-preview":{id:"sourceful/riverflow-v2-fast-preview",name:"Sourceful: Riverflow V2 Fast Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-max-preview":{id:"sourceful/riverflow-v2-max-preview",name:"Sourceful: Riverflow V2 Max Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-pro":{id:"sourceful/riverflow-v2-pro",name:"Sourceful: Riverflow V2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-standard-preview":{id:"sourceful/riverflow-v2-standard-preview",name:"Sourceful: Riverflow V2 Standard Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"x-ai/grok-imagine-image-quality":{id:"x-ai/grok-imagine-image-quality",name:"xAI: Grok Imagine Image Quality",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}}}};var LO=new Map;for(let[t,e]of Object.entries(Cw)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);LO.set(t,n)}var WO=new Map;function UO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function Tw(t,e){WO.set(t.api,{provider:{api:t.api,generateImages:UO(t.api,t.generateImages)},sourceId:e})}var Iw;function jO(t,e){return{api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function qO(){return Iw||=Promise.resolve().then(()=>(Mw(),kw)).then(t=>t),Iw}var GO=async(t,e,n)=>{try{return await(await qO()).generateImagesOpenRouter(t,e,n)}catch(i){return jO(t,i)}};function KO(){Tw({api:"openrouter-images",generateImages:GO})}KO();In();Rn();Rn();var $9=t=>import(import.meta.url.endsWith(".js")?t.replace(/\.ts$/,".js"):t),jS,qS,GS,KS,HS,zS,VS,JS,QS,YS;function XS(t,e){(async()=>{for await(let n of e)t.push(n);t.end()})()}function ZS(t,e){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function Wi(t){return(e,n,i)=>{let s=new nt;return t().then(o=>{let r=o.stream(e,n,i);XS(s,r)}).catch(o=>{let r=ZS(e,o);s.push({type:"error",reason:"error",error:r}),s.end(r)}),s}}function Ui(t){return(e,n,i)=>{let s=new nt;return t().then(o=>{let r=o.streamSimple(e,n,i);XS(s,r)}).catch(o=>{let r=ZS(e,o);s.push({type:"error",reason:"error",error:r}),s.end(r)}),s}}function eC(){return jS||=Promise.resolve().then(()=>(Bw(),$w)).then(t=>{let e=t;return{stream:e.streamAnthropic,streamSimple:e.streamSimpleAnthropic}}),jS}function tC(){return qS||=Promise.resolve().then(()=>(qw(),jw)).then(t=>{let e=t;return{stream:e.streamAzureOpenAIResponses,streamSimple:e.streamSimpleAzureOpenAIResponses}}),qS}function nC(){return GS||=Promise.resolve().then(()=>(zw(),Hw)).then(t=>{let e=t;return{stream:e.streamGoogle,streamSimple:e.streamSimpleGoogle}}),GS}function iC(){return KS||=Promise.resolve().then(()=>(Zw(),Xw)).then(t=>{let e=t;return{stream:e.streamGoogleVertex,streamSimple:e.streamSimpleGoogleVertex}}),KS}function sC(){return HS||=Promise.resolve().then(()=>(oS(),sS)).then(t=>{let e=t;return{stream:e.streamMistral,streamSimple:e.streamSimpleMistral}}),HS}function oC(){return zS||=Promise.resolve().then(()=>(RS(),IS)).then(t=>{let e=t;return{stream:e.streamOpenAICodexResponses,streamSimple:e.streamSimpleOpenAICodexResponses}}),zS}function rC(){return VS||=Promise.resolve().then(()=>(US(),WS)).then(t=>{let e=t;return{stream:e.streamOpenAICompletions,streamSimple:e.streamSimpleOpenAICompletions}}),VS}function aC(){return JS||=Promise.resolve().then(()=>(NS(),BS)).then(t=>{let e=t;return{stream:e.streamOpenAIResponses,streamSimple:e.streamSimpleOpenAIResponses}}),JS}function cC(){return QS?Promise.resolve(QS):(YS||=$9("./amazon-bedrock.ts").then(t=>{let e=t;return{stream:e.streamBedrock,streamSimple:e.streamSimpleBedrock}}),YS)}var B9=Wi(eC),N9=Ui(eC),j9=Wi(tC),q9=Ui(tC),G9=Wi(nC),K9=Ui(nC),H9=Wi(iC),z9=Ui(iC),V9=Wi(sC),J9=Ui(sC),Q9=Wi(oC),Y9=Ui(oC),X9=Wi(rC),Z9=Ui(rC),eW=Wi(aC),tW=Ui(aC),nW=Wi(cC),iW=Ui(cC);function sW(){Mn({api:"anthropic-messages",stream:B9,streamSimple:N9}),Mn({api:"openai-completions",stream:X9,streamSimple:Z9}),Mn({api:"mistral-conversations",stream:V9,streamSimple:J9}),Mn({api:"openai-responses",stream:eW,streamSimple:tW}),Mn({api:"azure-openai-responses",stream:j9,streamSimple:q9}),Mn({api:"openai-codex-responses",stream:Q9,streamSimple:Y9}),Mn({api:"google-generative-ai",stream:G9,streamSimple:K9}),Mn({api:"google-vertex",stream:H9,streamSimple:z9}),Mn({api:"bedrock-converse-stream",stream:nW,streamSimple:iW})}sW();Sg();Gn();function oW(t){let e=ww(t);if(!e)throw new Error(`No API provider registered for api: ${t}`);return e}function rW(t,e,n){return oW(t.api).stream(t,e,n)}async function lC(t,e,n){return rW(t,e,n).result()}Cg();Rn();zr();import{Type as zce}from"typebox";import{Compile as Qce}from"typebox/compile";import{Value as Xce}from"typebox/value";var Zce=Symbol.for("TypeBox.Kind");import*as Lt from"node:fs";import*as go from"node:path";import{spawn as cW}from"child_process";import{readdirSync as lW,statSync as uC}from"fs";import{homedir as dC}from"os";import{basename as Pg,dirname as Cd,join as ws}from"path";function Sd(t,e){let n=t.toLowerCase(),i=e.toLowerCase(),s=d=>{if(d.length===0)return{matches:!0,score:0};if(d.length>i.length)return{matches:!1,score:0};let u=0,p=0,m=-1,g=0;for(let h=0;h<i.length&&u<d.length;h++)if(i[h]===d[u]){let f=h===0||/[\s\-_./:]/.test(i[h-1]);m===h-1?(g++,p-=g*5):(g=0,m>=0&&(p+=(h-m-1)*2)),f&&(p-=10),p+=h*.1,m=h,u++}return u<d.length?{matches:!1,score:0}:(d===i&&(p-=100),{matches:!0,score:p})},o=s(n);if(o.matches)return o;let r=n.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/),a=n.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/),c=r?`${r.groups?.digits??""}${r.groups?.letters??""}`:a?`${a.groups?.letters??""}${a.groups?.digits??""}`:"";if(!c)return o;let l=s(c);return l.matches?{matches:!0,score:l.score+5}:o}function Kt(t,e,n){if(!e.trim())return t;let i=e.trim().split(/\s+/).filter(o=>o.length>0);if(i.length===0)return t;let s=[];for(let o of t){let r=n(o),a=0,c=!0;for(let l of i){let d=Sd(l,r);if(d.matches)a+=d.score;else{c=!1;break}}c&&s.push({item:o,totalScore:a})}return s.sort((o,r)=>o.totalScore-r.totalScore),s.map(o=>o.item)}var bC=new Set([" "," ",'"',"'","="]);function so(t){return t.replace(/\\/g,"/")}function uW(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dW(t){let e=so(t);if(!e.includes("/"))return e;let n=e.endsWith("/"),i=e.replace(/^\/+|\/+$/g,"");if(!i)return e;let s="[\\\\/]",o=i.split("/").filter(Boolean).map(a=>uW(a));if(o.length===0)return e;let r=o.join(s);return n&&(r+=s),r}function pC(t){for(let e=t.length-1;e>=0;e-=1)if(bC.has(t[e]??""))return e;return-1}function pW(t){let e=!1,n=-1;for(let i=0;i<t.length;i+=1)t[i]==='"'&&(e=!e,e&&(n=i));return e?n:null}function mC(t,e){return e===0||bC.has(t[e-1]??"")}function hC(t){let e=pW(t);return e===null?null:e>0&&t[e-1]==="@"?mC(t,e-1)?t.slice(e-1):null:mC(t,e)?t.slice(e):null}function gC(t){return t.startsWith('@"')?{rawPrefix:t.slice(2),isAtPrefix:!0,isQuotedPrefix:!0}:t.startsWith('"')?{rawPrefix:t.slice(1),isAtPrefix:!1,isQuotedPrefix:!0}:t.startsWith("@")?{rawPrefix:t.slice(1),isAtPrefix:!0,isQuotedPrefix:!1}:{rawPrefix:t,isAtPrefix:!1,isQuotedPrefix:!1}}function fC(t,e){let n=e.isQuotedPrefix||t.includes(" "),i=e.isAtPrefix?"@":"";return n?`${`${i}"`}${t}"`:`${i}${t}`}async function mW(t,e,n,i,s){let o=["--base-directory",t,"--max-results",String(i),"--type","f","--type","d","--follow","--hidden","--exclude",".git","--exclude",".git/*","--exclude",".git/**"];return so(n).includes("/")&&o.push("--full-path"),n&&o.push(dW(n)),await new Promise(r=>{if(s.aborted){r([]);return}let a=cW(e,o,{stdio:["ignore","pipe","pipe"]}),c="",l=!1,d=p=>{l||(l=!0,s.removeEventListener("abort",u),r(p))},u=()=>{a.exitCode===null&&a.kill("SIGKILL")};s.addEventListener("abort",u,{once:!0}),a.stdout.setEncoding("utf-8"),a.stdout.on("data",p=>{c+=p}),a.on("error",()=>{d([])}),a.on("close",p=>{if(s.aborted||p!==0||!c){d([]);return}let m=c.trim().split(`
|
|
31
|
+
${r}`),i.push({type:"error",reason:s.stopReason,error:s}),i.end()}})(),i},b9=(t,e,n)=>{let i=n?.apiKey||Ke(t.provider);if(!i)throw new Error(`No API key for provider: ${t.provider}`);let s=Pt(t,n,i),o=n?.reasoning?Rt(t,n.reasoning):void 0,r=o==="off"?void 0:o,a=n?.toolChoice;return AS(t,e,{...s,reasoningEffort:r,toolChoice:a})}});var BS={};Ei(BS,{streamOpenAIResponses:()=>$S,streamSimpleOpenAIResponses:()=>L9});import _9 from"openai";function FS(t){return t||(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long"?"long":"short")}function DS(t){return{sendSessionIdHeader:t.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:t.compat?.supportsLongCacheRetention??!0}}function A9(t,e){return e==="long"&&t.supportsLongCacheRetention?"24h":void 0}function O9(t){if(t instanceof Error){let e=t.status,n=typeof e=="number"?e:void 0;return n!==void 0?`OpenAI API error (${n}): ${t.message}`:t.message}try{return JSON.stringify(t)}catch{return String(t)}}function W9(t,e,n,i,s){if(!n){if(!process.env.OPENAI_API_KEY)throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");n=process.env.OPENAI_API_KEY}let o=DS(t),r={...t.headers};if(t.provider==="github-copilot"){let c=Jr(e.messages),l=Qr({messages:e.messages,hasImages:c});Object.assign(r,l)}s&&(o.sendSessionIdHeader&&(r.session_id=s),r["x-client-request-id"]=s),i&&Object.assign(r,i);let a=t.provider==="cloudflare-ai-gateway"?{...r,Authorization:r.Authorization??null,"cf-aig-authorization":`Bearer ${n}`}:r;return new _9({apiKey:n,baseURL:nd(t.provider)?Vr(t):t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:a})}function U9(t,e,n){let i=to(t,e,E9),s=FS(n?.cacheRetention),o=DS(t),r={model:t.id,input:i,stream:!0,prompt_cache_key:s==="none"?void 0:ys(n?.sessionId),prompt_cache_retention:A9(o,s),store:!1};if(n?.maxTokens&&(r.max_output_tokens=n?.maxTokens),n?.temperature!==void 0&&(r.temperature=n?.temperature),n?.serviceTier!==void 0&&(r.service_tier=n.serviceTier),e.tools&&e.tools.length>0&&(r.tools=Xr(e.tools)),t.reasoning)if(n?.reasoningEffort||n?.reasoningSummary){let a=n?.reasoningEffort?t.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort:"medium";r.reasoning={effort:a,summary:n?.reasoningSummary||"auto"},r.include=["reasoning.encrypted_content"]}else t.provider!=="github-copilot"&&t.thinkingLevelMap?.off!==null&&(r.reasoning={effort:t.thinkingLevelMap?.off??"none"});return r}function F9(t,e){switch(e){case"flex":return .5;case"priority":return t.id==="gpt-5.5"?2.5:2;default:return 1}}function D9(t,e,n){let i=F9(n,e);i!==1&&(t.cost.input*=i,t.cost.output*=i,t.cost.cacheRead*=i,t.cost.cacheWrite*=i,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite)}var E9,$S,L9,NS=Be(()=>{"use strict";Gn();In();Rn();eo();id();sd();Nc();ud();Li();E9=new Set(["openai","openai-codex","opencode"]);$S=(t,e,n)=>{let i=new nt;return(async()=>{let s={role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=n?.apiKey||Ke(t.provider)||"",a=FS(n?.cacheRetention)==="none"?void 0:n?.sessionId,c=W9(t,e,o,n?.headers,a),l=U9(t,e,n),d=await n?.onPayload?.(l,t);d!==void 0&&(l=d);let u={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},...n?.maxRetries!==void 0?{maxRetries:n.maxRetries}:{}},{data:p,response:m}=await c.responses.create(l,u).withResponse();if(await n?.onResponse?.({status:m.status,headers:gn(m.headers)},t),i.push({type:"start",partial:s}),await no(p,s,i,t,{serviceTier:n?.serviceTier,applyServiceTierPricing:(g,h)=>D9(g,h,t)}),n?.signal?.aborted)throw new Error("Request was aborted");if(s.stopReason==="aborted"||s.stopReason==="error")throw new Error("An unknown error occurred");i.push({type:"done",reason:s.stopReason,message:s}),i.end()}catch(o){for(let r of s.content)delete r.index,delete r.partialJson;s.stopReason=n?.signal?.aborted?"aborted":"error",s.errorMessage=O9(o),i.push({type:"error",reason:s.stopReason,error:s}),i.end()}})(),i},L9=(t,e,n)=>{let i=n?.apiKey||Ke(t.provider);if(!i)throw new Error(`No API key for provider: ${t.provider}`);let s=Pt(t,n,i),o=n?.reasoning?Rt(t,n.reasoning):void 0;return $S(t,e,{...s,reasoningEffort:o==="off"?void 0:o})}});var Ut=T(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.HasPropertyKey=oj;xt.IsAsyncIterator=rj;xt.IsArray=Ub;xt.IsBigInt=aj;xt.IsBoolean=cj;xt.IsDate=lj;xt.IsFunction=uj;xt.IsIterator=dj;xt.IsNull=pj;xt.IsNumber=mj;xt.IsObject=Fb;xt.IsRegExp=hj;xt.IsString=gj;xt.IsSymbol=fj;xt.IsUint8Array=Db;xt.IsUndefined=bj;function oj(t,e){return e in t}function rj(t){return Fb(t)&&!Ub(t)&&!Db(t)&&Symbol.asyncIterator in t}function Ub(t){return Array.isArray(t)}function aj(t){return typeof t=="bigint"}function cj(t){return typeof t=="boolean"}function lj(t){return t instanceof globalThis.Date}function uj(t){return typeof t=="function"}function dj(t){return Fb(t)&&!Ub(t)&&!Db(t)&&Symbol.iterator in t}function pj(t){return t===null}function mj(t){return typeof t=="number"}function Fb(t){return typeof t=="object"&&t!==null}function hj(t){return t instanceof globalThis.RegExp}function gj(t){return typeof t=="string"}function fj(t){return typeof t=="symbol"}function Db(t){return t instanceof globalThis.Uint8Array}function bj(t){return t===void 0}});var tn=T(Qi=>{"use strict";var xj=Qi&&Qi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yj=Qi&&Qi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),vj=Qi&&Qi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&xj(n,e,i[s]);return yj(n,e),n}})();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.Clone=Mj;var lu=vj(Ut());function wj(t){return t.map(e=>Cm(e))}function Sj(t){return new Date(t.getTime())}function Cj(t){return new Uint8Array(t)}function Tj(t){return new RegExp(t.source,t.flags)}function kj(t){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=Cm(t[n]);for(let n of Object.getOwnPropertySymbols(t))e[n]=Cm(t[n]);return e}function Cm(t){return lu.IsArray(t)?wj(t):lu.IsDate(t)?Sj(t):lu.IsUint8Array(t)?Cj(t):lu.IsRegExp(t)?Tj(t):lu.IsObject(t)?kj(t):t}function Mj(t){return Cm(t)}});var km=T(Tm=>{"use strict";Object.defineProperty(Tm,"__esModule",{value:!0});Tm.CloneRest=Ij;Tm.CloneType=qI;var jI=tn();function Ij(t){return t.map(e=>qI(e))}function qI(t,e){return e===void 0?(0,jI.Clone)(t):(0,jI.Clone)({...e,...t})}});var $b=T($s=>{"use strict";var Rj=$s&&$s.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),GI=$s&&$s.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Rj(e,t,n)};Object.defineProperty($s,"__esModule",{value:!0});GI(km(),$s);GI(tn(),$s)});var eR=T(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.IsAsyncIterator=Pj;ke.IsIterator=_j;ke.IsStandardObject=Ej;ke.IsInstanceObject=Aj;ke.IsPromise=Oj;ke.IsDate=Lj;ke.IsMap=Wj;ke.IsSet=Uj;ke.IsRegExp=Fj;ke.IsTypedArray=Dj;ke.IsInt8Array=$j;ke.IsUint8Array=Bj;ke.IsUint8ClampedArray=Nj;ke.IsInt16Array=jj;ke.IsUint16Array=qj;ke.IsInt32Array=Gj;ke.IsUint32Array=Kj;ke.IsFloat32Array=Hj;ke.IsFloat64Array=zj;ke.IsBigInt64Array=Vj;ke.IsBigUint64Array=Jj;ke.HasPropertyKey=Qj;ke.IsObject=uu;ke.IsArray=KI;ke.IsUndefined=HI;ke.IsNull=zI;ke.IsBoolean=VI;ke.IsNumber=JI;ke.IsInteger=Yj;ke.IsBigInt=QI;ke.IsString=YI;ke.IsFunction=XI;ke.IsSymbol=ZI;ke.IsValueType=Xj;function Pj(t){return uu(t)&&globalThis.Symbol.asyncIterator in t}function _j(t){return uu(t)&&globalThis.Symbol.iterator in t}function Ej(t){return uu(t)&&(globalThis.Object.getPrototypeOf(t)===Object.prototype||globalThis.Object.getPrototypeOf(t)===null)}function Aj(t){return uu(t)&&!KI(t)&&XI(t.constructor)&&t.constructor.name!=="Object"}function Oj(t){return t instanceof globalThis.Promise}function Lj(t){return t instanceof Date&&globalThis.Number.isFinite(t.getTime())}function Wj(t){return t instanceof globalThis.Map}function Uj(t){return t instanceof globalThis.Set}function Fj(t){return t instanceof globalThis.RegExp}function Dj(t){return globalThis.ArrayBuffer.isView(t)}function $j(t){return t instanceof globalThis.Int8Array}function Bj(t){return t instanceof globalThis.Uint8Array}function Nj(t){return t instanceof globalThis.Uint8ClampedArray}function jj(t){return t instanceof globalThis.Int16Array}function qj(t){return t instanceof globalThis.Uint16Array}function Gj(t){return t instanceof globalThis.Int32Array}function Kj(t){return t instanceof globalThis.Uint32Array}function Hj(t){return t instanceof globalThis.Float32Array}function zj(t){return t instanceof globalThis.Float64Array}function Vj(t){return t instanceof globalThis.BigInt64Array}function Jj(t){return t instanceof globalThis.BigUint64Array}function Qj(t,e){return e in t}function uu(t){return t!==null&&typeof t=="object"}function KI(t){return globalThis.Array.isArray(t)&&!globalThis.ArrayBuffer.isView(t)}function HI(t){return t===void 0}function zI(t){return t===null}function VI(t){return typeof t=="boolean"}function JI(t){return typeof t=="number"}function Yj(t){return globalThis.Number.isInteger(t)}function QI(t){return typeof t=="bigint"}function YI(t){return typeof t=="string"}function XI(t){return typeof t=="function"}function ZI(t){return typeof t=="symbol"}function Xj(t){return QI(t)||VI(t)||zI(t)||JI(t)||YI(t)||ZI(t)||HI(t)}});var tR=T(Wo=>{"use strict";var Zj=Wo&&Wo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),eq=Wo&&Wo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Zj(e,t,n)};Object.defineProperty(Wo,"__esModule",{value:!0});eq(eR(),Wo)});var iR=T(Im=>{"use strict";Object.defineProperty(Im,"__esModule",{value:!0});Im.TypeSystemPolicy=void 0;var Mm=tR(),nR;(function(t){t.InstanceMode="default",t.ExactOptionalPropertyTypes=!1,t.AllowArrayObject=!1,t.AllowNaN=!1,t.AllowNullVoid=!1;function e(r,a){return t.ExactOptionalPropertyTypes?a in r:r[a]!==void 0}t.IsExactOptionalProperty=e;function n(r){let a=(0,Mm.IsObject)(r);return t.AllowArrayObject?a:a&&!(0,Mm.IsArray)(r)}t.IsObjectLike=n;function i(r){return n(r)&&!(r instanceof Date)&&!(r instanceof Uint8Array)}t.IsRecordLike=i;function s(r){return t.AllowNaN?(0,Mm.IsNumber)(r):Number.isFinite(r)}t.IsNumberLike=s;function o(r){let a=(0,Mm.IsUndefined)(r);return t.AllowNullVoid?a||r===null:a}t.IsVoidLike=o})(nR||(Im.TypeSystemPolicy=nR={}))});var sR=T(Yi=>{"use strict";var tq=Yi&&Yi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),nq=Yi&&Yi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),iq=Yi&&Yi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&tq(n,e,i[s]);return nq(n,e),n}})();Object.defineProperty(Yi,"__esModule",{value:!0});Yi.Immutable=Rm;var du=iq(Ut());function sq(t){return globalThis.Object.freeze(t).map(e=>Rm(e))}function oq(t){let e={};for(let n of Object.getOwnPropertyNames(t))e[n]=Rm(t[n]);for(let n of Object.getOwnPropertySymbols(t))e[n]=Rm(t[n]);return globalThis.Object.freeze(e)}function Rm(t){return du.IsArray(t)?sq(t):du.IsDate(t)?t:du.IsUint8Array(t)?t:du.IsRegExp(t)?t:du.IsObject(t)?oq(t):t}});var le=T(Bb=>{"use strict";Object.defineProperty(Bb,"__esModule",{value:!0});Bb.CreateType=lq;var rq=iR(),aq=sR(),cq=tn();function lq(t,e){let n=e!==void 0?{...e,...t}:t;switch(rq.TypeSystemPolicy.InstanceMode){case"freeze":return(0,aq.Immutable)(n);case"clone":return(0,cq.Clone)(n);default:return n}}});var Xi=T(Uo=>{"use strict";var uq=Uo&&Uo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dq=Uo&&Uo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uq(e,t,n)};Object.defineProperty(Uo,"__esModule",{value:!0});dq(le(),Uo)});var oR=T(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.TypeBoxError=void 0;var Nb=class extends Error{constructor(e){super(e)}};Pm.TypeBoxError=Nb});var xi=T(Fo=>{"use strict";var pq=Fo&&Fo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mq=Fo&&Fo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pq(e,t,n)};Object.defineProperty(Fo,"__esModule",{value:!0});mq(oR(),Fo)});var pu=T(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.Kind=Fn.Hint=Fn.OptionalKind=Fn.ReadonlyKind=Fn.TransformKind=void 0;Fn.TransformKind=Symbol.for("TypeBox.Transform");Fn.ReadonlyKind=Symbol.for("TypeBox.Readonly");Fn.OptionalKind=Symbol.for("TypeBox.Optional");Fn.Hint=Symbol.for("TypeBox.Hint");Fn.Kind=Symbol.for("TypeBox.Kind")});var re=T(Do=>{"use strict";var hq=Do&&Do.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gq=Do&&Do.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hq(e,t,n)};Object.defineProperty(Do,"__esModule",{value:!0});gq(pu(),Do)});var Me=T(oe=>{"use strict";var fq=oe&&oe.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),bq=oe&&oe.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),xq=oe&&oe.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&fq(n,e,i[s]);return bq(n,e),n}})();Object.defineProperty(oe,"__esModule",{value:!0});oe.IsReadonly=yq;oe.IsOptional=vq;oe.IsAny=rR;oe.IsArgument=aR;oe.IsArray=cR;oe.IsAsyncIterator=lR;oe.IsBigInt=uR;oe.IsBoolean=dR;oe.IsComputed=pR;oe.IsConstructor=mR;oe.IsDate=hR;oe.IsFunction=gR;oe.IsImport=wq;oe.IsInteger=fR;oe.IsProperties=Sq;oe.IsIntersect=bR;oe.IsIterator=xR;oe.IsKindOf=Se;oe.IsLiteralString=Cq;oe.IsLiteralNumber=Tq;oe.IsLiteralBoolean=kq;oe.IsLiteralValue=Mq;oe.IsLiteral=mu;oe.IsMappedKey=yR;oe.IsMappedResult=vR;oe.IsNever=wR;oe.IsNot=SR;oe.IsNull=CR;oe.IsNumber=TR;oe.IsObject=kR;oe.IsPromise=MR;oe.IsRecord=IR;oe.IsRecursive=Iq;oe.IsRef=RR;oe.IsRegExp=PR;oe.IsString=_R;oe.IsSymbol=ER;oe.IsTemplateLiteral=AR;oe.IsThis=OR;oe.IsTransform=Rq;oe.IsTuple=LR;oe.IsUndefined=WR;oe.IsUnion=UR;oe.IsUint8Array=FR;oe.IsUnknown=DR;oe.IsUnsafe=$R;oe.IsVoid=BR;oe.IsKind=NR;oe.IsSchema=Pq;var nn=xq(Ut()),Zi=re();function yq(t){return nn.IsObject(t)&&t[Zi.ReadonlyKind]==="Readonly"}function vq(t){return nn.IsObject(t)&&t[Zi.OptionalKind]==="Optional"}function rR(t){return Se(t,"Any")}function aR(t){return Se(t,"Argument")}function cR(t){return Se(t,"Array")}function lR(t){return Se(t,"AsyncIterator")}function uR(t){return Se(t,"BigInt")}function dR(t){return Se(t,"Boolean")}function pR(t){return Se(t,"Computed")}function mR(t){return Se(t,"Constructor")}function hR(t){return Se(t,"Date")}function gR(t){return Se(t,"Function")}function wq(t){return Se(t,"Import")}function fR(t){return Se(t,"Integer")}function Sq(t){return nn.IsObject(t)}function bR(t){return Se(t,"Intersect")}function xR(t){return Se(t,"Iterator")}function Se(t,e){return nn.IsObject(t)&&Zi.Kind in t&&t[Zi.Kind]===e}function Cq(t){return mu(t)&&nn.IsString(t.const)}function Tq(t){return mu(t)&&nn.IsNumber(t.const)}function kq(t){return mu(t)&&nn.IsBoolean(t.const)}function Mq(t){return nn.IsBoolean(t)||nn.IsNumber(t)||nn.IsString(t)}function mu(t){return Se(t,"Literal")}function yR(t){return Se(t,"MappedKey")}function vR(t){return Se(t,"MappedResult")}function wR(t){return Se(t,"Never")}function SR(t){return Se(t,"Not")}function CR(t){return Se(t,"Null")}function TR(t){return Se(t,"Number")}function kR(t){return Se(t,"Object")}function MR(t){return Se(t,"Promise")}function IR(t){return Se(t,"Record")}function Iq(t){return nn.IsObject(t)&&Zi.Hint in t&&t[Zi.Hint]==="Recursive"}function RR(t){return Se(t,"Ref")}function PR(t){return Se(t,"RegExp")}function _R(t){return Se(t,"String")}function ER(t){return Se(t,"Symbol")}function AR(t){return Se(t,"TemplateLiteral")}function OR(t){return Se(t,"This")}function Rq(t){return nn.IsObject(t)&&Zi.TransformKind in t}function LR(t){return Se(t,"Tuple")}function WR(t){return Se(t,"Undefined")}function UR(t){return Se(t,"Union")}function FR(t){return Se(t,"Uint8Array")}function DR(t){return Se(t,"Unknown")}function $R(t){return Se(t,"Unsafe")}function BR(t){return Se(t,"Void")}function NR(t){return nn.IsObject(t)&&Zi.Kind in t&&nn.IsString(t[Zi.Kind])}function Pq(t){return rR(t)||aR(t)||cR(t)||dR(t)||uR(t)||lR(t)||pR(t)||mR(t)||hR(t)||gR(t)||fR(t)||bR(t)||xR(t)||mu(t)||yR(t)||vR(t)||wR(t)||SR(t)||CR(t)||TR(t)||kR(t)||MR(t)||IR(t)||RR(t)||PR(t)||_R(t)||ER(t)||AR(t)||OR(t)||LR(t)||WR(t)||UR(t)||FR(t)||DR(t)||$R(t)||BR(t)||NR(t)}});var _P=T(ie=>{"use strict";var _q=ie&&ie.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Eq=ie&&ie.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Aq=ie&&ie.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&_q(n,e,i[s]);return Eq(n,e),n}})();Object.defineProperty(ie,"__esModule",{value:!0});ie.TypeGuardUnknownTypeError=void 0;ie.IsReadonly=Fq;ie.IsOptional=Dq;ie.IsAny=KR;ie.IsArgument=HR;ie.IsArray=zR;ie.IsAsyncIterator=VR;ie.IsBigInt=JR;ie.IsBoolean=QR;ie.IsComputed=YR;ie.IsConstructor=XR;ie.IsDate=ZR;ie.IsFunction=eP;ie.IsImport=$q;ie.IsInteger=tP;ie.IsProperties=_m;ie.IsIntersect=nP;ie.IsIterator=iP;ie.IsKindOf=Ce;ie.IsLiteralString=sP;ie.IsLiteralNumber=oP;ie.IsLiteralBoolean=Bq;ie.IsLiteral=gu;ie.IsLiteralValue=rP;ie.IsMappedKey=aP;ie.IsMappedResult=cP;ie.IsNever=lP;ie.IsNot=uP;ie.IsNull=dP;ie.IsNumber=pP;ie.IsObject=mP;ie.IsPromise=hP;ie.IsRecord=gP;ie.IsRecursive=Nq;ie.IsRef=fP;ie.IsRegExp=bP;ie.IsString=xP;ie.IsSymbol=yP;ie.IsTemplateLiteral=vP;ie.IsThis=wP;ie.IsTransform=SP;ie.IsTuple=CP;ie.IsUndefined=TP;ie.IsUnionLiteral=jq;ie.IsUnion=Kb;ie.IsUint8Array=kP;ie.IsUnknown=MP;ie.IsUnsafe=IP;ie.IsVoid=RP;ie.IsKind=PP;ie.IsSchema=yt;var se=Aq(Ut()),yi=re(),Oq=xi(),jb=class extends Oq.TypeBoxError{};ie.TypeGuardUnknownTypeError=jb;var Lq=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function jR(t){try{return new RegExp(t),!0}catch{return!1}}function qb(t){if(!se.IsString(t))return!1;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function qR(t){return Gb(t)||yt(t)}function hu(t){return se.IsUndefined(t)||se.IsBigInt(t)}function $e(t){return se.IsUndefined(t)||se.IsNumber(t)}function Gb(t){return se.IsUndefined(t)||se.IsBoolean(t)}function We(t){return se.IsUndefined(t)||se.IsString(t)}function Wq(t){return se.IsUndefined(t)||se.IsString(t)&&qb(t)&&jR(t)}function Uq(t){return se.IsUndefined(t)||se.IsString(t)&&qb(t)}function GR(t){return se.IsUndefined(t)||yt(t)}function Fq(t){return se.IsObject(t)&&t[yi.ReadonlyKind]==="Readonly"}function Dq(t){return se.IsObject(t)&&t[yi.OptionalKind]==="Optional"}function KR(t){return Ce(t,"Any")&&We(t.$id)}function HR(t){return Ce(t,"Argument")&&se.IsNumber(t.index)}function zR(t){return Ce(t,"Array")&&t.type==="array"&&We(t.$id)&&yt(t.items)&&$e(t.minItems)&&$e(t.maxItems)&&Gb(t.uniqueItems)&&GR(t.contains)&&$e(t.minContains)&&$e(t.maxContains)}function VR(t){return Ce(t,"AsyncIterator")&&t.type==="AsyncIterator"&&We(t.$id)&&yt(t.items)}function JR(t){return Ce(t,"BigInt")&&t.type==="bigint"&&We(t.$id)&&hu(t.exclusiveMaximum)&&hu(t.exclusiveMinimum)&&hu(t.maximum)&&hu(t.minimum)&&hu(t.multipleOf)}function QR(t){return Ce(t,"Boolean")&&t.type==="boolean"&&We(t.$id)}function YR(t){return Ce(t,"Computed")&&se.IsString(t.target)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))}function XR(t){return Ce(t,"Constructor")&&t.type==="Constructor"&&We(t.$id)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))&&yt(t.returns)}function ZR(t){return Ce(t,"Date")&&t.type==="Date"&&We(t.$id)&&$e(t.exclusiveMaximumTimestamp)&&$e(t.exclusiveMinimumTimestamp)&&$e(t.maximumTimestamp)&&$e(t.minimumTimestamp)&&$e(t.multipleOfTimestamp)}function eP(t){return Ce(t,"Function")&&t.type==="Function"&&We(t.$id)&&se.IsArray(t.parameters)&&t.parameters.every(e=>yt(e))&&yt(t.returns)}function $q(t){return Ce(t,"Import")&&se.HasPropertyKey(t,"$defs")&&se.IsObject(t.$defs)&&_m(t.$defs)&&se.HasPropertyKey(t,"$ref")&&se.IsString(t.$ref)&&t.$ref in t.$defs}function tP(t){return Ce(t,"Integer")&&t.type==="integer"&&We(t.$id)&&$e(t.exclusiveMaximum)&&$e(t.exclusiveMinimum)&&$e(t.maximum)&&$e(t.minimum)&&$e(t.multipleOf)}function _m(t){return se.IsObject(t)&&Object.entries(t).every(([e,n])=>qb(e)&&yt(n))}function nP(t){return Ce(t,"Intersect")&&!(se.IsString(t.type)&&t.type!=="object")&&se.IsArray(t.allOf)&&t.allOf.every(e=>yt(e)&&!SP(e))&&We(t.type)&&(Gb(t.unevaluatedProperties)||GR(t.unevaluatedProperties))&&We(t.$id)}function iP(t){return Ce(t,"Iterator")&&t.type==="Iterator"&&We(t.$id)&&yt(t.items)}function Ce(t,e){return se.IsObject(t)&&yi.Kind in t&&t[yi.Kind]===e}function sP(t){return gu(t)&&se.IsString(t.const)}function oP(t){return gu(t)&&se.IsNumber(t.const)}function Bq(t){return gu(t)&&se.IsBoolean(t.const)}function gu(t){return Ce(t,"Literal")&&We(t.$id)&&rP(t.const)}function rP(t){return se.IsBoolean(t)||se.IsNumber(t)||se.IsString(t)}function aP(t){return Ce(t,"MappedKey")&&se.IsArray(t.keys)&&t.keys.every(e=>se.IsNumber(e)||se.IsString(e))}function cP(t){return Ce(t,"MappedResult")&&_m(t.properties)}function lP(t){return Ce(t,"Never")&&se.IsObject(t.not)&&Object.getOwnPropertyNames(t.not).length===0}function uP(t){return Ce(t,"Not")&&yt(t.not)}function dP(t){return Ce(t,"Null")&&t.type==="null"&&We(t.$id)}function pP(t){return Ce(t,"Number")&&t.type==="number"&&We(t.$id)&&$e(t.exclusiveMaximum)&&$e(t.exclusiveMinimum)&&$e(t.maximum)&&$e(t.minimum)&&$e(t.multipleOf)}function mP(t){return Ce(t,"Object")&&t.type==="object"&&We(t.$id)&&_m(t.properties)&&qR(t.additionalProperties)&&$e(t.minProperties)&&$e(t.maxProperties)}function hP(t){return Ce(t,"Promise")&&t.type==="Promise"&&We(t.$id)&&yt(t.item)}function gP(t){return Ce(t,"Record")&&t.type==="object"&&We(t.$id)&&qR(t.additionalProperties)&&se.IsObject(t.patternProperties)&&(e=>{let n=Object.getOwnPropertyNames(e.patternProperties);return n.length===1&&jR(n[0])&&se.IsObject(e.patternProperties)&&yt(e.patternProperties[n[0]])})(t)}function Nq(t){return se.IsObject(t)&&yi.Hint in t&&t[yi.Hint]==="Recursive"}function fP(t){return Ce(t,"Ref")&&We(t.$id)&&se.IsString(t.$ref)}function bP(t){return Ce(t,"RegExp")&&We(t.$id)&&se.IsString(t.source)&&se.IsString(t.flags)&&$e(t.maxLength)&&$e(t.minLength)}function xP(t){return Ce(t,"String")&&t.type==="string"&&We(t.$id)&&$e(t.minLength)&&$e(t.maxLength)&&Wq(t.pattern)&&Uq(t.format)}function yP(t){return Ce(t,"Symbol")&&t.type==="symbol"&&We(t.$id)}function vP(t){return Ce(t,"TemplateLiteral")&&t.type==="string"&&se.IsString(t.pattern)&&t.pattern[0]==="^"&&t.pattern[t.pattern.length-1]==="$"}function wP(t){return Ce(t,"This")&&We(t.$id)&&se.IsString(t.$ref)}function SP(t){return se.IsObject(t)&&yi.TransformKind in t}function CP(t){return Ce(t,"Tuple")&&t.type==="array"&&We(t.$id)&&se.IsNumber(t.minItems)&&se.IsNumber(t.maxItems)&&t.minItems===t.maxItems&&(se.IsUndefined(t.items)&&se.IsUndefined(t.additionalItems)&&t.minItems===0||se.IsArray(t.items)&&t.items.every(e=>yt(e)))}function TP(t){return Ce(t,"Undefined")&&t.type==="undefined"&&We(t.$id)}function jq(t){return Kb(t)&&t.anyOf.every(e=>sP(e)||oP(e))}function Kb(t){return Ce(t,"Union")&&We(t.$id)&&se.IsObject(t)&&se.IsArray(t.anyOf)&&t.anyOf.every(e=>yt(e))}function kP(t){return Ce(t,"Uint8Array")&&t.type==="Uint8Array"&&We(t.$id)&&$e(t.minByteLength)&&$e(t.maxByteLength)}function MP(t){return Ce(t,"Unknown")&&We(t.$id)}function IP(t){return Ce(t,"Unsafe")}function RP(t){return Ce(t,"Void")&&t.type==="void"&&We(t.$id)}function PP(t){return se.IsObject(t)&&yi.Kind in t&&se.IsString(t[yi.Kind])&&!Lq.includes(t[yi.Kind])}function yt(t){return se.IsObject(t)&&(KR(t)||HR(t)||zR(t)||QR(t)||JR(t)||VR(t)||YR(t)||XR(t)||ZR(t)||eP(t)||tP(t)||nP(t)||iP(t)||gu(t)||aP(t)||cP(t)||lP(t)||uP(t)||dP(t)||pP(t)||mP(t)||hP(t)||gP(t)||fP(t)||bP(t)||xP(t)||yP(t)||vP(t)||wP(t)||CP(t)||TP(t)||Kb(t)||kP(t)||MP(t)||IP(t)||RP(t)||PP(t))}});var zb=T(sn=>{"use strict";var qq=sn&&sn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Gq=sn&&sn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Hb=sn&&sn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&qq(n,e,i[s]);return Gq(n,e),n}})();Object.defineProperty(sn,"__esModule",{value:!0});sn.ValueGuard=sn.TypeGuard=sn.KindGuard=void 0;sn.KindGuard=Hb(Me());sn.TypeGuard=Hb(_P());sn.ValueGuard=Hb(Ut())});var EP=T(Vb=>{"use strict";Object.defineProperty(Vb,"__esModule",{value:!0});Vb.Increment=Kq;function Kq(t){return(parseInt(t)+1).toString()}});var AP=T($o=>{"use strict";var Hq=$o&&$o.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),zq=$o&&$o.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Hq(e,t,n)};Object.defineProperty($o,"__esModule",{value:!0});zq(EP(),$o)});var OP=T(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.PatternNeverExact=Ze.PatternStringExact=Ze.PatternNumberExact=Ze.PatternBooleanExact=Ze.PatternNever=Ze.PatternString=Ze.PatternNumber=Ze.PatternBoolean=void 0;Ze.PatternBoolean="(true|false)";Ze.PatternNumber="(0|[1-9][0-9]*)";Ze.PatternString="(.*)";Ze.PatternNever="(?!.*)";Ze.PatternBooleanExact=`^${Ze.PatternBoolean}$`;Ze.PatternNumberExact=`^${Ze.PatternNumber}$`;Ze.PatternStringExact=`^${Ze.PatternString}$`;Ze.PatternNeverExact=`^${Ze.PatternNever}$`});var fu=T(Bo=>{"use strict";var Vq=Bo&&Bo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Jq=Bo&&Bo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Vq(e,t,n)};Object.defineProperty(Bo,"__esModule",{value:!0});Jq(OP(),Bo)});var LP=T(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.Entries=Qq;Bs.Clear=Yq;Bs.Delete=Xq;Bs.Has=Zq;Bs.Set=e7;Bs.Get=t7;var lc=new Map;function Qq(){return new Map(lc)}function Yq(){return lc.clear()}function Xq(t){return lc.delete(t)}function Zq(t){return lc.has(t)}function e7(t,e){lc.set(t,e)}function t7(t){return lc.get(t)}});var WP=T(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Entries=n7;Ns.Clear=i7;Ns.Delete=s7;Ns.Has=o7;Ns.Set=r7;Ns.Get=a7;var uc=new Map;function n7(){return new Map(uc)}function i7(){return uc.clear()}function s7(t){return uc.delete(t)}function o7(t){return uc.has(t)}function r7(t,e){uc.set(t,e)}function a7(t){return uc.get(t)}});var FP=T(Dn=>{"use strict";var c7=Dn&&Dn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),l7=Dn&&Dn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),UP=Dn&&Dn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&c7(n,e,i[s]);return l7(n,e),n}})();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.TypeRegistry=Dn.FormatRegistry=void 0;Dn.FormatRegistry=UP(LP());Dn.TypeRegistry=UP(WP())});var BP=T(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.SetIncludes=DP;vi.SetIsSubset=u7;vi.SetDistinct=d7;vi.SetIntersect=$P;vi.SetUnion=p7;vi.SetComplement=m7;vi.SetIntersectMany=g7;vi.SetUnionMany=f7;function DP(t,e){return t.includes(e)}function u7(t,e){return t.every(n=>DP(e,n))}function d7(t){return[...new Set(t)]}function $P(t,e){return t.filter(n=>e.includes(n))}function p7(t,e){return[...t,...e]}function m7(t,e){return t.filter(n=>!e.includes(n))}function h7(t,e){return t.reduce((n,i)=>$P(n,i),e)}function g7(t){return t.length===1?t[0]:t.length>1?h7(t.slice(1),t[0]):[]}function f7(t){let e=[];for(let n of t)e.push(...n);return e}});var bu=T(No=>{"use strict";var b7=No&&No.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),x7=No&&No.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&b7(e,t,n)};Object.defineProperty(No,"__esModule",{value:!0});x7(BP(),No)});var NP=T(Jb=>{"use strict";Object.defineProperty(Jb,"__esModule",{value:!0});Jb.Any=w7;var y7=Xi(),v7=re();function w7(t){return(0,y7.CreateType)({[v7.Kind]:"Any"},t)}});var dc=T(jo=>{"use strict";var S7=jo&&jo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),C7=jo&&jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&S7(e,t,n)};Object.defineProperty(jo,"__esModule",{value:!0});C7(NP(),jo)});var jP=T(Qb=>{"use strict";Object.defineProperty(Qb,"__esModule",{value:!0});Qb.Array=M7;var T7=le(),k7=re();function M7(t,e){return(0,T7.CreateType)({[k7.Kind]:"Array",type:"array",items:t},e)}});var pc=T(qo=>{"use strict";var I7=qo&&qo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),R7=qo&&qo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&I7(e,t,n)};Object.defineProperty(qo,"__esModule",{value:!0});R7(jP(),qo)});var qP=T(Yb=>{"use strict";Object.defineProperty(Yb,"__esModule",{value:!0});Yb.Argument=E7;var P7=le(),_7=re();function E7(t){return(0,P7.CreateType)({[_7.Kind]:"Argument",index:t})}});var Em=T(Go=>{"use strict";var A7=Go&&Go.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),O7=Go&&Go.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&A7(e,t,n)};Object.defineProperty(Go,"__esModule",{value:!0});O7(qP(),Go)});var GP=T(Xb=>{"use strict";Object.defineProperty(Xb,"__esModule",{value:!0});Xb.AsyncIterator=U7;var L7=re(),W7=le();function U7(t,e){return(0,W7.CreateType)({[L7.Kind]:"AsyncIterator",type:"AsyncIterator",items:t},e)}});var mc=T(Ko=>{"use strict";var F7=Ko&&Ko.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),D7=Ko&&Ko.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&F7(e,t,n)};Object.defineProperty(Ko,"__esModule",{value:!0});D7(GP(),Ko)});var KP=T(Zb=>{"use strict";Object.defineProperty(Zb,"__esModule",{value:!0});Zb.Computed=N7;var $7=Xi(),B7=pu();function N7(t,e,n){return(0,$7.CreateType)({[B7.Kind]:"Computed",target:t,parameters:e},n)}});var js=T(Ho=>{"use strict";var j7=Ho&&Ho.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),q7=Ho&&Ho.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&j7(e,t,n)};Object.defineProperty(Ho,"__esModule",{value:!0});q7(KP(),Ho)});var Am=T(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.Discard=K7;function G7(t,e){let{[e]:n,...i}=t;return i}function K7(t,e){return e.reduce((n,i)=>G7(n,i),t)}});var es=T(zo=>{"use strict";var H7=zo&&zo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),z7=zo&&zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&H7(e,t,n)};Object.defineProperty(zo,"__esModule",{value:!0});z7(Am(),zo)});var HP=T(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:!0});tx.Never=Q7;var V7=le(),J7=re();function Q7(t){return(0,V7.CreateType)({[J7.Kind]:"Never",not:{}},t)}});var vt=T(Vo=>{"use strict";var Y7=Vo&&Vo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),X7=Vo&&Vo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Y7(e,t,n)};Object.defineProperty(Vo,"__esModule",{value:!0});X7(HP(),Vo)});var zP=T(nx=>{"use strict";Object.defineProperty(nx,"__esModule",{value:!0});nx.MappedKey=tG;var Z7=le(),eG=re();function tG(t){return(0,Z7.CreateType)({[eG.Kind]:"MappedKey",keys:t})}});var sx=T(ix=>{"use strict";Object.defineProperty(ix,"__esModule",{value:!0});ix.MappedResult=sG;var nG=le(),iG=re();function sG(t){return(0,nG.CreateType)({[iG.Kind]:"MappedResult",properties:t})}});var VP=T(ox=>{"use strict";Object.defineProperty(ox,"__esModule",{value:!0});ox.Constructor=aG;var oG=le(),rG=re();function aG(t,e,n){return(0,oG.CreateType)({[rG.Kind]:"Constructor",type:"Constructor",parameters:t,returns:e},n)}});var hc=T(Jo=>{"use strict";var cG=Jo&&Jo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),lG=Jo&&Jo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&cG(e,t,n)};Object.defineProperty(Jo,"__esModule",{value:!0});lG(VP(),Jo)});var JP=T(rx=>{"use strict";Object.defineProperty(rx,"__esModule",{value:!0});rx.Function=pG;var uG=le(),dG=re();function pG(t,e,n){return(0,uG.CreateType)({[dG.Kind]:"Function",type:"Function",parameters:t,returns:e},n)}});var qs=T(Qo=>{"use strict";var mG=Qo&&Qo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),hG=Qo&&Qo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mG(e,t,n)};Object.defineProperty(Qo,"__esModule",{value:!0});hG(JP(),Qo)});var cx=T(ax=>{"use strict";Object.defineProperty(ax,"__esModule",{value:!0});ax.UnionCreate=bG;var gG=le(),fG=re();function bG(t,e){return(0,gG.CreateType)({[fG.Kind]:"Union",anyOf:t},e)}});var ZP=T(lx=>{"use strict";Object.defineProperty(lx,"__esModule",{value:!0});lx.UnionEvaluated=MG;var xG=le(),yG=re(),vG=es(),wG=vt(),SG=wi(),QP=cx(),XP=Me();function CG(t){return t.some(e=>(0,XP.IsOptional)(e))}function YP(t){return t.map(e=>(0,XP.IsOptional)(e)?TG(e):e)}function TG(t){return(0,vG.Discard)(t,[yG.OptionalKind])}function kG(t,e){return CG(t)?(0,SG.Optional)((0,QP.UnionCreate)(YP(t),e)):(0,QP.UnionCreate)(YP(t),e)}function MG(t,e){return t.length===1?(0,xG.CreateType)(t[0],e):t.length===0?(0,wG.Never)(e):kG(t,e)}});var t_=T(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var GRe=re()});var n_=T(ux=>{"use strict";Object.defineProperty(ux,"__esModule",{value:!0});ux.Union=_G;var IG=vt(),RG=le(),PG=cx();function _G(t,e){return t.length===0?(0,IG.Never)(e):t.length===1?(0,RG.CreateType)(t[0],e):(0,PG.UnionCreate)(t,e)}});var it=T(ts=>{"use strict";var EG=ts&&ts.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dx=ts&&ts.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&EG(e,t,n)};Object.defineProperty(ts,"__esModule",{value:!0});dx(ZP(),ts);dx(t_(),ts);dx(n_(),ts)});var Om=T(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.TemplateLiteralParserError=void 0;gc.TemplateLiteralParse=Yo;gc.TemplateLiteralParseExact=BG;var AG=xi(),xu=class extends AG.TypeBoxError{};gc.TemplateLiteralParserError=xu;function OG(t){return t.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function px(t,e,n){return t[e]===n&&t.charCodeAt(e-1)!==92}function ns(t,e){return px(t,e,"(")}function yu(t,e){return px(t,e,")")}function i_(t,e){return px(t,e,"|")}function LG(t){if(!(ns(t,0)&&yu(t,t.length-1)))return!1;let e=0;for(let n=0;n<t.length;n++)if(ns(t,n)&&(e+=1),yu(t,n)&&(e-=1),e===0&&n!==t.length-1)return!1;return!0}function WG(t){return t.slice(1,t.length-1)}function UG(t){let e=0;for(let n=0;n<t.length;n++)if(ns(t,n)&&(e+=1),yu(t,n)&&(e-=1),i_(t,n)&&e===0)return!0;return!1}function FG(t){for(let e=0;e<t.length;e++)if(ns(t,e))return!0;return!1}function DG(t){let[e,n]=[0,0],i=[];for(let o=0;o<t.length;o++)if(ns(t,o)&&(e+=1),yu(t,o)&&(e-=1),i_(t,o)&&e===0){let r=t.slice(n,o);r.length>0&&i.push(Yo(r)),n=o+1}let s=t.slice(n);return s.length>0&&i.push(Yo(s)),i.length===0?{type:"const",const:""}:i.length===1?i[0]:{type:"or",expr:i}}function $G(t){function e(s,o){if(!ns(s,o))throw new xu("TemplateLiteralParser: Index must point to open parens");let r=0;for(let a=o;a<s.length;a++)if(ns(s,a)&&(r+=1),yu(s,a)&&(r-=1),r===0)return[o,a];throw new xu("TemplateLiteralParser: Unclosed group parens in expression")}function n(s,o){for(let r=o;r<s.length;r++)if(ns(s,r))return[o,r];return[o,s.length]}let i=[];for(let s=0;s<t.length;s++)if(ns(t,s)){let[o,r]=e(t,s),a=t.slice(o,r+1);i.push(Yo(a)),s=r}else{let[o,r]=n(t,s),a=t.slice(o,r);a.length>0&&i.push(Yo(a)),s=r-1}return i.length===0?{type:"const",const:""}:i.length===1?i[0]:{type:"and",expr:i}}function Yo(t){return LG(t)?Yo(WG(t)):UG(t)?DG(t):FG(t)?$G(t):{type:"const",const:OG(t)}}function BG(t){return Yo(t.slice(1,t.length-1))}});var mx=T(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.TemplateLiteralFiniteError=void 0;fc.IsTemplateLiteralExpressionFinite=Wm;fc.IsTemplateLiteralFinite=HG;var NG=Om(),jG=xi(),Lm=class extends jG.TypeBoxError{};fc.TemplateLiteralFiniteError=Lm;function qG(t){return t.type==="or"&&t.expr.length===2&&t.expr[0].type==="const"&&t.expr[0].const==="0"&&t.expr[1].type==="const"&&t.expr[1].const==="[1-9][0-9]*"}function GG(t){return t.type==="or"&&t.expr.length===2&&t.expr[0].type==="const"&&t.expr[0].const==="true"&&t.expr[1].type==="const"&&t.expr[1].const==="false"}function KG(t){return t.type==="const"&&t.const===".*"}function Wm(t){return qG(t)||KG(t)?!1:GG(t)?!0:t.type==="and"?t.expr.every(e=>Wm(e)):t.type==="or"?t.expr.every(e=>Wm(e)):t.type==="const"?!0:(()=>{throw new Lm("Unknown expression type")})()}function HG(t){let e=(0,NG.TemplateLiteralParseExact)(t.pattern);return Wm(e)}});var hx=T(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.TemplateLiteralGenerateError=void 0;bc.TemplateLiteralExpressionGenerate=Fm;bc.TemplateLiteralGenerate=ZG;var zG=mx(),VG=Om(),JG=xi(),Um=class extends JG.TypeBoxError{};bc.TemplateLiteralGenerateError=Um;function*s_(t){if(t.length===1)return yield*t[0];for(let e of t[0])for(let n of s_(t.slice(1)))yield`${e}${n}`}function*QG(t){return yield*s_(t.expr.map(e=>[...Fm(e)]))}function*YG(t){for(let e of t.expr)yield*Fm(e)}function*XG(t){return yield t.const}function*Fm(t){return t.type==="and"?yield*QG(t):t.type==="or"?yield*YG(t):t.type==="const"?yield*XG(t):(()=>{throw new Um("Unknown expression")})()}function ZG(t){let e=(0,VG.TemplateLiteralParseExact)(t.pattern);return(0,zG.IsTemplateLiteralExpressionFinite)(e)?[...Fm(e)]:[]}});var o_=T(gx=>{"use strict";Object.defineProperty(gx,"__esModule",{value:!0});gx.Literal=nK;var eK=le(),tK=re();function nK(t,e){return(0,eK.CreateType)({[tK.Kind]:"Literal",const:t,type:typeof t},e)}});var Ft=T(Xo=>{"use strict";var iK=Xo&&Xo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sK=Xo&&Xo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&iK(e,t,n)};Object.defineProperty(Xo,"__esModule",{value:!0});sK(o_(),Xo)});var r_=T(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:!0});fx.Boolean=aK;var oK=re(),rK=Xi();function aK(t){return(0,rK.CreateType)({[oK.Kind]:"Boolean",type:"boolean"},t)}});var vu=T(Zo=>{"use strict";var cK=Zo&&Zo.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),lK=Zo&&Zo.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&cK(e,t,n)};Object.defineProperty(Zo,"__esModule",{value:!0});lK(r_(),Zo)});var a_=T(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:!0});bx.BigInt=pK;var uK=re(),dK=Xi();function pK(t){return(0,dK.CreateType)({[uK.Kind]:"BigInt",type:"bigint"},t)}});var xc=T(er=>{"use strict";var mK=er&&er.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),hK=er&&er.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mK(e,t,n)};Object.defineProperty(er,"__esModule",{value:!0});hK(a_(),er)});var c_=T(xx=>{"use strict";Object.defineProperty(xx,"__esModule",{value:!0});xx.Number=bK;var gK=le(),fK=re();function bK(t){return(0,gK.CreateType)({[fK.Kind]:"Number",type:"number"},t)}});var Gs=T(tr=>{"use strict";var xK=tr&&tr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yK=tr&&tr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xK(e,t,n)};Object.defineProperty(tr,"__esModule",{value:!0});yK(c_(),tr)});var l_=T(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:!0});yx.String=SK;var vK=le(),wK=re();function SK(t){return(0,vK.CreateType)({[wK.Kind]:"String",type:"string"},t)}});var ir=T(nr=>{"use strict";var CK=nr&&nr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),TK=nr&&nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&CK(e,t,n)};Object.defineProperty(nr,"__esModule",{value:!0});TK(l_(),nr)});var Sx=T(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:!0});wx.TemplateLiteralSyntax=OK;var wu=Ft(),kK=vu(),MK=xc(),IK=Gs(),RK=ir(),PK=it(),_K=vt();function*EK(t){let e=t.trim().replace(/"|'/g,"");return e==="boolean"?yield(0,kK.Boolean)():e==="number"?yield(0,IK.Number)():e==="bigint"?yield(0,MK.BigInt)():e==="string"?yield(0,RK.String)():yield(()=>{let n=e.split("|").map(i=>(0,wu.Literal)(i.trim()));return n.length===0?(0,_K.Never)():n.length===1?n[0]:(0,PK.UnionEvaluated)(n)})()}function*AK(t){if(t[1]!=="{"){let e=(0,wu.Literal)("$"),n=vx(t.slice(1));return yield*[e,...n]}for(let e=2;e<t.length;e++)if(t[e]==="}"){let n=EK(t.slice(2,e)),i=vx(t.slice(e+1));return yield*[...n,...i]}yield(0,wu.Literal)(t)}function*vx(t){for(let e=0;e<t.length;e++)if(t[e]==="$"){let n=(0,wu.Literal)(t.slice(0,e)),i=AK(t.slice(e));return yield*[n,...i]}yield(0,wu.Literal)(t)}function OK(t){return[...vx(t)]}});var Cx=T(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.TemplateLiteralPatternError=void 0;Cu.TemplateLiteralPattern=FK;var Su=fu(),LK=re(),WK=xi(),Ks=Me(),Dm=class extends WK.TypeBoxError{};Cu.TemplateLiteralPatternError=Dm;function UK(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u_(t,e){return(0,Ks.IsTemplateLiteral)(t)?t.pattern.slice(1,t.pattern.length-1):(0,Ks.IsUnion)(t)?`(${t.anyOf.map(n=>u_(n,e)).join("|")})`:(0,Ks.IsNumber)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsInteger)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsBigInt)(t)?`${e}${Su.PatternNumber}`:(0,Ks.IsString)(t)?`${e}${Su.PatternString}`:(0,Ks.IsLiteral)(t)?`${e}${UK(t.const.toString())}`:(0,Ks.IsBoolean)(t)?`${e}${Su.PatternBoolean}`:(()=>{throw new Dm(`Unexpected Kind '${t[LK.Kind]}'`)})()}function FK(t){return`^${t.map(e=>u_(e,"")).join("")}$`}});var d_=T(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:!0});Tx.TemplateLiteralToUnion=NK;var DK=it(),$K=Ft(),BK=hx();function NK(t){let n=(0,BK.TemplateLiteralGenerate)(t).map(i=>(0,$K.Literal)(i));return(0,DK.UnionEvaluated)(n)}});var m_=T(kx=>{"use strict";Object.defineProperty(kx,"__esModule",{value:!0});kx.TemplateLiteral=HK;var jK=le(),qK=Sx(),p_=Cx(),GK=Ut(),KK=re();function HK(t,e){let n=(0,GK.IsString)(t)?(0,p_.TemplateLiteralPattern)((0,qK.TemplateLiteralSyntax)(t)):(0,p_.TemplateLiteralPattern)(t);return(0,jK.CreateType)({[KK.Kind]:"TemplateLiteral",type:"string",pattern:n},e)}});var Si=T(Sn=>{"use strict";var zK=Sn&&Sn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sr=Sn&&Sn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&zK(e,t,n)};Object.defineProperty(Sn,"__esModule",{value:!0});sr(mx(),Sn);sr(hx(),Sn);sr(Sx(),Sn);sr(Om(),Sn);sr(Cx(),Sn);sr(d_(),Sn);sr(m_(),Sn)});var $m=T(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:!0});Mx.IndexPropertyKeys=h_;var VK=Si(),Tu=Me();function JK(t){return(0,VK.TemplateLiteralGenerate)(t).map(n=>n.toString())}function QK(t){let e=[];for(let n of t)e.push(...h_(n));return e}function YK(t){return[t.toString()]}function h_(t){return[...new Set((0,Tu.IsTemplateLiteral)(t)?JK(t):(0,Tu.IsUnion)(t)?QK(t.anyOf):(0,Tu.IsLiteral)(t)?YK(t.const):(0,Tu.IsNumber)(t)?["[number]"]:(0,Tu.IsInteger)(t)?["[number]"]:[])]}});var Rx=T(Ix=>{"use strict";Object.defineProperty(Ix,"__esModule",{value:!0});Ix.IndexFromMappedResult=iH;var XK=ot(),ZK=$m(),eH=ti();function tH(t,e,n){let i={};for(let s of Object.getOwnPropertyNames(e))i[s]=(0,eH.Index)(t,(0,ZK.IndexPropertyKeys)(e[s]),n);return i}function nH(t,e,n){return tH(t,e.properties,n)}function iH(t,e,n){let i=nH(t,e,n);return(0,XK.MappedResult)(i)}});var Nm=T(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.IndexFromPropertyKey=_x;yc.IndexFromPropertyKeys=x_;yc.IndexFromComputed=bH;yc.Index=xH;var sH=le(),oH=xi(),f_=js(),Bm=vt(),rH=Cn(),Px=it(),aH=$m(),cH=Ex(),lH=Rx(),on=Me();function b_(t,e){return t.map(n=>_x(n,e))}function uH(t){return t.filter(e=>!(0,on.IsNever)(e))}function dH(t,e){return(0,rH.IntersectEvaluated)(uH(b_(t,e)))}function pH(t){return t.some(e=>(0,on.IsNever)(e))?[]:t}function mH(t,e){return(0,Px.UnionEvaluated)(pH(b_(t,e)))}function hH(t,e){return e in t?t[e]:e==="[number]"?(0,Px.UnionEvaluated)(t):(0,Bm.Never)()}function gH(t,e){return e==="[number]"?t:(0,Bm.Never)()}function fH(t,e){return e in t?t[e]:(0,Bm.Never)()}function _x(t,e){return(0,on.IsIntersect)(t)?dH(t.allOf,e):(0,on.IsUnion)(t)?mH(t.anyOf,e):(0,on.IsTuple)(t)?hH(t.items??[],e):(0,on.IsArray)(t)?gH(t.items,e):(0,on.IsObject)(t)?fH(t.properties,e):(0,Bm.Never)()}function x_(t,e){return e.map(n=>_x(t,n))}function g_(t,e){return(0,Px.UnionEvaluated)(x_(t,e))}function bH(t,e){return(0,f_.Computed)("Index",[t,e])}function xH(t,e,n){if((0,on.IsRef)(t)||(0,on.IsRef)(e)){let i="Index types using Ref parameters require both Type and Key to be of TSchema";if(!(0,on.IsSchema)(t)||!(0,on.IsSchema)(e))throw new oH.TypeBoxError(i);return(0,f_.Computed)("Index",[t,e])}return(0,on.IsMappedResult)(e)?(0,lH.IndexFromMappedResult)(t,e,n):(0,on.IsMappedKey)(e)?(0,cH.IndexFromMappedKey)(t,e,n):(0,sH.CreateType)((0,on.IsSchema)(e)?g_(t,(0,aH.IndexPropertyKeys)(e)):g_(t,e),n)}});var Ex=T(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:!0});Ax.IndexFromMappedKey=kH;var yH=Nm(),vH=ot(),wH=tn();function SH(t,e,n){return{[e]:(0,yH.Index)(t,[e],(0,wH.Clone)(n))}}function CH(t,e,n){return e.reduce((i,s)=>({...i,...SH(t,s,n)}),{})}function TH(t,e,n){return CH(t,e.keys,n)}function kH(t,e,n){let i=TH(t,e,n);return(0,vH.MappedResult)(i)}});var ti=T(Ci=>{"use strict";var MH=Ci&&Ci.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),jm=Ci&&Ci.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&MH(e,t,n)};Object.defineProperty(Ci,"__esModule",{value:!0});jm(Ex(),Ci);jm(Rx(),Ci);jm($m(),Ci);jm(Nm(),Ci)});var y_=T(Ox=>{"use strict";Object.defineProperty(Ox,"__esModule",{value:!0});Ox.Iterator=PH;var IH=le(),RH=re();function PH(t,e){return(0,IH.CreateType)({[RH.Kind]:"Iterator",type:"Iterator",items:t},e)}});var vc=T(or=>{"use strict";var _H=or&&or.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),EH=or&&or.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_H(e,t,n)};Object.defineProperty(or,"__esModule",{value:!0});EH(y_(),or)});var w_=T(qm=>{"use strict";Object.defineProperty(qm,"__esModule",{value:!0});qm.Object=void 0;var AH=le(),v_=re(),OH=Me();function LH(t){return globalThis.Object.keys(t).filter(e=>!(0,OH.IsOptional)(t[e]))}function WH(t,e){let n=LH(t),i=n.length>0?{[v_.Kind]:"Object",type:"object",required:n,properties:t}:{[v_.Kind]:"Object",type:"object",properties:t};return(0,AH.CreateType)(i,e)}qm.Object=WH});var rn=T(rr=>{"use strict";var UH=rr&&rr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),FH=rr&&rr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&UH(e,t,n)};Object.defineProperty(rr,"__esModule",{value:!0});FH(w_(),rr)});var S_=T(Lx=>{"use strict";Object.defineProperty(Lx,"__esModule",{value:!0});Lx.Promise=BH;var DH=le(),$H=re();function BH(t,e){return(0,DH.CreateType)({[$H.Kind]:"Promise",type:"Promise",item:t},e)}});var ku=T(ar=>{"use strict";var NH=ar&&ar.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),jH=ar&&ar.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&NH(e,t,n)};Object.defineProperty(ar,"__esModule",{value:!0});jH(S_(),ar)});var Ux=T(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.Readonly=JH;var C_=le(),T_=re(),qH=es(),GH=Fx(),KH=Me();function HH(t){return(0,C_.CreateType)((0,qH.Discard)(t,[T_.ReadonlyKind]))}function zH(t){return(0,C_.CreateType)({...t,[T_.ReadonlyKind]:"Readonly"})}function VH(t,e){return e===!1?HH(t):zH(t)}function JH(t,e){let n=e??!0;return(0,KH.IsMappedResult)(t)?(0,GH.ReadonlyFromMappedResult)(t,n):VH(t,n)}});var Fx=T(Dx=>{"use strict";Object.defineProperty(Dx,"__esModule",{value:!0});Dx.ReadonlyFromMappedResult=ez;var QH=ot(),YH=Ux();function XH(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,YH.Readonly)(t[i],e);return n}function ZH(t,e){return XH(t.properties,e)}function ez(t,e){let n=ZH(t,e);return(0,QH.MappedResult)(n)}});var zs=T(Hs=>{"use strict";var tz=Hs&&Hs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),k_=Hs&&Hs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&tz(e,t,n)};Object.defineProperty(Hs,"__esModule",{value:!0});k_(Fx(),Hs);k_(Ux(),Hs)});var I_=T($x=>{"use strict";Object.defineProperty($x,"__esModule",{value:!0});$x.Tuple=iz;var nz=le(),M_=re();function iz(t,e){return(0,nz.CreateType)(t.length>0?{[M_.Kind]:"Tuple",type:"array",items:t,additionalItems:!1,minItems:t.length,maxItems:t.length}:{[M_.Kind]:"Tuple",type:"array",minItems:t.length,maxItems:t.length},e)}});var is=T(cr=>{"use strict";var sz=cr&&cr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),oz=cr&&cr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&sz(e,t,n)};Object.defineProperty(cr,"__esModule",{value:!0});oz(I_(),cr)});var O_=T(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.MappedFunctionReturnType=A_;Gm.Mapped=kz;var Bx=re(),R_=es(),rz=pc(),az=mc(),cz=hc(),lz=qs(),uz=ti(),dz=Cn(),pz=vc(),P_=Ft(),__=rn(),mz=wi(),hz=ku(),gz=zs(),fz=is(),bz=it(),xz=bu(),yz=sx(),Dt=Me();function E_(t,e){return t in e?$n(t,e[t]):(0,yz.MappedResult)(e)}function vz(t){return{[t]:(0,P_.Literal)(t)}}function wz(t){let e={};for(let n of t)e[n]=(0,P_.Literal)(n);return e}function Sz(t,e){return(0,xz.SetIncludes)(e,t)?vz(t):wz(e)}function Cz(t,e){let n=Sz(t,e);return E_(t,n)}function Mu(t,e){return e.map(n=>$n(t,n))}function Tz(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(e))n[i]=$n(t,e[i]);return n}function $n(t,e){let n={...e};return(0,Dt.IsOptional)(e)?(0,mz.Optional)($n(t,(0,R_.Discard)(e,[Bx.OptionalKind]))):(0,Dt.IsReadonly)(e)?(0,gz.Readonly)($n(t,(0,R_.Discard)(e,[Bx.ReadonlyKind]))):(0,Dt.IsMappedResult)(e)?E_(t,e.properties):(0,Dt.IsMappedKey)(e)?Cz(t,e.keys):(0,Dt.IsConstructor)(e)?(0,cz.Constructor)(Mu(t,e.parameters),$n(t,e.returns),n):(0,Dt.IsFunction)(e)?(0,lz.Function)(Mu(t,e.parameters),$n(t,e.returns),n):(0,Dt.IsAsyncIterator)(e)?(0,az.AsyncIterator)($n(t,e.items),n):(0,Dt.IsIterator)(e)?(0,pz.Iterator)($n(t,e.items),n):(0,Dt.IsIntersect)(e)?(0,dz.Intersect)(Mu(t,e.allOf),n):(0,Dt.IsUnion)(e)?(0,bz.Union)(Mu(t,e.anyOf),n):(0,Dt.IsTuple)(e)?(0,fz.Tuple)(Mu(t,e.items??[]),n):(0,Dt.IsObject)(e)?(0,__.Object)(Tz(t,e.properties),n):(0,Dt.IsArray)(e)?(0,rz.Array)($n(t,e.items),n):(0,Dt.IsPromise)(e)?(0,hz.Promise)($n(t,e.item),n):e}function A_(t,e){let n={};for(let i of t)n[i]=$n(i,e);return n}function kz(t,e,n){let i=(0,Dt.IsSchema)(t)?(0,uz.IndexPropertyKeys)(t):t,s=e({[Bx.Kind]:"MappedKey",keys:i}),o=A_(i,s);return(0,__.Object)(o,n)}});var ot=T(ss=>{"use strict";var Mz=ss&&ss.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Nx=ss&&ss.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Mz(e,t,n)};Object.defineProperty(ss,"__esModule",{value:!0});Nx(zP(),ss);Nx(sx(),ss);Nx(O_(),ss)});var qx=T(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:!0});jx.Optional=Oz;var L_=le(),W_=re(),Iz=es(),Rz=Gx(),Pz=Me();function _z(t){return(0,L_.CreateType)((0,Iz.Discard)(t,[W_.OptionalKind]))}function Ez(t){return(0,L_.CreateType)({...t,[W_.OptionalKind]:"Optional"})}function Az(t,e){return e===!1?_z(t):Ez(t)}function Oz(t,e){let n=e??!0;return(0,Pz.IsMappedResult)(t)?(0,Rz.OptionalFromMappedResult)(t,n):Az(t,n)}});var Gx=T(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.OptionalFromMappedResult=Dz;var Lz=ot(),Wz=qx();function Uz(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,Wz.Optional)(t[i],e);return n}function Fz(t,e){return Uz(t.properties,e)}function Dz(t,e){let n=Fz(t,e);return(0,Lz.MappedResult)(n)}});var wi=T(Vs=>{"use strict";var $z=Vs&&Vs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),U_=Vs&&Vs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$z(e,t,n)};Object.defineProperty(Vs,"__esModule",{value:!0});U_(Gx(),Vs);U_(qx(),Vs)});var Vx=T(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:!0});zx.IntersectCreate=Nz;var Bz=le(),F_=re(),Hx=Me();function Nz(t,e={}){let n=t.every(s=>(0,Hx.IsObject)(s)),i=(0,Hx.IsSchema)(e.unevaluatedProperties)?{unevaluatedProperties:e.unevaluatedProperties}:{};return(0,Bz.CreateType)(e.unevaluatedProperties===!1||(0,Hx.IsSchema)(e.unevaluatedProperties)||n?{...i,[F_.Kind]:"Intersect",type:"object",allOf:t}:{...i,[F_.Kind]:"Intersect",allOf:t},e)}});var B_=T(Qx=>{"use strict";Object.defineProperty(Qx,"__esModule",{value:!0});Qx.IntersectEvaluated=Qz;var jz=re(),qz=le(),Gz=es(),Kz=vt(),Hz=wi(),D_=Vx(),Jx=Me();function zz(t){return t.every(e=>(0,Jx.IsOptional)(e))}function Vz(t){return(0,Gz.Discard)(t,[jz.OptionalKind])}function $_(t){return t.map(e=>(0,Jx.IsOptional)(e)?Vz(e):e)}function Jz(t,e){return zz(t)?(0,Hz.Optional)((0,D_.IntersectCreate)($_(t),e)):(0,D_.IntersectCreate)($_(t),e)}function Qz(t,e={}){if(t.length===1)return(0,qz.CreateType)(t[0],e);if(t.length===0)return(0,Kz.Never)(e);if(t.some(n=>(0,Jx.IsTransform)(n)))throw new Error("Cannot intersect transform types");return Jz(t,e)}});var j_=T(N_=>{"use strict";Object.defineProperty(N_,"__esModule",{value:!0});var WPe=re()});var q_=T(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:!0});Yx.Intersect=tV;var Yz=le(),Xz=vt(),Zz=Vx(),eV=Me();function tV(t,e){if(t.length===1)return(0,Yz.CreateType)(t[0],e);if(t.length===0)return(0,Xz.Never)(e);if(t.some(n=>(0,eV.IsTransform)(n)))throw new Error("Cannot intersect transform types");return(0,Zz.IntersectCreate)(t,e)}});var Cn=T(os=>{"use strict";var nV=os&&os.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Xx=os&&os.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&nV(e,t,n)};Object.defineProperty(os,"__esModule",{value:!0});Xx(B_(),os);Xx(j_(),os);Xx(q_(),os)});var G_=T(Zx=>{"use strict";Object.defineProperty(Zx,"__esModule",{value:!0});Zx.Ref=rV;var iV=xi(),sV=le(),oV=re();function rV(...t){let[e,n]=typeof t[0]=="string"?[t[0],t[1]]:[t[0].$id,t[1]];if(typeof e!="string")throw new iV.TypeBoxError("Ref: $ref must be a string");return(0,sV.CreateType)({[oV.Kind]:"Ref",$ref:e},n)}});var Js=T(lr=>{"use strict";var aV=lr&&lr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cV=lr&&lr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aV(e,t,n)};Object.defineProperty(lr,"__esModule",{value:!0});cV(G_(),lr)});var H_=T(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.Awaited=ty;var lV=le(),ey=js(),uV=Cn(),dV=it(),pV=Js(),Iu=Me();function mV(t,e){return(0,ey.Computed)("Awaited",[(0,ey.Computed)(t,e)])}function hV(t){return(0,ey.Computed)("Awaited",[(0,pV.Ref)(t)])}function gV(t){return(0,uV.Intersect)(K_(t))}function fV(t){return(0,dV.Union)(K_(t))}function bV(t){return ty(t)}function K_(t){return t.map(e=>ty(e))}function ty(t,e){return(0,lV.CreateType)((0,Iu.IsComputed)(t)?mV(t.target,t.parameters):(0,Iu.IsIntersect)(t)?gV(t.allOf):(0,Iu.IsUnion)(t)?fV(t.anyOf):(0,Iu.IsPromise)(t)?bV(t.item):(0,Iu.IsRef)(t)?hV(t.$ref):t,e)}});var Ru=T(ur=>{"use strict";var xV=ur&&ur.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yV=ur&&ur.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xV(e,t,n)};Object.defineProperty(ur,"__esModule",{value:!0});yV(H_(),ur)});var Hm=T(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.KeyOfPropertyKeys=sy;Km.KeyOfPattern=MV;var z_=bu(),wc=Me();function V_(t){let e=[];for(let n of t)e.push(sy(n));return e}function vV(t){let e=V_(t);return(0,z_.SetUnionMany)(e)}function wV(t){let e=V_(t);return(0,z_.SetIntersectMany)(e)}function SV(t){return t.map((e,n)=>n.toString())}function CV(t){return["[number]"]}function TV(t){return globalThis.Object.getOwnPropertyNames(t)}function kV(t){return iy?globalThis.Object.getOwnPropertyNames(t).map(n=>n[0]==="^"&&n[n.length-1]==="$"?n.slice(1,n.length-1):n):[]}function sy(t){return(0,wc.IsIntersect)(t)?vV(t.allOf):(0,wc.IsUnion)(t)?wV(t.anyOf):(0,wc.IsTuple)(t)?SV(t.items??[]):(0,wc.IsArray)(t)?CV(t.items):(0,wc.IsObject)(t)?TV(t.properties):(0,wc.IsRecord)(t)?kV(t.patternProperties):[]}var iy=!1;function MV(t){iy=!0;let e=sy(t);return iy=!1,`^(${e.map(i=>`(${i})`).join("|")})$`}});var ay=T(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.KeyOfPropertyKeysToRest=J_;zm.KeyOf=FV;var IV=le(),RV=Ft(),PV=Gs(),ry=js(),_V=Js(),EV=Hm(),AV=it(),OV=cy(),oy=Me();function LV(t,e){return(0,ry.Computed)("KeyOf",[(0,ry.Computed)(t,e)])}function WV(t){return(0,ry.Computed)("KeyOf",[(0,_V.Ref)(t)])}function UV(t,e){let n=(0,EV.KeyOfPropertyKeys)(t),i=J_(n),s=(0,AV.UnionEvaluated)(i);return(0,IV.CreateType)(s,e)}function J_(t){return t.map(e=>e==="[number]"?(0,PV.Number)():(0,RV.Literal)(e))}function FV(t,e){return(0,oy.IsComputed)(t)?LV(t.target,t.parameters):(0,oy.IsRef)(t)?WV(t.$ref):(0,oy.IsMappedResult)(t)?(0,OV.KeyOfFromMappedResult)(t,e):UV(t,e)}});var cy=T(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.KeyOfFromMappedResult=qV;var DV=ot(),$V=ay(),BV=tn();function NV(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,$V.KeyOf)(t[i],(0,BV.Clone)(e));return n}function jV(t,e){return NV(t.properties,e)}function qV(t,e){let n=jV(t,e);return(0,DV.MappedResult)(n)}});var Q_=T(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});uy.KeyOfPropertyEntries=HV;var GV=Nm(),KV=Hm();function HV(t){let e=(0,KV.KeyOfPropertyKeys)(t),n=(0,GV.IndexFromPropertyKeys)(t,e);return e.map((i,s)=>[e[s],n[s]])}});var Sc=T(Ti=>{"use strict";var zV=Ti&&Ti.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Vm=Ti&&Ti.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&zV(e,t,n)};Object.defineProperty(Ti,"__esModule",{value:!0});Vm(cy(),Ti);Vm(Q_(),Ti);Vm(Hm(),Ti);Vm(ay(),Ti)});var Y_=T(dy=>{"use strict";Object.defineProperty(dy,"__esModule",{value:!0});dy.Composite=sJ;var VV=Cn(),JV=ti(),QV=Sc(),YV=rn(),XV=bu(),ZV=Me();function eJ(t){let e=[];for(let n of t)e.push(...(0,QV.KeyOfPropertyKeys)(n));return(0,XV.SetDistinct)(e)}function tJ(t){return t.filter(e=>!(0,ZV.IsNever)(e))}function nJ(t,e){let n=[];for(let i of t)n.push(...(0,JV.IndexFromPropertyKeys)(i,[e]));return tJ(n)}function iJ(t,e){let n={};for(let i of e)n[i]=(0,VV.IntersectEvaluated)(nJ(t,i));return n}function sJ(t,e){let n=eJ(t),i=iJ(t,n);return(0,YV.Object)(i,e)}});var Jm=T(dr=>{"use strict";var oJ=dr&&dr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),rJ=dr&&dr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oJ(e,t,n)};Object.defineProperty(dr,"__esModule",{value:!0});rJ(Y_(),dr)});var X_=T(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.Date=lJ;var aJ=re(),cJ=le();function lJ(t){return(0,cJ.CreateType)({[aJ.Kind]:"Date",type:"Date"},t)}});var Pu=T(pr=>{"use strict";var uJ=pr&&pr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),dJ=pr&&pr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uJ(e,t,n)};Object.defineProperty(pr,"__esModule",{value:!0});dJ(X_(),pr)});var Z_=T(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});my.Null=hJ;var pJ=le(),mJ=re();function hJ(t){return(0,pJ.CreateType)({[mJ.Kind]:"Null",type:"null"},t)}});var _u=T(mr=>{"use strict";var gJ=mr&&mr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),fJ=mr&&mr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&gJ(e,t,n)};Object.defineProperty(mr,"__esModule",{value:!0});fJ(Z_(),mr)});var eE=T(hy=>{"use strict";Object.defineProperty(hy,"__esModule",{value:!0});hy.Symbol=yJ;var bJ=le(),xJ=re();function yJ(t){return(0,bJ.CreateType)({[xJ.Kind]:"Symbol",type:"symbol"},t)}});var Eu=T(hr=>{"use strict";var vJ=hr&&hr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),wJ=hr&&hr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&vJ(e,t,n)};Object.defineProperty(hr,"__esModule",{value:!0});wJ(eE(),hr)});var tE=T(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.Undefined=TJ;var SJ=le(),CJ=re();function TJ(t){return(0,SJ.CreateType)({[CJ.Kind]:"Undefined",type:"undefined"},t)}});var Au=T(gr=>{"use strict";var kJ=gr&&gr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),MJ=gr&&gr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&kJ(e,t,n)};Object.defineProperty(gr,"__esModule",{value:!0});MJ(tE(),gr)});var nE=T(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});fy.Uint8Array=PJ;var IJ=le(),RJ=re();function PJ(t){return(0,IJ.CreateType)({[RJ.Kind]:"Uint8Array",type:"Uint8Array"},t)}});var Ou=T(fr=>{"use strict";var _J=fr&&fr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),EJ=fr&&fr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_J(e,t,n)};Object.defineProperty(fr,"__esModule",{value:!0});EJ(nE(),fr)});var iE=T(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.Unknown=LJ;var AJ=le(),OJ=re();function LJ(t){return(0,AJ.CreateType)({[OJ.Kind]:"Unknown"},t)}});var xr=T(br=>{"use strict";var WJ=br&&br.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),UJ=br&&br.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WJ(e,t,n)};Object.defineProperty(br,"__esModule",{value:!0});UJ(iE(),br)});var rE=T(wy=>{"use strict";Object.defineProperty(wy,"__esModule",{value:!0});wy.Const=JJ;var sE=dc(),FJ=xc(),DJ=Pu(),$J=qs(),xy=Ft(),BJ=_u(),oE=rn(),NJ=Eu(),jJ=is(),yy=zs(),qJ=Au(),GJ=Ou(),KJ=xr(),HJ=Xi(),an=Ut();function zJ(t){return t.map(e=>vy(e,!1))}function VJ(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,yy.Readonly)(vy(t[n],!1));return e}function Qm(t,e){return e===!0?t:(0,yy.Readonly)(t)}function vy(t,e){return(0,an.IsAsyncIterator)(t)||(0,an.IsIterator)(t)?Qm((0,sE.Any)(),e):(0,an.IsArray)(t)?(0,yy.Readonly)((0,jJ.Tuple)(zJ(t))):(0,an.IsUint8Array)(t)?(0,GJ.Uint8Array)():(0,an.IsDate)(t)?(0,DJ.Date)():(0,an.IsObject)(t)?Qm((0,oE.Object)(VJ(t)),e):(0,an.IsFunction)(t)?Qm((0,$J.Function)([],(0,KJ.Unknown)()),e):(0,an.IsUndefined)(t)?(0,qJ.Undefined)():(0,an.IsNull)(t)?(0,BJ.Null)():(0,an.IsSymbol)(t)?(0,NJ.Symbol)():(0,an.IsBigInt)(t)?(0,FJ.BigInt)():(0,an.IsNumber)(t)||(0,an.IsBoolean)(t)||(0,an.IsString)(t)?(0,xy.Literal)(t):(0,oE.Object)({})}function JJ(t,e){return(0,HJ.CreateType)(vy(t,!0),e)}});var Ym=T(yr=>{"use strict";var QJ=yr&&yr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),YJ=yr&&yr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&QJ(e,t,n)};Object.defineProperty(yr,"__esModule",{value:!0});YJ(rE(),yr)});var aE=T(rs=>{"use strict";var XJ=rs&&rs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),ZJ=rs&&rs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),eQ=rs&&rs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&XJ(n,e,i[s]);return ZJ(n,e),n}})();Object.defineProperty(rs,"__esModule",{value:!0});rs.ConstructorParameters=sQ;var tQ=is(),nQ=vt(),iQ=eQ(Me());function sQ(t,e){return iQ.IsConstructor(t)?(0,tQ.Tuple)(t.parameters,e):(0,nQ.Never)(e)}});var Xm=T(vr=>{"use strict";var oQ=vr&&vr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),rQ=vr&&vr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&oQ(e,t,n)};Object.defineProperty(vr,"__esModule",{value:!0});rQ(aE(),vr)});var cE=T(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:!0});Sy.Enum=dQ;var aQ=Ft(),cQ=re(),lQ=it(),uQ=Ut();function dQ(t,e){if((0,uQ.IsUndefined)(t))throw new Error("Enum undefined or empty");let n=globalThis.Object.getOwnPropertyNames(t).filter(o=>isNaN(o)).map(o=>t[o]),s=[...new Set(n)].map(o=>(0,aQ.Literal)(o));return(0,lQ.Union)(s,{...e,[cQ.Hint]:"Enum"})}});var Zm=T(wr=>{"use strict";var pQ=wr&&wr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mQ=wr&&wr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pQ(e,t,n)};Object.defineProperty(wr,"__esModule",{value:!0});mQ(cE(),wr)});var _y=T(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.ExtendsResult=Sr.ExtendsResolverError=void 0;Sr.ExtendsCheck=nY;var lE=dc(),hQ=qs(),Iy=Gs(),Ty=ir(),gQ=xr(),uE=Si(),Cc=fu(),gE=re(),fQ=xi(),k=zb(),eh=class extends fQ.TypeBoxError{};Sr.ExtendsResolverError=eh;var B;(function(t){t[t.Union=0]="Union",t[t.True=1]="True",t[t.False=2]="False"})(B||(Sr.ExtendsResult=B={}));function Bn(t){return t===B.False?t:B.True}function Tc(t){throw new eh(t)}function rt(t){return k.TypeGuard.IsNever(t)||k.TypeGuard.IsIntersect(t)||k.TypeGuard.IsUnion(t)||k.TypeGuard.IsUnknown(t)||k.TypeGuard.IsAny(t)}function at(t,e){return k.TypeGuard.IsNever(e)?xE(t,e):k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsUnknown(e)?SE(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):Tc("StructuralRight")}function Ry(t,e){return B.True}function bQ(t,e){return k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)&&e.anyOf.some(n=>k.TypeGuard.IsAny(n)||k.TypeGuard.IsUnknown(n))?B.True:k.TypeGuard.IsUnion(e)?B.Union:k.TypeGuard.IsUnknown(e)||k.TypeGuard.IsAny(e)?B.True:B.Union}function xQ(t,e){return k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:k.TypeGuard.IsNever(t)?B.True:B.False}function yQ(t,e){return k.TypeGuard.IsObject(e)&&nh(e)?B.True:rt(e)?at(t,e):k.TypeGuard.IsArray(e)?Bn(Ue(t.items,e.items)):B.False}function vQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsAsyncIterator(e)?Bn(Ue(t.items,e.items)):B.False}function wQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsBigInt(e)?B.True:B.False}function fE(t,e){return k.TypeGuard.IsLiteralBoolean(t)||k.TypeGuard.IsBoolean(t)?B.True:B.False}function SQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsBoolean(e)?B.True:B.False}function CQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsConstructor(e)?t.parameters.length>e.parameters.length?B.False:t.parameters.every((n,i)=>Bn(Ue(e.parameters[i],n))===B.True)?Bn(Ue(t.returns,e.returns)):B.False:B.False}function TQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsDate(e)?B.True:B.False}function kQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsFunction(e)?t.parameters.length>e.parameters.length?B.False:t.parameters.every((n,i)=>Bn(Ue(e.parameters[i],n))===B.True)?Bn(Ue(t.returns,e.returns)):B.False:B.False}function bE(t,e){return k.TypeGuard.IsLiteral(t)&&k.ValueGuard.IsNumber(t.const)||k.TypeGuard.IsNumber(t)||k.TypeGuard.IsInteger(t)?B.True:B.False}function MQ(t,e){return k.TypeGuard.IsInteger(e)||k.TypeGuard.IsNumber(e)?B.True:rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):B.False}function th(t,e){return e.allOf.every(n=>Ue(t,n)===B.True)?B.True:B.False}function IQ(t,e){return t.allOf.some(n=>Ue(n,e)===B.True)?B.True:B.False}function RQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsIterator(e)?Bn(Ue(t.items,e.items)):B.False}function PQ(t,e){return k.TypeGuard.IsLiteral(e)&&e.const===t.const?B.True:rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsString(e)?wE(t,e):k.TypeGuard.IsNumber(e)?yE(t,e):k.TypeGuard.IsInteger(e)?bE(t,e):k.TypeGuard.IsBoolean(e)?fE(t,e):B.False}function xE(t,e){return B.False}function _Q(t,e){return B.True}function dE(t){let[e,n]=[t,0];for(;k.TypeGuard.IsNot(e);)e=e.not,n+=1;return n%2===0?e:(0,gQ.Unknown)()}function EQ(t,e){return k.TypeGuard.IsNot(t)?Ue(dE(t),e):k.TypeGuard.IsNot(e)?Ue(t,dE(e)):Tc("Invalid fallthrough for Not")}function AQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsNull(e)?B.True:B.False}function yE(t,e){return k.TypeGuard.IsLiteralNumber(t)||k.TypeGuard.IsNumber(t)||k.TypeGuard.IsInteger(t)?B.True:B.False}function OQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsInteger(e)||k.TypeGuard.IsNumber(e)?B.True:B.False}function cn(t,e){return Object.getOwnPropertyNames(t.properties).length===e}function pE(t){return nh(t)}function mE(t){return cn(t,0)||cn(t,1)&&"description"in t.properties&&k.TypeGuard.IsUnion(t.properties.description)&&t.properties.description.anyOf.length===2&&(k.TypeGuard.IsString(t.properties.description.anyOf[0])&&k.TypeGuard.IsUndefined(t.properties.description.anyOf[1])||k.TypeGuard.IsString(t.properties.description.anyOf[1])&&k.TypeGuard.IsUndefined(t.properties.description.anyOf[0]))}function Cy(t){return cn(t,0)}function hE(t){return cn(t,0)}function LQ(t){return cn(t,0)}function WQ(t){return cn(t,0)}function UQ(t){return nh(t)}function FQ(t){let e=(0,Iy.Number)();return cn(t,0)||cn(t,1)&&"length"in t.properties&&Bn(Ue(t.properties.length,e))===B.True}function DQ(t){return cn(t,0)}function nh(t){let e=(0,Iy.Number)();return cn(t,0)||cn(t,1)&&"length"in t.properties&&Bn(Ue(t.properties.length,e))===B.True}function $Q(t){let e=(0,hQ.Function)([(0,lE.Any)()],(0,lE.Any)());return cn(t,0)||cn(t,1)&&"then"in t.properties&&Bn(Ue(t.properties.then,e))===B.True}function vE(t,e){return Ue(t,e)===B.False||k.TypeGuard.IsOptional(t)&&!k.TypeGuard.IsOptional(e)?B.False:B.True}function Et(t,e){return k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:k.TypeGuard.IsNever(t)||k.TypeGuard.IsLiteralString(t)&&pE(e)||k.TypeGuard.IsLiteralNumber(t)&&Cy(e)||k.TypeGuard.IsLiteralBoolean(t)&&hE(e)||k.TypeGuard.IsSymbol(t)&&mE(e)||k.TypeGuard.IsBigInt(t)&&LQ(e)||k.TypeGuard.IsString(t)&&pE(e)||k.TypeGuard.IsSymbol(t)&&mE(e)||k.TypeGuard.IsNumber(t)&&Cy(e)||k.TypeGuard.IsInteger(t)&&Cy(e)||k.TypeGuard.IsBoolean(t)&&hE(e)||k.TypeGuard.IsUint8Array(t)&&UQ(e)||k.TypeGuard.IsDate(t)&&WQ(e)||k.TypeGuard.IsConstructor(t)&&DQ(e)||k.TypeGuard.IsFunction(t)&&FQ(e)?B.True:k.TypeGuard.IsRecord(t)&&k.TypeGuard.IsString(ky(t))?e[gE.Hint]==="Record"?B.True:B.False:k.TypeGuard.IsRecord(t)&&k.TypeGuard.IsNumber(ky(t))&&cn(e,0)?B.True:B.False}function BQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsObject(e)?(()=>{for(let n of Object.getOwnPropertyNames(e.properties)){if(!(n in t.properties)&&!k.TypeGuard.IsOptional(e.properties[n]))return B.False;if(k.TypeGuard.IsOptional(e.properties[n]))return B.True;if(vE(t.properties[n],e.properties[n])===B.False)return B.False}return B.True})():B.False}function NQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)&&$Q(e)?B.True:k.TypeGuard.IsPromise(e)?Bn(Ue(t.item,e.item)):B.False}function ky(t){return Cc.PatternNumberExact in t.patternProperties?(0,Iy.Number)():Cc.PatternStringExact in t.patternProperties?(0,Ty.String)():Tc("Unknown record key pattern")}function My(t){return Cc.PatternNumberExact in t.patternProperties?t.patternProperties[Cc.PatternNumberExact]:Cc.PatternStringExact in t.patternProperties?t.patternProperties[Cc.PatternStringExact]:Tc("Unable to get record value schema")}function Nn(t,e){let[n,i]=[ky(e),My(e)];return k.TypeGuard.IsLiteralString(t)&&k.TypeGuard.IsNumber(n)&&Bn(Ue(t,i))===B.True?B.True:k.TypeGuard.IsUint8Array(t)&&k.TypeGuard.IsNumber(n)||k.TypeGuard.IsString(t)&&k.TypeGuard.IsNumber(n)||k.TypeGuard.IsArray(t)&&k.TypeGuard.IsNumber(n)?Ue(t,i):k.TypeGuard.IsObject(t)?(()=>{for(let s of Object.getOwnPropertyNames(t.properties))if(vE(i,t.properties[s])===B.False)return B.False;return B.True})():B.False}function jQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Ue(My(t),My(e)):B.False}function qQ(t,e){let n=k.TypeGuard.IsRegExp(t)?(0,Ty.String)():t,i=k.TypeGuard.IsRegExp(e)?(0,Ty.String)():e;return Ue(n,i)}function wE(t,e){return k.TypeGuard.IsLiteral(t)&&k.ValueGuard.IsString(t.const)||k.TypeGuard.IsString(t)?B.True:B.False}function GQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsString(e)?B.True:B.False}function KQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsSymbol(e)?B.True:B.False}function HQ(t,e){return k.TypeGuard.IsTemplateLiteral(t)?Ue((0,uE.TemplateLiteralToUnion)(t),e):k.TypeGuard.IsTemplateLiteral(e)?Ue(t,(0,uE.TemplateLiteralToUnion)(e)):Tc("Invalid fallthrough for TemplateLiteral")}function zQ(t,e){return k.TypeGuard.IsArray(e)&&t.items!==void 0&&t.items.every(n=>Ue(n,e.items)===B.True)}function VQ(t,e){return k.TypeGuard.IsNever(t)?B.True:k.TypeGuard.IsUnknown(t)?B.False:k.TypeGuard.IsAny(t)?B.Union:B.False}function JQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)&&nh(e)||k.TypeGuard.IsArray(e)&&zQ(t,e)?B.True:k.TypeGuard.IsTuple(e)?k.ValueGuard.IsUndefined(t.items)&&!k.ValueGuard.IsUndefined(e.items)||!k.ValueGuard.IsUndefined(t.items)&&k.ValueGuard.IsUndefined(e.items)?B.False:k.ValueGuard.IsUndefined(t.items)&&!k.ValueGuard.IsUndefined(e.items)||t.items.every((n,i)=>Ue(n,e.items[i])===B.True)?B.True:B.False:B.False}function QQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsUint8Array(e)?B.True:B.False}function YQ(t,e){return rt(e)?at(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsRecord(e)?Nn(t,e):k.TypeGuard.IsVoid(e)?eY(t,e):k.TypeGuard.IsUndefined(e)?B.True:B.False}function Py(t,e){return e.anyOf.some(n=>Ue(t,n)===B.True)?B.True:B.False}function XQ(t,e){return t.anyOf.every(n=>Ue(n,e)===B.True)?B.True:B.False}function SE(t,e){return B.True}function ZQ(t,e){return k.TypeGuard.IsNever(e)?xE(t,e):k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):k.TypeGuard.IsString(e)?wE(t,e):k.TypeGuard.IsNumber(e)?yE(t,e):k.TypeGuard.IsInteger(e)?bE(t,e):k.TypeGuard.IsBoolean(e)?fE(t,e):k.TypeGuard.IsArray(e)?xQ(t,e):k.TypeGuard.IsTuple(e)?VQ(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsUnknown(e)?B.True:B.False}function eY(t,e){return k.TypeGuard.IsUndefined(t)||k.TypeGuard.IsUndefined(t)?B.True:B.False}function tY(t,e){return k.TypeGuard.IsIntersect(e)?th(t,e):k.TypeGuard.IsUnion(e)?Py(t,e):k.TypeGuard.IsUnknown(e)?SE(t,e):k.TypeGuard.IsAny(e)?Ry(t,e):k.TypeGuard.IsObject(e)?Et(t,e):k.TypeGuard.IsVoid(e)?B.True:B.False}function Ue(t,e){return k.TypeGuard.IsTemplateLiteral(t)||k.TypeGuard.IsTemplateLiteral(e)?HQ(t,e):k.TypeGuard.IsRegExp(t)||k.TypeGuard.IsRegExp(e)?qQ(t,e):k.TypeGuard.IsNot(t)||k.TypeGuard.IsNot(e)?EQ(t,e):k.TypeGuard.IsAny(t)?bQ(t,e):k.TypeGuard.IsArray(t)?yQ(t,e):k.TypeGuard.IsBigInt(t)?wQ(t,e):k.TypeGuard.IsBoolean(t)?SQ(t,e):k.TypeGuard.IsAsyncIterator(t)?vQ(t,e):k.TypeGuard.IsConstructor(t)?CQ(t,e):k.TypeGuard.IsDate(t)?TQ(t,e):k.TypeGuard.IsFunction(t)?kQ(t,e):k.TypeGuard.IsInteger(t)?MQ(t,e):k.TypeGuard.IsIntersect(t)?IQ(t,e):k.TypeGuard.IsIterator(t)?RQ(t,e):k.TypeGuard.IsLiteral(t)?PQ(t,e):k.TypeGuard.IsNever(t)?_Q(t,e):k.TypeGuard.IsNull(t)?AQ(t,e):k.TypeGuard.IsNumber(t)?OQ(t,e):k.TypeGuard.IsObject(t)?BQ(t,e):k.TypeGuard.IsRecord(t)?jQ(t,e):k.TypeGuard.IsString(t)?GQ(t,e):k.TypeGuard.IsSymbol(t)?KQ(t,e):k.TypeGuard.IsTuple(t)?JQ(t,e):k.TypeGuard.IsPromise(t)?NQ(t,e):k.TypeGuard.IsUint8Array(t)?QQ(t,e):k.TypeGuard.IsUndefined(t)?YQ(t,e):k.TypeGuard.IsUnion(t)?XQ(t,e):k.TypeGuard.IsUnknown(t)?ZQ(t,e):k.TypeGuard.IsVoid(t)?tY(t,e):Tc(`Unknown left type operand '${t[gE.Kind]}'`)}function nY(t,e){return Ue(t,e)}});var Ay=T(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ExtendsFromMappedResult=cY;var iY=ot(),sY=ih(),oY=tn();function rY(t,e,n,i,s){let o={};for(let r of globalThis.Object.getOwnPropertyNames(t))o[r]=(0,sY.Extends)(t[r],e,n,i,(0,oY.Clone)(s));return o}function aY(t,e,n,i,s){return rY(t.properties,e,n,i,s)}function cY(t,e,n,i,s){let o=aY(t,e,n,i,s);return(0,iY.MappedResult)(o)}});var ih=T(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});Ly.Extends=mY;var CE=le(),lY=it(),Oy=_y(),uY=Wy(),dY=Ay(),TE=Me();function pY(t,e,n,i){let s=(0,Oy.ExtendsCheck)(t,e);return s===Oy.ExtendsResult.Union?(0,lY.Union)([n,i]):s===Oy.ExtendsResult.True?n:i}function mY(t,e,n,i,s){return(0,TE.IsMappedResult)(t)?(0,dY.ExtendsFromMappedResult)(t,e,n,i,s):(0,TE.IsMappedKey)(t)?(0,CE.CreateType)((0,uY.ExtendsFromMappedKey)(t,e,n,i,s)):(0,CE.CreateType)(pY(t,e,n,i),s)}});var Wy=T(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});Uy.ExtendsFromMappedKey=wY;var hY=ot(),gY=Ft(),fY=ih(),bY=tn();function xY(t,e,n,i,s){return{[t]:(0,fY.Extends)((0,gY.Literal)(t),e,n,i,(0,bY.Clone)(s))}}function yY(t,e,n,i,s){return t.reduce((o,r)=>({...o,...xY(r,e,n,i,s)}),{})}function vY(t,e,n,i,s){return yY(t.keys,e,n,i,s)}function wY(t,e,n,i,s){let o=vY(t,e,n,i,s);return(0,hY.MappedResult)(o)}});var kE=T(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:!0});Fy.ExtendsUndefinedCheck=oh;var sh=re();function SY(t){return t.allOf.every(e=>oh(e))}function CY(t){return t.anyOf.some(e=>oh(e))}function TY(t){return!oh(t.not)}function oh(t){return t[sh.Kind]==="Intersect"?SY(t):t[sh.Kind]==="Union"?CY(t):t[sh.Kind]==="Not"?TY(t):t[sh.Kind]==="Undefined"}});var kc=T(ni=>{"use strict";var kY=ni&&ni.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Lu=ni&&ni.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&kY(e,t,n)};Object.defineProperty(ni,"__esModule",{value:!0});Lu(_y(),ni);Lu(Wy(),ni);Lu(Ay(),ni);Lu(kE(),ni);Lu(ih(),ni)});var $y=T(Dy=>{"use strict";Object.defineProperty(Dy,"__esModule",{value:!0});Dy.ExcludeFromTemplateLiteral=RY;var MY=rh(),IY=Si();function RY(t,e){return(0,MY.Exclude)((0,IY.TemplateLiteralToUnion)(t),e)}});var rh=T(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});jy.Exclude=LY;var By=le(),PY=it(),_Y=vt(),ah=kc(),EY=qy(),AY=$y(),Ny=Me();function OY(t,e){let n=t.filter(i=>(0,ah.ExtendsCheck)(i,e)===ah.ExtendsResult.False);return n.length===1?n[0]:(0,PY.Union)(n)}function LY(t,e,n={}){return(0,Ny.IsTemplateLiteral)(t)?(0,By.CreateType)((0,AY.ExcludeFromTemplateLiteral)(t,e),n):(0,Ny.IsMappedResult)(t)?(0,By.CreateType)((0,EY.ExcludeFromMappedResult)(t,e),n):(0,By.CreateType)((0,Ny.IsUnion)(t)?OY(t.anyOf,e):(0,ah.ExtendsCheck)(t,e)!==ah.ExtendsResult.False?(0,_Y.Never)():t,n)}});var qy=T(Gy=>{"use strict";Object.defineProperty(Gy,"__esModule",{value:!0});Gy.ExcludeFromMappedResult=$Y;var WY=ot(),UY=rh();function FY(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,UY.Exclude)(t[i],e);return n}function DY(t,e){return FY(t.properties,e)}function $Y(t,e){let n=DY(t,e);return(0,WY.MappedResult)(n)}});var ch=T(as=>{"use strict";var BY=as&&as.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ky=as&&as.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&BY(e,t,n)};Object.defineProperty(as,"__esModule",{value:!0});Ky(qy(),as);Ky($y(),as);Ky(rh(),as)});var zy=T(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.ExtractFromTemplateLiteral=qY;var NY=lh(),jY=Si();function qY(t,e){return(0,NY.Extract)((0,jY.TemplateLiteralToUnion)(t),e)}});var lh=T(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});Qy.Extract=JY;var Vy=le(),GY=it(),KY=vt(),uh=kc(),HY=Yy(),zY=zy(),Jy=Me();function VY(t,e){let n=t.filter(i=>(0,uh.ExtendsCheck)(i,e)!==uh.ExtendsResult.False);return n.length===1?n[0]:(0,GY.Union)(n)}function JY(t,e,n){return(0,Jy.IsTemplateLiteral)(t)?(0,Vy.CreateType)((0,zY.ExtractFromTemplateLiteral)(t,e),n):(0,Jy.IsMappedResult)(t)?(0,Vy.CreateType)((0,HY.ExtractFromMappedResult)(t,e),n):(0,Vy.CreateType)((0,Jy.IsUnion)(t)?VY(t.anyOf,e):(0,uh.ExtendsCheck)(t,e)!==uh.ExtendsResult.False?t:(0,KY.Never)(),n)}});var Yy=T(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.ExtractFromMappedResult=eX;var QY=ot(),YY=lh();function XY(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,YY.Extract)(t[i],e);return n}function ZY(t,e){return XY(t.properties,e)}function eX(t,e){let n=ZY(t,e);return(0,QY.MappedResult)(n)}});var dh=T(cs=>{"use strict";var tX=cs&&cs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Zy=cs&&cs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&tX(e,t,n)};Object.defineProperty(cs,"__esModule",{value:!0});Zy(Yy(),cs);Zy(zy(),cs);Zy(lh(),cs)});var ME=T(ls=>{"use strict";var nX=ls&&ls.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),iX=ls&&ls.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),sX=ls&&ls.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&nX(n,e,i[s]);return iX(n,e),n}})();Object.defineProperty(ls,"__esModule",{value:!0});ls.InstanceType=cX;var oX=le(),rX=vt(),aX=sX(Me());function cX(t,e){return aX.IsConstructor(t)?(0,oX.CreateType)(t.returns,e):(0,rX.Never)(e)}});var ph=T(Cr=>{"use strict";var lX=Cr&&Cr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),uX=Cr&&Cr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&lX(e,t,n)};Object.defineProperty(Cr,"__esModule",{value:!0});uX(ME(),Cr)});var IE=T(ev=>{"use strict";Object.defineProperty(ev,"__esModule",{value:!0});ev.ReadonlyOptional=mX;var dX=zs(),pX=wi();function mX(t){return(0,dX.Readonly)((0,pX.Optional)(t))}});var Wu=T(Tr=>{"use strict";var hX=Tr&&Tr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gX=Tr&&Tr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hX(e,t,n)};Object.defineProperty(Tr,"__esModule",{value:!0});gX(IE(),Tr)});var AE=T(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.Record=AX;Mc.RecordPattern=nv;Mc.RecordKey=OX;Mc.RecordValue=LX;var fX=le(),PE=re(),bX=vt(),xX=Gs(),_E=rn(),RE=ir(),yX=it(),vX=Si(),kr=fu(),EE=ti(),wX=Ut(),ki=Me();function Mr(t,e,n){return(0,fX.CreateType)({[PE.Kind]:"Record",type:"object",patternProperties:{[t]:e}},n)}function tv(t,e,n){let i={};for(let s of t)i[s]=e;return(0,_E.Object)(i,{...n,[PE.Hint]:"Record"})}function SX(t,e,n){return(0,vX.IsTemplateLiteralFinite)(t)?tv((0,EE.IndexPropertyKeys)(t),e,n):Mr(t.pattern,e,n)}function CX(t,e,n){return tv((0,EE.IndexPropertyKeys)((0,yX.Union)(t)),e,n)}function TX(t,e,n){return tv([t.toString()],e,n)}function kX(t,e,n){return Mr(t.source,e,n)}function MX(t,e,n){let i=(0,wX.IsUndefined)(t.pattern)?kr.PatternStringExact:t.pattern;return Mr(i,e,n)}function IX(t,e,n){return Mr(kr.PatternStringExact,e,n)}function RX(t,e,n){return Mr(kr.PatternNeverExact,e,n)}function PX(t,e,n){return(0,_E.Object)({true:e,false:e},n)}function _X(t,e,n){return Mr(kr.PatternNumberExact,e,n)}function EX(t,e,n){return Mr(kr.PatternNumberExact,e,n)}function AX(t,e,n={}){return(0,ki.IsUnion)(t)?CX(t.anyOf,e,n):(0,ki.IsTemplateLiteral)(t)?SX(t,e,n):(0,ki.IsLiteral)(t)?TX(t.const,e,n):(0,ki.IsBoolean)(t)?PX(t,e,n):(0,ki.IsInteger)(t)?_X(t,e,n):(0,ki.IsNumber)(t)?EX(t,e,n):(0,ki.IsRegExp)(t)?kX(t,e,n):(0,ki.IsString)(t)?MX(t,e,n):(0,ki.IsAny)(t)?IX(t,e,n):(0,ki.IsNever)(t)?RX(t,e,n):(0,bX.Never)(n)}function nv(t){return globalThis.Object.getOwnPropertyNames(t.patternProperties)[0]}function OX(t){let e=nv(t);return e===kr.PatternStringExact?(0,RE.String)():e===kr.PatternNumberExact?(0,xX.Number)():(0,RE.String)({pattern:e})}function LX(t){return t.patternProperties[nv(t)]}});var Ic=T(Ir=>{"use strict";var WX=Ir&&Ir.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),UX=Ir&&Ir.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WX(e,t,n)};Object.defineProperty(Ir,"__esModule",{value:!0});UX(AE(),Ir)});var LE=T(Mi=>{"use strict";var FX=Mi&&Mi.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),DX=Mi&&Mi.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),OE=Mi&&Mi.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&FX(n,e,i[s]);return DX(n,e),n}})();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.FromTypes=Rc;Mi.Instantiate=rZ;var $X=km(),BX=xr(),NX=Wu(),jX=zs(),qX=wi(),GX=rn(),iv=Ic(),KX=OE(Ut()),ln=OE(Me());function HX(t,e){return e.parameters=Rc(t,e.parameters),e.returns=ii(t,e.returns),e}function zX(t,e){return e.parameters=Rc(t,e.parameters),e.returns=ii(t,e.returns),e}function VX(t,e){return e.allOf=Rc(t,e.allOf),e}function JX(t,e){return e.anyOf=Rc(t,e.anyOf),e}function QX(t,e){return KX.IsUndefined(e.items)||(e.items=Rc(t,e.items)),e}function YX(t,e){return e.items=ii(t,e.items),e}function XX(t,e){return e.items=ii(t,e.items),e}function ZX(t,e){return e.items=ii(t,e.items),e}function eZ(t,e){return e.item=ii(t,e.item),e}function tZ(t,e){let n=oZ(t,e.properties);return{...e,...(0,GX.Object)(n)}}function nZ(t,e){let n=ii(t,(0,iv.RecordKey)(e)),i=ii(t,(0,iv.RecordValue)(e)),s=(0,iv.Record)(n,i);return{...e,...s}}function iZ(t,e){return e.index in t?t[e.index]:(0,BX.Unknown)()}function sZ(t,e){let n=ln.IsReadonly(e),i=ln.IsOptional(e),s=ii(t,e);return n&&i?(0,NX.ReadonlyOptional)(s):n&&!i?(0,jX.Readonly)(s):!n&&i?(0,qX.Optional)(s):s}function oZ(t,e){return globalThis.Object.getOwnPropertyNames(e).reduce((n,i)=>({...n,[i]:sZ(t,e[i])}),{})}function Rc(t,e){return e.map(n=>ii(t,n))}function ii(t,e){return ln.IsConstructor(e)?HX(t,e):ln.IsFunction(e)?zX(t,e):ln.IsIntersect(e)?VX(t,e):ln.IsUnion(e)?JX(t,e):ln.IsTuple(e)?QX(t,e):ln.IsArray(e)?YX(t,e):ln.IsAsyncIterator(e)?XX(t,e):ln.IsIterator(e)?ZX(t,e):ln.IsPromise(e)?eZ(t,e):ln.IsObject(e)?tZ(t,e):ln.IsRecord(e)?nZ(t,e):ln.IsArgument(e)?iZ(t,e):e}function rZ(t,e){return ii(e,(0,$X.CloneType)(t))}});var mh=T(Rr=>{"use strict";var aZ=Rr&&Rr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cZ=Rr&&Rr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aZ(e,t,n)};Object.defineProperty(Rr,"__esModule",{value:!0});cZ(LE(),Rr)});var WE=T(sv=>{"use strict";Object.defineProperty(sv,"__esModule",{value:!0});sv.Integer=dZ;var lZ=le(),uZ=re();function dZ(t){return(0,lZ.CreateType)({[uZ.Kind]:"Integer",type:"integer"},t)}});var hh=T(Pr=>{"use strict";var pZ=Pr&&Pr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mZ=Pr&&Pr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&pZ(e,t,n)};Object.defineProperty(Pr,"__esModule",{value:!0});mZ(WE(),Pr)});var rv=T(ov=>{"use strict";Object.defineProperty(ov,"__esModule",{value:!0});ov.IntrinsicFromMappedKey=wZ;var hZ=ot(),gZ=_r(),fZ=Ft(),bZ=tn();function xZ(t,e,n){return{[t]:(0,gZ.Intrinsic)((0,fZ.Literal)(t),e,(0,bZ.Clone)(n))}}function yZ(t,e,n){return t.reduce((s,o)=>({...s,...xZ(o,e,n)}),{})}function vZ(t,e,n){return yZ(t.keys,e,n)}function wZ(t,e,n){let i=vZ(t,e,n);return(0,hZ.MappedResult)(i)}});var _r=T(av=>{"use strict";Object.defineProperty(av,"__esModule",{value:!0});av.Intrinsic=BE;var SZ=le(),gh=Si(),CZ=rv(),UE=Ft(),FE=it(),fh=Me();function TZ(t){let[e,n]=[t.slice(0,1),t.slice(1)];return[e.toLowerCase(),n].join("")}function kZ(t){let[e,n]=[t.slice(0,1),t.slice(1)];return[e.toUpperCase(),n].join("")}function MZ(t){return t.toUpperCase()}function IZ(t){return t.toLowerCase()}function RZ(t,e,n){let i=(0,gh.TemplateLiteralParseExact)(t.pattern);if(!(0,gh.IsTemplateLiteralExpressionFinite)(i))return{...t,pattern:DE(t.pattern,e)};let r=[...(0,gh.TemplateLiteralExpressionGenerate)(i)].map(l=>(0,UE.Literal)(l)),a=$E(r,e),c=(0,FE.Union)(a);return(0,gh.TemplateLiteral)([c],n)}function DE(t,e){return typeof t=="string"?e==="Uncapitalize"?TZ(t):e==="Capitalize"?kZ(t):e==="Uppercase"?MZ(t):e==="Lowercase"?IZ(t):t:t.toString()}function $E(t,e){return t.map(n=>BE(n,e))}function BE(t,e,n={}){return(0,fh.IsMappedKey)(t)?(0,CZ.IntrinsicFromMappedKey)(t,e,n):(0,fh.IsTemplateLiteral)(t)?RZ(t,e,n):(0,fh.IsUnion)(t)?(0,FE.Union)($E(t.anyOf,e),n):(0,fh.IsLiteral)(t)?(0,UE.Literal)(DE(t.const,e),n):(0,SZ.CreateType)(t,n)}});var NE=T(cv=>{"use strict";Object.defineProperty(cv,"__esModule",{value:!0});cv.Capitalize=_Z;var PZ=_r();function _Z(t,e={}){return(0,PZ.Intrinsic)(t,"Capitalize",e)}});var jE=T(lv=>{"use strict";Object.defineProperty(lv,"__esModule",{value:!0});lv.Lowercase=AZ;var EZ=_r();function AZ(t,e={}){return(0,EZ.Intrinsic)(t,"Lowercase",e)}});var qE=T(uv=>{"use strict";Object.defineProperty(uv,"__esModule",{value:!0});uv.Uncapitalize=LZ;var OZ=_r();function LZ(t,e={}){return(0,OZ.Intrinsic)(t,"Uncapitalize",e)}});var GE=T(dv=>{"use strict";Object.defineProperty(dv,"__esModule",{value:!0});dv.Uppercase=UZ;var WZ=_r();function UZ(t,e={}){return(0,WZ.Intrinsic)(t,"Uppercase",e)}});var bh=T(jn=>{"use strict";var FZ=jn&&jn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Pc=jn&&jn.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&FZ(e,t,n)};Object.defineProperty(jn,"__esModule",{value:!0});Pc(NE(),jn);Pc(rv(),jn);Pc(_r(),jn);Pc(jE(),jn);Pc(qE(),jn);Pc(GE(),jn)});var mv=T(pv=>{"use strict";Object.defineProperty(pv,"__esModule",{value:!0});pv.OmitFromMappedResult=qZ;var DZ=ot(),$Z=xh(),BZ=tn();function NZ(t,e,n){let i={};for(let s of globalThis.Object.getOwnPropertyNames(t))i[s]=(0,$Z.Omit)(t[s],e,(0,BZ.Clone)(n));return i}function jZ(t,e,n){return NZ(t.properties,e,n)}function qZ(t,e,n){let i=jZ(t,e,n);return(0,DZ.MappedResult)(i)}});var xh=T(fv=>{"use strict";Object.defineProperty(fv,"__esModule",{value:!0});fv.Omit=oee;var GZ=le(),KZ=Am(),HZ=pu(),hv=js(),zZ=Ft(),VZ=ti(),JZ=Cn(),KE=it(),HE=rn(),QZ=bv(),YZ=mv(),us=Me(),XZ=Ut();function ZZ(t,e){return t.map(n=>gv(n,e))}function eee(t,e){return t.map(n=>gv(n,e))}function tee(t,e){let{[e]:n,...i}=t;return i}function nee(t,e){return e.reduce((n,i)=>tee(n,i),t)}function iee(t,e,n){let i=(0,KZ.Discard)(t,[HZ.TransformKind,"$id","required","properties"]),s=nee(n,e);return(0,HE.Object)(s,i)}function see(t){let e=t.reduce((n,i)=>(0,us.IsLiteralValue)(i)?[...n,(0,zZ.Literal)(i)]:n,[]);return(0,KE.Union)(e)}function gv(t,e){return(0,us.IsIntersect)(t)?(0,JZ.Intersect)(ZZ(t.allOf,e)):(0,us.IsUnion)(t)?(0,KE.Union)(eee(t.anyOf,e)):(0,us.IsObject)(t)?iee(t,e,t.properties):(0,HE.Object)({})}function oee(t,e,n){let i=(0,XZ.IsArray)(e)?see(e):e,s=(0,us.IsSchema)(e)?(0,VZ.IndexPropertyKeys)(e):e,o=(0,us.IsRef)(t),r=(0,us.IsRef)(e);return(0,us.IsMappedResult)(t)?(0,YZ.OmitFromMappedResult)(t,s,n):(0,us.IsMappedKey)(e)?(0,QZ.OmitFromMappedKey)(t,e,n):o&&r?(0,hv.Computed)("Omit",[t,i],n):!o&&r?(0,hv.Computed)("Omit",[t,i],n):o&&!r?(0,hv.Computed)("Omit",[t,i],n):(0,GZ.CreateType)({...gv(t,s),...n})}});var bv=T(xv=>{"use strict";Object.defineProperty(xv,"__esModule",{value:!0});xv.OmitFromMappedKey=pee;var ree=ot(),aee=xh(),cee=tn();function lee(t,e,n){return{[e]:(0,aee.Omit)(t,[e],(0,cee.Clone)(n))}}function uee(t,e,n){return e.reduce((i,s)=>({...i,...lee(t,s,n)}),{})}function dee(t,e,n){return uee(t,e.keys,n)}function pee(t,e,n){let i=dee(t,e,n);return(0,ree.MappedResult)(i)}});var Uu=T(ds=>{"use strict";var mee=ds&&ds.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yv=ds&&ds.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&mee(e,t,n)};Object.defineProperty(ds,"__esModule",{value:!0});yv(bv(),ds);yv(mv(),ds);yv(xh(),ds)});var wv=T(vv=>{"use strict";Object.defineProperty(vv,"__esModule",{value:!0});vv.PickFromMappedResult=yee;var hee=ot(),gee=yh(),fee=tn();function bee(t,e,n){let i={};for(let s of globalThis.Object.getOwnPropertyNames(t))i[s]=(0,gee.Pick)(t[s],e,(0,fee.Clone)(n));return i}function xee(t,e,n){return bee(t.properties,e,n)}function yee(t,e,n){let i=xee(t,e,n);return(0,hee.MappedResult)(i)}});var yh=T(Tv=>{"use strict";Object.defineProperty(Tv,"__esModule",{value:!0});Tv.Pick=Lee;var vee=le(),wee=Am(),Sv=js(),See=Cn(),Cee=Ft(),zE=rn(),VE=it(),Tee=ti(),kee=pu(),ps=Me(),Mee=Ut(),Iee=kv(),Ree=wv();function Pee(t,e){return t.map(n=>Cv(n,e))}function _ee(t,e){return t.map(n=>Cv(n,e))}function Eee(t,e){let n={};for(let i of e)i in t&&(n[i]=t[i]);return n}function Aee(t,e,n){let i=(0,wee.Discard)(t,[kee.TransformKind,"$id","required","properties"]),s=Eee(n,e);return(0,zE.Object)(s,i)}function Oee(t){let e=t.reduce((n,i)=>(0,ps.IsLiteralValue)(i)?[...n,(0,Cee.Literal)(i)]:n,[]);return(0,VE.Union)(e)}function Cv(t,e){return(0,ps.IsIntersect)(t)?(0,See.Intersect)(Pee(t.allOf,e)):(0,ps.IsUnion)(t)?(0,VE.Union)(_ee(t.anyOf,e)):(0,ps.IsObject)(t)?Aee(t,e,t.properties):(0,zE.Object)({})}function Lee(t,e,n){let i=(0,Mee.IsArray)(e)?Oee(e):e,s=(0,ps.IsSchema)(e)?(0,Tee.IndexPropertyKeys)(e):e,o=(0,ps.IsRef)(t),r=(0,ps.IsRef)(e);return(0,ps.IsMappedResult)(t)?(0,Ree.PickFromMappedResult)(t,s,n):(0,ps.IsMappedKey)(e)?(0,Iee.PickFromMappedKey)(t,e,n):o&&r?(0,Sv.Computed)("Pick",[t,i],n):!o&&r?(0,Sv.Computed)("Pick",[t,i],n):o&&!r?(0,Sv.Computed)("Pick",[t,i],n):(0,vee.CreateType)({...Cv(t,s),...n})}});var kv=T(Mv=>{"use strict";Object.defineProperty(Mv,"__esModule",{value:!0});Mv.PickFromMappedKey=Nee;var Wee=ot(),Uee=yh(),Fee=tn();function Dee(t,e,n){return{[e]:(0,Uee.Pick)(t,[e],(0,Fee.Clone)(n))}}function $ee(t,e,n){return e.reduce((i,s)=>({...i,...Dee(t,s,n)}),{})}function Bee(t,e,n){return $ee(t,e.keys,n)}function Nee(t,e,n){let i=Bee(t,e,n);return(0,Wee.MappedResult)(i)}});var Fu=T(ms=>{"use strict";var jee=ms&&ms.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Iv=ms&&ms.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jee(e,t,n)};Object.defineProperty(ms,"__esModule",{value:!0});Iv(kv(),ms);Iv(wv(),ms);Iv(yh(),ms)});var Pv=T(hs=>{"use strict";var qee=hs&&hs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Gee=hs&&hs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Kee=hs&&hs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&qee(n,e,i[s]);return Gee(n,e),n}})();Object.defineProperty(hs,"__esModule",{value:!0});hs.Partial=ste;var Hee=le(),Rv=js(),zee=wi(),QE=rn(),Vee=Cn(),Jee=it(),Qee=Js(),Yee=es(),Xee=re(),Zee=_v(),$t=Kee(Me());function ete(t,e){return(0,Rv.Computed)("Partial",[(0,Rv.Computed)(t,e)])}function tte(t){return(0,Rv.Computed)("Partial",[(0,Qee.Ref)(t)])}function nte(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,zee.Optional)(t[n]);return e}function ite(t,e){let n=(0,Yee.Discard)(t,[Xee.TransformKind,"$id","required","properties"]),i=nte(e);return(0,QE.Object)(i,n)}function JE(t){return t.map(e=>YE(e))}function YE(t){return $t.IsComputed(t)?ete(t.target,t.parameters):$t.IsRef(t)?tte(t.$ref):$t.IsIntersect(t)?(0,Vee.Intersect)(JE(t.allOf)):$t.IsUnion(t)?(0,Jee.Union)(JE(t.anyOf)):$t.IsObject(t)?ite(t,t.properties):$t.IsBigInt(t)||$t.IsBoolean(t)||$t.IsInteger(t)||$t.IsLiteral(t)||$t.IsNull(t)||$t.IsNumber(t)||$t.IsString(t)||$t.IsSymbol(t)||$t.IsUndefined(t)?t:(0,QE.Object)({})}function ste(t,e){return $t.IsMappedResult(t)?(0,Zee.PartialFromMappedResult)(t,e):(0,Hee.CreateType)({...YE(t),...e})}});var _v=T(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.PartialFromMappedResult=ute;var ote=ot(),rte=Pv(),ate=tn();function cte(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,rte.Partial)(t[i],(0,ate.Clone)(e));return n}function lte(t,e){return cte(t.properties,e)}function ute(t,e){let n=lte(t,e);return(0,ote.MappedResult)(n)}});var Du=T(Qs=>{"use strict";var dte=Qs&&Qs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),XE=Qs&&Qs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&dte(e,t,n)};Object.defineProperty(Qs,"__esModule",{value:!0});XE(_v(),Qs);XE(Pv(),Qs)});var Ov=T(gs=>{"use strict";var pte=gs&&gs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),mte=gs&&gs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),hte=gs&&gs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&pte(n,e,i[s]);return mte(n,e),n}})();Object.defineProperty(gs,"__esModule",{value:!0});gs.Required=Tte;var gte=le(),Av=js(),eA=rn(),fte=Cn(),bte=it(),xte=Js(),tA=re(),nA=es(),yte=Lv(),Bt=hte(Me());function vte(t,e){return(0,Av.Computed)("Required",[(0,Av.Computed)(t,e)])}function wte(t){return(0,Av.Computed)("Required",[(0,xte.Ref)(t)])}function Ste(t){let e={};for(let n of globalThis.Object.getOwnPropertyNames(t))e[n]=(0,nA.Discard)(t[n],[tA.OptionalKind]);return e}function Cte(t,e){let n=(0,nA.Discard)(t,[tA.TransformKind,"$id","required","properties"]),i=Ste(e);return(0,eA.Object)(i,n)}function ZE(t){return t.map(e=>iA(e))}function iA(t){return Bt.IsComputed(t)?vte(t.target,t.parameters):Bt.IsRef(t)?wte(t.$ref):Bt.IsIntersect(t)?(0,fte.Intersect)(ZE(t.allOf)):Bt.IsUnion(t)?(0,bte.Union)(ZE(t.anyOf)):Bt.IsObject(t)?Cte(t,t.properties):Bt.IsBigInt(t)||Bt.IsBoolean(t)||Bt.IsInteger(t)||Bt.IsLiteral(t)||Bt.IsNull(t)||Bt.IsNumber(t)||Bt.IsString(t)||Bt.IsSymbol(t)||Bt.IsUndefined(t)?t:(0,eA.Object)({})}function Tte(t,e){return Bt.IsMappedResult(t)?(0,yte.RequiredFromMappedResult)(t,e):(0,gte.CreateType)({...iA(t),...e})}});var Lv=T(Wv=>{"use strict";Object.defineProperty(Wv,"__esModule",{value:!0});Wv.RequiredFromMappedResult=Pte;var kte=ot(),Mte=Ov();function Ite(t,e){let n={};for(let i of globalThis.Object.getOwnPropertyNames(t))n[i]=(0,Mte.Required)(t[i],e);return n}function Rte(t,e){return Ite(t.properties,e)}function Pte(t,e){let n=Rte(t,e);return(0,kte.MappedResult)(n)}});var $u=T(Ys=>{"use strict";var _te=Ys&&Ys.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),sA=Ys&&Ys.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&_te(e,t,n)};Object.defineProperty(Ys,"__esModule",{value:!0});sA(Lv(),Ys);sA(Ov(),Ys)});var cA=T(si=>{"use strict";var Ete=si&&si.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ate=si&&si.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ote=si&&si.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Ete(n,e,i[s]);return Ate(n,e),n}})();Object.defineProperty(si,"__esModule",{value:!0});si.FromType=dn;si.ComputeType=aA;si.ComputeModuleProperties=bne;var un=Xi(),Lte=$b(),oA=es(),Wte=pc(),Ute=Ru(),Fte=mc(),Dte=hc(),$te=ti(),Bte=qs(),Nte=Cn(),jte=vc(),qte=Sc(),Gte=rn(),Kte=Uu(),Hte=Fu(),Uv=vt(),zte=Du(),rA=Ic(),Vte=$u(),Jte=is(),Qte=it(),vh=re(),Mt=Ote(Me());function Yte(t,e){return e.map(n=>Mt.IsRef(n)?Fv(t,n.$ref):dn(t,n))}function Fv(t,e){return e in t?Mt.IsRef(t[e])?Fv(t,t[e].$ref):dn(t,t[e]):(0,Uv.Never)()}function Xte(t){return(0,Ute.Awaited)(t[0])}function Zte(t){return(0,$te.Index)(t[0],t[1])}function ene(t){return(0,qte.KeyOf)(t[0])}function tne(t){return(0,zte.Partial)(t[0])}function nne(t){return(0,Kte.Omit)(t[0],t[1])}function ine(t){return(0,Hte.Pick)(t[0],t[1])}function sne(t){return(0,Vte.Required)(t[0])}function one(t,e,n){let i=Yte(t,n);return e==="Awaited"?Xte(i):e==="Index"?Zte(i):e==="KeyOf"?ene(i):e==="Partial"?tne(i):e==="Omit"?nne(i):e==="Pick"?ine(i):e==="Required"?sne(i):(0,Uv.Never)()}function rne(t,e){return(0,Wte.Array)(dn(t,e))}function ane(t,e){return(0,Fte.AsyncIterator)(dn(t,e))}function cne(t,e,n){return(0,Dte.Constructor)(Bu(t,e),dn(t,n))}function lne(t,e,n){return(0,Bte.Function)(Bu(t,e),dn(t,n))}function une(t,e){return(0,Nte.Intersect)(Bu(t,e))}function dne(t,e){return(0,jte.Iterator)(dn(t,e))}function pne(t,e){return(0,Gte.Object)(globalThis.Object.keys(e).reduce((n,i)=>({...n,[i]:dn(t,e[i])}),{}))}function mne(t,e){let[n,i]=[dn(t,(0,rA.RecordValue)(e)),(0,rA.RecordPattern)(e)],s=(0,Lte.CloneType)(e);return s.patternProperties[i]=n,s}function hne(t,e){return Mt.IsRef(e)?{...Fv(t,e.$ref),[vh.TransformKind]:e[vh.TransformKind]}:e}function gne(t,e){return(0,Jte.Tuple)(Bu(t,e))}function fne(t,e){return(0,Qte.Union)(Bu(t,e))}function Bu(t,e){return e.map(n=>dn(t,n))}function dn(t,e){return Mt.IsOptional(e)?(0,un.CreateType)(dn(t,(0,oA.Discard)(e,[vh.OptionalKind])),e):Mt.IsReadonly(e)?(0,un.CreateType)(dn(t,(0,oA.Discard)(e,[vh.ReadonlyKind])),e):Mt.IsTransform(e)?(0,un.CreateType)(hne(t,e),e):Mt.IsArray(e)?(0,un.CreateType)(rne(t,e.items),e):Mt.IsAsyncIterator(e)?(0,un.CreateType)(ane(t,e.items),e):Mt.IsComputed(e)?(0,un.CreateType)(one(t,e.target,e.parameters)):Mt.IsConstructor(e)?(0,un.CreateType)(cne(t,e.parameters,e.returns),e):Mt.IsFunction(e)?(0,un.CreateType)(lne(t,e.parameters,e.returns),e):Mt.IsIntersect(e)?(0,un.CreateType)(une(t,e.allOf),e):Mt.IsIterator(e)?(0,un.CreateType)(dne(t,e.items),e):Mt.IsObject(e)?(0,un.CreateType)(pne(t,e.properties),e):Mt.IsRecord(e)?(0,un.CreateType)(mne(t,e)):Mt.IsTuple(e)?(0,un.CreateType)(gne(t,e.items||[]),e):Mt.IsUnion(e)?(0,un.CreateType)(fne(t,e.anyOf),e):e}function aA(t,e){return e in t?dn(t,t[e]):(0,Uv.Never)()}function bne(t){return globalThis.Object.getOwnPropertyNames(t).reduce((e,n)=>({...e,[n]:aA(t,n)}),{})}});var uA=T(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.TModule=void 0;Nu.Module=vne;var lA=Xi(),xne=re(),yne=cA(),wh=class{constructor(e){let n=(0,yne.ComputeModuleProperties)(e),i=this.WithIdentifiers(n);this.$defs=i}Import(e,n){let i={...this.$defs,[e]:(0,lA.CreateType)(this.$defs[e],n)};return(0,lA.CreateType)({[xne.Kind]:"Import",$defs:i,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((n,i)=>({...n,[i]:{...e[i],$id:i}}),{})}};Nu.TModule=wh;function vne(t){return new wh(t)}});var Sh=T(Er=>{"use strict";var wne=Er&&Er.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Sne=Er&&Er.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&wne(e,t,n)};Object.defineProperty(Er,"__esModule",{value:!0});Sne(uA(),Er)});var dA=T(Dv=>{"use strict";Object.defineProperty(Dv,"__esModule",{value:!0});Dv.Not=kne;var Cne=le(),Tne=re();function kne(t,e){return(0,Cne.CreateType)({[Tne.Kind]:"Not",not:t},e)}});var Ch=T(Ar=>{"use strict";var Mne=Ar&&Ar.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Ine=Ar&&Ar.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Mne(e,t,n)};Object.defineProperty(Ar,"__esModule",{value:!0});Ine(dA(),Ar)});var pA=T(fs=>{"use strict";var Rne=fs&&fs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Pne=fs&&fs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),_ne=fs&&fs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Rne(n,e,i[s]);return Pne(n,e),n}})();Object.defineProperty(fs,"__esModule",{value:!0});fs.Parameters=Lne;var Ene=is(),Ane=vt(),One=_ne(Me());function Lne(t,e){return One.IsFunction(t)?(0,Ene.Tuple)(t.parameters,e):(0,Ane.Never)()}});var Th=T(Or=>{"use strict";var Wne=Or&&Or.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Une=Or&&Or.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Wne(e,t,n)};Object.defineProperty(Or,"__esModule",{value:!0});Une(pA(),Or)});var hA=T($v=>{"use strict";Object.defineProperty($v,"__esModule",{value:!0});$v.Recursive=Nne;var Fne=km(),Dne=le(),$ne=Ut(),mA=re(),Bne=0;function Nne(t,e={}){(0,$ne.IsUndefined)(e.$id)&&(e.$id=`T${Bne++}`);let n=(0,Fne.CloneType)(t({[mA.Kind]:"This",$ref:`${e.$id}`}));return n.$id=e.$id,(0,Dne.CreateType)({[mA.Hint]:"Recursive",...n},e)}});var kh=T(Lr=>{"use strict";var jne=Lr&&Lr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),qne=Lr&&Lr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jne(e,t,n)};Object.defineProperty(Lr,"__esModule",{value:!0});qne(hA(),Lr)});var gA=T(Bv=>{"use strict";Object.defineProperty(Bv,"__esModule",{value:!0});Bv.RegExp=zne;var Gne=le(),Kne=Ut(),Hne=re();function zne(t,e){let n=(0,Kne.IsString)(t)?new globalThis.RegExp(t):t;return(0,Gne.CreateType)({[Hne.Kind]:"RegExp",type:"RegExp",source:n.source,flags:n.flags},e)}});var Mh=T(Wr=>{"use strict";var Vne=Wr&&Wr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Jne=Wr&&Wr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Vne(e,t,n)};Object.defineProperty(Wr,"__esModule",{value:!0});Jne(gA(),Wr)});var fA=T(jv=>{"use strict";Object.defineProperty(jv,"__esModule",{value:!0});jv.Rest=Yne;var Nv=Me();function Qne(t){return(0,Nv.IsIntersect)(t)?t.allOf:(0,Nv.IsUnion)(t)?t.anyOf:(0,Nv.IsTuple)(t)?t.items??[]:[]}function Yne(t){return Qne(t)}});var Ih=T(Ur=>{"use strict";var Xne=Ur&&Ur.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Zne=Ur&&Ur.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Xne(e,t,n)};Object.defineProperty(Ur,"__esModule",{value:!0});Zne(fA(),Ur)});var bA=T(bs=>{"use strict";var eie=bs&&bs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),tie=bs&&bs.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),nie=bs&&bs.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&eie(n,e,i[s]);return tie(n,e),n}})();Object.defineProperty(bs,"__esModule",{value:!0});bs.ReturnType=rie;var iie=le(),sie=vt(),oie=nie(Me());function rie(t,e){return oie.IsFunction(t)?(0,iie.CreateType)(t.returns,e):(0,sie.Never)(e)}});var Rh=T(Fr=>{"use strict";var aie=Fr&&Fr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),cie=Fr&&Fr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&aie(e,t,n)};Object.defineProperty(Fr,"__esModule",{value:!0});cie(bA(),Fr)});var yA=T(xA=>{"use strict";Object.defineProperty(xA,"__esModule",{value:!0})});var wA=T(vA=>{"use strict";Object.defineProperty(vA,"__esModule",{value:!0});var wEe=re()});var CA=T(Xs=>{"use strict";var lie=Xs&&Xs.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),SA=Xs&&Xs.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&lie(e,t,n)};Object.defineProperty(Xs,"__esModule",{value:!0});SA(yA(),Xs);SA(wA(),Xs)});var kA=T(TA=>{"use strict";Object.defineProperty(TA,"__esModule",{value:!0})});var MA=T(Dr=>{"use strict";var uie=Dr&&Dr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),die=Dr&&Dr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uie(e,t,n)};Object.defineProperty(Dr,"__esModule",{value:!0});die(kA(),Dr)});var IA=T($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.TransformEncodeBuilder=$r.TransformDecodeBuilder=void 0;$r.Transform=mie;var Ph=re(),pie=Me(),_h=class{constructor(e){this.schema=e}Decode(e){return new Eh(this.schema,e)}};$r.TransformDecodeBuilder=_h;var Eh=class{constructor(e,n){this.schema=e,this.decode=n}EncodeTransform(e,n){let o={Encode:r=>n[Ph.TransformKind].Encode(e(r)),Decode:r=>this.decode(n[Ph.TransformKind].Decode(r))};return{...n,[Ph.TransformKind]:o}}EncodeSchema(e,n){let i={Decode:this.decode,Encode:e};return{...n,[Ph.TransformKind]:i}}Encode(e){return(0,pie.IsTransform)(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};$r.TransformEncodeBuilder=Eh;function mie(t){return new _h(t)}});var Ah=T(Br=>{"use strict";var hie=Br&&Br.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),gie=Br&&Br.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&hie(e,t,n)};Object.defineProperty(Br,"__esModule",{value:!0});gie(IA(),Br)});var PA=T(qv=>{"use strict";Object.defineProperty(qv,"__esModule",{value:!0});qv.Unsafe=bie;var fie=le(),RA=re();function bie(t={}){return(0,fie.CreateType)({[RA.Kind]:t[RA.Kind]??"Unsafe"},t)}});var Oh=T(Nr=>{"use strict";var xie=Nr&&Nr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),yie=Nr&&Nr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&xie(e,t,n)};Object.defineProperty(Nr,"__esModule",{value:!0});yie(PA(),Nr)});var _A=T(Gv=>{"use strict";Object.defineProperty(Gv,"__esModule",{value:!0});Gv.Void=Sie;var vie=le(),wie=re();function Sie(t){return(0,vie.CreateType)({[wie.Kind]:"Void",type:"void"},t)}});var Lh=T(jr=>{"use strict";var Cie=jr&&jr.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Tie=jr&&jr.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Cie(e,t,n)};Object.defineProperty(jr,"__esModule",{value:!0});Tie(_A(),jr)});var Hv=T(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.JsonTypeBuilder=void 0;var kie=dc(),Mie=pc(),Iie=vu(),Rie=Jm(),Pie=Ym(),_ie=Zm(),Eie=ch(),Aie=kc(),Oie=dh(),Lie=ti(),Wie=hh(),Uie=Cn(),Wh=bh(),Fie=Sc(),Die=Ft(),$ie=ot(),Bie=vt(),Nie=Ch(),jie=_u(),qie=Sh(),Gie=Gs(),Kie=rn(),Hie=Uu(),zie=wi(),Vie=Du(),Jie=Fu(),Qie=zs(),Yie=Wu(),Xie=Ic(),Zie=kh(),ese=Js(),tse=$u(),nse=Ih(),ise=ir(),sse=Si(),ose=Ah(),rse=is(),ase=it(),cse=xr(),lse=Oh(),Kv=class{ReadonlyOptional(e){return(0,Yie.ReadonlyOptional)(e)}Readonly(e,n){return(0,Qie.Readonly)(e,n??!0)}Optional(e,n){return(0,zie.Optional)(e,n??!0)}Any(e){return(0,kie.Any)(e)}Array(e,n){return(0,Mie.Array)(e,n)}Boolean(e){return(0,Iie.Boolean)(e)}Capitalize(e,n){return(0,Wh.Capitalize)(e,n)}Composite(e,n){return(0,Rie.Composite)(e,n)}Const(e,n){return(0,Pie.Const)(e,n)}Enum(e,n){return(0,_ie.Enum)(e,n)}Exclude(e,n,i){return(0,Eie.Exclude)(e,n,i)}Extends(e,n,i,s,o){return(0,Aie.Extends)(e,n,i,s,o)}Extract(e,n,i){return(0,Oie.Extract)(e,n,i)}Index(e,n,i){return(0,Lie.Index)(e,n,i)}Integer(e){return(0,Wie.Integer)(e)}Intersect(e,n){return(0,Uie.Intersect)(e,n)}KeyOf(e,n){return(0,Fie.KeyOf)(e,n)}Literal(e,n){return(0,Die.Literal)(e,n)}Lowercase(e,n){return(0,Wh.Lowercase)(e,n)}Mapped(e,n,i){return(0,$ie.Mapped)(e,n,i)}Module(e){return(0,qie.Module)(e)}Never(e){return(0,Bie.Never)(e)}Not(e,n){return(0,Nie.Not)(e,n)}Null(e){return(0,jie.Null)(e)}Number(e){return(0,Gie.Number)(e)}Object(e,n){return(0,Kie.Object)(e,n)}Omit(e,n,i){return(0,Hie.Omit)(e,n,i)}Partial(e,n){return(0,Vie.Partial)(e,n)}Pick(e,n,i){return(0,Jie.Pick)(e,n,i)}Record(e,n,i){return(0,Xie.Record)(e,n,i)}Recursive(e,n){return(0,Zie.Recursive)(e,n)}Ref(...e){return(0,ese.Ref)(e[0],e[1])}Required(e,n){return(0,tse.Required)(e,n)}Rest(e){return(0,nse.Rest)(e)}String(e){return(0,ise.String)(e)}TemplateLiteral(e,n){return(0,sse.TemplateLiteral)(e,n)}Transform(e){return(0,ose.Transform)(e)}Tuple(e,n){return(0,rse.Tuple)(e,n)}Uncapitalize(e,n){return(0,Wh.Uncapitalize)(e,n)}Union(e,n){return(0,ase.Union)(e,n)}Unknown(e){return(0,cse.Unknown)(e)}Unsafe(e){return(0,lse.Unsafe)(e)}Uppercase(e,n){return(0,Wh.Uppercase)(e,n)}};Uh.JsonTypeBuilder=Kv});var EA=T($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.Rest=$.Required=$.RegExp=$.Ref=$.Recursive=$.Record=$.ReadonlyOptional=$.Readonly=$.Promise=$.Pick=$.Partial=$.Parameters=$.Optional=$.Omit=$.Object=$.Number=$.Null=$.Not=$.Never=$.Module=$.Mapped=$.Literal=$.KeyOf=$.Iterator=$.Uppercase=$.Lowercase=$.Uncapitalize=$.Capitalize=$.Intersect=$.Integer=$.Instantiate=$.InstanceType=$.Index=$.Function=$.Extract=$.Extends=$.Exclude=$.Enum=$.Date=$.ConstructorParameters=$.Constructor=$.Const=$.Composite=$.Boolean=$.BigInt=$.Awaited=$.AsyncIterator=$.Array=$.Argument=$.Any=void 0;$.Void=$.Unsafe=$.Unknown=$.Union=$.Undefined=$.Uint8Array=$.Tuple=$.Transform=$.TemplateLiteral=$.Symbol=$.String=$.ReturnType=void 0;var use=dc();Object.defineProperty($,"Any",{enumerable:!0,get:function(){return use.Any}});var dse=Em();Object.defineProperty($,"Argument",{enumerable:!0,get:function(){return dse.Argument}});var pse=pc();Object.defineProperty($,"Array",{enumerable:!0,get:function(){return pse.Array}});var mse=mc();Object.defineProperty($,"AsyncIterator",{enumerable:!0,get:function(){return mse.AsyncIterator}});var hse=Ru();Object.defineProperty($,"Awaited",{enumerable:!0,get:function(){return hse.Awaited}});var gse=xc();Object.defineProperty($,"BigInt",{enumerable:!0,get:function(){return gse.BigInt}});var fse=vu();Object.defineProperty($,"Boolean",{enumerable:!0,get:function(){return fse.Boolean}});var bse=Jm();Object.defineProperty($,"Composite",{enumerable:!0,get:function(){return bse.Composite}});var xse=Ym();Object.defineProperty($,"Const",{enumerable:!0,get:function(){return xse.Const}});var yse=hc();Object.defineProperty($,"Constructor",{enumerable:!0,get:function(){return yse.Constructor}});var vse=Xm();Object.defineProperty($,"ConstructorParameters",{enumerable:!0,get:function(){return vse.ConstructorParameters}});var wse=Pu();Object.defineProperty($,"Date",{enumerable:!0,get:function(){return wse.Date}});var Sse=Zm();Object.defineProperty($,"Enum",{enumerable:!0,get:function(){return Sse.Enum}});var Cse=ch();Object.defineProperty($,"Exclude",{enumerable:!0,get:function(){return Cse.Exclude}});var Tse=kc();Object.defineProperty($,"Extends",{enumerable:!0,get:function(){return Tse.Extends}});var kse=dh();Object.defineProperty($,"Extract",{enumerable:!0,get:function(){return kse.Extract}});var Mse=qs();Object.defineProperty($,"Function",{enumerable:!0,get:function(){return Mse.Function}});var Ise=ti();Object.defineProperty($,"Index",{enumerable:!0,get:function(){return Ise.Index}});var Rse=ph();Object.defineProperty($,"InstanceType",{enumerable:!0,get:function(){return Rse.InstanceType}});var Pse=mh();Object.defineProperty($,"Instantiate",{enumerable:!0,get:function(){return Pse.Instantiate}});var _se=hh();Object.defineProperty($,"Integer",{enumerable:!0,get:function(){return _se.Integer}});var Ese=Cn();Object.defineProperty($,"Intersect",{enumerable:!0,get:function(){return Ese.Intersect}});var Fh=bh();Object.defineProperty($,"Capitalize",{enumerable:!0,get:function(){return Fh.Capitalize}});Object.defineProperty($,"Uncapitalize",{enumerable:!0,get:function(){return Fh.Uncapitalize}});Object.defineProperty($,"Lowercase",{enumerable:!0,get:function(){return Fh.Lowercase}});Object.defineProperty($,"Uppercase",{enumerable:!0,get:function(){return Fh.Uppercase}});var Ase=vc();Object.defineProperty($,"Iterator",{enumerable:!0,get:function(){return Ase.Iterator}});var Ose=Sc();Object.defineProperty($,"KeyOf",{enumerable:!0,get:function(){return Ose.KeyOf}});var Lse=Ft();Object.defineProperty($,"Literal",{enumerable:!0,get:function(){return Lse.Literal}});var Wse=ot();Object.defineProperty($,"Mapped",{enumerable:!0,get:function(){return Wse.Mapped}});var Use=Sh();Object.defineProperty($,"Module",{enumerable:!0,get:function(){return Use.Module}});var Fse=vt();Object.defineProperty($,"Never",{enumerable:!0,get:function(){return Fse.Never}});var Dse=Ch();Object.defineProperty($,"Not",{enumerable:!0,get:function(){return Dse.Not}});var $se=_u();Object.defineProperty($,"Null",{enumerable:!0,get:function(){return $se.Null}});var Bse=Gs();Object.defineProperty($,"Number",{enumerable:!0,get:function(){return Bse.Number}});var Nse=rn();Object.defineProperty($,"Object",{enumerable:!0,get:function(){return Nse.Object}});var jse=Uu();Object.defineProperty($,"Omit",{enumerable:!0,get:function(){return jse.Omit}});var qse=wi();Object.defineProperty($,"Optional",{enumerable:!0,get:function(){return qse.Optional}});var Gse=Th();Object.defineProperty($,"Parameters",{enumerable:!0,get:function(){return Gse.Parameters}});var Kse=Du();Object.defineProperty($,"Partial",{enumerable:!0,get:function(){return Kse.Partial}});var Hse=Fu();Object.defineProperty($,"Pick",{enumerable:!0,get:function(){return Hse.Pick}});var zse=ku();Object.defineProperty($,"Promise",{enumerable:!0,get:function(){return zse.Promise}});var Vse=zs();Object.defineProperty($,"Readonly",{enumerable:!0,get:function(){return Vse.Readonly}});var Jse=Wu();Object.defineProperty($,"ReadonlyOptional",{enumerable:!0,get:function(){return Jse.ReadonlyOptional}});var Qse=Ic();Object.defineProperty($,"Record",{enumerable:!0,get:function(){return Qse.Record}});var Yse=kh();Object.defineProperty($,"Recursive",{enumerable:!0,get:function(){return Yse.Recursive}});var Xse=Js();Object.defineProperty($,"Ref",{enumerable:!0,get:function(){return Xse.Ref}});var Zse=Mh();Object.defineProperty($,"RegExp",{enumerable:!0,get:function(){return Zse.RegExp}});var eoe=$u();Object.defineProperty($,"Required",{enumerable:!0,get:function(){return eoe.Required}});var toe=Ih();Object.defineProperty($,"Rest",{enumerable:!0,get:function(){return toe.Rest}});var noe=Rh();Object.defineProperty($,"ReturnType",{enumerable:!0,get:function(){return noe.ReturnType}});var ioe=ir();Object.defineProperty($,"String",{enumerable:!0,get:function(){return ioe.String}});var soe=Eu();Object.defineProperty($,"Symbol",{enumerable:!0,get:function(){return soe.Symbol}});var ooe=Si();Object.defineProperty($,"TemplateLiteral",{enumerable:!0,get:function(){return ooe.TemplateLiteral}});var roe=Ah();Object.defineProperty($,"Transform",{enumerable:!0,get:function(){return roe.Transform}});var aoe=is();Object.defineProperty($,"Tuple",{enumerable:!0,get:function(){return aoe.Tuple}});var coe=Ou();Object.defineProperty($,"Uint8Array",{enumerable:!0,get:function(){return coe.Uint8Array}});var loe=Au();Object.defineProperty($,"Undefined",{enumerable:!0,get:function(){return loe.Undefined}});var uoe=it();Object.defineProperty($,"Union",{enumerable:!0,get:function(){return uoe.Union}});var doe=xr();Object.defineProperty($,"Unknown",{enumerable:!0,get:function(){return doe.Unknown}});var poe=Oh();Object.defineProperty($,"Unsafe",{enumerable:!0,get:function(){return poe.Unsafe}});var moe=Lh();Object.defineProperty($,"Void",{enumerable:!0,get:function(){return moe.Void}})});var AA=T(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.JavaScriptTypeBuilder=void 0;var hoe=Hv(),goe=Em(),foe=mc(),boe=Ru(),xoe=xc(),yoe=hc(),voe=Xm(),woe=Pu(),Soe=qs(),Coe=ph(),Toe=mh(),koe=vc(),Moe=Th(),Ioe=ku(),Roe=Mh(),Poe=Rh(),_oe=Eu(),Eoe=Ou(),Aoe=Au(),Ooe=Lh(),zv=class extends hoe.JsonTypeBuilder{Argument(e){return(0,goe.Argument)(e)}AsyncIterator(e,n){return(0,foe.AsyncIterator)(e,n)}Awaited(e,n){return(0,boe.Awaited)(e,n)}BigInt(e){return(0,xoe.BigInt)(e)}ConstructorParameters(e,n){return(0,voe.ConstructorParameters)(e,n)}Constructor(e,n,i){return(0,yoe.Constructor)(e,n,i)}Date(e={}){return(0,woe.Date)(e)}Function(e,n,i){return(0,Soe.Function)(e,n,i)}InstanceType(e,n){return(0,Coe.InstanceType)(e,n)}Instantiate(e,n){return(0,Toe.Instantiate)(e,n)}Iterator(e,n){return(0,koe.Iterator)(e,n)}Parameters(e,n){return(0,Moe.Parameters)(e,n)}Promise(e,n){return(0,Ioe.Promise)(e,n)}RegExp(e,n){return(0,Roe.RegExp)(e,n)}ReturnType(e,n){return(0,Poe.ReturnType)(e,n)}Symbol(e){return(0,_oe.Symbol)(e)}Undefined(e){return(0,Aoe.Undefined)(e)}Uint8Array(e){return(0,Eoe.Uint8Array)(e)}Void(e){return(0,Ooe.Void)(e)}};Dh.JavaScriptTypeBuilder=zv});var OA=T(pn=>{"use strict";var Loe=pn&&pn.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Woe=pn&&pn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Uoe=pn&&pn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var i=[];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[i.length]=s);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var i=t(e),s=0;s<i.length;s++)i[s]!=="default"&&Loe(n,e,i[s]);return Woe(n,e),n}})();Object.defineProperty(pn,"__esModule",{value:!0});pn.Type=pn.JavaScriptTypeBuilder=pn.JsonTypeBuilder=void 0;var Foe=Hv();Object.defineProperty(pn,"JsonTypeBuilder",{enumerable:!0,get:function(){return Foe.JsonTypeBuilder}});var Doe=Uoe(EA()),$oe=AA();Object.defineProperty(pn,"JavaScriptTypeBuilder",{enumerable:!0,get:function(){return $oe.JavaScriptTypeBuilder}});var Boe=Doe;pn.Type=Boe});var LA=T(z=>{"use strict";var Noe=z&&z.__createBinding||(Object.create?(function(t,e,n,i){i===void 0&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}):(function(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]})),Q=z&&z.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Noe(e,t,n)};Object.defineProperty(z,"__esModule",{value:!0});Q($b(),z);Q(Xi(),z);Q(xi(),z);Q(zb(),z);Q(AP(),z);Q(fu(),z);Q(FP(),z);Q(bu(),z);Q(re(),z);Q(dc(),z);Q(pc(),z);Q(Em(),z);Q(mc(),z);Q(Ru(),z);Q(xc(),z);Q(vu(),z);Q(Jm(),z);Q(Ym(),z);Q(hc(),z);Q(Xm(),z);Q(Pu(),z);Q(Zm(),z);Q(ch(),z);Q(kc(),z);Q(dh(),z);Q(qs(),z);Q(ti(),z);Q(ph(),z);Q(mh(),z);Q(hh(),z);Q(Cn(),z);Q(vc(),z);Q(bh(),z);Q(Sc(),z);Q(Ft(),z);Q(Sh(),z);Q(ot(),z);Q(vt(),z);Q(Ch(),z);Q(_u(),z);Q(Gs(),z);Q(rn(),z);Q(Uu(),z);Q(wi(),z);Q(Th(),z);Q(Du(),z);Q(Fu(),z);Q(ku(),z);Q(zs(),z);Q(Wu(),z);Q(Ic(),z);Q(kh(),z);Q(Js(),z);Q(Mh(),z);Q($u(),z);Q(Ih(),z);Q(Rh(),z);Q(CA(),z);Q(MA(),z);Q(ir(),z);Q(Eu(),z);Q(Si(),z);Q(Ah(),z);Q(is(),z);Q(Ou(),z);Q(Au(),z);Q(it(),z);Q(xr(),z);Q(Oh(),z);Q(Lh(),z);Q(OA(),z)});import{randomBytes as CB}from"node:crypto";import{accessSync as mre,constants as hre,existsSync as Xh,readFileSync as vO,realpathSync as gre}from"fs";import{homedir as Uc}from"os";import{basename as xre,dirname as Ju,join as mt,resolve as Zh,sep as yre,win32 as vre}from"path";import{fileURLToPath as wO}from"url";import{spawn as bO,spawnSync as xO}from"node:child_process";import uw from"cross-spawn";var yO=100;function Vu(t,e,n){return process.platform==="win32"?uw(t,e,n):bO(t,e,n)}function Hr(t,e,n){return process.platform==="win32"?uw.sync(t,e,n):xO(t,e,n)}function Yh(t){return new Promise((e,n)=>{let i=!1,s=!1,o=null,r,a=t.stdout===null,c=t.stderr===null,l=()=>{r&&(clearTimeout(r),r=void 0),t.removeListener("error",g),t.removeListener("exit",h),t.removeListener("close",f),t.stdout?.removeListener("end",p),t.stderr?.removeListener("end",m)},d=x=>{i||(i=!0,l(),t.stdout?.destroy(),t.stderr?.destroy(),e(x))},u=()=>{!s||i||a&&c&&d(o)},p=()=>{a=!0,u()},m=()=>{c=!0,u()},g=x=>{i||(i=!0,l(),n(x))},h=x=>{s=!0,o=x,u(),i||(r=setTimeout(()=>d(x),yO))},f=x=>{d(x)};t.stdout?.once("end",p),t.stderr?.once("end",m),t.once("error",g),t.once("exit",h),t.once("close",f)})}var SO=wO(import.meta.url),dw=Ju(SO),Qu=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),Cre=!!process.versions.bun;function ai(){let t=process.env.PI_PACKAGE_DIR;if(t)return t==="~"?Uc():t.startsWith("~/")?Uc()+t.slice(1):t;if(Qu)return Ju(process.execPath);let e=dw;for(;e!==Ju(e);){if(Xh(mt(e,"package.json")))return e;e=Ju(e)}return dw}function eg(){if(Qu)return mt(ai(),"theme");let t=ai(),e=Xh(mt(t,"src"))?"src":"dist";return mt(t,e,"modes","interactive","theme")}function CO(){return mt(ai(),"package.json")}function tg(){return Zh(mt(ai(),"README.md"))}function Yu(){return Zh(mt(ai(),"docs"))}function Xu(){return Zh(mt(ai(),"CHANGELOG.md"))}function TO(){if(Qu)return mt(ai(),"assets");let t=ai(),e=Xh(mt(t,"src"))?"src":"dist";return mt(t,e,"modes","interactive","assets")}function pw(t){return mt(TO(),t)}var Zu=JSON.parse(vO(CO(),"utf-8")),mw=Zu.piConfig?.name,kO=Zu.name||"@earendil-works/pi-coding-agent",Ot=mw||"pi",ng=mw?Ot:"\u03C0",St=Zu.piConfig?.configDir||".pi",Ai=Zu.version||"0.0.0",hw=`${Ot.toUpperCase()}_CODING_AGENT_DIR`,gw=`${Ot.toUpperCase()}_CODING_AGENT_SESSION_DIR`;function fw(t){return t==="~"?Uc():t.startsWith("~/")?Uc()+t.slice(1):t}var MO="https://pi.dev/session/";function bw(t){return`${process.env.PI_SHARE_VIEWER_URL||MO}#${t}`}function Le(){let t=process.env[hw];return t?fw(t):mt(Uc(),St,"agent")}function Fc(){return mt(Le(),"themes")}function ig(){return mt(Le(),"auth.json")}function Dc(){return mt(Le(),"bin")}function xw(){return mt(Le(),"sessions")}function yw(){return mt(Le(),`${Ot}-debug.log`)}import{Type as tle}from"typebox";var vw=new Map;function IO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function RO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function Mn(t,e){vw.set(t.api,{provider:{api:t.api,stream:IO(t.api,t.stream),streamSimple:RO(t.api,t.streamSimple)},sourceId:e})}function ww(t){return vw.get(t)?.provider}Gn();var Cw={openrouter:{"black-forest-labs/flux.2-flex":{id:"black-forest-labs/flux.2-flex",name:"Black Forest Labs: FLUX.2 Flex",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-klein-4b":{id:"black-forest-labs/flux.2-klein-4b",name:"Black Forest Labs: FLUX.2 Klein 4B",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-max":{id:"black-forest-labs/flux.2-max",name:"Black Forest Labs: FLUX.2 Max",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"black-forest-labs/flux.2-pro":{id:"black-forest-labs/flux.2-pro",name:"Black Forest Labs: FLUX.2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"bytedance-seed/seedream-4.5":{id:"bytedance-seed/seedream-4.5",name:"ByteDance Seed: Seedream 4.5",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"google/gemini-2.5-flash-image":{id:"google/gemini-2.5-flash-image",name:"Google: Nano Banana (Gemini 2.5 Flash Image)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334}},"google/gemini-3-pro-image-preview":{id:"google/gemini-3-pro-image-preview",name:"Google: Nano Banana Pro (Gemini 3 Pro Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375}},"google/gemini-3.1-flash-image-preview":{id:"google/gemini-3.1-flash-image-preview",name:"Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview)",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0}},"openai/gpt-5-image":{id:"openai/gpt-5-image",name:"OpenAI: GPT-5 Image",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:10,output:10,cacheRead:1.25,cacheWrite:0}},"openai/gpt-5-image-mini":{id:"openai/gpt-5-image-mini",name:"OpenAI: GPT-5 Image Mini",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:2.5,output:2,cacheRead:.25,cacheWrite:0}},"openai/gpt-5.4-image-2":{id:"openai/gpt-5.4-image-2",name:"OpenAI: GPT-5.4 Image 2",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["image","text"],output:["image","text"],cost:{input:8,output:15,cacheRead:2,cacheWrite:0}},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0}},"recraft/recraft-v3":{id:"recraft/recraft-v3",name:"Recraft: Recraft V3",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4":{id:"recraft/recraft-v4",name:"Recraft: Recraft V4",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro":{id:"recraft/recraft-v4-pro",name:"Recraft: Recraft V4 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-pro-vector":{id:"recraft/recraft-v4-pro-vector",name:"Recraft: Recraft V4 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4-vector":{id:"recraft/recraft-v4-vector",name:"Recraft: Recraft V4 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1":{id:"recraft/recraft-v4.1",name:"Recraft: Recraft V4.1",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro":{id:"recraft/recraft-v4.1-pro",name:"Recraft: Recraft V4.1 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-pro-vector":{id:"recraft/recraft-v4.1-pro-vector",name:"Recraft: Recraft V4.1 Pro Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility":{id:"recraft/recraft-v4.1-utility",name:"Recraft: Recraft V4.1 Utility",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-utility-pro":{id:"recraft/recraft-v4.1-utility-pro",name:"Recraft: Recraft V4.1 Utility Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"recraft/recraft-v4.1-vector":{id:"recraft/recraft-v4.1-vector",name:"Recraft: Recraft V4.1 Vector",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast":{id:"sourceful/riverflow-v2-fast",name:"Sourceful: Riverflow V2 Fast",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-fast-preview":{id:"sourceful/riverflow-v2-fast-preview",name:"Sourceful: Riverflow V2 Fast Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-max-preview":{id:"sourceful/riverflow-v2-max-preview",name:"Sourceful: Riverflow V2 Max Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-pro":{id:"sourceful/riverflow-v2-pro",name:"Sourceful: Riverflow V2 Pro",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"sourceful/riverflow-v2-standard-preview":{id:"sourceful/riverflow-v2-standard-preview",name:"Sourceful: Riverflow V2 Standard Preview",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}},"x-ai/grok-imagine-image-quality":{id:"x-ai/grok-imagine-image-quality",name:"xAI: Grok Imagine Image Quality",api:"openrouter-images",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",input:["text","image"],output:["image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0}}}};var LO=new Map;for(let[t,e]of Object.entries(Cw)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);LO.set(t,n)}var WO=new Map;function UO(t,e){return(n,i,s)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,i,s)}}function Tw(t,e){WO.set(t.api,{provider:{api:t.api,generateImages:UO(t.api,t.generateImages)},sourceId:e})}var Iw;function jO(t,e){return{api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function qO(){return Iw||=Promise.resolve().then(()=>(Mw(),kw)).then(t=>t),Iw}var GO=async(t,e,n)=>{try{return await(await qO()).generateImagesOpenRouter(t,e,n)}catch(i){return jO(t,i)}};function KO(){Tw({api:"openrouter-images",generateImages:GO})}KO();In();Rn();Rn();var $9=t=>import(import.meta.url.endsWith(".js")?t.replace(/\.ts$/,".js"):t),jS,qS,GS,KS,HS,zS,VS,JS,QS,YS;function XS(t,e){(async()=>{for await(let n of e)t.push(n);t.end()})()}function ZS(t,e){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function Wi(t){return(e,n,i)=>{let s=new nt;return t().then(o=>{let r=o.stream(e,n,i);XS(s,r)}).catch(o=>{let r=ZS(e,o);s.push({type:"error",reason:"error",error:r}),s.end(r)}),s}}function Ui(t){return(e,n,i)=>{let s=new nt;return t().then(o=>{let r=o.streamSimple(e,n,i);XS(s,r)}).catch(o=>{let r=ZS(e,o);s.push({type:"error",reason:"error",error:r}),s.end(r)}),s}}function eC(){return jS||=Promise.resolve().then(()=>(Bw(),$w)).then(t=>{let e=t;return{stream:e.streamAnthropic,streamSimple:e.streamSimpleAnthropic}}),jS}function tC(){return qS||=Promise.resolve().then(()=>(qw(),jw)).then(t=>{let e=t;return{stream:e.streamAzureOpenAIResponses,streamSimple:e.streamSimpleAzureOpenAIResponses}}),qS}function nC(){return GS||=Promise.resolve().then(()=>(zw(),Hw)).then(t=>{let e=t;return{stream:e.streamGoogle,streamSimple:e.streamSimpleGoogle}}),GS}function iC(){return KS||=Promise.resolve().then(()=>(Zw(),Xw)).then(t=>{let e=t;return{stream:e.streamGoogleVertex,streamSimple:e.streamSimpleGoogleVertex}}),KS}function sC(){return HS||=Promise.resolve().then(()=>(oS(),sS)).then(t=>{let e=t;return{stream:e.streamMistral,streamSimple:e.streamSimpleMistral}}),HS}function oC(){return zS||=Promise.resolve().then(()=>(RS(),IS)).then(t=>{let e=t;return{stream:e.streamOpenAICodexResponses,streamSimple:e.streamSimpleOpenAICodexResponses}}),zS}function rC(){return VS||=Promise.resolve().then(()=>(US(),WS)).then(t=>{let e=t;return{stream:e.streamOpenAICompletions,streamSimple:e.streamSimpleOpenAICompletions}}),VS}function aC(){return JS||=Promise.resolve().then(()=>(NS(),BS)).then(t=>{let e=t;return{stream:e.streamOpenAIResponses,streamSimple:e.streamSimpleOpenAIResponses}}),JS}function cC(){return QS?Promise.resolve(QS):(YS||=$9("./amazon-bedrock.ts").then(t=>{let e=t;return{stream:e.streamBedrock,streamSimple:e.streamSimpleBedrock}}),YS)}var B9=Wi(eC),N9=Ui(eC),j9=Wi(tC),q9=Ui(tC),G9=Wi(nC),K9=Ui(nC),H9=Wi(iC),z9=Ui(iC),V9=Wi(sC),J9=Ui(sC),Q9=Wi(oC),Y9=Ui(oC),X9=Wi(rC),Z9=Ui(rC),eW=Wi(aC),tW=Ui(aC),nW=Wi(cC),iW=Ui(cC);function sW(){Mn({api:"anthropic-messages",stream:B9,streamSimple:N9}),Mn({api:"openai-completions",stream:X9,streamSimple:Z9}),Mn({api:"mistral-conversations",stream:V9,streamSimple:J9}),Mn({api:"openai-responses",stream:eW,streamSimple:tW}),Mn({api:"azure-openai-responses",stream:j9,streamSimple:q9}),Mn({api:"openai-codex-responses",stream:Q9,streamSimple:Y9}),Mn({api:"google-generative-ai",stream:G9,streamSimple:K9}),Mn({api:"google-vertex",stream:H9,streamSimple:z9}),Mn({api:"bedrock-converse-stream",stream:nW,streamSimple:iW})}sW();Sg();Gn();function oW(t){let e=ww(t);if(!e)throw new Error(`No API provider registered for api: ${t}`);return e}function rW(t,e,n){return oW(t.api).stream(t,e,n)}async function lC(t,e,n){return rW(t,e,n).result()}Cg();Rn();zr();import{Type as zce}from"typebox";import{Compile as Qce}from"typebox/compile";import{Value as Xce}from"typebox/value";import*as Lt from"node:fs";import*as go from"node:path";import{spawn as cW}from"child_process";import{readdirSync as lW,statSync as uC}from"fs";import{homedir as dC}from"os";import{basename as Pg,dirname as Cd,join as ws}from"path";function Sd(t,e){let n=t.toLowerCase(),i=e.toLowerCase(),s=d=>{if(d.length===0)return{matches:!0,score:0};if(d.length>i.length)return{matches:!1,score:0};let u=0,p=0,m=-1,g=0;for(let h=0;h<i.length&&u<d.length;h++)if(i[h]===d[u]){let f=h===0||/[\s\-_./:]/.test(i[h-1]);m===h-1?(g++,p-=g*5):(g=0,m>=0&&(p+=(h-m-1)*2)),f&&(p-=10),p+=h*.1,m=h,u++}return u<d.length?{matches:!1,score:0}:(d===i&&(p-=100),{matches:!0,score:p})},o=s(n);if(o.matches)return o;let r=n.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/),a=n.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/),c=r?`${r.groups?.digits??""}${r.groups?.letters??""}`:a?`${a.groups?.letters??""}${a.groups?.digits??""}`:"";if(!c)return o;let l=s(c);return l.matches?{matches:!0,score:l.score+5}:o}function Kt(t,e,n){if(!e.trim())return t;let i=e.trim().split(/\s+/).filter(o=>o.length>0);if(i.length===0)return t;let s=[];for(let o of t){let r=n(o),a=0,c=!0;for(let l of i){let d=Sd(l,r);if(d.matches)a+=d.score;else{c=!1;break}}c&&s.push({item:o,totalScore:a})}return s.sort((o,r)=>o.totalScore-r.totalScore),s.map(o=>o.item)}var bC=new Set([" "," ",'"',"'","="]);function so(t){return t.replace(/\\/g,"/")}function uW(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dW(t){let e=so(t);if(!e.includes("/"))return e;let n=e.endsWith("/"),i=e.replace(/^\/+|\/+$/g,"");if(!i)return e;let s="[\\\\/]",o=i.split("/").filter(Boolean).map(a=>uW(a));if(o.length===0)return e;let r=o.join(s);return n&&(r+=s),r}function pC(t){for(let e=t.length-1;e>=0;e-=1)if(bC.has(t[e]??""))return e;return-1}function pW(t){let e=!1,n=-1;for(let i=0;i<t.length;i+=1)t[i]==='"'&&(e=!e,e&&(n=i));return e?n:null}function mC(t,e){return e===0||bC.has(t[e-1]??"")}function hC(t){let e=pW(t);return e===null?null:e>0&&t[e-1]==="@"?mC(t,e-1)?t.slice(e-1):null:mC(t,e)?t.slice(e):null}function gC(t){return t.startsWith('@"')?{rawPrefix:t.slice(2),isAtPrefix:!0,isQuotedPrefix:!0}:t.startsWith('"')?{rawPrefix:t.slice(1),isAtPrefix:!1,isQuotedPrefix:!0}:t.startsWith("@")?{rawPrefix:t.slice(1),isAtPrefix:!0,isQuotedPrefix:!1}:{rawPrefix:t,isAtPrefix:!1,isQuotedPrefix:!1}}function fC(t,e){let n=e.isQuotedPrefix||t.includes(" "),i=e.isAtPrefix?"@":"";return n?`${`${i}"`}${t}"`:`${i}${t}`}async function mW(t,e,n,i,s){let o=["--base-directory",t,"--max-results",String(i),"--type","f","--type","d","--follow","--hidden","--exclude",".git","--exclude",".git/*","--exclude",".git/**"];return so(n).includes("/")&&o.push("--full-path"),n&&o.push(dW(n)),await new Promise(r=>{if(s.aborted){r([]);return}let a=cW(e,o,{stdio:["ignore","pipe","pipe"]}),c="",l=!1,d=p=>{l||(l=!0,s.removeEventListener("abort",u),r(p))},u=()=>{a.exitCode===null&&a.kill("SIGKILL")};s.addEventListener("abort",u,{once:!0}),a.stdout.setEncoding("utf-8"),a.stdout.on("data",p=>{c+=p}),a.on("error",()=>{d([])}),a.on("close",p=>{if(s.aborted||p!==0||!c){d([]);return}let m=c.trim().split(`
|
|
32
32
|
`).filter(Boolean),g=[];for(let h of m){let f=so(h),x=f.endsWith("/"),y=x?f.slice(0,-1):f;y===".git"||y.startsWith(".git/")||y.includes("/.git/")||g.push({path:f,isDirectory:x})}d(g)})})}var Vc=class{constructor(e=[],n,i=null){this.commands=e,this.basePath=n,this.fdPath=i}async getSuggestions(e,n,i,s){let r=(e[n]||"").slice(0,i),a=this.extractAtPrefix(r);if(a){let{rawPrefix:d,isQuotedPrefix:u}=gC(a),p=await this.getFuzzyFileSuggestions(d,{isQuotedPrefix:u,signal:s.signal});return p.length===0?null:{items:p,prefix:a}}if(!s.force&&r.startsWith("/")){let d=r.indexOf(" ");if(d===-1){let h=r.slice(1),f=this.commands.map(y=>{let w="name"in y?y.name:y.value,P="argumentHint"in y&&y.argumentHint?y.argumentHint:void 0,_=y.description??"",R=P?_?`${P} \u2014 ${_}`:P:_;return{name:w,label:w,description:R||void 0}}),x=Kt(f,h,y=>y.name).map(y=>({value:y.name,label:y.label,...y.description&&{description:y.description}}));return x.length===0?null:{items:x,prefix:r}}let u=r.slice(1,d),p=r.slice(d+1),m=this.commands.find(h=>("name"in h?h.name:h.value)===u);if(!m||!("getArgumentCompletions"in m)||!m.getArgumentCompletions)return null;let g=await m.getArgumentCompletions(p);return!Array.isArray(g)||g.length===0?null:{items:g,prefix:p}}let c=this.extractPathPrefix(r,s.force??!1);if(c===null)return null;let l=this.getFileSuggestions(c);return l.length===0?null:{items:l,prefix:c}}applyCompletion(e,n,i,s,o){let r=e[n]||"",a=r.slice(0,i-o.length),c=r.slice(i),l=o.startsWith('"')||o.startsWith('@"'),d=c.startsWith('"'),u=s.value.endsWith('"'),p=l&&u&&d?c.slice(1):c;if(o.startsWith("/")&&a.trim()===""&&!o.slice(1).includes("/")){let P=`${a}/${s.value} ${p}`,_=[...e];return _[n]=P,{lines:_,cursorLine:n,cursorCol:a.length+s.value.length+2}}if(o.startsWith("@")){let P=s.label.endsWith("/"),_=P?"":" ",R=`${a+s.value}${_}${p}`,L=[...e];L[n]=R;let E=s.value.endsWith('"'),W=P&&E?s.value.length-1:s.value.length;return{lines:L,cursorLine:n,cursorCol:a.length+W+_.length}}let g=r.slice(0,i);if(g.includes("/")&&g.includes(" ")){let P=a+s.value+p,_=[...e];_[n]=P;let R=s.label.endsWith("/"),L=s.value.endsWith('"'),E=R&&L?s.value.length-1:s.value.length;return{lines:_,cursorLine:n,cursorCol:a.length+E}}let h=a+s.value+p,f=[...e];f[n]=h;let x=s.label.endsWith("/"),y=s.value.endsWith('"'),w=x&&y?s.value.length-1:s.value.length;return{lines:f,cursorLine:n,cursorCol:a.length+w}}extractAtPrefix(e){let n=hC(e);if(n?.startsWith('@"'))return n;let i=pC(e),s=i===-1?0:i+1;return e[s]==="@"?e.slice(s):null}extractPathPrefix(e,n=!1){let i=hC(e);if(i)return i;let s=pC(e),o=s===-1?e:e.slice(s+1);return n||o.includes("/")||o.startsWith(".")||o.startsWith("~/")||o===""&&e.endsWith(" ")?o:null}expandHomePath(e){if(e.startsWith("~/")){let n=ws(dC(),e.slice(2));return e.endsWith("/")&&!n.endsWith("/")?`${n}/`:n}else if(e==="~")return dC();return e}resolveScopedFuzzyQuery(e){let n=so(e),i=n.lastIndexOf("/");if(i===-1)return null;let s=n.slice(0,i+1),o=n.slice(i+1),r;s.startsWith("~/")?r=this.expandHomePath(s):s.startsWith("/")?r=s:r=ws(this.basePath,s);try{if(!uC(r).isDirectory())return null}catch{return null}return{baseDir:r,query:o,displayBase:s}}scopedPathForDisplay(e,n){let i=so(n);return e==="/"?`/${i}`:`${so(e)}${i}`}getFileSuggestions(e){try{let n,i,{rawPrefix:s,isAtPrefix:o,isQuotedPrefix:r}=gC(e),a=s;if(a.startsWith("~")&&(a=this.expandHomePath(a)),s===""||s==="./"||s==="../"||s==="~"||s==="~/"||s==="/"||o&&s==="")s.startsWith("~")||a.startsWith("/")?n=a:n=ws(this.basePath,a),i="";else if(s.endsWith("/"))s.startsWith("~")||a.startsWith("/")?n=a:n=ws(this.basePath,a),i="";else{let u=Cd(a),p=Pg(a);s.startsWith("~")||a.startsWith("/")?n=u:n=ws(this.basePath,u),i=p}let l=lW(n,{withFileTypes:!0}),d=[];for(let u of l){if(!u.name.toLowerCase().startsWith(i.toLowerCase()))continue;let p=u.isDirectory();if(!p&&u.isSymbolicLink())try{let y=ws(n,u.name);p=uC(y).isDirectory()}catch{}let m,g=u.name,h=s;if(h.endsWith("/"))m=h+g;else if(h.includes("/")||h.includes("\\"))if(h.startsWith("~/")){let y=h.slice(2),w=Cd(y);m=`~/${w==="."?g:ws(w,g)}`}else if(h.startsWith("/")){let y=Cd(h);y==="/"?m=`/${g}`:m=`${y}/${g}`}else m=ws(Cd(h),g),h.startsWith("./")&&!m.startsWith("./")&&(m=`./${m}`);else h.startsWith("~")?m=`~/${g}`:m=g;m=so(m);let f=p?`${m}/`:m,x=fC(f,{isDirectory:p,isAtPrefix:o,isQuotedPrefix:r});d.push({value:x,label:g+(p?"/":"")})}return d.sort((u,p)=>{let m=u.value.endsWith("/"),g=p.value.endsWith("/");return m&&!g?-1:!m&&g?1:u.label.localeCompare(p.label)}),d}catch{return[]}}scoreEntry(e,n,i){let o=Pg(e).toLowerCase(),r=n.toLowerCase(),a=0;return o===r?a=100:o.startsWith(r)?a=80:o.includes(r)?a=50:e.toLowerCase().includes(r)&&(a=30),i&&a>0&&(a+=10),a}async getFuzzyFileSuggestions(e,n){if(!this.fdPath||n.signal.aborted)return[];try{let i=this.resolveScopedFuzzyQuery(e),s=i?.baseDir??this.basePath,o=i?.query??e,r=await mW(s,this.fdPath,o,100,n.signal);if(n.signal.aborted)return[];let a=r.map(d=>({...d,score:o?this.scoreEntry(d.path,o,d.isDirectory):1})).filter(d=>d.score>0);a.sort((d,u)=>u.score-d.score);let c=a.slice(0,20),l=[];for(let{path:d,isDirectory:u}of c){let p=u?d.slice(0,-1):d,m=i?this.scopedPathForDisplay(i.displayBase,p):p,g=Pg(p),h=u?`${m}/`:m,f=fC(h,{isDirectory:u,isAtPrefix:!0,isQuotedPrefix:n.isQuotedPrefix});l.push({value:f,label:g+(u?"/":""),description:m})}return l}catch{return[]}}shouldTriggerFileCompletion(e,n,i){let o=(e[n]||"").slice(0,i);return!(o.trim().startsWith("/")&&!o.trim().includes(" "))}};import{eastAsianWidth as xC}from"get-east-asian-width";var Fi=new Intl.Segmenter(void 0,{granularity:"grapheme"});function Td(){return Fi}function hW(t){let e=t.codePointAt(0);return e>=126976&&e<=130047||e>=8960&&e<=9215||e>=9728&&e<=10175||e>=11088&&e<=11093||t.includes("\uFE0F")||t.length>2}var gW=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$","v"),fW=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),bW=new RegExp("^\\p{RGI_Emoji}$","v"),xW=512,Jc=new Map;function Ag(t){for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n<32||n>126)return!1}return!0}function yW(t,e){if(e<=0||t.length===0)return{text:"",width:0};if(Ag(t)){let c=t.slice(0,e);return{text:c,width:c.length}}let n=t.includes("\x1B"),i=t.includes(" ");if(!n&&!i){let c="",l=0;for(let{segment:d}of Fi.segment(t)){let u=oo(d);if(l+u>e)break;c+=d,l+=u}return{text:c,width:l}}let s="",o=0,r=0,a="";for(;r<t.length;){let c=bn(t,r);if(c){a+=c.code,r+=c.length;continue}if(t[r]===" "){if(o+3>e)break;a&&(s+=a,a=""),s+=" ",o+=3,r++;continue}let l=r;for(;l<t.length&&t[l]!==" "&&!bn(t,l);)l++;for(let{segment:d}of Fi.segment(t.slice(r,l))){let u=oo(d);if(o+u>e)return{text:s,width:o};a&&(s+=a,a=""),s+=d,o+=u}r=l}return{text:s,width:o}}function _g(t,e,n,i,s,o){let r="\x1B[0m",a=e+i,c;return n.length>0?c=`${t}${r}${n}${r}`:c=`${t}${r}`,o?c+" ".repeat(Math.max(0,s-a)):c}function oo(t){if(gW.test(t))return 0;if(hW(t)&&bW.test(t))return 2;let n=t.replace(fW,"").codePointAt(0);if(n===void 0)return 0;if(n>=127462&&n<=127487)return 2;let i=xC(n);if(t.length>1)for(let s of t.slice(1)){let o=s.codePointAt(0);o>=65280&&o<=65519?i+=xC(o):(o===3635||o===3763)&&(i+=1)}return i}function j(t){if(t.length===0)return 0;if(Ag(t))return t.length;let e=Jc.get(t);if(e!==void 0)return e;let n=t;if(t.includes(" ")&&(n=n.replace(/\t/g," ")),n.includes("\x1B")){let s="",o=0;for(;o<n.length;){let r=bn(n,o);if(r){o+=r.length;continue}s+=n[o],o++}n=s}let i=0;for(let{segment:s}of Fi.segment(n))i+=oo(s);if(Jc.size>=xW){let s=Jc.keys().next().value;s!==void 0&&Jc.delete(s)}return Jc.set(t,i),i}var vW=/[\u0e33\u0eb3]/,wW=/[\u0e33\u0eb3]/g;function yC(t){return vW.test(t)?t.replace(wW,e=>e==="\u0E33"?"\u0E4D\u0E32":"\u0ECD\u0EB2"):t}function bn(t,e){if(e>=t.length||t[e]!=="\x1B")return null;let n=t[e+1];if(n==="["){let i=e+2;for(;i<t.length&&!/[mGKHJ]/.test(t[i]);)i++;return i<t.length?{code:t.substring(e,i+1),length:i+1-e}:null}if(n==="]"){let i=e+2;for(;i<t.length;){if(t[i]==="\x07")return{code:t.substring(e,i+1),length:i+1-e};if(t[i]==="\x1B"&&t[i+1]==="\\")return{code:t.substring(e,i+2),length:i+2-e};i++}return null}if(n==="_"){let i=e+2;for(;i<t.length;){if(t[i]==="\x07")return{code:t.substring(e,i+1),length:i+1-e};if(t[i]==="\x1B"&&t[i+1]==="\\")return{code:t.substring(e,i+2),length:i+2-e};i++}return null}return null}function SW(t){if(!t.startsWith("\x1B]8;"))return;let e=t.endsWith("\x07")?"\x07":"\x1B\\",n=t.slice(4,e==="\x07"?-1:-2),i=n.indexOf(";");if(i===-1)return;let s=n.slice(0,i),o=n.slice(i+1);return o?{params:s,url:o,terminator:e}:null}function CW(t){return`\x1B]8;${t.params};${t.url}${t.terminator}`}function TW(t){return`\x1B]8;;${t}`}var Qc=class{constructor(){this.bold=!1;this.dim=!1;this.italic=!1;this.underline=!1;this.blink=!1;this.inverse=!1;this.hidden=!1;this.strikethrough=!1;this.fgColor=null;this.bgColor=null;this.activeHyperlink=null}process(e){let n=SW(e);if(n!==void 0){this.activeHyperlink=n;return}if(!e.endsWith("m"))return;let i=e.match(/\x1b\[([\d;]*)m/);if(!i)return;let s=i[1];if(s===""||s==="0"){this.reset();return}let o=s.split(";"),r=0;for(;r<o.length;){let a=Number.parseInt(o[r],10);if(a===38||a===48){if(o[r+1]==="5"&&o[r+2]!==void 0){let c=`${o[r]};${o[r+1]};${o[r+2]}`;a===38?this.fgColor=c:this.bgColor=c,r+=3;continue}else if(o[r+1]==="2"&&o[r+4]!==void 0){let c=`${o[r]};${o[r+1]};${o[r+2]};${o[r+3]};${o[r+4]}`;a===38?this.fgColor=c:this.bgColor=c,r+=5;continue}}switch(a){case 0:this.reset();break;case 1:this.bold=!0;break;case 2:this.dim=!0;break;case 3:this.italic=!0;break;case 4:this.underline=!0;break;case 5:this.blink=!0;break;case 7:this.inverse=!0;break;case 8:this.hidden=!0;break;case 9:this.strikethrough=!0;break;case 21:this.bold=!1;break;case 22:this.bold=!1,this.dim=!1;break;case 23:this.italic=!1;break;case 24:this.underline=!1;break;case 25:this.blink=!1;break;case 27:this.inverse=!1;break;case 28:this.hidden=!1;break;case 29:this.strikethrough=!1;break;case 39:this.fgColor=null;break;case 49:this.bgColor=null;break;default:a>=30&&a<=37||a>=90&&a<=97?this.fgColor=String(a):(a>=40&&a<=47||a>=100&&a<=107)&&(this.bgColor=String(a));break}r++}}reset(){this.bold=!1,this.dim=!1,this.italic=!1,this.underline=!1,this.blink=!1,this.inverse=!1,this.hidden=!1,this.strikethrough=!1,this.fgColor=null,this.bgColor=null}clear(){this.reset(),this.activeHyperlink=null}getActiveCodes(){let e=[];this.bold&&e.push("1"),this.dim&&e.push("2"),this.italic&&e.push("3"),this.underline&&e.push("4"),this.blink&&e.push("5"),this.inverse&&e.push("7"),this.hidden&&e.push("8"),this.strikethrough&&e.push("9"),this.fgColor&&e.push(this.fgColor),this.bgColor&&e.push(this.bgColor);let n=e.length>0?`\x1B[${e.join(";")}m`:"";return this.activeHyperlink&&(n+=CW(this.activeHyperlink)),n}hasActiveCodes(){return this.bold||this.dim||this.italic||this.underline||this.blink||this.inverse||this.hidden||this.strikethrough||this.fgColor!==null||this.bgColor!==null||this.activeHyperlink!==null}getLineEndReset(){let e="";return this.underline&&(e+="\x1B[24m"),this.activeHyperlink&&(e+=TW(this.activeHyperlink.terminator)),e}};function vC(t,e){let n=0;for(;n<t.length;){let i=bn(t,n);i?(e.process(i.code),n+=i.length):n++}}function kW(t){let e=[],n="",i="",s=!1,o=0;for(;o<t.length;){let r=bn(t,o);if(r){i+=r.code,o+=r.length;continue}let a=t[o],c=a===" ";c!==s&&n&&(e.push(n),n=""),i&&(n+=i,i=""),s=c,n+=a,o++}return i&&(n+=i),n&&e.push(n),e}function zn(t,e){if(!t)return[""];let n=t.split(`
|
|
33
33
|
`),i=[],s=new Qc;for(let o of n){let r=i.length>0?s.getActiveCodes():"";i.push(...MW(r+o,e)),vC(o,s)}return i.length>0?i:[""]}function MW(t,e){if(!t)return[""];if(j(t)<=e)return[t];let i=[],s=new Qc,o=kW(t),r="",a=0;for(let c of o){let l=j(c),d=c.trim()==="";if(l>e&&!d){if(r){let m=s.getLineEndReset();m&&(r+=m),i.push(r),r="",a=0}let p=RW(c,e,s);i.push(...p.slice(0,-1)),r=p[p.length-1],a=j(r);continue}if(a+l>e&&a>0){let p=r.trimEnd(),m=s.getLineEndReset();m&&(p+=m),i.push(p),d?(r=s.getActiveCodes(),a=0):(r=s.getActiveCodes()+c,a=l)}else r+=c,a+=l;vC(c,s)}return r&&i.push(r),i.length>0?i.map(c=>c.trimEnd()):[""]}var IW=/[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;function Ht(t){return/\s/.test(t)}function zt(t){return IW.test(t)}function RW(t,e,n){let i=[],s=n.getActiveCodes(),o=0,r=0,a=[];for(;r<t.length;){let c=bn(t,r);if(c)a.push({type:"ansi",value:c.code}),r+=c.length;else{let l=r;for(;l<t.length&&!bn(t,l);)l++;let d=t.slice(r,l);for(let u of Fi.segment(d))a.push({type:"grapheme",value:u.segment});r=l}}for(let c of a){if(c.type==="ansi"){s+=c.value,n.process(c.value);continue}let l=c.value;if(!l)continue;let d=j(l);if(o+d>e){let u=n.getLineEndReset();u&&(s+=u),i.push(s),s=n.getActiveCodes(),o=0}s+=l,o+=d}return s&&i.push(s),i.length>0?i:[""]}function Ss(t,e,n){let i=j(t),s=Math.max(0,e-i),o=" ".repeat(s),r=t+o;return n(r)}function X(t,e,n="...",i=!1){if(e<=0)return"";if(t.length===0)return i?" ".repeat(e):"";let s=j(n);if(s>=e){let h=j(t);if(h<=e)return i?t+" ".repeat(e-h):t;let f=yW(n,e);return f.width===0?i?" ".repeat(e):"":_g("",0,f.text,f.width,e,i)}if(Ag(t)){if(t.length<=e)return i?t+" ".repeat(e-t.length):t;let h=e-s;return _g(t.slice(0,h),h,n,s,e,i)}let o=e-s,r="",a="",c=0,l=0,d=!0,u=!1,p=!1,m=t.includes("\x1B"),g=t.includes(" ");if(!m&&!g){for(let{segment:h}of Fi.segment(t)){let f=oo(h);if(d&&l+f<=o?(r+=h,l+=f):d=!1,c+=f,c>e){u=!0;break}}p=!u}else{let h=0;for(;h<t.length;){let f=bn(t,h);if(f){a+=f.code,h+=f.length;continue}if(t[h]===" "){if(d&&l+3<=o?(a&&(r+=a,a=""),r+=" ",l+=3):(d=!1,a=""),c+=3,c>e){u=!0;break}h++;continue}let x=h;for(;x<t.length&&t[x]!==" "&&!bn(t,x);)x++;for(let{segment:y}of Fi.segment(t.slice(h,x))){let w=oo(y);if(d&&l+w<=o?(a&&(r+=a,a=""),r+=y,l+=w):(d=!1,a=""),c+=w,c>e){u=!0;break}}if(u)break;h=x}p=h>=t.length}return!u&&p?i?t+" ".repeat(Math.max(0,e-c)):t:_g(r,l,n,s,e,i)}function ea(t,e,n,i=!1){return Og(t,e,n,i).text}function Og(t,e,n,i=!1){if(n<=0)return{text:"",width:0};let s=e+n,o="",r=0,a=0,c=0,l="";for(;c<t.length;){let d=bn(t,c);if(d){a>=e&&a<s?o+=d.code:a<e&&(l+=d.code),c+=d.length;continue}let u=c;for(;u<t.length&&!bn(t,u);)u++;for(let{segment:p}of Fi.segment(t.slice(c,u))){let m=oo(p),g=a>=e&&a<s,h=!i||a+m<=s;if(g&&h&&(l&&(o+=l,l=""),o+=p,r+=m),a+=m,a>=s)break}if(c=u,a>=s)break}return{text:o,width:r}}var Eg=new Qc;function wC(t,e,n,i,s=!1){let o="",r=0,a="",c=0,l=0,d=0,u="",p=!1,m=n+i;for(Eg.clear();d<t.length;){let g=bn(t,d);if(g){Eg.process(g.code),l<e?u+=g.code:l>=n&&l<m&&p&&(a+=g.code),d+=g.length;continue}let h=d;for(;h<t.length&&!bn(t,h);)h++;for(let{segment:f}of Fi.segment(t.slice(d,h))){let x=oo(f);if(l<e?(u&&(o+=u,u=""),o+=f,r+=x):l>=n&&l<m&&(!s||l+x<=m)&&(p||(a+=Eg.getActiveCodes(),p=!0),a+=f,c+=x),l+=x,i<=0?l>=e:l>=m)break}if(d=h,i<=0?l>=e:l>=m)break}return{before:o,beforeWidth:r,after:a,afterWidth:c}}var lt=class{constructor(e=1,n=1,i){this.children=[];this.paddingX=e,this.paddingY=n,this.bgFn=i}addChild(e){this.children.push(e),this.invalidateCache()}removeChild(e){let n=this.children.indexOf(e);n!==-1&&(this.children.splice(n,1),this.invalidateCache())}clear(){this.children=[],this.invalidateCache()}setBgFn(e){this.bgFn=e}invalidateCache(){this.cache=void 0}matchCache(e,n,i){let s=this.cache;return!!s&&s.width===e&&s.bgSample===i&&s.childLines.length===n.length&&s.childLines.every((o,r)=>o===n[r])}invalidate(){this.invalidateCache();for(let e of this.children)e.invalidate?.()}render(e){if(this.children.length===0)return[];let n=Math.max(1,e-this.paddingX*2),i=" ".repeat(this.paddingX),s=[];for(let a of this.children){let c=a.render(n);for(let l of c)s.push(i+l)}if(s.length===0)return[];let o=this.bgFn?this.bgFn("test"):void 0;if(this.matchCache(e,s,o))return this.cache.lines;let r=[];for(let a=0;a<this.paddingY;a++)r.push(this.applyBg("",e));for(let a of s)r.push(this.applyBg(a,e));for(let a=0;a<this.paddingY;a++)r.push(this.applyBg("",e));return this.cache={childLines:s,width:e,bgSample:o,lines:r},r}applyBg(e,n){let i=j(e),s=Math.max(0,n-i),o=e+" ".repeat(s);return this.bgFn?Ss(o,n,this.bgFn):o}};var Di=!1;function Xc(t){Di=t}var ro={escape:"escape",esc:"esc",enter:"enter",return:"return",tab:"tab",space:"space",backspace:"backspace",delete:"delete",insert:"insert",clear:"clear",home:"home",end:"end",pageUp:"pageUp",pageDown:"pageDown",up:"up",down:"down",left:"left",right:"right",f1:"f1",f2:"f2",f3:"f3",f4:"f4",f5:"f5",f6:"f6",f7:"f7",f8:"f8",f9:"f9",f10:"f10",f11:"f11",f12:"f12",backtick:"`",hyphen:"-",equals:"=",leftbracket:"[",rightbracket:"]",backslash:"\\",semicolon:";",quote:"'",comma:",",period:".",slash:"/",exclamation:"!",at:"@",hash:"#",dollar:"$",percent:"%",caret:"^",ampersand:"&",asterisk:"*",leftparen:"(",rightparen:")",underscore:"_",plus:"+",pipe:"|",tilde:"~",leftbrace:"{",rightbrace:"}",colon:":",lessthan:"<",greaterthan:">",question:"?",ctrl:t=>`ctrl+${t}`,shift:t=>`shift+${t}`,alt:t=>`alt+${t}`,super:t=>`super+${t}`,ctrlShift:t=>`ctrl+shift+${t}`,shiftCtrl:t=>`shift+ctrl+${t}`,ctrlAlt:t=>`ctrl+alt+${t}`,altCtrl:t=>`alt+ctrl+${t}`,shiftAlt:t=>`shift+alt+${t}`,altShift:t=>`alt+shift+${t}`,ctrlSuper:t=>`ctrl+super+${t}`,superCtrl:t=>`super+ctrl+${t}`,shiftSuper:t=>`shift+super+${t}`,superShift:t=>`super+shift+${t}`,altSuper:t=>`alt+super+${t}`,superAlt:t=>`super+alt+${t}`,ctrlShiftAlt:t=>`ctrl+shift+alt+${t}`,ctrlShiftSuper:t=>`ctrl+shift+super+${t}`},TC=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),ee={shift:1,alt:2,ctrl:4,super:8},Yc=192,Ee={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},ht={up:-1,down:-2,right:-3,left:-4},Ne={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15},PW=new Map([[57399,48],[57400,49],[57401,50],[57402,51],[57403,52],[57404,53],[57405,54],[57406,55],[57407,56],[57408,57],[57409,46],[57410,47],[57411,42],[57412,45],[57413,43],[57415,61],[57416,44],[57417,ht.left],[57418,ht.right],[57419,ht.up],[57420,ht.down],[57421,Ne.pageUp],[57422,Ne.pageDown],[57423,Ne.home],[57424,Ne.end],[57425,Ne.insert],[57426,Ne.delete]]);function Lg(t){return PW.get(t)??t}function Rd(t,e){return(e&~Yc&ee.shift)!==0&&t>=65&&t<=90?t+32:t}var Pn={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},_W={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},EW={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]};var Vt=(t,e)=>e.includes(t),xn=(t,e,n)=>n===ee.shift?Vt(t,_W[e]):n===ee.ctrl?Vt(t,EW[e]):!1,kd="press";function Vn(t){return t.includes("\x1B[200~")?!1:!!(t.includes(":3u")||t.includes(":3~")||t.includes(":3A")||t.includes(":3B")||t.includes(":3C")||t.includes(":3D")||t.includes(":3H")||t.includes(":3F"))}function Md(t){if(!t)return"press";let e=parseInt(t,10);return e===2?"repeat":e===3?"release":"press"}function AW(t){let e=t.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(e){let o=parseInt(e[1],10),r=e[2]&&e[2].length>0?parseInt(e[2],10):void 0,a=e[3]?parseInt(e[3],10):void 0,c=e[4]?parseInt(e[4],10):1,l=Md(e[5]);return kd=l,{codepoint:o,shiftedKey:r,baseLayoutKey:a,modifier:c-1,eventType:l}}let n=t.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(n){let o=parseInt(n[1],10),r=Md(n[2]),a={A:-1,B:-2,C:-3,D:-4};return kd=r,{codepoint:a[n[3]],modifier:o-1,eventType:r}}let i=t.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(i){let o=parseInt(i[1],10),r=i[2]?parseInt(i[2],10):1,a=Md(i[3]),l={2:Ne.insert,3:Ne.delete,5:Ne.pageUp,6:Ne.pageDown,7:Ne.home,8:Ne.end}[o];if(l!==void 0)return kd=a,{codepoint:l,modifier:r-1,eventType:a}}let s=t.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(s){let o=parseInt(s[1],10),r=Md(s[2]),a=s[3]==="H"?Ne.home:Ne.end;return kd=r,{codepoint:a,modifier:o-1,eventType:r}}return null}function me(t,e,n){let i=AW(t);if(!i)return!1;let s=i.modifier&~Yc,o=n&~Yc;if(s!==o)return!1;let r=Rd(Lg(i.codepoint),i.modifier),a=Rd(Lg(e),n);if(r===a)return!0;if(i.baseLayoutKey!==void 0&&i.baseLayoutKey===e){let c=r,l=c>=97&&c<=122,d=TC.has(String.fromCharCode(c));if(!l&&!d)return!0}return!1}function Wg(t){let e=t.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!e)return null;let n=parseInt(e[1],10);return{codepoint:parseInt(e[2],10),modifier:n-1}}function _n(t,e,n){let i=Wg(t);return i?i.codepoint===e&&i.modifier===n:!1}function OW(){return!!process.env.WT_SESSION&&!process.env.SSH_CONNECTION&&!process.env.SSH_CLIENT&&!process.env.SSH_TTY}function SC(t,e){return t==="\x7F"?e===0:t!=="\b"?!1:OW()?e===ee.ctrl:e===0}function LW(t){let e=t.toLowerCase(),n=e.charCodeAt(0);return n>=97&&n<=122||e==="["||e==="\\"||e==="]"||e==="_"?String.fromCharCode(n&31):e==="-"?"":null}function CC(t){return t>="0"&&t<="9"}function Id(t,e,n){if(n===0)return!1;let i=Wg(t);return!i||i.modifier!==n?!1:Rd(i.codepoint,i.modifier)===Rd(e,n)}function WW(t){let e=t.toLowerCase().split("+"),n=e[e.length-1];return n?{key:n,ctrl:e.includes("ctrl"),shift:e.includes("shift"),alt:e.includes("alt"),super:e.includes("super")}:null}function Pe(t,e){let n=WW(e);if(!n)return!1;let{key:i,ctrl:s,shift:o,alt:r,super:a}=n,c=0;switch(o&&(c|=ee.shift),r&&(c|=ee.alt),s&&(c|=ee.ctrl),a&&(c|=ee.super),i){case"escape":case"esc":return c!==0?!1:t==="\x1B"||me(t,Ee.escape,0)||_n(t,Ee.escape,0);case"space":return!Di&&(c===ee.ctrl&&t==="\0"||c===ee.alt&&t==="\x1B ")?!0:c===0?t===" "||me(t,Ee.space,0)||_n(t,Ee.space,0):me(t,Ee.space,c)||_n(t,Ee.space,c);case"tab":return c===ee.shift?t==="\x1B[Z"||me(t,Ee.tab,ee.shift)||_n(t,Ee.tab,ee.shift):c===0?t===" "||me(t,Ee.tab,0):me(t,Ee.tab,c)||_n(t,Ee.tab,c);case"enter":case"return":return c===ee.shift?me(t,Ee.enter,ee.shift)||me(t,Ee.kpEnter,ee.shift)||_n(t,Ee.enter,ee.shift)?!0:Di?t==="\x1B\r"||t===`
|
|
34
34
|
`:!1:c===ee.alt?me(t,Ee.enter,ee.alt)||me(t,Ee.kpEnter,ee.alt)||_n(t,Ee.enter,ee.alt)?!0:Di?!1:t==="\x1B\r":c===0?t==="\r"||!Di&&t===`
|
|
@@ -82,7 +82,7 @@ ${s.join(`
|
|
|
82
82
|
`)}}function xo(t){let e=t.split(".").pop()?.toLowerCase();return e?{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",md:"markdown",markdown:"markdown",dockerfile:"dockerfile",makefile:"makefile",cmake:"cmake",lua:"lua",perl:"perl",r:"r",scala:"scala",clj:"clojure",ex:"elixir",exs:"elixir",erl:"erlang",hs:"haskell",ml:"ocaml",vim:"vim",graphql:"graphql",proto:"protobuf",tf:"hcl",hcl:"hcl"}[e]:void 0}function Tt(){return{heading:t=>b.fg("mdHeading",t),link:t=>b.fg("mdLink",t),linkUrl:t=>b.fg("mdLinkUrl",t),code:t=>b.fg("mdCode",t),codeBlock:t=>b.fg("mdCodeBlock",t),codeBlockBorder:t=>b.fg("mdCodeBlockBorder",t),quote:t=>b.fg("mdQuote",t),quoteBorder:t=>b.fg("mdQuoteBorder",t),hr:t=>b.fg("mdHr",t),listBullet:t=>b.fg("mdListBullet",t),bold:t=>b.bold(t),italic:t=>b.italic(t),underline:t=>b.underline(t),strikethrough:t=>la.strikethrough(t),highlightCode:(t,e)=>{let n=e&&Yg(e)?e:void 0;if(!n)return t.split(`
|
|
83
83
|
`).map(s=>b.fg("mdCodeBlock",s));let i={language:n,ignoreIllegals:!0,theme:dT(b)};try{return Qg(t,i).split(`
|
|
84
84
|
`)}catch{return t.split(`
|
|
85
|
-
`).map(s=>b.fg("mdCodeBlock",s))}}}}function yo(){return{selectedPrefix:t=>b.fg("accent",t),selectedText:t=>b.fg("accent",t),description:t=>b.fg("muted",t),scrollInfo:t=>b.fg("muted",t),noMatch:t=>b.fg("muted",t)}}function ll(){return{borderColor:t=>b.fg("borderMuted",t),selectList:yo()}}function Fd(){return{label:(t,e)=>e?b.fg("accent",t):t,value:(t,e)=>e?b.fg("accent",t):b.fg("muted",t),description:t=>b.fg("dim",t),cursor:b.fg("accent","\u2192 "),hint:t=>b.fg("dim",t)}}import{parse as
|
|
85
|
+
`).map(s=>b.fg("mdCodeBlock",s))}}}}function yo(){return{selectedPrefix:t=>b.fg("accent",t),selectedText:t=>b.fg("accent",t),description:t=>b.fg("muted",t),scrollInfo:t=>b.fg("muted",t),noMatch:t=>b.fg("muted",t)}}function ll(){return{borderColor:t=>b.fg("borderMuted",t),selectList:yo()}}function Fd(){return{label:(t,e)=>e?b.fg("accent",t):t,value:(t,e)=>e?b.fg("accent",t):b.fg("muted",t),description:t=>b.fg("dim",t),cursor:b.fg("accent","\u2192 "),hint:t=>b.fg("dim",t)}}import{parse as Sde}from"yaml";function O5({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var L5=O5();function ul(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return!t.includes("\x1B")&&!t.includes("\x9B")?t:t.replace(L5,"")}import{existsSync as Dd}from"node:fs";import{delimiter as pT}from"node:path";import{spawn as W5,spawnSync as mT}from"child_process";function hT(){if(process.platform==="win32"){try{let t=mT("where",["bash.exe"],{encoding:"utf-8",timeout:5e3,windowsHide:!0});if(t.status===0&&t.stdout){let e=t.stdout.trim().split(/\r?\n/)[0];if(e&&Dd(e))return e}}catch{}return null}try{let t=mT("which",["bash"],{encoding:"utf-8",timeout:5e3});if(t.status===0&&t.stdout){let e=t.stdout.trim().split(/\r?\n/)[0];if(e)return e}}catch{}return null}function Bd(t){if(t){if(Dd(t))return{shell:t,args:["-c"]};throw new Error(`Custom shell path not found: ${t}`)}if(process.platform==="win32"){let n=[],i=process.env.ProgramFiles;i&&n.push(`${i}\\Git\\bin\\bash.exe`);let s=process.env["ProgramFiles(x86)"];s&&n.push(`${s}\\Git\\bin\\bash.exe`);for(let r of n)if(Dd(r))return{shell:r,args:["-c"]};let o=hT();if(o)return{shell:o,args:["-c"]};throw new Error(`No bash shell found. Options:
|
|
86
86
|
1. Install Git for Windows: https://git-scm.com/download/win
|
|
87
87
|
2. Add your bash to PATH (Cygwin, MSYS2, etc.)
|
|
88
88
|
3. Set shellPath in settings.json
|
|
@@ -102,7 +102,7 @@ ${n.map(r=>` ${r}`).join(`
|
|
|
102
102
|
`);else{for(let i of this.fileEntries)Gd(this.sessionFile,`${JSON.stringify(i)}
|
|
103
103
|
`);this.flushed=!0}}_appendEntry(e){this.fileEntries.push(e),this.byId.set(e.id,e),this.leafId=e.id,this._persist(e)}appendMessage(e){let n={type:"message",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),message:e};return this._appendEntry(n),n.id}appendThinkingLevelChange(e){let n={type:"thinking_level_change",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),thinkingLevel:e};return this._appendEntry(n),n.id}appendModelChange(e,n){let i={type:"model_change",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),provider:e,modelId:n};return this._appendEntry(i),i.id}appendCompaction(e,n,i,s,o){let r={type:"compaction",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),summary:e,firstKeptEntryId:n,tokensBefore:i,details:s,fromHook:o};return this._appendEntry(r),r.id}appendCustomEntry(e,n){let i={type:"custom",customType:e,data:n,id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString()};return this._appendEntry(i),i.id}appendSessionInfo(e){let n={type:"session_info",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),name:e.trim()};return this._appendEntry(n),n.id}getSessionName(){let e=this.getEntries();for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.type==="session_info")return i.name?.trim()||void 0}}appendCustomMessageEntry(e,n,i,s){let o={type:"custom_message",customType:e,content:n,display:i,details:s,id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString()};return this._appendEntry(o),o.id}getLeafId(){return this.leafId}getLeafEntry(){return this.leafId?this.byId.get(this.leafId):void 0}getEntry(e){return this.byId.get(e)}getChildren(e){let n=[];for(let i of this.byId.values())i.parentId===e&&n.push(i);return n}getLabel(e){return this.labelsById.get(e)}appendLabelChange(e,n){if(!this.byId.has(e))throw new Error(`Entry ${e} not found`);let i={type:"label",id:En(this.byId),parentId:this.leafId,timestamp:new Date().toISOString(),targetId:e,label:n};return this._appendEntry(i),n?(this.labelsById.set(e,n),this.labelTimestampsById.set(e,i.timestamp)):(this.labelsById.delete(e),this.labelTimestampsById.delete(e)),i.id}getBranch(e){let n=[],i=e??this.leafId,s=i?this.byId.get(i):void 0;for(;s;)n.unshift(s),s=s.parentId?this.byId.get(s.parentId):void 0;return n}buildSessionContext(){return pf(this.getEntries(),this.leafId,this.byId)}getHeader(){let e=this.fileEntries.find(n=>n.type==="session");return e||null}getEntries(){return this.fileEntries.filter(e=>e.type!=="session")}getTree(){let e=this.getEntries(),n=new Map,i=[];for(let o of e){let r=this.labelsById.get(o.id),a=this.labelTimestampsById.get(o.id);n.set(o.id,{entry:o,children:[],label:r,labelTimestamp:a})}for(let o of e){let r=n.get(o.id);if(o.parentId===null||o.parentId===o.id)i.push(r);else{let a=n.get(o.parentId);a?a.children.push(r):i.push(r)}}let s=[...i];for(;s.length>0;){let o=s.pop();o.children.sort((r,a)=>new Date(r.entry.timestamp).getTime()-new Date(a.entry.timestamp).getTime()),s.push(...o.children)}return i}branch(e){if(!this.byId.has(e))throw new Error(`Entry ${e} not found`);this.leafId=e}resetLeaf(){this.leafId=null}branchWithSummary(e,n,i,s){if(e!==null&&!this.byId.has(e))throw new Error(`Entry ${e} not found`);this.leafId=e;let o={type:"branch_summary",id:En(this.byId),parentId:e,timestamp:new Date().toISOString(),fromId:e??"root",summary:n,details:i,fromHook:s};return this._appendEntry(o),o.id}createBranchedSession(e){let n=this.sessionFile,i=this.getBranch(e);if(i.length===0)throw new Error(`Entry ${e} not found`);let s=i.filter(g=>g.type!=="label"),o=Kd(),r=new Date().toISOString(),a=r.replace(/[:.]/g,"-"),c=Is(this.getSessionDir(),`${a}_${o}.jsonl`),l={type:"session",version:ga,id:o,timestamp:r,cwd:this.cwd,parentSession:this.persist?n:void 0},d=new Set(s.map(g=>g.id)),u=[];for(let[g,h]of this.labelsById)d.has(g)&&u.push({targetId:g,label:h,timestamp:this.labelTimestampsById.get(g)});if(this.persist){let h=s[s.length-1]?.id||null,f=[];for(let{targetId:y,label:w,timestamp:P}of u){let _={type:"label",id:En(new Set(d)),parentId:h,timestamp:P,targetId:y,label:w};d.add(_.id),f.push(_),h=_.id}return this.fileEntries=[l,...s,...f],this.sessionId=o,this.sessionFile=c,this._buildIndex(),this.fileEntries.some(y=>y.type==="message"&&y.message.role==="assistant")?(this._rewriteFile(),this.flushed=!0):this.flushed=!1,c}let p=[],m=s[s.length-1]?.id||null;for(let{targetId:g,label:h,timestamp:f}of u){let x={type:"label",id:En(new Set([...d,...p.map(y=>y.id)])),parentId:m,timestamp:f,targetId:g,label:h};p.push(x),m=x.id}this.fileEntries=[l,...s,...p],this.sessionId=o,this._buildIndex()}static create(e,n){let i=n??pl(e);return new t(e,i,void 0,!0)}static open(e,n,i){let o=lf(e).find(c=>c.type==="session"),r=i??o?.cwd??process.cwd(),a=n??bT(e,"..");return new t(r,a,e,!0)}static continueRecent(e,n){let i=n??pl(e),s=Y5(i);return s?new t(e,i,s,!0):new t(e,i,void 0,!0)}static inMemory(e=process.cwd()){return new t(e,"",void 0,!1)}static forkFrom(e,n,i){let s=lf(e);if(s.length===0)throw new Error(`Cannot fork: source session file is empty or invalid: ${e}`);if(!s.find(p=>p.type==="session"))throw new Error(`Cannot fork: source session has no header: ${e}`);let r=i??pl(n);wo(r)||uf(r,{recursive:!0});let a=Kd(),c=new Date().toISOString(),l=c.replace(/[:.]/g,"-"),d=Is(r,`${l}_${a}.jsonl`);Gd(d,`${JSON.stringify({type:"session",version:ga,id:a,timestamp:c,cwd:n,parentSession:e})}
|
|
104
104
|
`);for(let p of s)p.type!=="session"&&Gd(d,`${JSON.stringify(p)}
|
|
105
|
-
`);return new t(n,r,d,!0)}static async list(e,n,i){let s=n??pl(e),o=await iU(s,i);return o.sort((r,a)=>a.modified.getTime()-r.modified.getTime()),o}static async listAll(e){let n=xw();try{if(!wo(n))return[];let s=(await df(n,{withFileTypes:!0})).filter(u=>u.isDirectory()).map(u=>Is(n,u.name)),o=0,r=[];for(let u of s)try{let p=(await df(u)).filter(m=>m.endsWith(".jsonl"));r.push(p.map(m=>Is(u,m))),o+=p.length}catch{r.push([])}let a=0,c=[],l=r.flat(),d=await yT(l,()=>{a++,e?.(a,o)});for(let u of d)u&&c.push(u);return c.sort((u,p)=>p.modified.getTime()-u.modified.getTime()),c}catch{return[]}}};import{createRequire as NU}from"node:module";import*as
|
|
105
|
+
`);return new t(n,r,d,!0)}static async list(e,n,i){let s=n??pl(e),o=await iU(s,i);return o.sort((r,a)=>a.modified.getTime()-r.modified.getTime()),o}static async listAll(e){let n=xw();try{if(!wo(n))return[];let s=(await df(n,{withFileTypes:!0})).filter(u=>u.isDirectory()).map(u=>Is(n,u.name)),o=0,r=[];for(let u of s)try{let p=(await df(u)).filter(m=>m.endsWith(".jsonl"));r.push(p.map(m=>Is(u,m))),o+=p.length}catch{r.push([])}let a=0,c=[],l=r.flat(),d=await yT(l,()=>{a++,e?.(a,o)});for(let u of d)u&&c.push(u);return c.sort((u,p)=>p.modified.getTime()-u.modified.getTime()),c}catch{return[]}}};import{createRequire as NU}from"node:module";import*as Kpe from"@earendil-works/pi-agent-core";var dU='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" aria-hidden="true"><path fill="#fff" fill-rule="evenodd" d="M165.29 165.29 H517.36 V400 H400 V517.36 H282.65 V634.72 H165.29 Z M282.65 282.65 V400 H400 V282.65 Z"/><path fill="#fff" d="M517.36 400 H634.72 V634.72 H517.36 Z"/></svg>';function Hd(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function wT(t){let e=Hd(t.title),n=Hd(t.heading),i=Hd(t.message),s=t.details?Hd(t.details):void 0;return`<!doctype html>
|
|
106
106
|
<html lang="en">
|
|
107
107
|
<head>
|
|
108
108
|
<meta charset="utf-8" />
|
|
@@ -175,7 +175,7 @@ ${n.map(r=>` ${r}`).join(`
|
|
|
175
175
|
${s?`<div class="details">${s}</div>`:""}
|
|
176
176
|
</main>
|
|
177
177
|
</body>
|
|
178
|
-
</html>`}function zd(t){return wT({title:"Authentication successful",heading:"Authentication successful",message:t})}function di(t,e){return wT({title:"Authentication failed",heading:"Authentication failed",message:t,details:e})}function ST(t){let e="";for(let n of t)e+=String.fromCharCode(n);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Vd(){let t=new Uint8Array(32);crypto.getRandomValues(t);let e=ST(t),i=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",i),o=ST(new Uint8Array(s));return{verifier:e,challenge:o}}var Jd=null,hf=null,pU=t=>atob(t),ff=pU("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),mU="https://claude.ai/oauth/authorize",ba="https://platform.claude.com/v1/oauth/token",hU=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",CT=53692,TT="/callback",fa=`http://localhost:${CT}${TT}`,gU="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";async function fU(){if(Jd)return Jd;if(!hf){if(typeof process>"u"||!process.versions?.node&&!process.versions?.bun)throw new Error("Anthropic OAuth is only available in Node.js environments");hf=import("node:http").then(t=>({createServer:t.createServer}))}return Jd=await hf,Jd}function gf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function ml(t){if(t instanceof Error){let e=[`${t.name}: ${t.message}`],n=t;return n.code&&e.push(`code=${n.code}`),typeof n.errno<"u"&&e.push(`errno=${String(n.errno)}`),typeof t.cause<"u"&&e.push(`cause=${ml(t.cause)}`),t.stack&&e.push(`stack=${t.stack}`),e.join("; ")}return String(t)}async function bU(t){let{createServer:e}=await fU();return new Promise((n,i)=>{let s,o=new Promise(a=>{let c=!1;s=l=>{c||(c=!0,a(l))}}),r=e((a,c)=>{try{let l=new URL(a.url||"","http://localhost");if(l.pathname!==TT){c.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Callback route not found."));return}let d=l.searchParams.get("code"),u=l.searchParams.get("state"),p=l.searchParams.get("error");if(p){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Anthropic authentication did not complete.",`Error: ${p}`));return}if(!d||!u){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Missing code or state parameter."));return}if(u!==t){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("State mismatch."));return}c.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),c.end(zd("Anthropic authentication completed. You can close this window.")),s?.({code:d,state:u})}catch{c.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),c.end("Internal error")}});r.on("error",a=>{i(a)}),r.listen(CT,hU,()=>{n({server:r,redirectUri:fa,cancelWait:()=>{s?.(null)},waitForCode:()=>o})})})}async function kT(t,e){let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e4)}),i=await n.text();if(!n.ok)throw new Error(`HTTP request failed. status=${n.status}; url=${t}; body=${i}`);return i}async function xU(t,e,n,i){let s;try{s=await kT(ba,{grant_type:"authorization_code",client_id:ff,code:t,state:e,redirect_uri:i,code_verifier:n})}catch(r){throw new Error(`Token exchange request failed. url=${ba}; redirect_uri=${i}; response_type=authorization_code; details=${ml(r)}`)}let o;try{o=JSON.parse(s)}catch(r){throw new Error(`Token exchange returned invalid JSON. url=${ba}; body=${s}; details=${ml(r)}`)}return{refresh:o.refresh_token,access:o.access_token,expires:Date.now()+o.expires_in*1e3-300*1e3}}async function MT(t){let{verifier:e,challenge:n}=await Vd(),i=await bU(e),s,o,r=fa;try{let a=new URLSearchParams({code:"true",client_id:ff,response_type:"code",redirect_uri:fa,scope:gU,code_challenge:n,code_challenge_method:"S256",state:e});if(t.onAuth({url:`${mU}?${a.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."}),t.onManualCodeInput){let c,l,d=t.onManualCodeInput().then(p=>{c=p,i.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),i.cancelWait()}),u=await i.waitForCode();if(l)throw l;if(u?.code)s=u.code,o=u.state,r=fa;else if(c){let p=gf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,o=p.state??e}if(!s){if(await d,l)throw l;if(c){let p=gf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,o=p.state??e}}}else{let c=await i.waitForCode();c?.code&&(s=c.code,o=c.state,r=fa)}if(!s){let c=await t.onPrompt({message:"Paste the authorization code or full redirect URL:",placeholder:fa}),l=gf(c);if(l.state&&l.state!==e)throw new Error("OAuth state mismatch");s=l.code,o=l.state??e}if(!s)throw new Error("Missing authorization code");if(!o)throw new Error("Missing OAuth state");return t.onProgress?.("Exchanging authorization code for tokens..."),xU(s,o,e,r)}finally{i.server.close()}}async function IT(t){let e;try{e=await kT(ba,{grant_type:"refresh_token",client_id:ff,refresh_token:t})}catch(i){throw new Error(`Anthropic token refresh request failed. url=${ba}; details=${ml(i)}`)}let n;try{n=JSON.parse(e)}catch(i){throw new Error(`Anthropic token refresh returned invalid JSON. url=${ba}; body=${e}; details=${ml(i)}`)}return{refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1e3-300*1e3}}var bf={id:"anthropic",name:"Anthropic (Claude Pro/Max)",usesCallbackServer:!0,async login(t){return MT({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return IT(t.refresh)},getApiKey(t){return t.access}};In();var yU=t=>atob(t),RT=yU("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),PT={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},vU=1.2,wU=1.4;function xf(t){let e=t.trim();if(!e)return null;try{return(e.includes("://")?new URL(e):new URL(`https://${e}`)).hostname}catch{return null}}function yf(t){return{deviceCodeUrl:`https://${t}/login/device/code`,accessTokenUrl:`https://${t}/login/oauth/access_token`,copilotTokenUrl:`https://api.${t}/copilot_internal/v2/token`}}function SU(t){let e=t.match(/proxy-ep=([^;]+)/);return e?`https://${e[1].replace(/^proxy\./,"api.")}`:null}function vf(t,e){if(t){let n=SU(t);if(n)return n}return e?`https://copilot-api.${e}`:"https://api.individual.githubcopilot.com"}async function wf(t,e){let n=await fetch(t,e);if(!n.ok){let i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json()}async function CU(t){let e=yf(t),n=await wf(e.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:RT,scope:"read:user"})});if(!n||typeof n!="object")throw new Error("Invalid device code response");let i=n.device_code,s=n.user_code,o=n.verification_uri,r=n.interval,a=n.expires_in;if(typeof i!="string"||typeof s!="string"||typeof o!="string"||typeof r!="number"||typeof a!="number")throw new Error("Invalid device code response fields");return{device_code:i,user_code:s,verification_uri:o,interval:r,expires_in:a}}function TU(t,e){return new Promise((n,i)=>{if(e?.aborted){i(new Error("Login cancelled"));return}let s=setTimeout(n,t);e?.addEventListener("abort",()=>{clearTimeout(s),i(new Error("Login cancelled"))},{once:!0})})}async function kU(t,e,n,i,s){let o=yf(t),r=Date.now()+i*1e3,a=Math.max(1e3,Math.floor(n*1e3)),c=vU,l=0;for(;Date.now()<r;){if(s?.aborted)throw new Error("Login cancelled");let d=r-Date.now(),u=Math.min(Math.ceil(a*c),d);await TU(u,s);let p=await wf(o.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:RT,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(p&&typeof p=="object"&&typeof p.access_token=="string")return p.access_token;if(p&&typeof p=="object"&&typeof p.error=="string"){let{error:m,error_description:g,interval:h}=p;if(m==="authorization_pending")continue;if(m==="slow_down"){l+=1,a=typeof h=="number"&&h>0?h*1e3:Math.max(1e3,a+5e3),c=wU;continue}let f=g?`: ${g}`:"";throw new Error(`Device flow failed: ${m}${f}`)}}throw l>0?new Error("Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again."):new Error("Device flow timed out")}async function Sf(t,e){let i=yf(e||"github.com"),s=await wf(i.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${t}`,...PT}});if(!s||typeof s!="object")throw new Error("Invalid Copilot token response");let o=s.token,r=s.expires_at;if(typeof o!="string"||typeof r!="number")throw new Error("Invalid Copilot token response fields");return{refresh:t,access:o,expires:r*1e3-300*1e3,enterpriseUrl:e}}async function MU(t,e,n){let s=`${vf(t,n)}/models/${e}/policy`;try{return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,...PT,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})})).ok}catch{return!1}}async function IU(t,e,n){let i=lg("github-copilot");await Promise.all(i.map(async s=>{let o=await MU(t,s.id,e);n?.(s.id,o)}))}async function _T(t){let e=await t.onPrompt({message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com",allowEmpty:!0});if(t.signal?.aborted)throw new Error("Login cancelled");let n=e.trim(),i=xf(e);if(n&&!i)throw new Error("Invalid GitHub Enterprise URL/domain");let s=i||"github.com",o=await CU(s);t.onAuth(o.verification_uri,`Enter code: ${o.user_code}`);let r=await kU(s,o.device_code,o.interval,o.expires_in,t.signal),a=await Sf(r,i??void 0);return t.onProgress?.("Enabling models..."),await IU(a.access,i??void 0),a}var Cf={id:"github-copilot",name:"GitHub Copilot",async login(t){return _T({onAuth:(e,n)=>t.onAuth({url:e,instructions:n}),onPrompt:t.onPrompt,onProgress:t.onProgress,signal:t.signal})},async refreshToken(t){let e=t;return Sf(e.refresh,e.enterpriseUrl)},getApiKey(t){return t.access},modifyModels(t,e){let n=e,i=n.enterpriseUrl?xf(n.enterpriseUrl)??void 0:void 0,s=vf(n.access,i);return t.map(o=>o.provider==="github-copilot"?{...o,baseUrl:s}:o)}};var kf=null,Mf=null;typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(import("node:crypto").then(t=>{kf=t.randomBytes}),import("node:http").then(t=>{Mf=t}));var RU=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",If="app_EMoamEEZ73f0CkXaXp7hrann",PU="https://auth.openai.com/oauth/authorize",ET="https://auth.openai.com/oauth/token",AT="http://localhost:1455/auth/callback",_U="openid profile email offline_access",EU="https://api.openai.com/auth";function AU(){if(!kf)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");return kf(16).toString("hex")}function Tf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function OU(t){try{let e=t.split(".");if(e.length!==3)return null;let n=e[1]??"",i=atob(n);return JSON.parse(i)}catch{return null}}async function LU(t,e,n=AT){let i=await fetch(ET,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:If,code:t,code_verifier:e,redirect_uri:n})});if(!i.ok){let o=await i.text().catch(()=>"");return{type:"failed",status:i.status,message:`OpenAI Codex token exchange failed (${i.status}): ${o||i.statusText}`}}let s=await i.json();return!s.access_token||!s.refresh_token||typeof s.expires_in!="number"?{type:"failed",message:`OpenAI Codex token exchange response missing fields: ${JSON.stringify(s)}`}:{type:"success",access:s.access_token,refresh:s.refresh_token,expires:Date.now()+s.expires_in*1e3}}async function WU(t){try{let e=await fetch(ET,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:If})});if(!e.ok){let i=await e.text().catch(()=>"");return{type:"failed",status:e.status,message:`OpenAI Codex token refresh failed (${e.status}): ${i||e.statusText}`}}let n=await e.json();return!n.access_token||!n.refresh_token||typeof n.expires_in!="number"?{type:"failed",message:`OpenAI Codex token refresh response missing fields: ${JSON.stringify(n)}`}:{type:"success",access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1e3}}catch(e){return{type:"failed",message:`OpenAI Codex token refresh error: ${e instanceof Error?e.message:String(e)}`}}}async function UU(t="pi"){let{verifier:e,challenge:n}=await Vd(),i=AU(),s=new URL(PU);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",If),s.searchParams.set("redirect_uri",AT),s.searchParams.set("scope",_U),s.searchParams.set("code_challenge",n),s.searchParams.set("code_challenge_method","S256"),s.searchParams.set("state",i),s.searchParams.set("id_token_add_organizations","true"),s.searchParams.set("codex_cli_simplified_flow","true"),s.searchParams.set("originator",t),{verifier:e,state:i,url:s.toString()}}function FU(t){if(!Mf)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");let e,n=new Promise(s=>{let o=!1;e=r=>{o||(o=!0,s(r))}}),i=Mf.createServer((s,o)=>{try{let r=new URL(s.url||"","http://localhost");if(r.pathname!=="/auth/callback"){o.statusCode=404,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Callback route not found."));return}if(r.searchParams.get("state")!==t){o.statusCode=400,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("State mismatch."));return}let a=r.searchParams.get("code");if(!a){o.statusCode=400,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Missing authorization code."));return}o.statusCode=200,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(zd("OpenAI authentication completed. You can close this window.")),e?.({code:a})}catch{o.statusCode=500,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Internal error while processing OAuth callback."))}});return new Promise(s=>{i.listen(1455,RU,()=>{s({close:()=>i.close(),cancelWait:()=>{e?.(null)},waitForCode:()=>n})}).on("error",o=>{e?.(null),s({close:()=>{try{i.close()}catch{}},cancelWait:()=>{},waitForCode:async()=>null})})})}function OT(t){let i=OU(t)?.[EU]?.chatgpt_account_id;return typeof i=="string"&&i.length>0?i:null}async function LT(t){let{verifier:e,state:n,url:i}=await UU(t.originator),s=await FU(n);t.onAuth({url:i,instructions:"A browser window should open. Complete login to finish."});let o;try{if(t.onManualCodeInput){let c,l,d=t.onManualCodeInput().then(p=>{c=p,s.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),s.cancelWait()}),u=await s.waitForCode();if(l)throw l;if(u?.code)o=u.code;else if(c){let p=Tf(c);if(p.state&&p.state!==n)throw new Error("State mismatch");o=p.code}if(!o){if(await d,l)throw l;if(c){let p=Tf(c);if(p.state&&p.state!==n)throw new Error("State mismatch");o=p.code}}}else{let c=await s.waitForCode();c?.code&&(o=c.code)}if(!o){let c=await t.onPrompt({message:"Paste the authorization code (or full redirect URL):"}),l=Tf(c);if(l.state&&l.state!==n)throw new Error("State mismatch");o=l.code}if(!o)throw new Error("Missing authorization code");let r=await LU(o,e);if(r.type!=="success")throw new Error(r.message);let a=OT(r.access);if(!a)throw new Error("Failed to extract accountId from token");return{access:r.access,refresh:r.refresh,expires:r.expires,accountId:a}}finally{s.close()}}async function WT(t){let e=await WU(t);if(e.type!=="success")throw new Error(e.message);let n=OT(e.access);if(!n)throw new Error("Failed to extract accountId from token");return{access:e.access,refresh:e.refresh,expires:e.expires,accountId:n}}var Rf={id:"openai-codex",name:"ChatGPT Plus/Pro (Codex Subscription)",usesCallbackServer:!0,async login(t){return LT({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return WT(t.refresh)},getApiKey(t){return t.access}};var DU=[bf,Cf,Rf],$U=new Map(DU.map(t=>[t.id,t]));function Pf(){return Array.from($U.values())}import{createJiti as Vpe}from"jiti/static";import*as Jpe from"typebox";import*as Qpe from"typebox/compile";import*as Ype from"typebox/value";var nme=NU(import.meta.url);function Yd(t){return t.toolName==="edit"}function Xd(t){return t.toolName==="write"}function hl(t,e){return e.toolName===t}import kme from"ignore";import{realpathSync as ZU}from"node:fs";import{isAbsolute as NT,relative as eF,resolve as _f,sep as jT}from"node:path";function xa(t){try{return ZU(t)}catch{return t}}function Zd(t){let e=t.trim();return!(e.startsWith("npm:")||e.startsWith("git:")||e.startsWith("github:")||e.startsWith("http:")||e.startsWith("https:")||e.startsWith("ssh:"))}function qT(t,e){return NT(t)?_f(t):_f(e,t)}function ep(t,e){let n=_f(e),i=qT(t,n),s=eF(n,i);return s===""||s!==".."&&!s.startsWith(`..${jT}`)&&!NT(s)?s||".":void 0}function GT(t,e){let n=qT(t,e);return(ep(n,e)??n).split(jT).join("/")}function KT(t){let e=process.platform==="darwin"?["com.dropbox.ignored","com.apple.fileprovider.ignore#P"]:process.platform==="linux"?["user.com.dropbox.ignored"]:[];for(let n of e)process.platform==="darwin"?Hr("xattr",["-w",n,"1",t],{encoding:"utf-8",stdio:"ignore"}):Hr("setfattr",["-n",n,"-v","1",t],{encoding:"utf-8",stdio:"ignore"})}import{existsSync as cF}from"node:fs";import{spawn as lF}from"child_process";import{Type as np}from"typebox";function nF(t,e){let n=process.platform==="darwin"&&t.toLowerCase()==="alt"?"option":t;return e.capitalize?n.charAt(0).toUpperCase()+n.slice(1):n}function gl(t,e={}){return t.split("/").map(n=>n.split("+").map(i=>nF(i,e)).join("+")).join("/")}function HT(t,e={}){return t.length===0?"":gl(t.join("/"),e)}function he(t){return HT(ve().getKeys(t))}function fl(t){return HT(ve().getKeys(t),{capitalize:!0})}function ce(t,e){return b.fg("dim",he(t))+b.fg("muted",` ${e}`)}function dt(t,e){return b.fg("dim",gl(t))+b.fg("muted",` ${e}`)}function ya(t,e,n,i=0){if(!t)return{visualLines:[],skippedCount:0};let o=new A(t,i,0).render(n);if(o.length<=e)return{visualLines:o,skippedCount:0};let r=o.slice(-e),a=o.length-e;return{visualLines:r,skippedCount:a}}import{randomBytes as iF}from"node:crypto";import{createWriteStream as sF}from"node:fs";import{tmpdir as oF}from"node:os";import{join as rF}from"node:path";function aF(t){let e=iF(8).toString("hex");return rF(oF(),`${t}-${e}.log`)}function Ef(t){return Buffer.byteLength(t,"utf-8")}var tp=class{constructor(e={}){this.decoder=new TextDecoder;this.rawChunks=[];this.tailText="";this.tailBytes=0;this.tailStartsAtLineBoundary=!0;this.totalRawBytes=0;this.totalDecodedBytes=0;this.totalLines=1;this.currentLineBytes=0;this.finished=!1;this.maxLines=e.maxLines??2e3,this.maxBytes=e.maxBytes??51200,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=e.tempFilePrefix??"pi-output"}append(e){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=e.length,this.appendDecodedText(this.decoder.decode(e,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(e)):e.length>0&&this.rawChunks.push(e)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(e={}){let n=vo(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),i=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,s=i?n.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,o={...n,truncated:i,truncatedBy:s,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return e.persistIfTruncated&&o.truncated&&this.ensureTempFile(),{content:o.content,truncation:o,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;let e=this.tempFileStream;this.tempFileStream=void 0,await new Promise((n,i)=>{let s=r=>{e.off("finish",o),i(r)},o=()=>{e.off("error",s),n()};e.once("error",s),e.once("finish",o),e.end()})}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(e){if(e.length===0)return;let n=Ef(e);this.totalDecodedBytes+=n,this.tailText+=e,this.tailBytes+=n,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let i=0,s=-1;for(let o=e.indexOf(`
|
|
178
|
+
</html>`}function zd(t){return wT({title:"Authentication successful",heading:"Authentication successful",message:t})}function di(t,e){return wT({title:"Authentication failed",heading:"Authentication failed",message:t,details:e})}function ST(t){let e="";for(let n of t)e+=String.fromCharCode(n);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function Vd(){let t=new Uint8Array(32);crypto.getRandomValues(t);let e=ST(t),i=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",i),o=ST(new Uint8Array(s));return{verifier:e,challenge:o}}var Jd=null,hf=null,pU=t=>atob(t),ff=pU("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),mU="https://claude.ai/oauth/authorize",ba="https://platform.claude.com/v1/oauth/token",hU=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",CT=53692,TT="/callback",fa=`http://localhost:${CT}${TT}`,gU="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";async function fU(){if(Jd)return Jd;if(!hf){if(typeof process>"u"||!process.versions?.node&&!process.versions?.bun)throw new Error("Anthropic OAuth is only available in Node.js environments");hf=import("node:http").then(t=>({createServer:t.createServer}))}return Jd=await hf,Jd}function gf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function ml(t){if(t instanceof Error){let e=[`${t.name}: ${t.message}`],n=t;return n.code&&e.push(`code=${n.code}`),typeof n.errno<"u"&&e.push(`errno=${String(n.errno)}`),typeof t.cause<"u"&&e.push(`cause=${ml(t.cause)}`),t.stack&&e.push(`stack=${t.stack}`),e.join("; ")}return String(t)}async function bU(t){let{createServer:e}=await fU();return new Promise((n,i)=>{let s,o=new Promise(a=>{let c=!1;s=l=>{c||(c=!0,a(l))}}),r=e((a,c)=>{try{let l=new URL(a.url||"","http://localhost");if(l.pathname!==TT){c.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Callback route not found."));return}let d=l.searchParams.get("code"),u=l.searchParams.get("state"),p=l.searchParams.get("error");if(p){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Anthropic authentication did not complete.",`Error: ${p}`));return}if(!d||!u){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("Missing code or state parameter."));return}if(u!==t){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(di("State mismatch."));return}c.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),c.end(zd("Anthropic authentication completed. You can close this window.")),s?.({code:d,state:u})}catch{c.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),c.end("Internal error")}});r.on("error",a=>{i(a)}),r.listen(CT,hU,()=>{n({server:r,redirectUri:fa,cancelWait:()=>{s?.(null)},waitForCode:()=>o})})})}async function kT(t,e){let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e4)}),i=await n.text();if(!n.ok)throw new Error(`HTTP request failed. status=${n.status}; url=${t}; body=${i}`);return i}async function xU(t,e,n,i){let s;try{s=await kT(ba,{grant_type:"authorization_code",client_id:ff,code:t,state:e,redirect_uri:i,code_verifier:n})}catch(r){throw new Error(`Token exchange request failed. url=${ba}; redirect_uri=${i}; response_type=authorization_code; details=${ml(r)}`)}let o;try{o=JSON.parse(s)}catch(r){throw new Error(`Token exchange returned invalid JSON. url=${ba}; body=${s}; details=${ml(r)}`)}return{refresh:o.refresh_token,access:o.access_token,expires:Date.now()+o.expires_in*1e3-300*1e3}}async function MT(t){let{verifier:e,challenge:n}=await Vd(),i=await bU(e),s,o,r=fa;try{let a=new URLSearchParams({code:"true",client_id:ff,response_type:"code",redirect_uri:fa,scope:gU,code_challenge:n,code_challenge_method:"S256",state:e});if(t.onAuth({url:`${mU}?${a.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."}),t.onManualCodeInput){let c,l,d=t.onManualCodeInput().then(p=>{c=p,i.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),i.cancelWait()}),u=await i.waitForCode();if(l)throw l;if(u?.code)s=u.code,o=u.state,r=fa;else if(c){let p=gf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,o=p.state??e}if(!s){if(await d,l)throw l;if(c){let p=gf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,o=p.state??e}}}else{let c=await i.waitForCode();c?.code&&(s=c.code,o=c.state,r=fa)}if(!s){let c=await t.onPrompt({message:"Paste the authorization code or full redirect URL:",placeholder:fa}),l=gf(c);if(l.state&&l.state!==e)throw new Error("OAuth state mismatch");s=l.code,o=l.state??e}if(!s)throw new Error("Missing authorization code");if(!o)throw new Error("Missing OAuth state");return t.onProgress?.("Exchanging authorization code for tokens..."),xU(s,o,e,r)}finally{i.server.close()}}async function IT(t){let e;try{e=await kT(ba,{grant_type:"refresh_token",client_id:ff,refresh_token:t})}catch(i){throw new Error(`Anthropic token refresh request failed. url=${ba}; details=${ml(i)}`)}let n;try{n=JSON.parse(e)}catch(i){throw new Error(`Anthropic token refresh returned invalid JSON. url=${ba}; body=${e}; details=${ml(i)}`)}return{refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1e3-300*1e3}}var bf={id:"anthropic",name:"Anthropic (Claude Pro/Max)",usesCallbackServer:!0,async login(t){return MT({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return IT(t.refresh)},getApiKey(t){return t.access}};In();var yU=t=>atob(t),RT=yU("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),PT={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},vU=1.2,wU=1.4;function xf(t){let e=t.trim();if(!e)return null;try{return(e.includes("://")?new URL(e):new URL(`https://${e}`)).hostname}catch{return null}}function yf(t){return{deviceCodeUrl:`https://${t}/login/device/code`,accessTokenUrl:`https://${t}/login/oauth/access_token`,copilotTokenUrl:`https://api.${t}/copilot_internal/v2/token`}}function SU(t){let e=t.match(/proxy-ep=([^;]+)/);return e?`https://${e[1].replace(/^proxy\./,"api.")}`:null}function vf(t,e){if(t){let n=SU(t);if(n)return n}return e?`https://copilot-api.${e}`:"https://api.individual.githubcopilot.com"}async function wf(t,e){let n=await fetch(t,e);if(!n.ok){let i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json()}async function CU(t){let e=yf(t),n=await wf(e.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:RT,scope:"read:user"})});if(!n||typeof n!="object")throw new Error("Invalid device code response");let i=n.device_code,s=n.user_code,o=n.verification_uri,r=n.interval,a=n.expires_in;if(typeof i!="string"||typeof s!="string"||typeof o!="string"||typeof r!="number"||typeof a!="number")throw new Error("Invalid device code response fields");return{device_code:i,user_code:s,verification_uri:o,interval:r,expires_in:a}}function TU(t,e){return new Promise((n,i)=>{if(e?.aborted){i(new Error("Login cancelled"));return}let s=setTimeout(n,t);e?.addEventListener("abort",()=>{clearTimeout(s),i(new Error("Login cancelled"))},{once:!0})})}async function kU(t,e,n,i,s){let o=yf(t),r=Date.now()+i*1e3,a=Math.max(1e3,Math.floor(n*1e3)),c=vU,l=0;for(;Date.now()<r;){if(s?.aborted)throw new Error("Login cancelled");let d=r-Date.now(),u=Math.min(Math.ceil(a*c),d);await TU(u,s);let p=await wf(o.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:RT,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(p&&typeof p=="object"&&typeof p.access_token=="string")return p.access_token;if(p&&typeof p=="object"&&typeof p.error=="string"){let{error:m,error_description:g,interval:h}=p;if(m==="authorization_pending")continue;if(m==="slow_down"){l+=1,a=typeof h=="number"&&h>0?h*1e3:Math.max(1e3,a+5e3),c=wU;continue}let f=g?`: ${g}`:"";throw new Error(`Device flow failed: ${m}${f}`)}}throw l>0?new Error("Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again."):new Error("Device flow timed out")}async function Sf(t,e){let i=yf(e||"github.com"),s=await wf(i.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${t}`,...PT}});if(!s||typeof s!="object")throw new Error("Invalid Copilot token response");let o=s.token,r=s.expires_at;if(typeof o!="string"||typeof r!="number")throw new Error("Invalid Copilot token response fields");return{refresh:t,access:o,expires:r*1e3-300*1e3,enterpriseUrl:e}}async function MU(t,e,n){let s=`${vf(t,n)}/models/${e}/policy`;try{return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,...PT,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})})).ok}catch{return!1}}async function IU(t,e,n){let i=lg("github-copilot");await Promise.all(i.map(async s=>{let o=await MU(t,s.id,e);n?.(s.id,o)}))}async function _T(t){let e=await t.onPrompt({message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com",allowEmpty:!0});if(t.signal?.aborted)throw new Error("Login cancelled");let n=e.trim(),i=xf(e);if(n&&!i)throw new Error("Invalid GitHub Enterprise URL/domain");let s=i||"github.com",o=await CU(s);t.onAuth(o.verification_uri,`Enter code: ${o.user_code}`);let r=await kU(s,o.device_code,o.interval,o.expires_in,t.signal),a=await Sf(r,i??void 0);return t.onProgress?.("Enabling models..."),await IU(a.access,i??void 0),a}var Cf={id:"github-copilot",name:"GitHub Copilot",async login(t){return _T({onAuth:(e,n)=>t.onAuth({url:e,instructions:n}),onPrompt:t.onPrompt,onProgress:t.onProgress,signal:t.signal})},async refreshToken(t){let e=t;return Sf(e.refresh,e.enterpriseUrl)},getApiKey(t){return t.access},modifyModels(t,e){let n=e,i=n.enterpriseUrl?xf(n.enterpriseUrl)??void 0:void 0,s=vf(n.access,i);return t.map(o=>o.provider==="github-copilot"?{...o,baseUrl:s}:o)}};var kf=null,Mf=null;typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(import("node:crypto").then(t=>{kf=t.randomBytes}),import("node:http").then(t=>{Mf=t}));var RU=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",If="app_EMoamEEZ73f0CkXaXp7hrann",PU="https://auth.openai.com/oauth/authorize",ET="https://auth.openai.com/oauth/token",AT="http://localhost:1455/auth/callback",_U="openid profile email offline_access",EU="https://api.openai.com/auth";function AU(){if(!kf)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");return kf(16).toString("hex")}function Tf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function OU(t){try{let e=t.split(".");if(e.length!==3)return null;let n=e[1]??"",i=atob(n);return JSON.parse(i)}catch{return null}}async function LU(t,e,n=AT){let i=await fetch(ET,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:If,code:t,code_verifier:e,redirect_uri:n})});if(!i.ok){let o=await i.text().catch(()=>"");return{type:"failed",status:i.status,message:`OpenAI Codex token exchange failed (${i.status}): ${o||i.statusText}`}}let s=await i.json();return!s.access_token||!s.refresh_token||typeof s.expires_in!="number"?{type:"failed",message:`OpenAI Codex token exchange response missing fields: ${JSON.stringify(s)}`}:{type:"success",access:s.access_token,refresh:s.refresh_token,expires:Date.now()+s.expires_in*1e3}}async function WU(t){try{let e=await fetch(ET,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:If})});if(!e.ok){let i=await e.text().catch(()=>"");return{type:"failed",status:e.status,message:`OpenAI Codex token refresh failed (${e.status}): ${i||e.statusText}`}}let n=await e.json();return!n.access_token||!n.refresh_token||typeof n.expires_in!="number"?{type:"failed",message:`OpenAI Codex token refresh response missing fields: ${JSON.stringify(n)}`}:{type:"success",access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1e3}}catch(e){return{type:"failed",message:`OpenAI Codex token refresh error: ${e instanceof Error?e.message:String(e)}`}}}async function UU(t="pi"){let{verifier:e,challenge:n}=await Vd(),i=AU(),s=new URL(PU);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",If),s.searchParams.set("redirect_uri",AT),s.searchParams.set("scope",_U),s.searchParams.set("code_challenge",n),s.searchParams.set("code_challenge_method","S256"),s.searchParams.set("state",i),s.searchParams.set("id_token_add_organizations","true"),s.searchParams.set("codex_cli_simplified_flow","true"),s.searchParams.set("originator",t),{verifier:e,state:i,url:s.toString()}}function FU(t){if(!Mf)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");let e,n=new Promise(s=>{let o=!1;e=r=>{o||(o=!0,s(r))}}),i=Mf.createServer((s,o)=>{try{let r=new URL(s.url||"","http://localhost");if(r.pathname!=="/auth/callback"){o.statusCode=404,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Callback route not found."));return}if(r.searchParams.get("state")!==t){o.statusCode=400,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("State mismatch."));return}let a=r.searchParams.get("code");if(!a){o.statusCode=400,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Missing authorization code."));return}o.statusCode=200,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(zd("OpenAI authentication completed. You can close this window.")),e?.({code:a})}catch{o.statusCode=500,o.setHeader("Content-Type","text/html; charset=utf-8"),o.end(di("Internal error while processing OAuth callback."))}});return new Promise(s=>{i.listen(1455,RU,()=>{s({close:()=>i.close(),cancelWait:()=>{e?.(null)},waitForCode:()=>n})}).on("error",o=>{e?.(null),s({close:()=>{try{i.close()}catch{}},cancelWait:()=>{},waitForCode:async()=>null})})})}function OT(t){let i=OU(t)?.[EU]?.chatgpt_account_id;return typeof i=="string"&&i.length>0?i:null}async function LT(t){let{verifier:e,state:n,url:i}=await UU(t.originator),s=await FU(n);t.onAuth({url:i,instructions:"A browser window should open. Complete login to finish."});let o;try{if(t.onManualCodeInput){let c,l,d=t.onManualCodeInput().then(p=>{c=p,s.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),s.cancelWait()}),u=await s.waitForCode();if(l)throw l;if(u?.code)o=u.code;else if(c){let p=Tf(c);if(p.state&&p.state!==n)throw new Error("State mismatch");o=p.code}if(!o){if(await d,l)throw l;if(c){let p=Tf(c);if(p.state&&p.state!==n)throw new Error("State mismatch");o=p.code}}}else{let c=await s.waitForCode();c?.code&&(o=c.code)}if(!o){let c=await t.onPrompt({message:"Paste the authorization code (or full redirect URL):"}),l=Tf(c);if(l.state&&l.state!==n)throw new Error("State mismatch");o=l.code}if(!o)throw new Error("Missing authorization code");let r=await LU(o,e);if(r.type!=="success")throw new Error(r.message);let a=OT(r.access);if(!a)throw new Error("Failed to extract accountId from token");return{access:r.access,refresh:r.refresh,expires:r.expires,accountId:a}}finally{s.close()}}async function WT(t){let e=await WU(t);if(e.type!=="success")throw new Error(e.message);let n=OT(e.access);if(!n)throw new Error("Failed to extract accountId from token");return{access:e.access,refresh:e.refresh,expires:e.expires,accountId:n}}var Rf={id:"openai-codex",name:"ChatGPT Plus/Pro (Codex Subscription)",usesCallbackServer:!0,async login(t){return LT({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return WT(t.refresh)},getApiKey(t){return t.access}};var DU=[bf,Cf,Rf],$U=new Map(DU.map(t=>[t.id,t]));function Pf(){return Array.from($U.values())}import{createJiti as zpe}from"jiti/static";import*as Vpe from"typebox";import*as Jpe from"typebox/compile";import*as Qpe from"typebox/value";var tme=NU(import.meta.url);function Yd(t){return t.toolName==="edit"}function Xd(t){return t.toolName==="write"}function hl(t,e){return e.toolName===t}import Tme from"ignore";import{realpathSync as ZU}from"node:fs";import{isAbsolute as NT,relative as eF,resolve as _f,sep as jT}from"node:path";function xa(t){try{return ZU(t)}catch{return t}}function Zd(t){let e=t.trim();return!(e.startsWith("npm:")||e.startsWith("git:")||e.startsWith("github:")||e.startsWith("http:")||e.startsWith("https:")||e.startsWith("ssh:"))}function qT(t,e){return NT(t)?_f(t):_f(e,t)}function ep(t,e){let n=_f(e),i=qT(t,n),s=eF(n,i);return s===""||s!==".."&&!s.startsWith(`..${jT}`)&&!NT(s)?s||".":void 0}function GT(t,e){let n=qT(t,e);return(ep(n,e)??n).split(jT).join("/")}function KT(t){let e=process.platform==="darwin"?["com.dropbox.ignored","com.apple.fileprovider.ignore#P"]:process.platform==="linux"?["user.com.dropbox.ignored"]:[];for(let n of e)process.platform==="darwin"?Hr("xattr",["-w",n,"1",t],{encoding:"utf-8",stdio:"ignore"}):Hr("setfattr",["-n",n,"-v","1",t],{encoding:"utf-8",stdio:"ignore"})}import{existsSync as cF}from"node:fs";import{spawn as lF}from"child_process";import{Type as np}from"typebox";function nF(t,e){let n=process.platform==="darwin"&&t.toLowerCase()==="alt"?"option":t;return e.capitalize?n.charAt(0).toUpperCase()+n.slice(1):n}function gl(t,e={}){return t.split("/").map(n=>n.split("+").map(i=>nF(i,e)).join("+")).join("/")}function HT(t,e={}){return t.length===0?"":gl(t.join("/"),e)}function he(t){return HT(ve().getKeys(t))}function fl(t){return HT(ve().getKeys(t),{capitalize:!0})}function ce(t,e){return b.fg("dim",he(t))+b.fg("muted",` ${e}`)}function dt(t,e){return b.fg("dim",gl(t))+b.fg("muted",` ${e}`)}function ya(t,e,n,i=0){if(!t)return{visualLines:[],skippedCount:0};let o=new A(t,i,0).render(n);if(o.length<=e)return{visualLines:o,skippedCount:0};let r=o.slice(-e),a=o.length-e;return{visualLines:r,skippedCount:a}}import{randomBytes as iF}from"node:crypto";import{createWriteStream as sF}from"node:fs";import{tmpdir as oF}from"node:os";import{join as rF}from"node:path";function aF(t){let e=iF(8).toString("hex");return rF(oF(),`${t}-${e}.log`)}function Ef(t){return Buffer.byteLength(t,"utf-8")}var tp=class{constructor(e={}){this.decoder=new TextDecoder;this.rawChunks=[];this.tailText="";this.tailBytes=0;this.tailStartsAtLineBoundary=!0;this.totalRawBytes=0;this.totalDecodedBytes=0;this.totalLines=1;this.currentLineBytes=0;this.finished=!1;this.maxLines=e.maxLines??2e3,this.maxBytes=e.maxBytes??51200,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=e.tempFilePrefix??"pi-output"}append(e){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=e.length,this.appendDecodedText(this.decoder.decode(e,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(e)):e.length>0&&this.rawChunks.push(e)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(e={}){let n=vo(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),i=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,s=i?n.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,o={...n,truncated:i,truncatedBy:s,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return e.persistIfTruncated&&o.truncated&&this.ensureTempFile(),{content:o.content,truncation:o,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;let e=this.tempFileStream;this.tempFileStream=void 0,await new Promise((n,i)=>{let s=r=>{e.off("finish",o),i(r)},o=()=>{e.off("error",s),n()};e.once("error",s),e.once("finish",o),e.end()})}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(e){if(e.length===0)return;let n=Ef(e);this.totalDecodedBytes+=n,this.tailText+=e,this.tailBytes+=n,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let i=0,s=-1;for(let o=e.indexOf(`
|
|
179
179
|
`);o!==-1;o=e.indexOf(`
|
|
180
180
|
`,o+1))i++,s=o;i===0?this.currentLineBytes+=n:(this.totalLines+=i,this.currentLineBytes=Ef(e.slice(s+1)))}trimTail(){let e=Buffer.from(this.tailText,"utf-8");if(e.length<=this.maxRollingBytes){this.tailBytes=e.length;return}let n=e.length-this.maxRollingBytes;for(;n<e.length&&(e[n]&192)===128;)n++;this.tailStartsAtLineBoundary=n===0?this.tailStartsAtLineBoundary:e[n-1]===10,this.tailText=e.subarray(n).toString("utf-8"),this.tailBytes=Ef(this.tailText)}getSnapshotText(){if(this.tailStartsAtLineBoundary)return this.tailText;let e=this.tailText.indexOf(`
|
|
181
181
|
`);return e===-1?this.tailText:this.tailText.slice(e+1)}shouldUseTempFile(){return this.totalRawBytes>this.maxBytes||this.totalDecodedBytes>this.maxBytes||this.totalLines>this.maxLines}ensureTempFile(){if(!this.tempFilePath){this.tempFilePath=aF(this.tempFilePrefix),this.tempFileStream=sF(this.tempFilePath);for(let e of this.rawChunks)this.tempFileStream.write(e);this.rawChunks=[]}}};import*as zT from"node:os";function An(t){if(typeof t!="string")return"";let e=zT.homedir();return t.startsWith(e)?`~${t.slice(e.length)}`:t}function Ye(t){return typeof t=="string"?t:t==null?"":null}function $i(t){return t.replace(/\t/g," ")}function bl(t){return t.replace(/\r/g,"")}function On(t,e){if(!t)return"";let n=t.content.filter(r=>r.type==="text"),i=t.content.filter(r=>r.type==="image"),s=n.map(r=>af(ul(r.text||"")).replace(/\r/g,"")).join(`
|
|
@@ -279,16 +279,16 @@ ${g.map(f=>l?f:n.fg("toolOutput",$i(f))).join(`
|
|
|
279
279
|
`)}`,h>0&&(c+=`${n.fg("muted",`
|
|
280
280
|
... (${h} more lines, ${p} total,`)} ${ce("app.tools.expand","to expand")})`)}return c}function _D(t,e){if(!t.isError)return;let n=t.content.filter(i=>i.type==="text").map(i=>i.text||"").join(`
|
|
281
281
|
`);if(n)return`
|
|
282
|
-
${e.fg("error",n)}`}function vp(t,e){let n=e?.operations??TD;return{name:"write",label:"write",description:"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",promptSnippet:"Create or overwrite files",promptGuidelines:["Use write only for new files or complete rewrites."],parameters:CD,async execute(i,{path:s,content:o},r,a,c){let l=yn(s,t),d=SD(l);return Co(l,()=>new Promise((u,p)=>{if(r?.aborted){p(new Error("Operation aborted"));return}let m=!1,g=()=>{m=!0,p(new Error("Operation aborted"))};r?.addEventListener("abort",g,{once:!0}),(async()=>{try{if(await n.mkdir(d),m||(await n.writeFile(l,o),m))return;r?.removeEventListener("abort",g),u({content:[{type:"text",text:`Successfully wrote ${o.length} bytes to ${s}`}],details:void 0})}catch(h){r?.removeEventListener("abort",g),m||p(h)}})()}))},renderCall(i,s,o){let r=i,a=Ye(r?.file_path??r?.path),c=Ye(r?.content),l=o.lastComponent??new Hf;return c!==null?l.cache=o.argsComplete?yp(a,c):ID(l.cache,a,c):l.cache=void 0,l.setText(PD(r,{expanded:o.expanded,isPartial:o.isPartial},s,l.cache)),l},renderResult(i,s,o,r){let a=_D({...i,isError:r.isError},o);if(!a){let l=r.lastComponent??new K;return l.clear(),l}let c=r.lastComponent??new A("",0,0);return c.setText(a),c}}}function t0(t,e){return{read:xp(t,e?.read),bash:sp(t,e?.bash),edit:ap(t,e?.edit),write:vp(t,e?.write),grep:up(t,e?.grep),find:lp(t,e?.find),ls:dp(t,e?.ls)}}function n0(t){let e=t.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);return e?{name:e[1],location:e[2],content:e[3],userMessage:e[4]?.trim()||void 0}:null}import u0e from"proper-lockfile";import{Type as C}from"typebox";import{Compile as ND}from"typebox/compile";var i0={anthropic:"Anthropic","amazon-bedrock":"Amazon Bedrock","azure-openai-responses":"Azure OpenAI Responses",cerebras:"Cerebras","cloudflare-ai-gateway":"Cloudflare AI Gateway","cloudflare-workers-ai":"Cloudflare Workers AI",deepseek:"DeepSeek",fireworks:"Fireworks",google:"Google Gemini","google-vertex":"Google Vertex AI",groq:"Groq",huggingface:"Hugging Face","kimi-coding":"Kimi For Coding",mistral:"Mistral",minimax:"MiniMax","minimax-cn":"MiniMax (China)",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI (China)",opencode:"OpenCode Zen","opencode-go":"OpenCode Go",openai:"OpenAI",openrouter:"OpenRouter",together:"Together AI","vercel-ai-gateway":"Vercel AI Gateway",xai:"xAI",zai:"ZAI",xiaomi:"Xiaomi MiMo","xiaomi-token-plan-cn":"Xiaomi MiMo Token Plan (China)","xiaomi-token-plan-ams":"Xiaomi MiMo Token Plan (Amsterdam)","xiaomi-token-plan-sgp":"Xiaomi MiMo Token Plan (Singapore)"};var Tk=C.Object({p50:C.Optional(C.Number()),p75:C.Optional(C.Number()),p90:C.Optional(C.Number()),p99:C.Optional(C.Number())}),jD=C.Object({allow_fallbacks:C.Optional(C.Boolean()),require_parameters:C.Optional(C.Boolean()),data_collection:C.Optional(C.Union([C.Literal("deny"),C.Literal("allow")])),zdr:C.Optional(C.Boolean()),enforce_distillable_text:C.Optional(C.Boolean()),order:C.Optional(C.Array(C.String())),only:C.Optional(C.Array(C.String())),ignore:C.Optional(C.Array(C.String())),quantizations:C.Optional(C.Array(C.String())),sort:C.Optional(C.Union([C.String(),C.Object({by:C.Optional(C.String()),partition:C.Optional(C.Union([C.String(),C.Null()]))})])),max_price:C.Optional(C.Object({prompt:C.Optional(C.Union([C.Number(),C.String()])),completion:C.Optional(C.Union([C.Number(),C.String()])),image:C.Optional(C.Union([C.Number(),C.String()])),audio:C.Optional(C.Union([C.Number(),C.String()])),request:C.Optional(C.Union([C.Number(),C.String()]))})),preferred_min_throughput:C.Optional(C.Union([C.Number(),Tk])),preferred_max_latency:C.Optional(C.Union([C.Number(),Tk]))}),qD=C.Object({only:C.Optional(C.Array(C.String())),order:C.Optional(C.Array(C.String()))}),Pa=C.Union([C.String(),C.Null()]),kk=C.Object({off:C.Optional(Pa),minimal:C.Optional(Pa),low:C.Optional(Pa),medium:C.Optional(Pa),high:C.Optional(Pa),xhigh:C.Optional(Pa)}),GD=C.Object({supportsStore:C.Optional(C.Boolean()),supportsDeveloperRole:C.Optional(C.Boolean()),supportsReasoningEffort:C.Optional(C.Boolean()),supportsUsageInStreaming:C.Optional(C.Boolean()),maxTokensField:C.Optional(C.Union([C.Literal("max_completion_tokens"),C.Literal("max_tokens")])),requiresToolResultName:C.Optional(C.Boolean()),requiresAssistantAfterToolResult:C.Optional(C.Boolean()),requiresThinkingAsText:C.Optional(C.Boolean()),requiresReasoningContentOnAssistantMessages:C.Optional(C.Boolean()),thinkingFormat:C.Optional(C.Union([C.Literal("openai"),C.Literal("openrouter"),C.Literal("together"),C.Literal("deepseek"),C.Literal("zai"),C.Literal("qwen"),C.Literal("qwen-chat-template")])),cacheControlFormat:C.Optional(C.Literal("anthropic")),openRouterRouting:C.Optional(jD),vercelGatewayRouting:C.Optional(qD),supportsStrictMode:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),KD=C.Object({sendSessionIdHeader:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),HD=C.Object({supportsEagerToolInputStreaming:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),s0=C.Union([GD,KD,HD]),zD=C.Object({id:C.String({minLength:1}),name:C.Optional(C.String({minLength:1})),api:C.Optional(C.String({minLength:1})),baseUrl:C.Optional(C.String({minLength:1})),reasoning:C.Optional(C.Boolean()),thinkingLevelMap:C.Optional(kk),input:C.Optional(C.Array(C.Union([C.Literal("text"),C.Literal("image")]))),cost:C.Optional(C.Object({input:C.Number(),output:C.Number(),cacheRead:C.Number(),cacheWrite:C.Number()})),contextWindow:C.Optional(C.Number()),maxTokens:C.Optional(C.Number()),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0)}),VD=C.Object({name:C.Optional(C.String({minLength:1})),reasoning:C.Optional(C.Boolean()),thinkingLevelMap:C.Optional(kk),input:C.Optional(C.Array(C.Union([C.Literal("text"),C.Literal("image")]))),cost:C.Optional(C.Object({input:C.Optional(C.Number()),output:C.Optional(C.Number()),cacheRead:C.Optional(C.Number()),cacheWrite:C.Optional(C.Number())})),contextWindow:C.Optional(C.Number()),maxTokens:C.Optional(C.Number()),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0)}),JD=C.Object({name:C.Optional(C.String({minLength:1})),baseUrl:C.Optional(C.String({minLength:1})),apiKey:C.Optional(C.String({minLength:1})),api:C.Optional(C.String({minLength:1})),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0),authHeader:C.Optional(C.Boolean()),models:C.Optional(C.Array(zD)),modelOverrides:C.Optional(C.Record(C.String(),VD))}),QD=C.Object({providers:C.Record(C.String(),JD)}),R0e=ND(QD);import{createHash as ZD}from"node:crypto";import{existsSync as xe,mkdirSync as o0,readdirSync as Ea,readFileSync as Il,rmSync as Pk,statSync as Rs,writeFileSync as _k}from"node:fs";import{homedir as e4,tmpdir as t4}from"node:os";import{basename as kp,dirname as Ln,join as ge,relative as Wn,resolve as hi,sep as n4}from"node:path";import{globSync as i4}from"glob";import Rl from"ignore";import{minimatch as _a}from"minimatch";import Mk from"hosted-git-info";function Ik(t){let e=t.match(/^git@([^:]+):(.+)$/);if(e){let c=e[2]??"",l=c.indexOf("@");if(l<0)return{repo:t};let d=c.slice(0,l),u=c.slice(l+1);return!d||!u?{repo:t}:{repo:`git@${e[1]??""}:${d}`,ref:u}}if(t.includes("://"))try{let c=new URL(t),l=c.pathname.replace(/^\/+/,""),d=l.indexOf("@");if(d<0)return{repo:t};let u=l.slice(0,d),p=l.slice(d+1);return!u||!p?{repo:t}:(c.pathname=`/${u}`,{repo:c.toString().replace(/\/$/,""),ref:p})}catch{return{repo:t}}let n=t.indexOf("/");if(n<0)return{repo:t};let i=t.slice(0,n),s=t.slice(n+1),o=s.indexOf("@");if(o<0)return{repo:t};let r=s.slice(0,o),a=s.slice(o+1);return!r||!a?{repo:t}:{repo:`${i}/${r}`,ref:a}}function YD(t){let{repo:e,ref:n}=Ik(t),i=e,s="",o="",r=e.match(/^git@([^:]+):(.+)$/);if(r)s=r[1]??"",o=r[2]??"";else if(e.startsWith("https://")||e.startsWith("http://")||e.startsWith("ssh://")||e.startsWith("git://"))try{let c=new URL(e);s=c.hostname,o=c.pathname.replace(/^\/+/,"")}catch{return null}else{let c=e.indexOf("/");if(c<0||(s=e.slice(0,c),o=e.slice(c+1),!s.includes(".")&&s!=="localhost"))return null;i=`https://${e}`}let a=o.replace(/\.git$/,"").replace(/^\/+/,"");return!s||!a||a.split("/").length<2?null:{type:"git",repo:i,host:s,path:a,ref:n,pinned:!!n}}function Ml(t){let e=t.trim(),n=e.startsWith("git:"),i=n?e.slice(4).trim():e;if(!n&&!/^(https?|ssh|git):\/\//i.test(i))return null;let s=Ik(i),o=[s.ref?`${s.repo}#${s.ref}`:void 0,i].filter(a=>!!a);for(let a of o){let c=Mk.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return{type:"git",repo:!s.repo.startsWith("http://")&&!s.repo.startsWith("https://")&&!s.repo.startsWith("ssh://")&&!s.repo.startsWith("git://")&&!s.repo.startsWith("git@")?`https://${s.repo}`:s.repo,host:c.domain||"",path:`${c.user}/${c.project}`.replace(/\.git$/,""),ref:c.committish||s.ref||void 0,pinned:!!(c.committish||s.ref)}}}let r=[s.ref?`https://${s.repo}#${s.ref}`:void 0,`https://${i}`].filter(a=>!!a);for(let a of r){let c=Mk.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return{type:"git",repo:`https://${s.repo}`,host:c.domain||"",path:`${c.user}/${c.project}`.replace(/\.git$/,""),ref:c.committish||s.ref||void 0,pinned:!!(c.committish||s.ref)}}}return YD(i)}var XD;function Rk(){return XD!==void 0}function r0(){if(process.platform!=="linux"||Object.keys(process.env).length>0)return process.env;try{let t=Il("/proc/self/environ","utf-8"),e={};for(let n of t.split("\0")){let i=n.indexOf("=");i>0&&(e[n.slice(0,i)]=n.slice(i+1))}return e}catch{return process.env}}var mi=1e4,Ek=4,s4=4;function ko(){let t=process.env.PI_OFFLINE;return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function Ak(t){return t.origin==="package"?4:(t.scope==="project"?0:2)+(t.source==="local"?0:1)}var wp=["extensions","skills","prompts","themes"],o4={extensions:/\.(ts|js)$/,skills:/\.md$/,prompts:/\.md$/,themes:/\.json$/},r4=[".gitignore",".ignore",".fdignore"];function kt(t){return t.split(n4).join("/")}function Mo(){return process.env.HOME||e4()}function a4(t,e){let n=t.trim();if(!n||n.startsWith("#")&&!n.startsWith("\\#"))return null;let i=t,s=!1;i.startsWith("!")?(s=!0,i=i.slice(1)):i.startsWith("\\!")&&(i=i.slice(1)),i.startsWith("/")&&(i=i.slice(1));let o=e?`${e}${i}`:i;return s?`!${o}`:o}function Pl(t,e,n){let i=Wn(n,e),s=i?`${kt(i)}/`:"";for(let o of r4){let r=ge(e,o);if(xe(r))try{let c=Il(r,"utf-8").split(/\r?\n/).map(l=>a4(l,s)).filter(l=>!!l);c.length>0&&t.add(c)}catch{}}}function c4(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")||t.includes("*")||t.includes("?")}function a0(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")}function l4(t){return t.includes("*")||t.includes("?")}function u4(t){let e=[],n=[];for(let i of t)c4(i)?n.push(i):e.push(i);return{plain:e,patterns:n}}function Uk(t,e,n=!0,i,s){let o=[];if(!xe(t))return o;let r=s??t,a=i??Rl();Pl(a,t,r);try{let c=Ea(t,{withFileTypes:!0});for(let l of c){if(l.name.startsWith(".")||n&&l.name==="node_modules")continue;let d=ge(t,l.name),u=l.isDirectory(),p=l.isFile();if(l.isSymbolicLink())try{let h=Rs(d);u=h.isDirectory(),p=h.isFile()}catch{continue}let m=kt(Wn(r,d)),g=u?`${m}/`:m;a.ignores(g)||(u?o.push(...Uk(d,e,n,a,r)):p&&e.test(l.name)&&o.push(d))}}catch{}return o}function u0(t,e,n,i){let s=[];if(!xe(t))return s;let o=i??t,r=n??Rl();Pl(r,t,o);try{let a=Ea(t,{withFileTypes:!0});for(let c of a){if(c.name!=="SKILL.md")continue;let l=ge(t,c.name),d=c.isFile();if(c.isSymbolicLink())try{d=Rs(l).isFile()}catch{continue}let u=kt(Wn(o,l));if(d&&!r.ignores(u))return s.push(l),s}for(let c of a){if(c.name.startsWith(".")||c.name==="node_modules")continue;let l=ge(t,c.name),d=c.isDirectory(),u=c.isFile();if(c.isSymbolicLink())try{let m=Rs(l);d=m.isDirectory(),u=m.isFile()}catch{continue}let p=kt(Wn(o,l));if(e==="pi"&&t===o&&u&&c.name.endsWith(".md")&&!r.ignores(p)){s.push(l);continue}d&&(r.ignores(`${p}/`)||s.push(...u0(l,e,r,o)))}}catch{}return s}function Sp(t,e){return u0(t,e)}function d4(t){let e=hi(t);for(;;){if(xe(ge(e,".git")))return e;let n=Ln(e);if(n===e)return null;e=n}}function p4(t){let e=[],n=hi(t),i=d4(n),s=n;for(;e.push(ge(s,".agents","skills")),!(i&&s===i);){let o=Ln(s);if(o===s)break;s=o}return e}function Ok(t){let e=[];if(!xe(t))return e;let n=Rl();Pl(n,t,t);try{let i=Ea(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let o=ge(t,s.name),r=s.isFile();if(s.isSymbolicLink())try{r=Rs(o).isFile()}catch{continue}let a=kt(Wn(t,o));n.ignores(a)||r&&s.name.endsWith(".md")&&e.push(o)}}catch{}return e}function Lk(t){let e=[];if(!xe(t))return e;let n=Rl();Pl(n,t,t);try{let i=Ea(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let o=ge(t,s.name),r=s.isFile();if(s.isSymbolicLink())try{r=Rs(o).isFile()}catch{continue}let a=kt(Wn(t,o));n.ignores(a)||r&&s.name.endsWith(".json")&&e.push(o)}}catch{}return e}function m4(t){try{let e=Il(t,"utf-8");return JSON.parse(e).pi??null}catch{return null}}function Wk(t){let e=ge(t,"package.json");if(xe(e)){let s=m4(e);if(s?.extensions?.length){let o=[];for(let r of s.extensions){let a=hi(t,r);xe(a)&&o.push(a)}if(o.length>0)return o}}let n=ge(t,"index.ts"),i=ge(t,"index.js");return xe(n)?[n]:xe(i)?[i]:null}function c0(t){let e=[];if(!xe(t))return e;let n=Wk(t);if(n)return n;let i=Rl();Pl(i,t,t);try{let s=Ea(t,{withFileTypes:!0});for(let o of s){if(o.name.startsWith(".")||o.name==="node_modules")continue;let r=ge(t,o.name),a=o.isDirectory(),c=o.isFile();if(o.isSymbolicLink())try{let u=Rs(r);a=u.isDirectory(),c=u.isFile()}catch{continue}let l=kt(Wn(t,r)),d=a?`${l}/`:l;if(!i.ignores(d)){if(c&&(o.name.endsWith(".ts")||o.name.endsWith(".js")))e.push(r);else if(a){let u=Wk(r);u&&e.push(...u)}}}}catch{}return e}function Cp(t,e){return e==="skills"?u0(t,"pi"):e==="extensions"?c0(t):Uk(t,o4[e])}function l0(t,e,n){let i=kt(Wn(n,t)),s=kp(t),o=kt(t),r=s==="SKILL.md",a=r?Ln(t):void 0,c=r?kt(Wn(n,a)):void 0,l=r?kp(a):void 0,d=r?kt(a):void 0;return e.some(u=>{let p=kt(u);return _a(i,p)||_a(s,p)||_a(o,p)?!0:r?_a(c,p)||_a(l,p)||_a(d,p):!1})}function h4(t){let e=t.startsWith("./")||t.startsWith(".\\")?t.slice(2):t;return kt(e)}function Mp(t,e,n){if(e.length===0)return!1;let i=kt(Wn(n,t)),s=kp(t),o=kt(t),r=s==="SKILL.md",a=r?Ln(t):void 0,c=r?kt(Wn(n,a)):void 0,l=r?kt(a):void 0;return e.some(d=>{let u=h4(d);return u===i||u===o?!0:r?u===c||u===l:!1})}function g4(t){return t.filter(e=>e.startsWith("!")||e.startsWith("+")||e.startsWith("-"))}function f4(t,e,n){let i=g4(e),s=i.filter(c=>c.startsWith("!")).map(c=>c.slice(1)),o=i.filter(c=>c.startsWith("+")).map(c=>c.slice(1)),r=i.filter(c=>c.startsWith("-")).map(c=>c.slice(1)),a=!0;return s.length>0&&l0(t,s,n)&&(a=!1),o.length>0&&Mp(t,o,n)&&(a=!0),r.length>0&&Mp(t,r,n)&&(a=!1),a}function Tp(t,e,n){let i=[],s=[],o=[],r=[];for(let c of e)c.startsWith("+")?o.push(c.slice(1)):c.startsWith("-")?r.push(c.slice(1)):c.startsWith("!")?s.push(c.slice(1)):i.push(c);let a;if(i.length===0?a=[...t]:a=t.filter(c=>l0(c,i,n)),s.length>0&&(a=a.filter(c=>!l0(c,s,n))),o.length>0)for(let c of t)!a.includes(c)&&Mp(c,o,n)&&a.push(c);return r.length>0&&(a=a.filter(c=>!Mp(c,r,n))),new Set(a)}var Ni=class{constructor(e){this.cwd=e.cwd,this.agentDir=e.agentDir,this.settingsManager=e.settingsManager}setProgressCallback(e){this.progressCallback=e}addSourceToSettings(e,n){let i=n?.local?"project":"user",o=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],r=this.normalizePackageSourceForSettings(e,i);if(o.some(l=>this.packageSourcesMatch(l,e,i)))return!1;let c=[...o,r];return i==="project"?this.settingsManager.setProjectPackages(c):this.settingsManager.setPackages(c),!0}removeSourceFromSettings(e,n){let i=n?.local?"project":"user",o=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],r=o.filter(c=>!this.packageSourcesMatch(c,e,i));return r.length!==o.length?(i==="project"?this.settingsManager.setProjectPackages(r):this.settingsManager.setPackages(r),!0):!1}getInstalledPath(e,n){let i=this.parseSource(e);if(i.type==="npm"){let s=this.getNpmInstallPath(i,n);return xe(s)?s:void 0}if(i.type==="git"){let s=this.getGitInstallPath(i,n);return xe(s)?s:void 0}if(i.type==="local"){let s=this.getBaseDirForScope(n),o=this.resolvePathFromBase(i.path,s);return xe(o)?o:void 0}}emitProgress(e){this.progressCallback?.(e)}async withProgress(e,n,i,s){this.emitProgress({type:"start",action:e,source:n,message:i});try{await s(),this.emitProgress({type:"complete",action:e,source:n})}catch(o){let r=o instanceof Error?o.message:String(o);throw this.emitProgress({type:"error",action:e,source:n,message:r}),o}}async resolve(e){let n=this.createAccumulator(),i=this.settingsManager.getGlobalSettings(),s=this.settingsManager.getProjectSettings(),o=[];for(let l of s.packages??[])o.push({pkg:l,scope:"project"});for(let l of i.packages??[])o.push({pkg:l,scope:"user"});let r=this.dedupePackages(o);await this.resolvePackageSources(r,n,e);let a=this.agentDir,c=ge(this.cwd,St);for(let l of wp){let d=this.getTargetMap(n,l),u=i[l]??[],p=s[l]??[];this.resolveLocalEntries(p,l,d,{source:"local",scope:"project",origin:"top-level"},c),this.resolveLocalEntries(u,l,d,{source:"local",scope:"user",origin:"top-level"},a)}return this.addAutoDiscoveredResources(n,i,s,a,c),this.toResolvedPaths(n)}async resolveExtensionSources(e,n){let i=this.createAccumulator(),s=n?.temporary?"temporary":n?.local?"project":"user",o=e.map(r=>({pkg:r,scope:s}));return await this.resolvePackageSources(o,i),this.toResolvedPaths(i)}listConfiguredPackages(){let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let s of e.packages??[]){let o=typeof s=="string"?s:s.source;i.push({source:o,scope:"user",filtered:typeof s=="object",installedPath:this.getInstalledPath(o,"user")})}for(let s of n.packages??[]){let o=typeof s=="string"?s:s.source;i.push({source:o,scope:"project",filtered:typeof s=="object",installedPath:this.getInstalledPath(o,"project")})}return i}async install(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";await this.withProgress("install",e,`Installing ${e}...`,async()=>{if(i.type==="npm"){await this.installNpm(i,s,!1);return}if(i.type==="git"){await this.installGit(i,s);return}if(i.type==="local"){let o=this.resolvePath(i.path);if(!xe(o))throw new Error(`Path does not exist: ${o}`);return}throw new Error(`Unsupported install source: ${e}`)})}async installAndPersist(e,n){await this.install(e,n),this.addSourceToSettings(e,n)}async remove(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";await this.withProgress("remove",e,`Removing ${e}...`,async()=>{if(i.type==="npm"){await this.uninstallNpm(i,s);return}if(i.type==="git"){await this.removeGit(i,s);return}if(i.type!=="local")throw new Error(`Unsupported remove source: ${e}`)})}async removeAndPersist(e,n){return await this.remove(e,n),this.removeSourceFromSettings(e,n)}async update(e){let n=this.settingsManager.getGlobalSettings(),i=this.settingsManager.getProjectSettings(),s=e?this.getPackageIdentity(e):void 0,o=!1,r=[];for(let a of n.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"user")!==s||(o=!0,r.push({source:c,scope:"user"}))}for(let a of i.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"project")!==s||(o=!0,r.push({source:c,scope:"project"}))}if(e&&!o)throw new Error(this.buildNoMatchingPackageMessage(e,[...n.packages??[],...i.packages??[]]));await this.updateConfiguredSources(r)}async updateConfiguredSources(e){if(ko()||e.length===0)return;let n=[],i=[];for(let l of e){let d=this.parseSource(l.source);if(!(d.type==="local"||d.pinned)){if(d.type==="npm"){n.push({...l,parsed:d});continue}i.push({...l,parsed:d})}}let s=n.map(l=>async()=>({entry:l,shouldUpdate:await this.shouldUpdateNpmSource(l.parsed,l.scope)})),o=await this.runWithConcurrency(s,Ek),r=[],a=[];for(let l of o)l.shouldUpdate&&(l.entry.scope==="user"?r.push(l.entry):a.push(l.entry));let c=[];if(r.length>0&&c.push(this.updateNpmBatch(r,"user")),a.length>0&&c.push(this.updateNpmBatch(a,"project")),i.length>0){let l=i.map(d=>async()=>this.withProgress("update",d.source,`Updating ${d.source}...`,async()=>{await this.updateGit(d.parsed,d.scope)}));c.push(this.runWithConcurrency(l,s4).then(()=>{}))}await Promise.all(c)}async shouldUpdateNpmSource(e,n){let i=this.getManagedNpmInstallPath(e,n),s=xe(i)?this.getInstalledNpmVersion(i):void 0;if(!s)return!0;try{return await this.getLatestNpmVersion(e.name)!==s}catch{return!0}}async updateNpmBatch(e,n){if(e.length===0)return;let i=e.length===1?e[0].source:`${n} npm packages`,s=e.length===1?`Updating ${e[0].source}...`:`Updating ${n} npm packages...`,o=e.map(r=>`${r.parsed.name}@latest`);await this.withProgress("update",i,s,async()=>{await this.installNpmBatch(o,n)})}async installNpmBatch(e,n){let i=this.getNpmInstallRoot(n,!1);this.ensureNpmProject(i),await this.runNpmCommand(this.getNpmInstallArgs(e,i))}async checkForAvailableUpdates(){if(ko())return[];let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let a of n.packages??[])i.push({pkg:a,scope:"project"});for(let a of e.packages??[])i.push({pkg:a,scope:"user"});let o=this.dedupePackages(i).filter(a=>a.scope!=="temporary").map(a=>async()=>{let c=typeof a.pkg=="string"?a.pkg:a.pkg.source,l=this.parseSource(c);if(l.type==="local"||l.pinned)return;if(l.type==="npm"){let p=this.getNpmInstallPath(l,a.scope);return!xe(p)||!await this.npmHasAvailableUpdate(l,p)?void 0:{source:c,displayName:l.name,type:"npm",scope:a.scope}}let d=this.getGitInstallPath(l,a.scope);if(!(!xe(d)||!await this.gitHasAvailableUpdate(d)))return{source:c,displayName:`${l.host}/${l.path}`,type:"git",scope:a.scope}});return(await this.runWithConcurrency(o,Ek)).filter(a=>a!==void 0)}async resolvePackageSources(e,n,i){for(let{pkg:s,scope:o}of e){let r=typeof s=="string"?s:s.source,a=typeof s=="object"?s:void 0,c=this.parseSource(r),l={source:r,scope:o,origin:"package"};if(c.type==="local"){let u=this.getBaseDirForScope(o);this.resolveLocalExtensionSource(c,n,a,l,u);continue}let d=async()=>{if(ko())return!1;if(!i)return await this.installParsedSource(c,o),!0;let u=await i(r);if(u==="skip")return!1;if(u==="error")throw new Error(`Missing source: ${r}`);return await this.installParsedSource(c,o),!0};if(c.type==="npm"){let u=this.getNpmInstallPath(c,o);if(!xe(u)||c.pinned&&!await this.installedNpmMatchesPinnedVersion(c,u)){if(!await d())continue;u=this.getNpmInstallPath(c,o)}l.baseDir=u,this.collectPackageResources(u,n,a,l);continue}if(c.type==="git"){let u=this.getGitInstallPath(c,o);if(xe(u))o==="temporary"&&!c.pinned&&!ko()&&await this.refreshTemporaryGitSource(c,r);else if(!await d())continue;l.baseDir=u,this.collectPackageResources(u,n,a,l)}}}resolveLocalExtensionSource(e,n,i,s,o){let r=this.resolvePathFromBase(e.path,o);if(xe(r))try{let a=Rs(r);if(a.isFile()){s.baseDir=Ln(r),this.addResource(n.extensions,r,s,!0);return}a.isDirectory()&&(s.baseDir=r,this.collectPackageResources(r,n,i,s)||this.addResource(n.extensions,r,s,!0))}catch{return}}async installParsedSource(e,n){if(e.type==="npm"){await this.installNpm(e,n,n==="temporary");return}if(e.type==="git"){await this.installGit(e,n);return}}getPackageSourceString(e){return typeof e=="string"?e:e.source}getSourceMatchKeyForInput(e){let n=this.parseSource(e);return n.type==="npm"?`npm:${n.name}`:n.type==="git"?`git:${n.host}/${n.path}`:`local:${this.resolvePath(n.path)}`}getSourceMatchKeyForSettings(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}buildNoMatchingPackageMessage(e,n){let i=this.findSuggestedConfiguredSource(e,n);return i?`No matching package found for ${e}. Did you mean ${i}?`:`No matching package found for ${e}`}findSuggestedConfiguredSource(e,n){let i=e.trim(),s=new Set;for(let o of n){let r=this.getPackageSourceString(o),a=this.parseSource(r);if(a.type==="npm"){(i===a.name||i===a.spec)&&s.add(r);continue}if(a.type==="git"){let c=`${a.host}/${a.path}`,l=a.ref?`${c}@${a.ref}`:void 0;(i===c||l&&i===l)&&s.add(r)}}return s.values().next().value}packageSourcesMatch(e,n,i){let s=this.getSourceMatchKeyForSettings(this.getPackageSourceString(e),i),o=this.getSourceMatchKeyForInput(n);return s===o}normalizePackageSourceForSettings(e,n){let i=this.parseSource(e);if(i.type!=="local")return e;let s=this.getBaseDirForScope(n),o=this.resolvePath(i.path);return Wn(s,o)||"."}parseSource(e){if(e.startsWith("npm:")){let i=e.slice(4).trim(),{name:s,version:o}=this.parseNpmSpec(i);return{type:"npm",spec:i,name:s,pinned:!!o}}if(Zd(e))return{type:"local",path:e};let n=Ml(e);return n||{type:"local",path:e}}async installedNpmMatchesPinnedVersion(e,n){let i=this.getInstalledNpmVersion(n);if(!i)return!1;let{version:s}=this.parseNpmSpec(e.spec);return s?i===s:!0}async npmHasAvailableUpdate(e,n){if(ko())return!1;let i=this.getInstalledNpmVersion(n);if(!i)return!1;try{return await this.getLatestNpmVersion(e.name)!==i}catch{return!1}}getInstalledNpmVersion(e){let n=ge(e,"package.json");if(xe(n))try{let i=Il(n,"utf-8");return JSON.parse(i).version}catch{return}}async getLatestNpmVersion(e){let n=this.getNpmCommand(),s=(await this.runCommandCapture(n.command,[...n.args,"view",e,"version","--json"],{cwd:this.cwd,timeoutMs:mi})).trim();if(!s)throw new Error("Empty response from npm view");return JSON.parse(s)}async gitHasAvailableUpdate(e){if(ko())return!1;try{let n=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:mi}),i=await this.getRemoteGitHead(e);return n.trim()!==i.trim()}catch{return!1}}async getRemoteGitHead(e){let n=await this.getGitUpstreamRef(e);if(n){let r=(await this.runGitRemoteCommand(e,["ls-remote","origin",n])).match(/^([0-9a-f]{40})\s+/m);if(r?.[1])return r[1]}let s=(await this.runGitRemoteCommand(e,["ls-remote","origin","HEAD"])).match(/^([0-9a-f]{40})\s+HEAD$/m);if(!s?.[1])throw new Error("Failed to determine remote HEAD");return s[1]}async getLocalGitUpdateTarget(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:mi})).trim();if(!i.startsWith("origin/"))throw new Error(`Unsupported upstream remote: ${i}`);let s=i.slice(7);if(!s)throw new Error("Missing upstream branch name");return{ref:"@{upstream}",head:await this.runCommandCapture("git",["rev-parse","@{upstream}"],{cwd:e,timeoutMs:mi}),fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}}catch{await this.runCommand("git",["remote","set-head","origin","-a"],{cwd:e}).catch(()=>{});let n=await this.runCommandCapture("git",["rev-parse","origin/HEAD"],{cwd:e,timeoutMs:mi}),s=(await this.runCommandCapture("git",["symbolic-ref","refs/remotes/origin/HEAD"],{cwd:e,timeoutMs:mi}).catch(()=>"")).trim().replace(/^refs\/remotes\/origin\//,"");return s?{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}:{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin","+HEAD:refs/remotes/origin/HEAD"]}}}async getGitUpstreamRef(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:mi})).trim();if(!i.startsWith("origin/"))return;let s=i.slice(7);return s?`refs/heads/${s}`:void 0}catch{return}}runGitRemoteCommand(e,n){return this.runCommandCapture("git",n,{cwd:e,timeoutMs:mi,env:{GIT_TERMINAL_PROMPT:"0"}})}async runWithConcurrency(e,n){if(e.length===0)return[];let i=new Array(e.length),s=0,o=Math.max(1,Math.min(n,e.length)),r=async()=>{for(;;){let a=s;if(s+=1,a>=e.length)return;i[a]=await e[a]()}};return await Promise.all(Array.from({length:o},()=>r())),i}getPackageIdentity(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;if(n){let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}return`local:${this.resolvePath(i.path)}`}dedupePackages(e){let n=new Map;for(let i of e){let s=typeof i.pkg=="string"?i.pkg:i.pkg.source,o=this.getPackageIdentity(s,i.scope),r=n.get(o);r?i.scope==="project"&&r.scope==="user"&&n.set(o,i):n.set(o,i)}return Array.from(n.values())}parseNpmSpec(e){let n=e.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);if(!n)return{name:e};let i=n[1]??e,s=n[2];return{name:i,version:s}}getNpmCommand(){let e=this.settingsManager.getNpmCommand();if(!e||e.length===0)return{command:"npm",args:[]};let[n,...i]=e;if(!n)throw new Error("Invalid npmCommand: first array entry must be a non-empty command");return{command:n,args:i}}getPackageManagerName(){let e=this.getNpmCommand(),n=[e.command,...e.args],i=n.lastIndexOf("--"),s=i>=0?n[i+1]:e.command;return s?kp(s).replace(/\.(cmd|exe)$/i,""):""}async runNpmCommand(e,n){let i=this.getNpmCommand();await this.runCommand(i.command,[...i.args,...e],n)}getGitDependencyInstallArgs(){let e=this.settingsManager.getNpmCommand();return e&&e.length>0?["install"]:["install","--omit=dev"]}runNpmCommandSync(e){let n=this.getNpmCommand();return this.runCommandSync(n.command,[...n.args,...e])}getNpmInstallArgs(e,n){let i=this.getPackageManagerName();return i==="bun"?["install",...e,"--cwd",n]:i==="pnpm"?["install",...e,"--prefix",n,"--config.strict-dep-builds=false"]:["install",...e,"--prefix",n]}async installNpm(e,n,i){let s=this.getNpmInstallRoot(n,i);this.ensureNpmProject(s),await this.runNpmCommand(this.getNpmInstallArgs([e.spec],s))}async uninstallNpm(e,n){let i=this.getNpmInstallRoot(n,!1);if(xe(i)){if(this.getPackageManagerName()==="bun"){await this.runNpmCommand(["uninstall",e.name,"--cwd",i]);return}await this.runNpmCommand(["uninstall",e.name,"--prefix",i])}}async installGit(e,n){let i=this.getGitInstallPath(e,n);if(xe(i))return;let s=this.getGitInstallRoot(n);s&&this.ensureGitIgnore(s),o0(Ln(i),{recursive:!0}),await this.runCommand("git",["clone",e.repo,i]),e.ref&&await this.runCommand("git",["checkout",e.ref],{cwd:i});let o=ge(i,"package.json");xe(o)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async updateGit(e,n){let i=this.getGitInstallPath(e,n);if(!xe(i)){await this.installGit(e,n);return}let s=await this.getLocalGitUpdateTarget(i);await this.runCommand("git",s.fetchArgs,{cwd:i});let o=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:i,timeoutMs:mi}),r=await this.runCommandCapture("git",["rev-parse",s.ref],{cwd:i,timeoutMs:mi});if(o.trim()===r.trim())return;await this.runCommand("git",["reset","--hard",s.ref],{cwd:i}),await this.runCommand("git",["clean","-fdx"],{cwd:i});let a=ge(i,"package.json");xe(a)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async refreshTemporaryGitSource(e,n){if(!ko())try{await this.withProgress("pull",n,`Refreshing ${n}...`,async()=>{await this.updateGit(e,"temporary")})}catch{}}async removeGit(e,n){let i=this.getGitInstallPath(e,n);xe(i)&&(Pk(i,{recursive:!0,force:!0}),this.pruneEmptyGitParents(i,this.getGitInstallRoot(n)))}pruneEmptyGitParents(e,n){if(!n)return;let i=hi(n),s=Ln(e);for(;s.startsWith(i)&&s!==i;){if(!xe(s)){s=Ln(s);continue}if(Ea(s).length>0)break;try{Pk(s,{recursive:!0,force:!0})}catch{break}s=Ln(s)}}ensureNpmProject(e){xe(e)||o0(e,{recursive:!0}),KT(e),this.ensureGitIgnore(e);let n=ge(e,"package.json");xe(n)||_k(n,JSON.stringify({name:"pi-extensions",private:!0},null,2),"utf-8")}ensureGitIgnore(e){xe(e)||o0(e,{recursive:!0});let n=ge(e,".gitignore");xe(n)||_k(n,`*
|
|
282
|
+
${e.fg("error",n)}`}function vp(t,e){let n=e?.operations??TD;return{name:"write",label:"write",description:"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",promptSnippet:"Create or overwrite files",promptGuidelines:["Use write only for new files or complete rewrites."],parameters:CD,async execute(i,{path:s,content:o},r,a,c){let l=yn(s,t),d=SD(l);return Co(l,()=>new Promise((u,p)=>{if(r?.aborted){p(new Error("Operation aborted"));return}let m=!1,g=()=>{m=!0,p(new Error("Operation aborted"))};r?.addEventListener("abort",g,{once:!0}),(async()=>{try{if(await n.mkdir(d),m||(await n.writeFile(l,o),m))return;r?.removeEventListener("abort",g),u({content:[{type:"text",text:`Successfully wrote ${o.length} bytes to ${s}`}],details:void 0})}catch(h){r?.removeEventListener("abort",g),m||p(h)}})()}))},renderCall(i,s,o){let r=i,a=Ye(r?.file_path??r?.path),c=Ye(r?.content),l=o.lastComponent??new Hf;return c!==null?l.cache=o.argsComplete?yp(a,c):ID(l.cache,a,c):l.cache=void 0,l.setText(PD(r,{expanded:o.expanded,isPartial:o.isPartial},s,l.cache)),l},renderResult(i,s,o,r){let a=_D({...i,isError:r.isError},o);if(!a){let l=r.lastComponent??new K;return l.clear(),l}let c=r.lastComponent??new A("",0,0);return c.setText(a),c}}}function t0(t,e){return{read:xp(t,e?.read),bash:sp(t,e?.bash),edit:ap(t,e?.edit),write:vp(t,e?.write),grep:up(t,e?.grep),find:lp(t,e?.find),ls:dp(t,e?.ls)}}function n0(t){let e=t.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);return e?{name:e[1],location:e[2],content:e[3],userMessage:e[4]?.trim()||void 0}:null}import l0e from"proper-lockfile";import{Type as C}from"typebox";import{Compile as ND}from"typebox/compile";var i0={anthropic:"Anthropic","amazon-bedrock":"Amazon Bedrock","azure-openai-responses":"Azure OpenAI Responses",cerebras:"Cerebras","cloudflare-ai-gateway":"Cloudflare AI Gateway","cloudflare-workers-ai":"Cloudflare Workers AI",deepseek:"DeepSeek",fireworks:"Fireworks",google:"Google Gemini","google-vertex":"Google Vertex AI",groq:"Groq",huggingface:"Hugging Face","kimi-coding":"Kimi For Coding",mistral:"Mistral",minimax:"MiniMax","minimax-cn":"MiniMax (China)",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI (China)",opencode:"OpenCode Zen","opencode-go":"OpenCode Go",openai:"OpenAI",openrouter:"OpenRouter",together:"Together AI","vercel-ai-gateway":"Vercel AI Gateway",xai:"xAI",zai:"ZAI",xiaomi:"Xiaomi MiMo","xiaomi-token-plan-cn":"Xiaomi MiMo Token Plan (China)","xiaomi-token-plan-ams":"Xiaomi MiMo Token Plan (Amsterdam)","xiaomi-token-plan-sgp":"Xiaomi MiMo Token Plan (Singapore)"};var Tk=C.Object({p50:C.Optional(C.Number()),p75:C.Optional(C.Number()),p90:C.Optional(C.Number()),p99:C.Optional(C.Number())}),jD=C.Object({allow_fallbacks:C.Optional(C.Boolean()),require_parameters:C.Optional(C.Boolean()),data_collection:C.Optional(C.Union([C.Literal("deny"),C.Literal("allow")])),zdr:C.Optional(C.Boolean()),enforce_distillable_text:C.Optional(C.Boolean()),order:C.Optional(C.Array(C.String())),only:C.Optional(C.Array(C.String())),ignore:C.Optional(C.Array(C.String())),quantizations:C.Optional(C.Array(C.String())),sort:C.Optional(C.Union([C.String(),C.Object({by:C.Optional(C.String()),partition:C.Optional(C.Union([C.String(),C.Null()]))})])),max_price:C.Optional(C.Object({prompt:C.Optional(C.Union([C.Number(),C.String()])),completion:C.Optional(C.Union([C.Number(),C.String()])),image:C.Optional(C.Union([C.Number(),C.String()])),audio:C.Optional(C.Union([C.Number(),C.String()])),request:C.Optional(C.Union([C.Number(),C.String()]))})),preferred_min_throughput:C.Optional(C.Union([C.Number(),Tk])),preferred_max_latency:C.Optional(C.Union([C.Number(),Tk]))}),qD=C.Object({only:C.Optional(C.Array(C.String())),order:C.Optional(C.Array(C.String()))}),Pa=C.Union([C.String(),C.Null()]),kk=C.Object({off:C.Optional(Pa),minimal:C.Optional(Pa),low:C.Optional(Pa),medium:C.Optional(Pa),high:C.Optional(Pa),xhigh:C.Optional(Pa)}),GD=C.Object({supportsStore:C.Optional(C.Boolean()),supportsDeveloperRole:C.Optional(C.Boolean()),supportsReasoningEffort:C.Optional(C.Boolean()),supportsUsageInStreaming:C.Optional(C.Boolean()),maxTokensField:C.Optional(C.Union([C.Literal("max_completion_tokens"),C.Literal("max_tokens")])),requiresToolResultName:C.Optional(C.Boolean()),requiresAssistantAfterToolResult:C.Optional(C.Boolean()),requiresThinkingAsText:C.Optional(C.Boolean()),requiresReasoningContentOnAssistantMessages:C.Optional(C.Boolean()),thinkingFormat:C.Optional(C.Union([C.Literal("openai"),C.Literal("openrouter"),C.Literal("together"),C.Literal("deepseek"),C.Literal("zai"),C.Literal("qwen"),C.Literal("qwen-chat-template")])),cacheControlFormat:C.Optional(C.Literal("anthropic")),openRouterRouting:C.Optional(jD),vercelGatewayRouting:C.Optional(qD),supportsStrictMode:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),KD=C.Object({sendSessionIdHeader:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),HD=C.Object({supportsEagerToolInputStreaming:C.Optional(C.Boolean()),supportsLongCacheRetention:C.Optional(C.Boolean())}),s0=C.Union([GD,KD,HD]),zD=C.Object({id:C.String({minLength:1}),name:C.Optional(C.String({minLength:1})),api:C.Optional(C.String({minLength:1})),baseUrl:C.Optional(C.String({minLength:1})),reasoning:C.Optional(C.Boolean()),thinkingLevelMap:C.Optional(kk),input:C.Optional(C.Array(C.Union([C.Literal("text"),C.Literal("image")]))),cost:C.Optional(C.Object({input:C.Number(),output:C.Number(),cacheRead:C.Number(),cacheWrite:C.Number()})),contextWindow:C.Optional(C.Number()),maxTokens:C.Optional(C.Number()),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0)}),VD=C.Object({name:C.Optional(C.String({minLength:1})),reasoning:C.Optional(C.Boolean()),thinkingLevelMap:C.Optional(kk),input:C.Optional(C.Array(C.Union([C.Literal("text"),C.Literal("image")]))),cost:C.Optional(C.Object({input:C.Optional(C.Number()),output:C.Optional(C.Number()),cacheRead:C.Optional(C.Number()),cacheWrite:C.Optional(C.Number())})),contextWindow:C.Optional(C.Number()),maxTokens:C.Optional(C.Number()),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0)}),JD=C.Object({name:C.Optional(C.String({minLength:1})),baseUrl:C.Optional(C.String({minLength:1})),apiKey:C.Optional(C.String({minLength:1})),api:C.Optional(C.String({minLength:1})),headers:C.Optional(C.Record(C.String(),C.String())),compat:C.Optional(s0),authHeader:C.Optional(C.Boolean()),models:C.Optional(C.Array(zD)),modelOverrides:C.Optional(C.Record(C.String(),VD))}),QD=C.Object({providers:C.Record(C.String(),JD)}),I0e=ND(QD);import{createHash as ZD}from"node:crypto";import{existsSync as xe,mkdirSync as o0,readdirSync as Ea,readFileSync as Il,rmSync as Pk,statSync as Rs,writeFileSync as _k}from"node:fs";import{homedir as e4,tmpdir as t4}from"node:os";import{basename as kp,dirname as Ln,join as ge,relative as Wn,resolve as hi,sep as n4}from"node:path";import{globSync as i4}from"glob";import Rl from"ignore";import{minimatch as _a}from"minimatch";import Mk from"hosted-git-info";function Ik(t){let e=t.match(/^git@([^:]+):(.+)$/);if(e){let c=e[2]??"",l=c.indexOf("@");if(l<0)return{repo:t};let d=c.slice(0,l),u=c.slice(l+1);return!d||!u?{repo:t}:{repo:`git@${e[1]??""}:${d}`,ref:u}}if(t.includes("://"))try{let c=new URL(t),l=c.pathname.replace(/^\/+/,""),d=l.indexOf("@");if(d<0)return{repo:t};let u=l.slice(0,d),p=l.slice(d+1);return!u||!p?{repo:t}:(c.pathname=`/${u}`,{repo:c.toString().replace(/\/$/,""),ref:p})}catch{return{repo:t}}let n=t.indexOf("/");if(n<0)return{repo:t};let i=t.slice(0,n),s=t.slice(n+1),o=s.indexOf("@");if(o<0)return{repo:t};let r=s.slice(0,o),a=s.slice(o+1);return!r||!a?{repo:t}:{repo:`${i}/${r}`,ref:a}}function YD(t){let{repo:e,ref:n}=Ik(t),i=e,s="",o="",r=e.match(/^git@([^:]+):(.+)$/);if(r)s=r[1]??"",o=r[2]??"";else if(e.startsWith("https://")||e.startsWith("http://")||e.startsWith("ssh://")||e.startsWith("git://"))try{let c=new URL(e);s=c.hostname,o=c.pathname.replace(/^\/+/,"")}catch{return null}else{let c=e.indexOf("/");if(c<0||(s=e.slice(0,c),o=e.slice(c+1),!s.includes(".")&&s!=="localhost"))return null;i=`https://${e}`}let a=o.replace(/\.git$/,"").replace(/^\/+/,"");return!s||!a||a.split("/").length<2?null:{type:"git",repo:i,host:s,path:a,ref:n,pinned:!!n}}function Ml(t){let e=t.trim(),n=e.startsWith("git:"),i=n?e.slice(4).trim():e;if(!n&&!/^(https?|ssh|git):\/\//i.test(i))return null;let s=Ik(i),o=[s.ref?`${s.repo}#${s.ref}`:void 0,i].filter(a=>!!a);for(let a of o){let c=Mk.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return{type:"git",repo:!s.repo.startsWith("http://")&&!s.repo.startsWith("https://")&&!s.repo.startsWith("ssh://")&&!s.repo.startsWith("git://")&&!s.repo.startsWith("git@")?`https://${s.repo}`:s.repo,host:c.domain||"",path:`${c.user}/${c.project}`.replace(/\.git$/,""),ref:c.committish||s.ref||void 0,pinned:!!(c.committish||s.ref)}}}let r=[s.ref?`https://${s.repo}#${s.ref}`:void 0,`https://${i}`].filter(a=>!!a);for(let a of r){let c=Mk.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return{type:"git",repo:`https://${s.repo}`,host:c.domain||"",path:`${c.user}/${c.project}`.replace(/\.git$/,""),ref:c.committish||s.ref||void 0,pinned:!!(c.committish||s.ref)}}}return YD(i)}var XD;function Rk(){return XD!==void 0}function r0(){if(process.platform!=="linux"||Object.keys(process.env).length>0)return process.env;try{let t=Il("/proc/self/environ","utf-8"),e={};for(let n of t.split("\0")){let i=n.indexOf("=");i>0&&(e[n.slice(0,i)]=n.slice(i+1))}return e}catch{return process.env}}var mi=1e4,Ek=4,s4=4;function ko(){let t=process.env.PI_OFFLINE;return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function Ak(t){return t.origin==="package"?4:(t.scope==="project"?0:2)+(t.source==="local"?0:1)}var wp=["extensions","skills","prompts","themes"],o4={extensions:/\.(ts|js)$/,skills:/\.md$/,prompts:/\.md$/,themes:/\.json$/},r4=[".gitignore",".ignore",".fdignore"];function kt(t){return t.split(n4).join("/")}function Mo(){return process.env.HOME||e4()}function a4(t,e){let n=t.trim();if(!n||n.startsWith("#")&&!n.startsWith("\\#"))return null;let i=t,s=!1;i.startsWith("!")?(s=!0,i=i.slice(1)):i.startsWith("\\!")&&(i=i.slice(1)),i.startsWith("/")&&(i=i.slice(1));let o=e?`${e}${i}`:i;return s?`!${o}`:o}function Pl(t,e,n){let i=Wn(n,e),s=i?`${kt(i)}/`:"";for(let o of r4){let r=ge(e,o);if(xe(r))try{let c=Il(r,"utf-8").split(/\r?\n/).map(l=>a4(l,s)).filter(l=>!!l);c.length>0&&t.add(c)}catch{}}}function c4(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")||t.includes("*")||t.includes("?")}function a0(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")}function l4(t){return t.includes("*")||t.includes("?")}function u4(t){let e=[],n=[];for(let i of t)c4(i)?n.push(i):e.push(i);return{plain:e,patterns:n}}function Uk(t,e,n=!0,i,s){let o=[];if(!xe(t))return o;let r=s??t,a=i??Rl();Pl(a,t,r);try{let c=Ea(t,{withFileTypes:!0});for(let l of c){if(l.name.startsWith(".")||n&&l.name==="node_modules")continue;let d=ge(t,l.name),u=l.isDirectory(),p=l.isFile();if(l.isSymbolicLink())try{let h=Rs(d);u=h.isDirectory(),p=h.isFile()}catch{continue}let m=kt(Wn(r,d)),g=u?`${m}/`:m;a.ignores(g)||(u?o.push(...Uk(d,e,n,a,r)):p&&e.test(l.name)&&o.push(d))}}catch{}return o}function u0(t,e,n,i){let s=[];if(!xe(t))return s;let o=i??t,r=n??Rl();Pl(r,t,o);try{let a=Ea(t,{withFileTypes:!0});for(let c of a){if(c.name!=="SKILL.md")continue;let l=ge(t,c.name),d=c.isFile();if(c.isSymbolicLink())try{d=Rs(l).isFile()}catch{continue}let u=kt(Wn(o,l));if(d&&!r.ignores(u))return s.push(l),s}for(let c of a){if(c.name.startsWith(".")||c.name==="node_modules")continue;let l=ge(t,c.name),d=c.isDirectory(),u=c.isFile();if(c.isSymbolicLink())try{let m=Rs(l);d=m.isDirectory(),u=m.isFile()}catch{continue}let p=kt(Wn(o,l));if(e==="pi"&&t===o&&u&&c.name.endsWith(".md")&&!r.ignores(p)){s.push(l);continue}d&&(r.ignores(`${p}/`)||s.push(...u0(l,e,r,o)))}}catch{}return s}function Sp(t,e){return u0(t,e)}function d4(t){let e=hi(t);for(;;){if(xe(ge(e,".git")))return e;let n=Ln(e);if(n===e)return null;e=n}}function p4(t){let e=[],n=hi(t),i=d4(n),s=n;for(;e.push(ge(s,".agents","skills")),!(i&&s===i);){let o=Ln(s);if(o===s)break;s=o}return e}function Ok(t){let e=[];if(!xe(t))return e;let n=Rl();Pl(n,t,t);try{let i=Ea(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let o=ge(t,s.name),r=s.isFile();if(s.isSymbolicLink())try{r=Rs(o).isFile()}catch{continue}let a=kt(Wn(t,o));n.ignores(a)||r&&s.name.endsWith(".md")&&e.push(o)}}catch{}return e}function Lk(t){let e=[];if(!xe(t))return e;let n=Rl();Pl(n,t,t);try{let i=Ea(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let o=ge(t,s.name),r=s.isFile();if(s.isSymbolicLink())try{r=Rs(o).isFile()}catch{continue}let a=kt(Wn(t,o));n.ignores(a)||r&&s.name.endsWith(".json")&&e.push(o)}}catch{}return e}function m4(t){try{let e=Il(t,"utf-8");return JSON.parse(e).pi??null}catch{return null}}function Wk(t){let e=ge(t,"package.json");if(xe(e)){let s=m4(e);if(s?.extensions?.length){let o=[];for(let r of s.extensions){let a=hi(t,r);xe(a)&&o.push(a)}if(o.length>0)return o}}let n=ge(t,"index.ts"),i=ge(t,"index.js");return xe(n)?[n]:xe(i)?[i]:null}function c0(t){let e=[];if(!xe(t))return e;let n=Wk(t);if(n)return n;let i=Rl();Pl(i,t,t);try{let s=Ea(t,{withFileTypes:!0});for(let o of s){if(o.name.startsWith(".")||o.name==="node_modules")continue;let r=ge(t,o.name),a=o.isDirectory(),c=o.isFile();if(o.isSymbolicLink())try{let u=Rs(r);a=u.isDirectory(),c=u.isFile()}catch{continue}let l=kt(Wn(t,r)),d=a?`${l}/`:l;if(!i.ignores(d)){if(c&&(o.name.endsWith(".ts")||o.name.endsWith(".js")))e.push(r);else if(a){let u=Wk(r);u&&e.push(...u)}}}}catch{}return e}function Cp(t,e){return e==="skills"?u0(t,"pi"):e==="extensions"?c0(t):Uk(t,o4[e])}function l0(t,e,n){let i=kt(Wn(n,t)),s=kp(t),o=kt(t),r=s==="SKILL.md",a=r?Ln(t):void 0,c=r?kt(Wn(n,a)):void 0,l=r?kp(a):void 0,d=r?kt(a):void 0;return e.some(u=>{let p=kt(u);return _a(i,p)||_a(s,p)||_a(o,p)?!0:r?_a(c,p)||_a(l,p)||_a(d,p):!1})}function h4(t){let e=t.startsWith("./")||t.startsWith(".\\")?t.slice(2):t;return kt(e)}function Mp(t,e,n){if(e.length===0)return!1;let i=kt(Wn(n,t)),s=kp(t),o=kt(t),r=s==="SKILL.md",a=r?Ln(t):void 0,c=r?kt(Wn(n,a)):void 0,l=r?kt(a):void 0;return e.some(d=>{let u=h4(d);return u===i||u===o?!0:r?u===c||u===l:!1})}function g4(t){return t.filter(e=>e.startsWith("!")||e.startsWith("+")||e.startsWith("-"))}function f4(t,e,n){let i=g4(e),s=i.filter(c=>c.startsWith("!")).map(c=>c.slice(1)),o=i.filter(c=>c.startsWith("+")).map(c=>c.slice(1)),r=i.filter(c=>c.startsWith("-")).map(c=>c.slice(1)),a=!0;return s.length>0&&l0(t,s,n)&&(a=!1),o.length>0&&Mp(t,o,n)&&(a=!0),r.length>0&&Mp(t,r,n)&&(a=!1),a}function Tp(t,e,n){let i=[],s=[],o=[],r=[];for(let c of e)c.startsWith("+")?o.push(c.slice(1)):c.startsWith("-")?r.push(c.slice(1)):c.startsWith("!")?s.push(c.slice(1)):i.push(c);let a;if(i.length===0?a=[...t]:a=t.filter(c=>l0(c,i,n)),s.length>0&&(a=a.filter(c=>!l0(c,s,n))),o.length>0)for(let c of t)!a.includes(c)&&Mp(c,o,n)&&a.push(c);return r.length>0&&(a=a.filter(c=>!Mp(c,r,n))),new Set(a)}var Ni=class{constructor(e){this.cwd=e.cwd,this.agentDir=e.agentDir,this.settingsManager=e.settingsManager}setProgressCallback(e){this.progressCallback=e}addSourceToSettings(e,n){let i=n?.local?"project":"user",o=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],r=this.normalizePackageSourceForSettings(e,i);if(o.some(l=>this.packageSourcesMatch(l,e,i)))return!1;let c=[...o,r];return i==="project"?this.settingsManager.setProjectPackages(c):this.settingsManager.setPackages(c),!0}removeSourceFromSettings(e,n){let i=n?.local?"project":"user",o=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],r=o.filter(c=>!this.packageSourcesMatch(c,e,i));return r.length!==o.length?(i==="project"?this.settingsManager.setProjectPackages(r):this.settingsManager.setPackages(r),!0):!1}getInstalledPath(e,n){let i=this.parseSource(e);if(i.type==="npm"){let s=this.getNpmInstallPath(i,n);return xe(s)?s:void 0}if(i.type==="git"){let s=this.getGitInstallPath(i,n);return xe(s)?s:void 0}if(i.type==="local"){let s=this.getBaseDirForScope(n),o=this.resolvePathFromBase(i.path,s);return xe(o)?o:void 0}}emitProgress(e){this.progressCallback?.(e)}async withProgress(e,n,i,s){this.emitProgress({type:"start",action:e,source:n,message:i});try{await s(),this.emitProgress({type:"complete",action:e,source:n})}catch(o){let r=o instanceof Error?o.message:String(o);throw this.emitProgress({type:"error",action:e,source:n,message:r}),o}}async resolve(e){let n=this.createAccumulator(),i=this.settingsManager.getGlobalSettings(),s=this.settingsManager.getProjectSettings(),o=[];for(let l of s.packages??[])o.push({pkg:l,scope:"project"});for(let l of i.packages??[])o.push({pkg:l,scope:"user"});let r=this.dedupePackages(o);await this.resolvePackageSources(r,n,e);let a=this.agentDir,c=ge(this.cwd,St);for(let l of wp){let d=this.getTargetMap(n,l),u=i[l]??[],p=s[l]??[];this.resolveLocalEntries(p,l,d,{source:"local",scope:"project",origin:"top-level"},c),this.resolveLocalEntries(u,l,d,{source:"local",scope:"user",origin:"top-level"},a)}return this.addAutoDiscoveredResources(n,i,s,a,c),this.toResolvedPaths(n)}async resolveExtensionSources(e,n){let i=this.createAccumulator(),s=n?.temporary?"temporary":n?.local?"project":"user",o=e.map(r=>({pkg:r,scope:s}));return await this.resolvePackageSources(o,i),this.toResolvedPaths(i)}listConfiguredPackages(){let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let s of e.packages??[]){let o=typeof s=="string"?s:s.source;i.push({source:o,scope:"user",filtered:typeof s=="object",installedPath:this.getInstalledPath(o,"user")})}for(let s of n.packages??[]){let o=typeof s=="string"?s:s.source;i.push({source:o,scope:"project",filtered:typeof s=="object",installedPath:this.getInstalledPath(o,"project")})}return i}async install(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";await this.withProgress("install",e,`Installing ${e}...`,async()=>{if(i.type==="npm"){await this.installNpm(i,s,!1);return}if(i.type==="git"){await this.installGit(i,s);return}if(i.type==="local"){let o=this.resolvePath(i.path);if(!xe(o))throw new Error(`Path does not exist: ${o}`);return}throw new Error(`Unsupported install source: ${e}`)})}async installAndPersist(e,n){await this.install(e,n),this.addSourceToSettings(e,n)}async remove(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";await this.withProgress("remove",e,`Removing ${e}...`,async()=>{if(i.type==="npm"){await this.uninstallNpm(i,s);return}if(i.type==="git"){await this.removeGit(i,s);return}if(i.type!=="local")throw new Error(`Unsupported remove source: ${e}`)})}async removeAndPersist(e,n){return await this.remove(e,n),this.removeSourceFromSettings(e,n)}async update(e){let n=this.settingsManager.getGlobalSettings(),i=this.settingsManager.getProjectSettings(),s=e?this.getPackageIdentity(e):void 0,o=!1,r=[];for(let a of n.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"user")!==s||(o=!0,r.push({source:c,scope:"user"}))}for(let a of i.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"project")!==s||(o=!0,r.push({source:c,scope:"project"}))}if(e&&!o)throw new Error(this.buildNoMatchingPackageMessage(e,[...n.packages??[],...i.packages??[]]));await this.updateConfiguredSources(r)}async updateConfiguredSources(e){if(ko()||e.length===0)return;let n=[],i=[];for(let l of e){let d=this.parseSource(l.source);if(!(d.type==="local"||d.pinned)){if(d.type==="npm"){n.push({...l,parsed:d});continue}i.push({...l,parsed:d})}}let s=n.map(l=>async()=>({entry:l,shouldUpdate:await this.shouldUpdateNpmSource(l.parsed,l.scope)})),o=await this.runWithConcurrency(s,Ek),r=[],a=[];for(let l of o)l.shouldUpdate&&(l.entry.scope==="user"?r.push(l.entry):a.push(l.entry));let c=[];if(r.length>0&&c.push(this.updateNpmBatch(r,"user")),a.length>0&&c.push(this.updateNpmBatch(a,"project")),i.length>0){let l=i.map(d=>async()=>this.withProgress("update",d.source,`Updating ${d.source}...`,async()=>{await this.updateGit(d.parsed,d.scope)}));c.push(this.runWithConcurrency(l,s4).then(()=>{}))}await Promise.all(c)}async shouldUpdateNpmSource(e,n){let i=this.getManagedNpmInstallPath(e,n),s=xe(i)?this.getInstalledNpmVersion(i):void 0;if(!s)return!0;try{return await this.getLatestNpmVersion(e.name)!==s}catch{return!0}}async updateNpmBatch(e,n){if(e.length===0)return;let i=e.length===1?e[0].source:`${n} npm packages`,s=e.length===1?`Updating ${e[0].source}...`:`Updating ${n} npm packages...`,o=e.map(r=>`${r.parsed.name}@latest`);await this.withProgress("update",i,s,async()=>{await this.installNpmBatch(o,n)})}async installNpmBatch(e,n){let i=this.getNpmInstallRoot(n,!1);this.ensureNpmProject(i),await this.runNpmCommand(this.getNpmInstallArgs(e,i))}async checkForAvailableUpdates(){if(ko())return[];let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let a of n.packages??[])i.push({pkg:a,scope:"project"});for(let a of e.packages??[])i.push({pkg:a,scope:"user"});let o=this.dedupePackages(i).filter(a=>a.scope!=="temporary").map(a=>async()=>{let c=typeof a.pkg=="string"?a.pkg:a.pkg.source,l=this.parseSource(c);if(l.type==="local"||l.pinned)return;if(l.type==="npm"){let p=this.getNpmInstallPath(l,a.scope);return!xe(p)||!await this.npmHasAvailableUpdate(l,p)?void 0:{source:c,displayName:l.name,type:"npm",scope:a.scope}}let d=this.getGitInstallPath(l,a.scope);if(!(!xe(d)||!await this.gitHasAvailableUpdate(d)))return{source:c,displayName:`${l.host}/${l.path}`,type:"git",scope:a.scope}});return(await this.runWithConcurrency(o,Ek)).filter(a=>a!==void 0)}async resolvePackageSources(e,n,i){for(let{pkg:s,scope:o}of e){let r=typeof s=="string"?s:s.source,a=typeof s=="object"?s:void 0,c=this.parseSource(r),l={source:r,scope:o,origin:"package"};if(c.type==="local"){let u=this.getBaseDirForScope(o);this.resolveLocalExtensionSource(c,n,a,l,u);continue}let d=async()=>{if(ko())return!1;if(!i)return await this.installParsedSource(c,o),!0;let u=await i(r);if(u==="skip")return!1;if(u==="error")throw new Error(`Missing source: ${r}`);return await this.installParsedSource(c,o),!0};if(c.type==="npm"){let u=this.getNpmInstallPath(c,o);if(!xe(u)||c.pinned&&!await this.installedNpmMatchesPinnedVersion(c,u)){if(!await d())continue;u=this.getNpmInstallPath(c,o)}l.baseDir=u,this.collectPackageResources(u,n,a,l);continue}if(c.type==="git"){let u=this.getGitInstallPath(c,o);if(xe(u))o==="temporary"&&!c.pinned&&!ko()&&await this.refreshTemporaryGitSource(c,r);else if(!await d())continue;l.baseDir=u,this.collectPackageResources(u,n,a,l)}}}resolveLocalExtensionSource(e,n,i,s,o){let r=this.resolvePathFromBase(e.path,o);if(xe(r))try{let a=Rs(r);if(a.isFile()){s.baseDir=Ln(r),this.addResource(n.extensions,r,s,!0);return}a.isDirectory()&&(s.baseDir=r,this.collectPackageResources(r,n,i,s)||this.addResource(n.extensions,r,s,!0))}catch{return}}async installParsedSource(e,n){if(e.type==="npm"){await this.installNpm(e,n,n==="temporary");return}if(e.type==="git"){await this.installGit(e,n);return}}getPackageSourceString(e){return typeof e=="string"?e:e.source}getSourceMatchKeyForInput(e){let n=this.parseSource(e);return n.type==="npm"?`npm:${n.name}`:n.type==="git"?`git:${n.host}/${n.path}`:`local:${this.resolvePath(n.path)}`}getSourceMatchKeyForSettings(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}buildNoMatchingPackageMessage(e,n){let i=this.findSuggestedConfiguredSource(e,n);return i?`No matching package found for ${e}. Did you mean ${i}?`:`No matching package found for ${e}`}findSuggestedConfiguredSource(e,n){let i=e.trim(),s=new Set;for(let o of n){let r=this.getPackageSourceString(o),a=this.parseSource(r);if(a.type==="npm"){(i===a.name||i===a.spec)&&s.add(r);continue}if(a.type==="git"){let c=`${a.host}/${a.path}`,l=a.ref?`${c}@${a.ref}`:void 0;(i===c||l&&i===l)&&s.add(r)}}return s.values().next().value}packageSourcesMatch(e,n,i){let s=this.getSourceMatchKeyForSettings(this.getPackageSourceString(e),i),o=this.getSourceMatchKeyForInput(n);return s===o}normalizePackageSourceForSettings(e,n){let i=this.parseSource(e);if(i.type!=="local")return e;let s=this.getBaseDirForScope(n),o=this.resolvePath(i.path);return Wn(s,o)||"."}parseSource(e){if(e.startsWith("npm:")){let i=e.slice(4).trim(),{name:s,version:o}=this.parseNpmSpec(i);return{type:"npm",spec:i,name:s,pinned:!!o}}if(Zd(e))return{type:"local",path:e};let n=Ml(e);return n||{type:"local",path:e}}async installedNpmMatchesPinnedVersion(e,n){let i=this.getInstalledNpmVersion(n);if(!i)return!1;let{version:s}=this.parseNpmSpec(e.spec);return s?i===s:!0}async npmHasAvailableUpdate(e,n){if(ko())return!1;let i=this.getInstalledNpmVersion(n);if(!i)return!1;try{return await this.getLatestNpmVersion(e.name)!==i}catch{return!1}}getInstalledNpmVersion(e){let n=ge(e,"package.json");if(xe(n))try{let i=Il(n,"utf-8");return JSON.parse(i).version}catch{return}}async getLatestNpmVersion(e){let n=this.getNpmCommand(),s=(await this.runCommandCapture(n.command,[...n.args,"view",e,"version","--json"],{cwd:this.cwd,timeoutMs:mi})).trim();if(!s)throw new Error("Empty response from npm view");return JSON.parse(s)}async gitHasAvailableUpdate(e){if(ko())return!1;try{let n=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:mi}),i=await this.getRemoteGitHead(e);return n.trim()!==i.trim()}catch{return!1}}async getRemoteGitHead(e){let n=await this.getGitUpstreamRef(e);if(n){let r=(await this.runGitRemoteCommand(e,["ls-remote","origin",n])).match(/^([0-9a-f]{40})\s+/m);if(r?.[1])return r[1]}let s=(await this.runGitRemoteCommand(e,["ls-remote","origin","HEAD"])).match(/^([0-9a-f]{40})\s+HEAD$/m);if(!s?.[1])throw new Error("Failed to determine remote HEAD");return s[1]}async getLocalGitUpdateTarget(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:mi})).trim();if(!i.startsWith("origin/"))throw new Error(`Unsupported upstream remote: ${i}`);let s=i.slice(7);if(!s)throw new Error("Missing upstream branch name");return{ref:"@{upstream}",head:await this.runCommandCapture("git",["rev-parse","@{upstream}"],{cwd:e,timeoutMs:mi}),fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}}catch{await this.runCommand("git",["remote","set-head","origin","-a"],{cwd:e}).catch(()=>{});let n=await this.runCommandCapture("git",["rev-parse","origin/HEAD"],{cwd:e,timeoutMs:mi}),s=(await this.runCommandCapture("git",["symbolic-ref","refs/remotes/origin/HEAD"],{cwd:e,timeoutMs:mi}).catch(()=>"")).trim().replace(/^refs\/remotes\/origin\//,"");return s?{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}:{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin","+HEAD:refs/remotes/origin/HEAD"]}}}async getGitUpstreamRef(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:mi})).trim();if(!i.startsWith("origin/"))return;let s=i.slice(7);return s?`refs/heads/${s}`:void 0}catch{return}}runGitRemoteCommand(e,n){return this.runCommandCapture("git",n,{cwd:e,timeoutMs:mi,env:{GIT_TERMINAL_PROMPT:"0"}})}async runWithConcurrency(e,n){if(e.length===0)return[];let i=new Array(e.length),s=0,o=Math.max(1,Math.min(n,e.length)),r=async()=>{for(;;){let a=s;if(s+=1,a>=e.length)return;i[a]=await e[a]()}};return await Promise.all(Array.from({length:o},()=>r())),i}getPackageIdentity(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;if(n){let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}return`local:${this.resolvePath(i.path)}`}dedupePackages(e){let n=new Map;for(let i of e){let s=typeof i.pkg=="string"?i.pkg:i.pkg.source,o=this.getPackageIdentity(s,i.scope),r=n.get(o);r?i.scope==="project"&&r.scope==="user"&&n.set(o,i):n.set(o,i)}return Array.from(n.values())}parseNpmSpec(e){let n=e.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);if(!n)return{name:e};let i=n[1]??e,s=n[2];return{name:i,version:s}}getNpmCommand(){let e=this.settingsManager.getNpmCommand();if(!e||e.length===0)return{command:"npm",args:[]};let[n,...i]=e;if(!n)throw new Error("Invalid npmCommand: first array entry must be a non-empty command");return{command:n,args:i}}getPackageManagerName(){let e=this.getNpmCommand(),n=[e.command,...e.args],i=n.lastIndexOf("--"),s=i>=0?n[i+1]:e.command;return s?kp(s).replace(/\.(cmd|exe)$/i,""):""}async runNpmCommand(e,n){let i=this.getNpmCommand();await this.runCommand(i.command,[...i.args,...e],n)}getGitDependencyInstallArgs(){let e=this.settingsManager.getNpmCommand();return e&&e.length>0?["install"]:["install","--omit=dev"]}runNpmCommandSync(e){let n=this.getNpmCommand();return this.runCommandSync(n.command,[...n.args,...e])}getNpmInstallArgs(e,n){let i=this.getPackageManagerName();return i==="bun"?["install",...e,"--cwd",n]:i==="pnpm"?["install",...e,"--prefix",n,"--config.strict-dep-builds=false"]:["install",...e,"--prefix",n]}async installNpm(e,n,i){let s=this.getNpmInstallRoot(n,i);this.ensureNpmProject(s),await this.runNpmCommand(this.getNpmInstallArgs([e.spec],s))}async uninstallNpm(e,n){let i=this.getNpmInstallRoot(n,!1);if(xe(i)){if(this.getPackageManagerName()==="bun"){await this.runNpmCommand(["uninstall",e.name,"--cwd",i]);return}await this.runNpmCommand(["uninstall",e.name,"--prefix",i])}}async installGit(e,n){let i=this.getGitInstallPath(e,n);if(xe(i))return;let s=this.getGitInstallRoot(n);s&&this.ensureGitIgnore(s),o0(Ln(i),{recursive:!0}),await this.runCommand("git",["clone",e.repo,i]),e.ref&&await this.runCommand("git",["checkout",e.ref],{cwd:i});let o=ge(i,"package.json");xe(o)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async updateGit(e,n){let i=this.getGitInstallPath(e,n);if(!xe(i)){await this.installGit(e,n);return}let s=await this.getLocalGitUpdateTarget(i);await this.runCommand("git",s.fetchArgs,{cwd:i});let o=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:i,timeoutMs:mi}),r=await this.runCommandCapture("git",["rev-parse",s.ref],{cwd:i,timeoutMs:mi});if(o.trim()===r.trim())return;await this.runCommand("git",["reset","--hard",s.ref],{cwd:i}),await this.runCommand("git",["clean","-fdx"],{cwd:i});let a=ge(i,"package.json");xe(a)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async refreshTemporaryGitSource(e,n){if(!ko())try{await this.withProgress("pull",n,`Refreshing ${n}...`,async()=>{await this.updateGit(e,"temporary")})}catch{}}async removeGit(e,n){let i=this.getGitInstallPath(e,n);xe(i)&&(Pk(i,{recursive:!0,force:!0}),this.pruneEmptyGitParents(i,this.getGitInstallRoot(n)))}pruneEmptyGitParents(e,n){if(!n)return;let i=hi(n),s=Ln(e);for(;s.startsWith(i)&&s!==i;){if(!xe(s)){s=Ln(s);continue}if(Ea(s).length>0)break;try{Pk(s,{recursive:!0,force:!0})}catch{break}s=Ln(s)}}ensureNpmProject(e){xe(e)||o0(e,{recursive:!0}),KT(e),this.ensureGitIgnore(e);let n=ge(e,"package.json");xe(n)||_k(n,JSON.stringify({name:"pi-extensions",private:!0},null,2),"utf-8")}ensureGitIgnore(e){xe(e)||o0(e,{recursive:!0});let n=ge(e,".gitignore");xe(n)||_k(n,`*
|
|
283
283
|
!.gitignore
|
|
284
|
-
`,"utf-8")}getNpmInstallRoot(e,n){return n?this.getTemporaryDir("npm"):e==="project"?ge(this.cwd,St,"npm"):ge(this.agentDir,"npm")}getGlobalNpmRoot(){let e=this.getNpmCommand(),n=[e.command,...e.args].join("\0");if(this.globalNpmRoot&&this.globalNpmRootCommandKey===n)return this.globalNpmRoot;if(this.getPackageManagerName()==="bun"){let i=this.runNpmCommandSync(["pm","bin","-g"]).trim();this.globalNpmRoot=ge(Ln(i),"install","global","node_modules")}else this.globalNpmRoot=this.runNpmCommandSync(["root","-g"]).trim();return this.globalNpmRootCommandKey=n,this.globalNpmRoot}getPnpmGlobalPackagePath(e){if(this.getPackageManagerName()!=="pnpm")return;let n=this.runNpmCommandSync(["list","-g","--depth","0","--json"]),i=JSON.parse(n);for(let s of i){let o=s.dependencies?.[e]?.path;if(o)return o}}getManagedNpmInstallPath(e,n){return n==="temporary"?ge(this.getTemporaryDir("npm"),"node_modules",e.name):n==="project"?ge(this.cwd,St,"npm","node_modules",e.name):ge(this.agentDir,"npm","node_modules",e.name)}getLegacyGlobalNpmInstallPath(e){try{return this.getPnpmGlobalPackagePath(e.name)??ge(this.getGlobalNpmRoot(),e.name)}catch{return}}getNpmInstallPath(e,n){let i=this.getManagedNpmInstallPath(e,n);if(n!=="user"||xe(i))return i;let s=this.getLegacyGlobalNpmInstallPath(e);return s&&xe(s)?s:i}getGitInstallPath(e,n){return n==="temporary"?this.getTemporaryDir(`git-${e.host}`,e.path):n==="project"?ge(this.cwd,St,"git",e.host,e.path):ge(this.agentDir,"git",e.host,e.path)}getGitInstallRoot(e){if(e!=="temporary")return e==="project"?ge(this.cwd,St,"git"):ge(this.agentDir,"git")}getTemporaryDir(e,n){let i=ZD("sha256").update(`${e}-${n??""}`).digest("hex").slice(0,8);return ge(t4(),"pi-extensions",e,i,n??"")}getBaseDirForScope(e){return e==="project"?ge(this.cwd,St):e==="user"?this.agentDir:this.cwd}resolvePath(e){let n=e.trim();return n==="~"?Mo():n.startsWith("~/")?ge(Mo(),n.slice(2)):n.startsWith("~")?ge(Mo(),n.slice(1)):hi(this.cwd,n)}resolvePathFromBase(e,n){let i=e.trim();return i==="~"?Mo():i.startsWith("~/")?ge(Mo(),i.slice(2)):i.startsWith("~")?ge(Mo(),i.slice(1)):hi(n,i)}collectPackageResources(e,n,i,s){if(i){for(let a of wp){let c=i[a],l=this.getTargetMap(n,a);c!==void 0?this.applyPackageFilter(e,c,a,l,s):this.collectDefaultResources(e,a,l,s)}return!0}let o=this.readPiManifest(e);if(o){for(let a of wp){let c=o[a];this.addManifestEntries(c,e,a,this.getTargetMap(n,a),s)}return!0}let r=!1;for(let a of wp){let c=ge(e,a);if(xe(c)){let l=Cp(c,a);for(let d of l)this.addResource(this.getTargetMap(n,a),d,s,!0);r=!0}}return r}collectDefaultResources(e,n,i,s){let r=this.readPiManifest(e)?.[n];if(r){this.addManifestEntries(r,e,n,i,s);return}let a=ge(e,n);if(xe(a)){let c=Cp(a,n);for(let l of c)this.addResource(i,l,s,!0)}}applyPackageFilter(e,n,i,s,o){let{allFiles:r}=this.collectManifestFiles(e,i);if(n.length===0){for(let c of r)this.addResource(s,c,o,!1);return}let a=Tp(r,n,e);for(let c of r){let l=a.has(c);this.addResource(s,c,o,l)}}collectManifestFiles(e,n){let s=this.readPiManifest(e)?.[n];if(s&&s.length>0){let a=this.collectFilesFromManifestEntries(s,e,n),c=s.filter(a0),l=c.length>0?Tp(a,c,e):new Set(a);return{allFiles:Array.from(l),enabledByManifest:l}}let o=ge(e,n);if(!xe(o))return{allFiles:[],enabledByManifest:new Set};let r=Cp(o,n);return{allFiles:r,enabledByManifest:new Set(r)}}readPiManifest(e){let n=ge(e,"package.json");if(!xe(n))return null;try{let i=Il(n,"utf-8");return JSON.parse(i).pi??null}catch{return null}}addManifestEntries(e,n,i,s,o){if(!e)return;let r=this.collectFilesFromManifestEntries(e,n,i),a=e.filter(a0),c=Tp(r,a,n);for(let l of r)c.has(l)&&this.addResource(s,l,o,!0)}collectFilesFromManifestEntries(e,n,i){let o=e.filter(r=>!a0(r)).flatMap(r=>l4(r)?i4(r,{cwd:n,absolute:!0,dot:!1,nodir:!1}).map(a=>hi(a)):[hi(n,r)]);return this.collectFilesFromPaths(o,i)}resolveLocalEntries(e,n,i,s,o){if(e.length===0)return;let{plain:r,patterns:a}=u4(e),c=r.map(u=>this.resolvePathFromBase(u,o)),l=this.collectFilesFromPaths(c,n),d=Tp(l,a,o);for(let u of l)this.addResource(i,u,s,d.has(u))}addAutoDiscoveredResources(e,n,i,s,o){let r={source:"auto",scope:"user",origin:"top-level",baseDir:s},a={source:"auto",scope:"project",origin:"top-level",baseDir:o},c={extensions:n.extensions??[],skills:n.skills??[],prompts:n.prompts??[],themes:n.themes??[]},l={extensions:i.extensions??[],skills:i.skills??[],prompts:i.prompts??[],themes:i.themes??[]},d={extensions:ge(s,"extensions"),skills:ge(s,"skills"),prompts:ge(s,"prompts"),themes:ge(s,"themes")},u={extensions:ge(o,"extensions"),skills:ge(o,"skills"),prompts:ge(o,"prompts"),themes:ge(o,"themes")},p=ge(Mo(),".agents","skills"),m=p4(this.cwd).filter(x=>hi(x)!==hi(p)),g=(x,y,w,P,_)=>{let R=this.getTargetMap(e,x);for(let L of y){let E=f4(L,P,_);this.addResource(R,L,w,E)}};g("extensions",c0(u.extensions),a,l.extensions,o),g("skills",Sp(u.skills,"pi"),a,l.skills,o);for(let x of m){let y=Ln(x),w={...a,baseDir:y};g("skills",Sp(x,"agents"),w,l.skills,y)}g("prompts",Ok(u.prompts),a,l.prompts,o),g("themes",Lk(u.themes),a,l.themes,o),g("extensions",c0(d.extensions),r,c.extensions,s),g("skills",Sp(d.skills,"pi"),r,c.skills,s);let h=Ln(p),f={...r,baseDir:h};g("skills",Sp(p,"agents"),f,c.skills,h),g("prompts",Ok(d.prompts),r,c.prompts,s),g("themes",Lk(d.themes),r,c.themes,s)}collectFilesFromPaths(e,n){let i=[];for(let s of e)if(xe(s))try{let o=Rs(s);o.isFile()?i.push(s):o.isDirectory()&&i.push(...Cp(s,n))}catch{}return i}getTargetMap(e,n){switch(n){case"extensions":return e.extensions;case"skills":return e.skills;case"prompts":return e.prompts;case"themes":return e.themes;default:throw new Error(`Unknown resource type: ${n}`)}}addResource(e,n,i,s){n&&(e.has(n)||e.set(n,{metadata:i,enabled:s}))}createAccumulator(){return{extensions:new Map,skills:new Map,prompts:new Map,themes:new Map}}toResolvedPaths(e){let n=i=>{let s=Array.from(i.entries()).map(([r,{metadata:a,enabled:c}])=>({path:r,enabled:c,metadata:a}));s.sort((r,a)=>Ak(r.metadata)-Ak(a.metadata));let o=new Set;return s.filter(r=>{let a=xa(r.path);return o.has(a)?!1:(o.add(a),!0)})};return{extensions:n(e.extensions),skills:n(e.skills),prompts:n(e.prompts),themes:n(e.themes)}}spawnCommand(e,n,i){let s=r0();return Vu(e,n,{cwd:i?.cwd,stdio:Rk()?["ignore",2,2]:"inherit",env:s})}spawnCaptureCommand(e,n,i){let s=r0(),o=i?.env?{...s,...i.env}:s;return Vu(e,n,{cwd:i?.cwd,stdio:["ignore","pipe","pipe"],env:o})}runCommandCapture(e,n,i){return new Promise((s,o)=>{let r=this.spawnCaptureCommand(e,n,i),a="",c="",l=!1,d=typeof i?.timeoutMs=="number"?setTimeout(()=>{l=!0,r.kill()},i.timeoutMs):void 0;r.stdout?.on("data",u=>{a+=u.toString()}),r.stderr?.on("data",u=>{c+=u.toString()}),r.once("error",u=>{d&&clearTimeout(d),o(u)}),r.once("close",(u,p)=>{if(d&&clearTimeout(d),l){o(new Error(`${e} ${n.join(" ")} timed out after ${i?.timeoutMs}ms`));return}if(u===0){s(a.trim());return}let m=u===null?`signal ${p??"unknown"}`:`code ${u}`;o(new Error(`${e} ${n.join(" ")} failed with ${m}: ${c||a}`))})})}runCommand(e,n,i){return new Promise((s,o)=>{let r=this.spawnCommand(e,n,i);r.on("error",o),r.on("exit",a=>{a===0?s():o(new Error(`${e} ${n.join(" ")} failed with code ${a}`))})})}runCommandSync(e,n){let i=r0(),s=Hr(e,n,{stdio:["ignore","pipe","pipe"],encoding:"utf-8",env:i});if(s.error||s.status!==0)throw new Error(`Failed to run ${e} ${n.join(" ")}: ${s.error?.message||s.stderr||s.stdout}`);return(s.stdout||s.stderr||"").trim()}};import ibe from"chalk";import{existsSync as Fk,mkdirSync as b4,readFileSync as x4,writeFileSync as y4}from"fs";import{homedir as Dk}from"os";import{dirname as v4,join as p0}from"path";import w4 from"proper-lockfile";import*as Aa from"undici";var d0=3e5,Ip=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}];function Rp(t){if(typeof t=="string"){let e=t.trim();return e.toLowerCase()==="disabled"?0:e.length===0?void 0:Rp(Number(e))}if(!(typeof t!="number"||!Number.isFinite(t)||t<0))return Math.floor(t)}function Pp(t){let e=Ip.find(n=>n.timeoutMs===t);return e?e.label:`${t/1e3} sec`}function _l(t=d0){let e=Rp(t);if(e===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(t)}`);Aa.setGlobalDispatcher(new Aa.EnvHttpProxyAgent({allowH2:!1,bodyTimeout:e,headersTimeout:e})),Aa.install?.()}function El(t,e){let n={...t};for(let i of Object.keys(e)){let s=e[i],o=t[i];s!==void 0&&(typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?n[i]={...o,...s}:n[i]=s)}return n}var m0=class{constructor(e,n){this.globalSettingsPath=p0(n,"settings.json"),this.projectSettingsPath=p0(e,St,"settings.json")}acquireLockSyncWithRetry(e){let s;for(let o=1;o<=10;o++)try{return w4.lockSync(e,{realpath:!1})}catch(r){if((typeof r=="object"&&r!==null&&"code"in r?String(r.code):void 0)!=="ELOCKED"||o===10)throw r;s=r;let c=Date.now();for(;Date.now()-c<20;);}throw s??new Error("Failed to acquire settings lock")}withLock(e,n){let i=e==="global"?this.globalSettingsPath:this.projectSettingsPath,s=v4(i),o;try{let r=Fk(i);r&&(o=this.acquireLockSyncWithRetry(i));let a=r?x4(i,"utf-8"):void 0,c=n(a);c!==void 0&&(Fk(s)||b4(s,{recursive:!0}),o||(o=this.acquireLockSyncWithRetry(i)),y4(i,c,"utf-8"))}finally{o&&o()}}},h0=class{withLock(e,n){let i=e==="global"?this.global:this.project,s=n(i);s!==void 0&&(e==="global"?this.global=s:this.project=s)}},gi=class t{constructor(e,n,i,s=null,o=null,r=[]){this.modifiedFields=new Set;this.modifiedNestedFields=new Map;this.modifiedProjectFields=new Set;this.modifiedProjectNestedFields=new Map;this.globalSettingsLoadError=null;this.projectSettingsLoadError=null;this.writeQueue=Promise.resolve();this.storage=e,this.globalSettings=n,this.projectSettings=i,this.globalSettingsLoadError=s,this.projectSettingsLoadError=o,this.errors=[...r],this.settings=El(this.globalSettings,this.projectSettings)}static create(e,n=Le()){let i=new m0(e,n);return t.fromStorage(i)}static fromStorage(e){let n=t.tryLoadFromStorage(e,"global"),i=t.tryLoadFromStorage(e,"project"),s=[];return n.error&&s.push({scope:"global",error:n.error}),i.error&&s.push({scope:"project",error:i.error}),new t(e,n.settings,i.settings,n.error,i.error,s)}static inMemory(e={}){let n=new h0,i=t.migrateSettings(structuredClone(e));return n.withLock("global",()=>JSON.stringify(i,null,2)),t.fromStorage(n)}static loadFromStorage(e,n){let i;if(e.withLock(n,o=>{i=o}),!i)return{};let s=JSON.parse(i);return t.migrateSettings(s)}static tryLoadFromStorage(e,n){try{return{settings:t.loadFromStorage(e,n),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let n=e.skills;n.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=n.enableSkillCommands),Array.isArray(n.customDirectories)&&n.customDirectories.length>0?e.skills=n.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){let n=e.retry,i=typeof n.provider=="object"&&n.provider!==null?n.provider:void 0;typeof n.maxDelayMs=="number"&&(i?.maxRetryDelayMs===void 0||i?.maxRetryDelayMs===null)&&(n.provider={...i??{},maxRetryDelayMs:n.maxDelayMs}),delete n.maxDelayMs}return e}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}async reload(){await this.writeQueue;let e=t.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();let n=t.tryLoadFromStorage(this.storage,"project");n.error?(this.projectSettingsLoadError=n.error,this.recordError("project",n.error)):(this.projectSettings=n.settings,this.projectSettingsLoadError=null),this.settings=El(this.globalSettings,this.projectSettings)}applyOverrides(e){this.settings=El(this.settings,e)}markModified(e,n){this.modifiedFields.add(e),n&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(n))}markProjectModified(e,n){this.modifiedProjectFields.add(e),n&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(n))}recordError(e,n){let i=n instanceof Error?n:new Error(String(n));this.errors.push({scope:e,error:i})}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,n){this.writeQueue=this.writeQueue.then(()=>{n(),this.clearModifiedScope(e)}).catch(i=>{this.recordError(e,i)})}cloneModifiedNestedFields(e){let n=new Map;for(let[i,s]of e.entries())n.set(i,new Set(s));return n}persistScopedSettings(e,n,i,s){this.storage.withLock(e,o=>{let r=o?t.migrateSettings(JSON.parse(o)):{},a={...r};for(let c of i){let l=n[c];if(s.has(c)&&typeof l=="object"&&l!==null){let d=s.get(c),u=r[c]??{},p=l,m={...u};for(let g of d)m[g]=p[g];a[c]=m}else a[c]=l}return JSON.stringify(a,null,2)})}save(){if(this.settings=El(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;let e=structuredClone(this.globalSettings),n=new Set(this.modifiedFields),i=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,n,i)})}saveProjectSettings(e){if(this.projectSettings=structuredClone(e),this.settings=El(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;let n=structuredClone(this.projectSettings),i=new Set(this.modifiedProjectFields),s=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",n,i,s)})}async flush(){await this.writeQueue}drainErrors(){let e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){let e=this.settings.sessionDir;return e&&(e==="~"?Dk():e.startsWith("~/")?p0(Dk(),e.slice(2)):e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,n){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=n,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getTheme(){return this.settings.theme}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens()}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3}}getHttpIdleTimeoutMs(){let e=this.settings.httpIdleTimeoutMs,n=Rp(e);if(n!==void 0)return n;if(e!==void 0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);return d0}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}getShellPath(){return this.settings.shellPath}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){let n=structuredClone(this.projectSettings);n.packages=e,this.markProjectModified("packages"),this.saveProjectSettings(n)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){let n=structuredClone(this.projectSettings);n.extensions=e,this.markProjectModified("extensions"),this.saveProjectSettings(n)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){let n=structuredClone(this.projectSettings);n.skills=e,this.markProjectModified("skills"),this.saveProjectSettings(n)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){let n=structuredClone(this.projectSettings);n.prompts=e,this.markProjectModified("prompts"),this.saveProjectSettings(n)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){let n=structuredClone(this.projectSettings);n.themes=e,this.markProjectModified("themes"),this.saveProjectSettings(n)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){let e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}};import{Agent as Kbe}from"@earendil-works/pi-agent-core";import f0 from"chalk";import{minimatch as $k}from"minimatch";import fbe from"chalk";var C4=["off","minimal","low","medium","high","xhigh"];function g0(t){return C4.includes(t)}var x0={"amazon-bedrock":"us.anthropic.claude-opus-4-6-v1",anthropic:"claude-opus-4-7",openai:"gpt-5.4","azure-openai-responses":"gpt-5.4","openai-codex":"gpt-5.5",deepseek:"deepseek-v4-pro",google:"gemini-3.1-pro-preview","google-vertex":"gemini-3.1-pro-preview","github-copilot":"gpt-5.4",openrouter:"moonshotai/kimi-k2.6","vercel-ai-gateway":"zai/glm-5.1",xai:"grok-4.20-0309-reasoning",groq:"openai/gpt-oss-120b",cerebras:"zai-glm-4.7",zai:"glm-5.1",mistral:"devstral-medium-latest",minimax:"MiniMax-M2.7","minimax-cn":"MiniMax-M2.7",moonshotai:"kimi-k2.6","moonshotai-cn":"kimi-k2.6",huggingface:"moonshotai/Kimi-K2.6",fireworks:"accounts/fireworks/models/kimi-k2p6",together:"moonshotai/Kimi-K2.6",opencode:"kimi-k2.6","opencode-go":"kimi-k2.6","kimi-coding":"kimi-for-coding","cloudflare-workers-ai":"@cf/moonshotai/kimi-k2.6","cloudflare-ai-gateway":"workers-ai/@cf/moonshotai/kimi-k2.6",xiaomi:"mimo-v2.5-pro","xiaomi-token-plan-cn":"mimo-v2.5-pro","xiaomi-token-plan-ams":"mimo-v2.5-pro","xiaomi-token-plan-sgp":"mimo-v2.5-pro"};function Bk(t){return t.endsWith("-latest")?!0:!/-\d{8}$/.test(t)}function y0(t,e){let n=t.trim();if(!n)return;let i=n.toLowerCase(),s=e.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===i);if(s.length===1)return s[0];if(s.length>1)return;let o=n.indexOf("/");if(o!==-1){let a=n.substring(0,o).trim(),c=n.substring(o+1).trim();if(a&&c){let l=e.filter(d=>d.provider.toLowerCase()===a.toLowerCase()&&d.id.toLowerCase()===c.toLowerCase());if(l.length===1)return l[0];if(l.length>1)return}}let r=e.filter(a=>a.id.toLowerCase()===i);return r.length===1?r[0]:void 0}function T4(t,e){let n=y0(t,e);if(n)return n;let i=e.filter(r=>r.id.toLowerCase().includes(t.toLowerCase())||r.name?.toLowerCase().includes(t.toLowerCase()));if(i.length===0)return;let s=i.filter(r=>Bk(r.id)),o=i.filter(r=>!Bk(r.id));return s.length>0?(s.sort((r,a)=>a.id.localeCompare(r.id)),s[0]):(o.sort((r,a)=>a.id.localeCompare(r.id)),o[0])}function b0(t,e,n){let i=T4(t,e);if(i)return{model:i,thinkingLevel:void 0,warning:void 0};let s=t.lastIndexOf(":");if(s===-1)return{model:void 0,thinkingLevel:void 0,warning:void 0};let o=t.substring(0,s),r=t.substring(s+1);if(g0(r)){let a=b0(o,e,n);return a.model?{model:a.model,thinkingLevel:a.warning?void 0:r,warning:a.warning}:a}else{if(!(n?.allowInvalidThinkingLevelFallback??!0))return{model:void 0,thinkingLevel:void 0,warning:void 0};let c=b0(o,e,n);return c.model?{model:c.model,thinkingLevel:void 0,warning:`Invalid thinking level "${r}" in pattern "${t}". Using default instead.`}:c}}async function _p(t,e){let n=await e.getAvailable(),i=[];for(let s of t){if(s.includes("*")||s.includes("?")||s.includes("[")){let c=s.lastIndexOf(":"),l=s,d;if(c!==-1){let p=s.substring(c+1);g0(p)&&(d=p,l=s.substring(0,c))}let u=n.filter(p=>{let m=`${p.provider}/${p.id}`;return $k(m,l,{nocase:!0})||$k(p.id,l,{nocase:!0})});if(u.length===0){console.warn(f0.yellow(`Warning: No models match pattern "${s}"`));continue}for(let p of u)i.find(m=>Kn(m.model,p))||i.push({model:p,thinkingLevel:d});continue}let{model:o,thinkingLevel:r,warning:a}=b0(s,n);if(a&&console.warn(f0.yellow(`Warning: ${a}`)),!o){console.warn(f0.yellow(`Warning: No models match pattern "${s}"`));continue}i.find(c=>Kn(c.model,o))||i.push({model:o,thinkingLevel:r})}return i}function k4(t){return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function v0(t,e=process.env.PI_TELEMETRY){return e!==void 0?k4(e):t.getEnableInstallTelemetry()}var Mbe=process.env.PI_TIMING==="1";var Ibe=Date.now();function M4(t){let e=t.sessionFile?`
|
|
284
|
+
`,"utf-8")}getNpmInstallRoot(e,n){return n?this.getTemporaryDir("npm"):e==="project"?ge(this.cwd,St,"npm"):ge(this.agentDir,"npm")}getGlobalNpmRoot(){let e=this.getNpmCommand(),n=[e.command,...e.args].join("\0");if(this.globalNpmRoot&&this.globalNpmRootCommandKey===n)return this.globalNpmRoot;if(this.getPackageManagerName()==="bun"){let i=this.runNpmCommandSync(["pm","bin","-g"]).trim();this.globalNpmRoot=ge(Ln(i),"install","global","node_modules")}else this.globalNpmRoot=this.runNpmCommandSync(["root","-g"]).trim();return this.globalNpmRootCommandKey=n,this.globalNpmRoot}getPnpmGlobalPackagePath(e){if(this.getPackageManagerName()!=="pnpm")return;let n=this.runNpmCommandSync(["list","-g","--depth","0","--json"]),i=JSON.parse(n);for(let s of i){let o=s.dependencies?.[e]?.path;if(o)return o}}getManagedNpmInstallPath(e,n){return n==="temporary"?ge(this.getTemporaryDir("npm"),"node_modules",e.name):n==="project"?ge(this.cwd,St,"npm","node_modules",e.name):ge(this.agentDir,"npm","node_modules",e.name)}getLegacyGlobalNpmInstallPath(e){try{return this.getPnpmGlobalPackagePath(e.name)??ge(this.getGlobalNpmRoot(),e.name)}catch{return}}getNpmInstallPath(e,n){let i=this.getManagedNpmInstallPath(e,n);if(n!=="user"||xe(i))return i;let s=this.getLegacyGlobalNpmInstallPath(e);return s&&xe(s)?s:i}getGitInstallPath(e,n){return n==="temporary"?this.getTemporaryDir(`git-${e.host}`,e.path):n==="project"?ge(this.cwd,St,"git",e.host,e.path):ge(this.agentDir,"git",e.host,e.path)}getGitInstallRoot(e){if(e!=="temporary")return e==="project"?ge(this.cwd,St,"git"):ge(this.agentDir,"git")}getTemporaryDir(e,n){let i=ZD("sha256").update(`${e}-${n??""}`).digest("hex").slice(0,8);return ge(t4(),"pi-extensions",e,i,n??"")}getBaseDirForScope(e){return e==="project"?ge(this.cwd,St):e==="user"?this.agentDir:this.cwd}resolvePath(e){let n=e.trim();return n==="~"?Mo():n.startsWith("~/")?ge(Mo(),n.slice(2)):n.startsWith("~")?ge(Mo(),n.slice(1)):hi(this.cwd,n)}resolvePathFromBase(e,n){let i=e.trim();return i==="~"?Mo():i.startsWith("~/")?ge(Mo(),i.slice(2)):i.startsWith("~")?ge(Mo(),i.slice(1)):hi(n,i)}collectPackageResources(e,n,i,s){if(i){for(let a of wp){let c=i[a],l=this.getTargetMap(n,a);c!==void 0?this.applyPackageFilter(e,c,a,l,s):this.collectDefaultResources(e,a,l,s)}return!0}let o=this.readPiManifest(e);if(o){for(let a of wp){let c=o[a];this.addManifestEntries(c,e,a,this.getTargetMap(n,a),s)}return!0}let r=!1;for(let a of wp){let c=ge(e,a);if(xe(c)){let l=Cp(c,a);for(let d of l)this.addResource(this.getTargetMap(n,a),d,s,!0);r=!0}}return r}collectDefaultResources(e,n,i,s){let r=this.readPiManifest(e)?.[n];if(r){this.addManifestEntries(r,e,n,i,s);return}let a=ge(e,n);if(xe(a)){let c=Cp(a,n);for(let l of c)this.addResource(i,l,s,!0)}}applyPackageFilter(e,n,i,s,o){let{allFiles:r}=this.collectManifestFiles(e,i);if(n.length===0){for(let c of r)this.addResource(s,c,o,!1);return}let a=Tp(r,n,e);for(let c of r){let l=a.has(c);this.addResource(s,c,o,l)}}collectManifestFiles(e,n){let s=this.readPiManifest(e)?.[n];if(s&&s.length>0){let a=this.collectFilesFromManifestEntries(s,e,n),c=s.filter(a0),l=c.length>0?Tp(a,c,e):new Set(a);return{allFiles:Array.from(l),enabledByManifest:l}}let o=ge(e,n);if(!xe(o))return{allFiles:[],enabledByManifest:new Set};let r=Cp(o,n);return{allFiles:r,enabledByManifest:new Set(r)}}readPiManifest(e){let n=ge(e,"package.json");if(!xe(n))return null;try{let i=Il(n,"utf-8");return JSON.parse(i).pi??null}catch{return null}}addManifestEntries(e,n,i,s,o){if(!e)return;let r=this.collectFilesFromManifestEntries(e,n,i),a=e.filter(a0),c=Tp(r,a,n);for(let l of r)c.has(l)&&this.addResource(s,l,o,!0)}collectFilesFromManifestEntries(e,n,i){let o=e.filter(r=>!a0(r)).flatMap(r=>l4(r)?i4(r,{cwd:n,absolute:!0,dot:!1,nodir:!1}).map(a=>hi(a)):[hi(n,r)]);return this.collectFilesFromPaths(o,i)}resolveLocalEntries(e,n,i,s,o){if(e.length===0)return;let{plain:r,patterns:a}=u4(e),c=r.map(u=>this.resolvePathFromBase(u,o)),l=this.collectFilesFromPaths(c,n),d=Tp(l,a,o);for(let u of l)this.addResource(i,u,s,d.has(u))}addAutoDiscoveredResources(e,n,i,s,o){let r={source:"auto",scope:"user",origin:"top-level",baseDir:s},a={source:"auto",scope:"project",origin:"top-level",baseDir:o},c={extensions:n.extensions??[],skills:n.skills??[],prompts:n.prompts??[],themes:n.themes??[]},l={extensions:i.extensions??[],skills:i.skills??[],prompts:i.prompts??[],themes:i.themes??[]},d={extensions:ge(s,"extensions"),skills:ge(s,"skills"),prompts:ge(s,"prompts"),themes:ge(s,"themes")},u={extensions:ge(o,"extensions"),skills:ge(o,"skills"),prompts:ge(o,"prompts"),themes:ge(o,"themes")},p=ge(Mo(),".agents","skills"),m=p4(this.cwd).filter(x=>hi(x)!==hi(p)),g=(x,y,w,P,_)=>{let R=this.getTargetMap(e,x);for(let L of y){let E=f4(L,P,_);this.addResource(R,L,w,E)}};g("extensions",c0(u.extensions),a,l.extensions,o),g("skills",Sp(u.skills,"pi"),a,l.skills,o);for(let x of m){let y=Ln(x),w={...a,baseDir:y};g("skills",Sp(x,"agents"),w,l.skills,y)}g("prompts",Ok(u.prompts),a,l.prompts,o),g("themes",Lk(u.themes),a,l.themes,o),g("extensions",c0(d.extensions),r,c.extensions,s),g("skills",Sp(d.skills,"pi"),r,c.skills,s);let h=Ln(p),f={...r,baseDir:h};g("skills",Sp(p,"agents"),f,c.skills,h),g("prompts",Ok(d.prompts),r,c.prompts,s),g("themes",Lk(d.themes),r,c.themes,s)}collectFilesFromPaths(e,n){let i=[];for(let s of e)if(xe(s))try{let o=Rs(s);o.isFile()?i.push(s):o.isDirectory()&&i.push(...Cp(s,n))}catch{}return i}getTargetMap(e,n){switch(n){case"extensions":return e.extensions;case"skills":return e.skills;case"prompts":return e.prompts;case"themes":return e.themes;default:throw new Error(`Unknown resource type: ${n}`)}}addResource(e,n,i,s){n&&(e.has(n)||e.set(n,{metadata:i,enabled:s}))}createAccumulator(){return{extensions:new Map,skills:new Map,prompts:new Map,themes:new Map}}toResolvedPaths(e){let n=i=>{let s=Array.from(i.entries()).map(([r,{metadata:a,enabled:c}])=>({path:r,enabled:c,metadata:a}));s.sort((r,a)=>Ak(r.metadata)-Ak(a.metadata));let o=new Set;return s.filter(r=>{let a=xa(r.path);return o.has(a)?!1:(o.add(a),!0)})};return{extensions:n(e.extensions),skills:n(e.skills),prompts:n(e.prompts),themes:n(e.themes)}}spawnCommand(e,n,i){let s=r0();return Vu(e,n,{cwd:i?.cwd,stdio:Rk()?["ignore",2,2]:"inherit",env:s})}spawnCaptureCommand(e,n,i){let s=r0(),o=i?.env?{...s,...i.env}:s;return Vu(e,n,{cwd:i?.cwd,stdio:["ignore","pipe","pipe"],env:o})}runCommandCapture(e,n,i){return new Promise((s,o)=>{let r=this.spawnCaptureCommand(e,n,i),a="",c="",l=!1,d=typeof i?.timeoutMs=="number"?setTimeout(()=>{l=!0,r.kill()},i.timeoutMs):void 0;r.stdout?.on("data",u=>{a+=u.toString()}),r.stderr?.on("data",u=>{c+=u.toString()}),r.once("error",u=>{d&&clearTimeout(d),o(u)}),r.once("close",(u,p)=>{if(d&&clearTimeout(d),l){o(new Error(`${e} ${n.join(" ")} timed out after ${i?.timeoutMs}ms`));return}if(u===0){s(a.trim());return}let m=u===null?`signal ${p??"unknown"}`:`code ${u}`;o(new Error(`${e} ${n.join(" ")} failed with ${m}: ${c||a}`))})})}runCommand(e,n,i){return new Promise((s,o)=>{let r=this.spawnCommand(e,n,i);r.on("error",o),r.on("exit",a=>{a===0?s():o(new Error(`${e} ${n.join(" ")} failed with code ${a}`))})})}runCommandSync(e,n){let i=r0(),s=Hr(e,n,{stdio:["ignore","pipe","pipe"],encoding:"utf-8",env:i});if(s.error||s.status!==0)throw new Error(`Failed to run ${e} ${n.join(" ")}: ${s.error?.message||s.stderr||s.stdout}`);return(s.stdout||s.stderr||"").trim()}};import nbe from"chalk";import{existsSync as Fk,mkdirSync as b4,readFileSync as x4,writeFileSync as y4}from"fs";import{homedir as Dk}from"os";import{dirname as v4,join as p0}from"path";import w4 from"proper-lockfile";import*as Aa from"undici";var d0=3e5,Ip=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}];function Rp(t){if(typeof t=="string"){let e=t.trim();return e.toLowerCase()==="disabled"?0:e.length===0?void 0:Rp(Number(e))}if(!(typeof t!="number"||!Number.isFinite(t)||t<0))return Math.floor(t)}function Pp(t){let e=Ip.find(n=>n.timeoutMs===t);return e?e.label:`${t/1e3} sec`}function _l(t=d0){let e=Rp(t);if(e===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(t)}`);Aa.setGlobalDispatcher(new Aa.EnvHttpProxyAgent({allowH2:!1,bodyTimeout:e,headersTimeout:e})),Aa.install?.()}function El(t,e){let n={...t};for(let i of Object.keys(e)){let s=e[i],o=t[i];s!==void 0&&(typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?n[i]={...o,...s}:n[i]=s)}return n}var m0=class{constructor(e,n){this.globalSettingsPath=p0(n,"settings.json"),this.projectSettingsPath=p0(e,St,"settings.json")}acquireLockSyncWithRetry(e){let s;for(let o=1;o<=10;o++)try{return w4.lockSync(e,{realpath:!1})}catch(r){if((typeof r=="object"&&r!==null&&"code"in r?String(r.code):void 0)!=="ELOCKED"||o===10)throw r;s=r;let c=Date.now();for(;Date.now()-c<20;);}throw s??new Error("Failed to acquire settings lock")}withLock(e,n){let i=e==="global"?this.globalSettingsPath:this.projectSettingsPath,s=v4(i),o;try{let r=Fk(i);r&&(o=this.acquireLockSyncWithRetry(i));let a=r?x4(i,"utf-8"):void 0,c=n(a);c!==void 0&&(Fk(s)||b4(s,{recursive:!0}),o||(o=this.acquireLockSyncWithRetry(i)),y4(i,c,"utf-8"))}finally{o&&o()}}},h0=class{withLock(e,n){let i=e==="global"?this.global:this.project,s=n(i);s!==void 0&&(e==="global"?this.global=s:this.project=s)}},gi=class t{constructor(e,n,i,s=null,o=null,r=[]){this.modifiedFields=new Set;this.modifiedNestedFields=new Map;this.modifiedProjectFields=new Set;this.modifiedProjectNestedFields=new Map;this.globalSettingsLoadError=null;this.projectSettingsLoadError=null;this.writeQueue=Promise.resolve();this.storage=e,this.globalSettings=n,this.projectSettings=i,this.globalSettingsLoadError=s,this.projectSettingsLoadError=o,this.errors=[...r],this.settings=El(this.globalSettings,this.projectSettings)}static create(e,n=Le()){let i=new m0(e,n);return t.fromStorage(i)}static fromStorage(e){let n=t.tryLoadFromStorage(e,"global"),i=t.tryLoadFromStorage(e,"project"),s=[];return n.error&&s.push({scope:"global",error:n.error}),i.error&&s.push({scope:"project",error:i.error}),new t(e,n.settings,i.settings,n.error,i.error,s)}static inMemory(e={}){let n=new h0,i=t.migrateSettings(structuredClone(e));return n.withLock("global",()=>JSON.stringify(i,null,2)),t.fromStorage(n)}static loadFromStorage(e,n){let i;if(e.withLock(n,o=>{i=o}),!i)return{};let s=JSON.parse(i);return t.migrateSettings(s)}static tryLoadFromStorage(e,n){try{return{settings:t.loadFromStorage(e,n),error:null}}catch(i){return{settings:{},error:i}}}static migrateSettings(e){if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let n=e.skills;n.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=n.enableSkillCommands),Array.isArray(n.customDirectories)&&n.customDirectories.length>0?e.skills=n.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){let n=e.retry,i=typeof n.provider=="object"&&n.provider!==null?n.provider:void 0;typeof n.maxDelayMs=="number"&&(i?.maxRetryDelayMs===void 0||i?.maxRetryDelayMs===null)&&(n.provider={...i??{},maxRetryDelayMs:n.maxDelayMs}),delete n.maxDelayMs}return e}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}async reload(){await this.writeQueue;let e=t.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();let n=t.tryLoadFromStorage(this.storage,"project");n.error?(this.projectSettingsLoadError=n.error,this.recordError("project",n.error)):(this.projectSettings=n.settings,this.projectSettingsLoadError=null),this.settings=El(this.globalSettings,this.projectSettings)}applyOverrides(e){this.settings=El(this.settings,e)}markModified(e,n){this.modifiedFields.add(e),n&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(n))}markProjectModified(e,n){this.modifiedProjectFields.add(e),n&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(n))}recordError(e,n){let i=n instanceof Error?n:new Error(String(n));this.errors.push({scope:e,error:i})}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,n){this.writeQueue=this.writeQueue.then(()=>{n(),this.clearModifiedScope(e)}).catch(i=>{this.recordError(e,i)})}cloneModifiedNestedFields(e){let n=new Map;for(let[i,s]of e.entries())n.set(i,new Set(s));return n}persistScopedSettings(e,n,i,s){this.storage.withLock(e,o=>{let r=o?t.migrateSettings(JSON.parse(o)):{},a={...r};for(let c of i){let l=n[c];if(s.has(c)&&typeof l=="object"&&l!==null){let d=s.get(c),u=r[c]??{},p=l,m={...u};for(let g of d)m[g]=p[g];a[c]=m}else a[c]=l}return JSON.stringify(a,null,2)})}save(){if(this.settings=El(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;let e=structuredClone(this.globalSettings),n=new Set(this.modifiedFields),i=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,n,i)})}saveProjectSettings(e){if(this.projectSettings=structuredClone(e),this.settings=El(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;let n=structuredClone(this.projectSettings),i=new Set(this.modifiedProjectFields),s=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",n,i,s)})}async flush(){await this.writeQueue}drainErrors(){let e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){let e=this.settings.sessionDir;return e&&(e==="~"?Dk():e.startsWith("~/")?p0(Dk(),e.slice(2)):e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,n){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=n,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getTheme(){return this.settings.theme}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens()}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3}}getHttpIdleTimeoutMs(){let e=this.settings.httpIdleTimeoutMs,n=Rp(e);if(n!==void 0)return n;if(e!==void 0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);return d0}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}getShellPath(){return this.settings.shellPath}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){let n=structuredClone(this.projectSettings);n.packages=e,this.markProjectModified("packages"),this.saveProjectSettings(n)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){let n=structuredClone(this.projectSettings);n.extensions=e,this.markProjectModified("extensions"),this.saveProjectSettings(n)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){let n=structuredClone(this.projectSettings);n.skills=e,this.markProjectModified("skills"),this.saveProjectSettings(n)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){let n=structuredClone(this.projectSettings);n.prompts=e,this.markProjectModified("prompts"),this.saveProjectSettings(n)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){let n=structuredClone(this.projectSettings);n.themes=e,this.markProjectModified("themes"),this.saveProjectSettings(n)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){let e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}};import{Agent as Gbe}from"@earendil-works/pi-agent-core";import f0 from"chalk";import{minimatch as $k}from"minimatch";import gbe from"chalk";var C4=["off","minimal","low","medium","high","xhigh"];function g0(t){return C4.includes(t)}var x0={"amazon-bedrock":"us.anthropic.claude-opus-4-6-v1",anthropic:"claude-opus-4-7",openai:"gpt-5.4","azure-openai-responses":"gpt-5.4","openai-codex":"gpt-5.5",deepseek:"deepseek-v4-pro",google:"gemini-3.1-pro-preview","google-vertex":"gemini-3.1-pro-preview","github-copilot":"gpt-5.4",openrouter:"moonshotai/kimi-k2.6","vercel-ai-gateway":"zai/glm-5.1",xai:"grok-4.20-0309-reasoning",groq:"openai/gpt-oss-120b",cerebras:"zai-glm-4.7",zai:"glm-5.1",mistral:"devstral-medium-latest",minimax:"MiniMax-M2.7","minimax-cn":"MiniMax-M2.7",moonshotai:"kimi-k2.6","moonshotai-cn":"kimi-k2.6",huggingface:"moonshotai/Kimi-K2.6",fireworks:"accounts/fireworks/models/kimi-k2p6",together:"moonshotai/Kimi-K2.6",opencode:"kimi-k2.6","opencode-go":"kimi-k2.6","kimi-coding":"kimi-for-coding","cloudflare-workers-ai":"@cf/moonshotai/kimi-k2.6","cloudflare-ai-gateway":"workers-ai/@cf/moonshotai/kimi-k2.6",xiaomi:"mimo-v2.5-pro","xiaomi-token-plan-cn":"mimo-v2.5-pro","xiaomi-token-plan-ams":"mimo-v2.5-pro","xiaomi-token-plan-sgp":"mimo-v2.5-pro"};function Bk(t){return t.endsWith("-latest")?!0:!/-\d{8}$/.test(t)}function y0(t,e){let n=t.trim();if(!n)return;let i=n.toLowerCase(),s=e.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===i);if(s.length===1)return s[0];if(s.length>1)return;let o=n.indexOf("/");if(o!==-1){let a=n.substring(0,o).trim(),c=n.substring(o+1).trim();if(a&&c){let l=e.filter(d=>d.provider.toLowerCase()===a.toLowerCase()&&d.id.toLowerCase()===c.toLowerCase());if(l.length===1)return l[0];if(l.length>1)return}}let r=e.filter(a=>a.id.toLowerCase()===i);return r.length===1?r[0]:void 0}function T4(t,e){let n=y0(t,e);if(n)return n;let i=e.filter(r=>r.id.toLowerCase().includes(t.toLowerCase())||r.name?.toLowerCase().includes(t.toLowerCase()));if(i.length===0)return;let s=i.filter(r=>Bk(r.id)),o=i.filter(r=>!Bk(r.id));return s.length>0?(s.sort((r,a)=>a.id.localeCompare(r.id)),s[0]):(o.sort((r,a)=>a.id.localeCompare(r.id)),o[0])}function b0(t,e,n){let i=T4(t,e);if(i)return{model:i,thinkingLevel:void 0,warning:void 0};let s=t.lastIndexOf(":");if(s===-1)return{model:void 0,thinkingLevel:void 0,warning:void 0};let o=t.substring(0,s),r=t.substring(s+1);if(g0(r)){let a=b0(o,e,n);return a.model?{model:a.model,thinkingLevel:a.warning?void 0:r,warning:a.warning}:a}else{if(!(n?.allowInvalidThinkingLevelFallback??!0))return{model:void 0,thinkingLevel:void 0,warning:void 0};let c=b0(o,e,n);return c.model?{model:c.model,thinkingLevel:void 0,warning:`Invalid thinking level "${r}" in pattern "${t}". Using default instead.`}:c}}async function _p(t,e){let n=await e.getAvailable(),i=[];for(let s of t){if(s.includes("*")||s.includes("?")||s.includes("[")){let c=s.lastIndexOf(":"),l=s,d;if(c!==-1){let p=s.substring(c+1);g0(p)&&(d=p,l=s.substring(0,c))}let u=n.filter(p=>{let m=`${p.provider}/${p.id}`;return $k(m,l,{nocase:!0})||$k(p.id,l,{nocase:!0})});if(u.length===0){console.warn(f0.yellow(`Warning: No models match pattern "${s}"`));continue}for(let p of u)i.find(m=>Kn(m.model,p))||i.push({model:p,thinkingLevel:d});continue}let{model:o,thinkingLevel:r,warning:a}=b0(s,n);if(a&&console.warn(f0.yellow(`Warning: ${a}`)),!o){console.warn(f0.yellow(`Warning: No models match pattern "${s}"`));continue}i.find(c=>Kn(c.model,o))||i.push({model:o,thinkingLevel:r})}return i}function k4(t){return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function v0(t,e=process.env.PI_TELEMETRY){return e!==void 0?k4(e):t.getEnableInstallTelemetry()}var kbe=process.env.PI_TIMING==="1";var Mbe=Date.now();function M4(t){let e=t.sessionFile?`
|
|
285
285
|
Session file: ${t.sessionFile}`:"";return`Stored session working directory does not exist: ${t.sessionCwd}${e}
|
|
286
286
|
Current working directory: ${t.fallbackCwd}`}function w0(t){return`cwd from session file does not exist
|
|
287
287
|
${t.sessionCwd}
|
|
288
288
|
|
|
289
289
|
continue in current cwd
|
|
290
|
-
${t.fallbackCwd}`}var Oa=class extends Error{constructor(e){super(M4(e)),this.name="MissingSessionCwdError",this.issue=e}};var Ep=class extends Error{constructor(e){super(`File not found: ${e}`),this.name="SessionImportFileNotFoundError",this.filePath=e}};import NCe from"chalk";import uxe from"chalk";import xxe from"chalk";import{existsSync as A4,readFileSync as O4}from"fs";import{join as L4}from"path";var Hk={...na,"app.interrupt":{defaultKeys:"escape",description:"Cancel or abort"},"app.clear":{defaultKeys:"ctrl+c",description:"Clear editor"},"app.exit":{defaultKeys:"ctrl+d",description:"Exit when editor is empty"},"app.suspend":{defaultKeys:process.platform==="win32"?[]:"ctrl+z",description:"Suspend to background"},"app.thinking.cycle":{defaultKeys:"shift+tab",description:"Cycle thinking level"},"app.model.cycleForward":{defaultKeys:"ctrl+p",description:"Cycle to next model"},"app.model.cycleBackward":{defaultKeys:"shift+ctrl+p",description:"Cycle to previous model"},"app.model.select":{defaultKeys:"ctrl+l",description:"Open model selector"},"app.tools.expand":{defaultKeys:"ctrl+o",description:"Toggle tool output"},"app.thinking.toggle":{defaultKeys:"ctrl+t",description:"Toggle thinking blocks"},"app.session.toggleNamedFilter":{defaultKeys:"ctrl+n",description:"Toggle named session filter"},"app.editor.external":{defaultKeys:"ctrl+g",description:"Open external editor"},"app.message.followUp":{defaultKeys:"alt+enter",description:"Queue follow-up message"},"app.message.dequeue":{defaultKeys:"alt+up",description:"Restore queued messages"},"app.clipboard.pasteImage":{defaultKeys:process.platform==="win32"?"alt+v":"ctrl+v",description:"Paste image from clipboard"},"app.session.new":{defaultKeys:[],description:"Start a new session"},"app.session.tree":{defaultKeys:[],description:"Open session tree"},"app.session.fork":{defaultKeys:[],description:"Fork current session"},"app.session.resume":{defaultKeys:[],description:"Resume a session"},"app.tree.foldOrUp":{defaultKeys:["ctrl+left","alt+left"],description:"Fold tree branch or move up"},"app.tree.unfoldOrDown":{defaultKeys:["ctrl+right","alt+right"],description:"Unfold tree branch or move down"},"app.tree.editLabel":{defaultKeys:"shift+l",description:"Edit tree label"},"app.tree.toggleLabelTimestamp":{defaultKeys:"shift+t",description:"Toggle tree label timestamps"},"app.session.togglePath":{defaultKeys:"ctrl+p",description:"Toggle session path display"},"app.session.toggleSort":{defaultKeys:"ctrl+s",description:"Toggle session sort mode"},"app.session.rename":{defaultKeys:"ctrl+r",description:"Rename session"},"app.session.delete":{defaultKeys:"ctrl+d",description:"Delete session"},"app.session.deleteNoninvasive":{defaultKeys:"ctrl+backspace",description:"Delete session when query is empty"},"app.models.save":{defaultKeys:"ctrl+s",description:"Save model selection"},"app.models.enableAll":{defaultKeys:"ctrl+a",description:"Enable all models"},"app.models.clearAll":{defaultKeys:"ctrl+x",description:"Clear all models"},"app.models.toggleProvider":{defaultKeys:"ctrl+p",description:"Toggle all models for provider"},"app.models.reorderUp":{defaultKeys:"alt+up",description:"Move model up in order"},"app.models.reorderDown":{defaultKeys:"alt+down",description:"Move model down in order"},"app.tree.filter.default":{defaultKeys:"ctrl+d",description:"Tree filter: default view"},"app.tree.filter.noTools":{defaultKeys:"ctrl+t",description:"Tree filter: hide tool results"},"app.tree.filter.userOnly":{defaultKeys:"ctrl+u",description:"Tree filter: user messages only"},"app.tree.filter.labeledOnly":{defaultKeys:"ctrl+l",description:"Tree filter: labeled entries only"},"app.tree.filter.all":{defaultKeys:"ctrl+a",description:"Tree filter: show all entries"},"app.tree.filter.cycleForward":{defaultKeys:"ctrl+o",description:"Tree filter: cycle forward"},"app.tree.filter.cycleBackward":{defaultKeys:"shift+ctrl+o",description:"Tree filter: cycle backward"}},zk={cursorUp:"tui.editor.cursorUp",cursorDown:"tui.editor.cursorDown",cursorLeft:"tui.editor.cursorLeft",cursorRight:"tui.editor.cursorRight",cursorWordLeft:"tui.editor.cursorWordLeft",cursorWordRight:"tui.editor.cursorWordRight",cursorLineStart:"tui.editor.cursorLineStart",cursorLineEnd:"tui.editor.cursorLineEnd",jumpForward:"tui.editor.jumpForward",jumpBackward:"tui.editor.jumpBackward",pageUp:"tui.editor.pageUp",pageDown:"tui.editor.pageDown",deleteCharBackward:"tui.editor.deleteCharBackward",deleteCharForward:"tui.editor.deleteCharForward",deleteWordBackward:"tui.editor.deleteWordBackward",deleteWordForward:"tui.editor.deleteWordForward",deleteToLineStart:"tui.editor.deleteToLineStart",deleteToLineEnd:"tui.editor.deleteToLineEnd",yank:"tui.editor.yank",yankPop:"tui.editor.yankPop",undo:"tui.editor.undo",newLine:"tui.input.newLine",submit:"tui.input.submit",tab:"tui.input.tab",copy:"tui.input.copy",selectUp:"tui.select.up",selectDown:"tui.select.down",selectPageUp:"tui.select.pageUp",selectPageDown:"tui.select.pageDown",selectConfirm:"tui.select.confirm",selectCancel:"tui.select.cancel",interrupt:"app.interrupt",clear:"app.clear",exit:"app.exit",suspend:"app.suspend",cycleThinkingLevel:"app.thinking.cycle",cycleModelForward:"app.model.cycleForward",cycleModelBackward:"app.model.cycleBackward",selectModel:"app.model.select",expandTools:"app.tools.expand",toggleThinking:"app.thinking.toggle",toggleSessionNamedFilter:"app.session.toggleNamedFilter",externalEditor:"app.editor.external",followUp:"app.message.followUp",dequeue:"app.message.dequeue",pasteImage:"app.clipboard.pasteImage",newSession:"app.session.new",tree:"app.session.tree",fork:"app.session.fork",resume:"app.session.resume",treeFoldOrUp:"app.tree.foldOrUp",treeUnfoldOrDown:"app.tree.unfoldOrDown",treeEditLabel:"app.tree.editLabel",treeToggleLabelTimestamp:"app.tree.toggleLabelTimestamp",toggleSessionPath:"app.session.togglePath",toggleSessionSort:"app.session.toggleSort",renameSession:"app.session.rename",deleteSession:"app.session.delete",deleteSessionNoninvasive:"app.session.deleteNoninvasive"};function Vk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function W4(t){return t in zk}function U4(t){if(!Vk(t))return{};let e={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"){e[n]=i;continue}Array.isArray(i)&&i.every(s=>typeof s=="string")&&(e[n]=i)}return e}function Jk(t){let e={},n=!1;for(let[i,s]of Object.entries(t)){let o=W4(i)?zk[i]:i;if(o!==i&&(n=!0),i!==o&&Object.hasOwn(t,o)){n=!0;continue}e[o]=s}return{config:F4(e),migrated:n}}function F4(t){let e={};for(let i of Object.keys(Hk))Object.hasOwn(t,i)&&(e[i]=t[i]);let n=Object.keys(t).filter(i=>!Object.hasOwn(e,i)).sort();for(let i of n)e[i]=t[i];return e}function D4(t){if(A4(t))try{let e=JSON.parse(O4(t,"utf-8"));return Vk(e)?e:void 0}catch{return}}var Ps=class t extends ta{constructor(e={},n){super(Hk,e),this.configPath=n}static create(e=Le()){let n=L4(e,"keybindings.json"),i=t.loadFromFile(n);return new t(i,n)}reload(){this.configPath&&this.setUserBindings(t.loadFromFile(this.configPath))}getEffectiveConfig(){return this.getResolvedBindings()}static loadFromFile(e){let n=D4(e);return n?U4(Jk(n).config):{}}};import{spawnSync as j4}from"node:child_process";import{existsSync as q4}from"node:fs";import{unlink as G4}from"node:fs/promises";import*as e1 from"node:os";var V=class{constructor(e=n=>b.fg("border",n)){this.color=e}invalidate(){}render(e){return[this.color("\u2500".repeat(Math.max(1,e)))]}};function Qk(t){return t.toLowerCase().replace(/\s+/g," ").trim()}function $4(t){return`${t.id} ${t.name??""} ${t.allMessagesText} ${t.cwd}`}function C0(t){return!!t.name?.trim()}function B4(t,e){return e==="all"?!0:C0(t)}function N4(t){let e=t.trim();if(!e)return{mode:"tokens",tokens:[],regex:null};if(e.startsWith("re:")){let a=e.slice(3).trim();if(!a)return{mode:"regex",tokens:[],regex:null,error:"Empty regex"};try{return{mode:"regex",tokens:[],regex:new RegExp(a,"i")}}catch(c){let l=c instanceof Error?c.message:String(c);return{mode:"regex",tokens:[],regex:null,error:l}}}let n=[],i="",s=!1,o=!1,r=a=>{let c=i.trim();i="",c&&n.push({kind:a,value:c})};for(let a=0;a<e.length;a++){let c=e[a];if(c==='"'){s?(r("phrase"),s=!1):(r("fuzzy"),s=!0);continue}if(!s&&/\s/.test(c)){r("fuzzy");continue}i+=c}return s&&(o=!0),o?{mode:"tokens",tokens:e.split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0).map(a=>({kind:"fuzzy",value:a})),regex:null}:(r(s?"phrase":"fuzzy"),{mode:"tokens",tokens:n,regex:null})}function Yk(t,e){let n=$4(t);if(e.mode==="regex"){if(!e.regex)return{matches:!1,score:0};let o=n.search(e.regex);return o<0?{matches:!1,score:0}:{matches:!0,score:o*.1}}if(e.tokens.length===0)return{matches:!0,score:0};let i=0,s=null;for(let o of e.tokens){if(o.kind==="phrase"){s===null&&(s=Qk(n));let a=Qk(o.value);if(!a)continue;let c=s.indexOf(a);if(c<0)return{matches:!1,score:0};i+=c*.1;continue}let r=Sd(o.value,n);if(!r.matches)return{matches:!1,score:0};i+=r.score}return{matches:!0,score:i}}function Xk(t,e,n,i="all"){let s=i==="all"?t:t.filter(c=>B4(c,i));if(!e.trim())return s;let r=N4(e);if(r.error)return[];if(n==="recent"){let c=[];for(let l of s)Yk(l,r).matches&&c.push(l);return c}let a=[];for(let c of s){let l=Yk(c,r);l.matches&&a.push({session:c,score:l.score})}return a.sort((c,l)=>c.score!==l.score?c.score-l.score:l.session.modified.getTime()-c.session.modified.getTime()),a.map(c=>c.session)}function Zk(t){let e=e1.homedir();return t&&(t.startsWith(e)?`~${t.slice(e.length)}`:t)}function K4(t){let n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"now":i<60?`${i}m`:s<24?`${s}h`:o<7?`${o}d`:o<30?`${Math.floor(o/7)}w`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Al(t){return t&&xa(t)}var T0=class{constructor(e,n,i,s){this.loading=!1;this.loadProgress=null;this.showPath=!1;this.confirmingDeletePath=null;this.statusMessage=null;this.statusTimeout=null;this.showRenameHint=!1;this.scope=e,this.sortMode=n,this.nameFilter=i,this.requestRender=s}setScope(e){this.scope=e}setSortMode(e){this.sortMode=e}setNameFilter(e){this.nameFilter=e}setLoading(e){this.loading=e,this.loadProgress=null}setProgress(e,n){this.loadProgress={loaded:e,total:n}}setShowPath(e){this.showPath=e}setShowRenameHint(e){this.showRenameHint=e}setConfirmingDeletePath(e){this.confirmingDeletePath=e}clearStatusTimeout(){this.statusTimeout&&(clearTimeout(this.statusTimeout),this.statusTimeout=null)}setStatusMessage(e,n){this.clearStatusTimeout(),this.statusMessage=e,!(!e||!n)&&(this.statusTimeout=setTimeout(()=>{this.statusMessage=null,this.statusTimeout=null,this.requestRender()},n))}invalidate(){}render(e){let n=this.scope==="current"?"Resume Session (Current Folder)":"Resume Session (All)",i=b.bold(n),s=this.sortMode==="threaded"?"Threaded":this.sortMode==="recent"?"Recent":"Fuzzy",o=b.fg("muted","Sort: ")+b.fg("accent",s),r=this.nameFilter==="all"?"All":"Named",a=b.fg("muted","Name: ")+b.fg("accent",r),c;if(this.loading){let h=this.loadProgress?`${this.loadProgress.loaded}/${this.loadProgress.total}`:"...";c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent",`Loading ${h}`)}`}else this.scope==="current"?c=`${b.fg("accent","\u25C9 Current Folder")}${b.fg("muted"," | \u25CB All")}`:c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent","\u25C9 All")}`;let l=X(`${c} ${a} ${o}`,e,""),d=Math.max(0,e-j(l)-1),u=X(i,d,""),p=Math.max(0,e-j(u)-j(l)),m,g;if(this.confirmingDeletePath!==null){let h=`Delete session? ${ce("tui.select.confirm","confirm")} \xB7 ${ce("tui.select.cancel","cancel")}`;m=b.fg("error",X(h,e,"\u2026")),g=""}else if(this.statusMessage){let h=this.statusMessage.type==="error"?"error":"accent";m=b.fg(h,X(this.statusMessage.message,e,"\u2026")),g=""}else{let h=this.showPath?"(on)":"(off)",f=b.fg("muted"," \xB7 "),x=ce("tui.input.tab","scope")+f+b.fg("muted",'re:<pattern> regex \xB7 "phrase" exact'),y=[ce("app.session.toggleSort","sort"),ce("app.session.toggleNamedFilter","named"),ce("app.session.delete","delete"),ce("app.session.togglePath",`path ${h}`)];this.showRenameHint&&y.push(ce("app.session.rename","rename"));let w=y.join(f);m=X(x,e,"\u2026"),g=X(w,e,"\u2026")}return[`${u}${" ".repeat(p)}${l}`,m,g]}};function H4(t){let e=new Map;for(let s of t){let o=Al(s.path)??s.path;e.set(o,{session:s,children:[]})}let n=[];for(let s of t){let o=Al(s.path)??s.path,r=e.get(o),a=Al(s.parentSessionPath);a&&e.has(a)?e.get(a).children.push(r):n.push(r)}let i=s=>{s.sort((o,r)=>r.session.modified.getTime()-o.session.modified.getTime());for(let o of s)i(o.children)};return i(n),n}function z4(t){let e=[],n=(i,s,o,r)=>{e.push({session:i.session,depth:s,isLast:r,ancestorContinues:o});for(let a=0;a<i.children.length;a++){let c=a===i.children.length-1,l=s>0?!r:!1;n(i.children[a],s+1,[...o,l],c)}};for(let i=0;i<t.length;i++)n(t[i],0,[],i===t.length-1);return e}var k0=class{constructor(e,n,i,s,o,r){this.allSessions=[];this.filteredSessions=[];this.selectedIndex=0;this.showCwd=!1;this.sortMode="threaded";this.nameFilter="all";this.showPath=!1;this.confirmingDeletePath=null;this.onExit=()=>{};this.maxVisible=10;this._focused=!1;this.allSessions=e,this.filteredSessions=[],this.searchInput=new Je,this.showCwd=n,this.sortMode=i,this.nameFilter=s,this.keybindings=o,this.currentSessionCanonicalPath=Al(r),this.filterSessions(""),this.searchInput.onSubmit=()=>{if(this.filteredSessions[this.selectedIndex]){let a=this.filteredSessions[this.selectedIndex];this.onSelect&&this.onSelect(a.session.path)}}}getSelectedSessionPath(){return this.filteredSessions[this.selectedIndex]?.session.path}get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}setSortMode(e){this.sortMode=e,this.filterSessions(this.searchInput.getValue())}setNameFilter(e){this.nameFilter=e,this.filterSessions(this.searchInput.getValue())}setSessions(e,n){this.allSessions=e,this.showCwd=n,this.filterSessions(this.searchInput.getValue())}filterSessions(e){let n=e.trim(),i=this.nameFilter==="all"?this.allSessions:this.allSessions.filter(s=>C0(s));if(this.sortMode==="threaded"&&!n){let s=H4(i);this.filteredSessions=z4(s)}else{let s=Xk(i,e,this.sortMode,"all");this.filteredSessions=s.map(o=>({session:o,depth:0,isLast:!0,ancestorContinues:[]}))}this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredSessions.length-1))}setConfirmingDeletePath(e){this.confirmingDeletePath=e,this.onDeleteConfirmationChange?.(e)}startDeleteConfirmationForSelectedSession(){let e=this.filteredSessions[this.selectedIndex];if(e){if(this.isCurrentSessionPath(e.session.path)){this.onError?.("Cannot delete the currently active session");return}this.setConfirmingDeletePath(e.session.path)}}isCurrentSessionPath(e){return this.currentSessionCanonicalPath?(Al(e)??e)===this.currentSessionCanonicalPath:!1}invalidate(){}render(e){let n=[];if(n.push(...this.searchInput.render(e)),n.push(""),this.filteredSessions.length===0){let o;if(this.nameFilter==="named"){let r=he("app.session.toggleNamedFilter");this.showCwd?o=` No named sessions found. Press ${r} to show all.`:o=` No named sessions in current folder. Press ${r} to show all, or Tab to view all.`}else this.showCwd?o=" No sessions found":o=" No sessions in current folder. Press Tab to view all.";return n.push(b.fg("muted",X(o,e,"\u2026"))),n}let i=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredSessions.length-this.maxVisible)),s=Math.min(i+this.maxVisible,this.filteredSessions.length);for(let o=i;o<s;o++){let r=this.filteredSessions[o],a=r.session,c=o===this.selectedIndex,l=a.path===this.confirmingDeletePath,d=this.isCurrentSessionPath(a.path),u=this.buildTreePrefix(r),p=!!a.name,g=(a.name??a.firstMessage).replace(/[\x00-\x1f\x7f]/g," ").trim(),h=K4(a.modified),x=`${String(a.messageCount)} ${h}`;this.showCwd&&a.cwd&&(x=`${Zk(a.cwd)} ${x}`),this.showPath&&(x=`${Zk(a.path)} ${x}`);let y=c?b.fg("accent","\u203A "):" ",w=j(u),P=j(x)+2,_=e-2-w-P,R=X(g,Math.max(10,_),"\u2026"),L=null;l?L="error":d?L="accent":p&&(L="warning");let E=L?b.fg(L,R):R;c&&(E=b.bold(E));let W=y+b.fg("dim",u)+E,M=j(W),I=Math.max(1,e-M-j(x)),O=b.fg(l?"error":"dim",x),F=W+" ".repeat(I)+O;c&&(F=b.bg("selectedBg",F)),n.push(X(F,e))}if(i>0||s<this.filteredSessions.length){let o=` (${this.selectedIndex+1}/${this.filteredSessions.length})`,r=b.fg("muted",X(o,e,""));n.push(r)}return n}buildTreePrefix(e){if(e.depth===0)return"";let n=e.ancestorContinues.map(s=>s?"\u2502 ":" "),i=e.isLast?"\u2514\u2500 ":"\u251C\u2500 ";return n.join("")+i}handleInput(e){let n=ve();if(this.confirmingDeletePath!==null){if(n.matches(e,"tui.select.confirm")){let i=this.confirmingDeletePath;this.setConfirmingDeletePath(null),this.onDeleteSession?.(i);return}if(n.matches(e,"tui.select.cancel")){this.setConfirmingDeletePath(null);return}return}if(n.matches(e,"tui.input.tab")){this.onToggleScope&&this.onToggleScope();return}if(n.matches(e,"app.session.toggleSort")){this.onToggleSort?.();return}if(this.keybindings.matches(e,"app.session.toggleNamedFilter")){this.onToggleNameFilter?.();return}if(n.matches(e,"app.session.togglePath")){this.showPath=!this.showPath,this.onTogglePath?.(this.showPath);return}if(n.matches(e,"app.session.delete")){this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"app.session.rename")){let i=this.filteredSessions[this.selectedIndex];i&&this.onRenameSession?.(i.session.path);return}if(n.matches(e,"app.session.deleteNoninvasive")){if(this.searchInput.getValue().length>0){this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue());return}this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"tui.select.up"))this.selectedIndex=Math.max(0,this.selectedIndex-1);else if(n.matches(e,"tui.select.down"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+1);else if(n.matches(e,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisible);else if(n.matches(e,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+this.maxVisible);else if(n.matches(e,"tui.select.confirm")){let i=this.filteredSessions[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.session.path)}else n.matches(e,"tui.select.cancel")?this.onCancel&&this.onCancel():(this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue()))}};async function V4(t){let e=t.startsWith("-")?["--",t]:[t],n=j4("trash",e,{encoding:"utf-8"}),i=()=>{let s=[];n.error&&s.push(n.error.message);let o=n.stderr?.trim();return o&&s.push(o.split(`
|
|
291
|
-
`)[0]??o),s.length===0?null:`trash: ${s.join(" \xB7 ").slice(0,200)}`};if(n.status===0||!q4(t))return{ok:!0,method:"trash"};try{return await G4(t),{ok:!0,method:"unlink"}}catch(s){let o=s instanceof Error?s.message:String(s),r=i();return{ok:!1,method:"unlink",error:r?`${o} (${r})`:o}}}var Io=class extends K{constructor(n,i,s,o,r,a,c,l){super();this.canRename=!0;this.scope="current";this.sortMode="threaded";this.nameFilter="all";this.currentSessions=null;this.allSessions=null;this.currentLoading=!1;this.allLoading=!1;this.allLoadSeq=0;this.mode="list";this.renameInput=new Je;this.renameTargetPath=null;this._focused=!1;this.keybindings=c?.keybindings??Ps.create(),this.currentSessionsLoader=n,this.allSessionsLoader=i,this.onCancel=o,this.requestRender=a,this.header=new T0(this.scope,this.sortMode,this.nameFilter,this.requestRender);let d=c?.renameSession;this.renameSession=d,this.canRename=!!d,this.header.setShowRenameHint(c?.showRenameHint??this.canRename),this.sessionList=new k0([],!1,this.sortMode,this.nameFilter,this.keybindings,l),this.buildBaseLayout(this.sessionList),this.renameInput.onSubmit=p=>{this.confirmRename(p)};let u=()=>this.header.setStatusMessage(null);this.sessionList.onSelect=p=>{u(),s(p)},this.sessionList.onCancel=()=>{u(),o()},this.sessionList.onExit=()=>{u(),r()},this.sessionList.onToggleScope=()=>this.toggleScope(),this.sessionList.onToggleSort=()=>this.toggleSortMode(),this.sessionList.onToggleNameFilter=()=>this.toggleNameFilter(),this.sessionList.onRenameSession=p=>{if(!d||this.scope==="current"&&this.currentLoading||this.scope==="all"&&this.allLoading)return;let g=(this.scope==="all"?this.allSessions??[]:this.currentSessions??[]).find(h=>h.path===p);this.enterRenameMode(p,g?.name)},this.sessionList.onTogglePath=p=>{this.header.setShowPath(p),this.requestRender()},this.sessionList.onDeleteConfirmationChange=p=>{this.header.setConfirmingDeletePath(p),this.requestRender()},this.sessionList.onError=p=>{this.header.setStatusMessage({type:"error",message:p},3e3),this.requestRender()},this.sessionList.onDeleteSession=async p=>{let m=await V4(p);if(m.ok){this.currentSessions&&(this.currentSessions=this.currentSessions.filter(x=>x.path!==p)),this.allSessions&&(this.allSessions=this.allSessions.filter(x=>x.path!==p));let g=this.scope==="all"?this.allSessions??[]:this.currentSessions??[],h=this.scope==="all";this.sessionList.setSessions(g,h);let f=m.method==="trash"?"Session moved to trash":"Session deleted";this.header.setStatusMessage({type:"info",message:f},2e3),await this.refreshSessionsAfterMutation()}else{let g=m.error??"Unknown error";this.header.setStatusMessage({type:"error",message:`Failed to delete: ${g}`},3e3)}this.requestRender()},this.loadCurrentSessions()}handleInput(n){if(this.mode==="rename"){if(ve().matches(n,"tui.select.cancel")){this.exitRenameMode();return}this.renameInput.handleInput(n);return}this.sessionList.handleInput(n)}get focused(){return this._focused}set focused(n){this._focused=n,this.sessionList.focused=n,this.renameInput.focused=n,n&&this.mode==="rename"&&(this.renameInput.focused=!0)}buildBaseLayout(n,i){this.clear(),this.addChild(new U(1)),this.addChild(new V(s=>b.fg("accent",s))),this.addChild(new U(1)),(i?.showHeader??!0)&&(this.addChild(this.header),this.addChild(new U(1))),this.addChild(n),this.addChild(new U(1)),this.addChild(new V(s=>b.fg("accent",s)))}loadCurrentSessions(){this.loadScope("current","initial")}enterRenameMode(n,i){this.mode="rename",this.renameTargetPath=n,this.renameInput.setValue(i??""),this.renameInput.focused=!0;let s=new K;s.addChild(new A(b.bold("Rename Session"),1,0)),s.addChild(new U(1)),s.addChild(this.renameInput),s.addChild(new U(1)),s.addChild(new A(b.fg("muted",`${he("tui.select.confirm")} to save \xB7 ${he("tui.select.cancel")} to cancel`),1,0)),this.buildBaseLayout(s,{showHeader:!1}),this.requestRender()}exitRenameMode(){this.mode="list",this.renameTargetPath=null,this.buildBaseLayout(this.sessionList),this.requestRender()}async confirmRename(n){let i=n.trim();if(!i)return;let s=this.renameTargetPath;if(!s){this.exitRenameMode();return}let o=this.renameSession;if(!o){this.exitRenameMode();return}try{await o(s,i),await this.refreshSessionsAfterMutation()}finally{this.exitRenameMode()}}async loadScope(n,i){let s=n==="all";n==="current"?this.currentLoading=!0:this.allLoading=!0;let o=n==="all"?++this.allLoadSeq:void 0;this.header.setScope(n),this.header.setLoading(!0),this.requestRender();let r=(a,c)=>{n===this.scope&&(o!==void 0&&o!==this.allLoadSeq||(this.header.setProgress(a,c),this.requestRender()))};try{let a=await(n==="current"?this.currentSessionsLoader(r):this.allSessionsLoader(r));if(n==="current"?(this.currentSessions=a,this.currentLoading=!1):(this.allSessions=a,this.allLoading=!1),n!==this.scope||o!==void 0&&o!==this.allLoadSeq)return;this.header.setLoading(!1),this.sessionList.setSessions(a,s),this.requestRender(),n==="all"&&a.length===0&&(this.currentSessions?.length??0)===0&&this.onCancel()}catch(a){if(n==="current"?this.currentLoading=!1:this.allLoading=!1,n!==this.scope||o!==void 0&&o!==this.allLoadSeq)return;let c=a instanceof Error?a.message:String(a);this.header.setLoading(!1),this.header.setStatusMessage({type:"error",message:`Failed to load sessions: ${c}`},4e3),i==="initial"&&this.sessionList.setSessions([],s),this.requestRender()}}toggleSortMode(){this.sortMode=this.sortMode==="threaded"?"recent":this.sortMode==="recent"?"relevance":"threaded",this.header.setSortMode(this.sortMode),this.sessionList.setSortMode(this.sortMode),this.requestRender()}toggleNameFilter(){this.nameFilter=this.nameFilter==="all"?"named":"all",this.header.setNameFilter(this.nameFilter),this.sessionList.setNameFilter(this.nameFilter),this.requestRender()}async refreshSessionsAfterMutation(){await this.loadScope(this.scope,"refresh")}toggleScope(){if(this.scope==="current"){if(this.scope="all",this.header.setScope(this.scope),this.allSessions!==null){this.header.setLoading(!1),this.sessionList.setSessions(this.allSessions,!0),this.requestRender();return}this.allLoading||this.loadScope("all","toggle");return}this.scope="current",this.header.setScope(this.scope),this.header.setLoading(this.currentLoading),this.sessionList.setSessions(this.currentSessions??[],!1),this.requestRender()}getSessionList(){return this.sessionList}};import Hxe from"chalk";import*as _1 from"node:crypto";import*as Xn from"node:fs";import*as Za from"node:os";import*as Ve from"node:path";import{spawn as D0,spawnSync as X$}from"child_process";import{execFile as J4,spawnSync as Q4}from"child_process";import{existsSync as La,readFileSync as Ap,statSync as Y4,unwatchFile as X4,watchFile as Z4}from"fs";import{dirname as i1,join as Wa,resolve as t1}from"path";function n1(t){let e=t;for(;;){let n=Wa(e,".git");if(La(n))try{let s=Y4(n);if(s.isFile()){let o=Ap(n,"utf8").trim();if(o.startsWith("gitdir: ")){let r=t1(e,o.slice(8).trim()),a=Wa(r,"HEAD");if(!La(a))return null;let c=Wa(r,"commondir"),l=La(c)?t1(r,Ap(c,"utf8").trim()):r;return{repoDir:e,commonGitDir:l,headPath:a}}}else if(s.isDirectory()){let o=Wa(n,"HEAD");return La(o)?{repoDir:e,commonGitDir:n,headPath:o}:null}}catch{return null}let i=i1(e);if(i===e)return null;e=i}}function e$(t){let e=Q4("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return(e.status===0?e.stdout.trim():"")||null}function t$(t){return new Promise(e=>{J4("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8"},(n,i)=>{if(n){e(null);return}let s=i.trim();e(s||null)})})}var Op=class t{constructor(e){this.extensionStatuses=new Map;this.cachedBranch=void 0;this.gitPaths=void 0;this.headWatcher=null;this.reftableWatcher=null;this.reftableTablesListWatcher=null;this.reftableTablesListPath=null;this.branchChangeCallbacks=new Set;this.availableProviderCount=0;this.refreshTimer=null;this.gitWatcherRetryTimer=null;this.refreshInFlight=!1;this.refreshPending=!1;this.disposed=!1;this.cwd=e,this.gitPaths=n1(e),this.setupGitWatcher()}static{this.WATCH_DEBOUNCE_MS=500}getGitBranch(){return this.cachedBranch===void 0&&(this.cachedBranch=this.resolveGitBranchSync()),this.cachedBranch}getExtensionStatuses(){return this.extensionStatuses}onBranchChange(e){return this.branchChangeCallbacks.add(e),()=>this.branchChangeCallbacks.delete(e)}setExtensionStatus(e,n){n===void 0?this.extensionStatuses.delete(e):this.extensionStatuses.set(e,n)}clearExtensionStatuses(){this.extensionStatuses.clear()}getAvailableProviderCount(){return this.availableProviderCount}setAvailableProviderCount(e){this.availableProviderCount=e}setCwd(e){this.cwd!==e&&(this.cwd=e,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.cachedBranch=void 0,this.gitPaths=n1(e),this.setupGitWatcher(),this.notifyBranchChange())}dispose(){this.disposed=!0,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.branchChangeCallbacks.clear()}notifyBranchChange(){for(let e of this.branchChangeCallbacks)e()}scheduleRefresh(){if(!(this.disposed||this.refreshTimer)){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refreshGitBranchAsync()},t.WATCH_DEBOUNCE_MS)}}async refreshGitBranchAsync(){if(!this.disposed){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshInFlight=!0;try{let e=await this.resolveGitBranchAsync();if(this.disposed)return;if(this.cachedBranch!==void 0&&this.cachedBranch!==e){this.cachedBranch=e,this.notifyBranchChange();return}this.cachedBranch=e}finally{this.refreshInFlight=!1,this.refreshPending&&!this.disposed&&(this.refreshPending=!1,this.scheduleRefresh())}}}resolveGitBranchSync(){try{if(!this.gitPaths)return null;let e=Ap(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?e$(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}async resolveGitBranchAsync(){try{if(!this.gitPaths)return null;let e=Ap(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?await t$(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}clearGitWatchers(){mo(this.headWatcher),this.headWatcher=null,mo(this.reftableWatcher),this.reftableWatcher=null,mo(this.reftableTablesListWatcher),this.reftableTablesListWatcher=null,this.reftableTablesListPath&&(X4(this.reftableTablesListPath),this.reftableTablesListPath=null),this.gitWatcherRetryTimer&&(clearTimeout(this.gitWatcherRetryTimer),this.gitWatcherRetryTimer=null)}scheduleGitWatcherRetry(){this.disposed||this.gitWatcherRetryTimer||(this.gitWatcherRetryTimer=setTimeout(()=>{this.gitWatcherRetryTimer=null,this.setupGitWatcher()},zC))}handleGitWatcherError(){this.clearGitWatchers(),this.scheduleGitWatcherRetry()}setupGitWatcher(){if(this.clearGitWatchers(),!this.gitPaths||(this.headWatcher=ca(i1(this.gitPaths.headPath),(n,i)=>{(!i||i==="HEAD")&&this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.headWatcher))return;let e=Wa(this.gitPaths.commonGitDir,"reftable");if(La(e)){if(this.reftableWatcher=ca(e,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableWatcher)return;let n=Wa(e,"tables.list");if(La(n)){if(this.reftableTablesListPath=n,this.reftableTablesListWatcher=ca(n,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableTablesListWatcher)return;Z4(n,{interval:250},(i,s)=>{(i.mtimeMs!==s.mtimeMs||i.ctimeMs!==s.ctimeMs||i.size!==s.size)&&this.scheduleRefresh()})}}}};var M0=[{name:"settings",description:"Open settings menu"},{name:"model",description:"Select model (opens selector UI)"},{name:"scoped-models",description:"Enable/disable models for Ctrl+P cycling"},{name:"export",description:"Export session (HTML default, or specify path: .html/.jsonl)"},{name:"import",description:"Import and resume a session from a JSONL file"},{name:"share",description:"Share session as a secret GitHub gist"},{name:"copy",description:"Copy last agent message to clipboard"},{name:"name",description:"Set session display name"},{name:"session",description:"Show session info and stats"},{name:"changelog",description:"Show changelog entries"},{name:"hotkeys",description:"Show all keyboard shortcuts"},{name:"fork",description:"Create a new fork from a previous user message"},{name:"clone",description:"Duplicate the current session at the current position"},{name:"tree",description:"Navigate session tree (switch branches)"},{name:"login",description:"Configure provider authentication"},{name:"logout",description:"Remove provider authentication"},{name:"new",description:"Start a new session"},{name:"compact",description:"Manually compact the session context"},{name:"resume",description:"Resume a different session"},{name:"reload",description:"Reload keybindings, extensions, skills, prompts, and themes"},{name:"quit",description:`Quit ${Ot}`}];import{existsSync as n$,readFileSync as i$}from"fs";function I0(t){if(!n$(t))return[];try{let n=i$(t,"utf-8").split(`
|
|
290
|
+
${t.fallbackCwd}`}var Oa=class extends Error{constructor(e){super(M4(e)),this.name="MissingSessionCwdError",this.issue=e}};var Ep=class extends Error{constructor(e){super(`File not found: ${e}`),this.name="SessionImportFileNotFoundError",this.filePath=e}};import BCe from"chalk";import lxe from"chalk";import bxe from"chalk";import{existsSync as A4,readFileSync as O4}from"fs";import{join as L4}from"path";var Hk={...na,"app.interrupt":{defaultKeys:"escape",description:"Cancel or abort"},"app.clear":{defaultKeys:"ctrl+c",description:"Clear editor"},"app.exit":{defaultKeys:"ctrl+d",description:"Exit when editor is empty"},"app.suspend":{defaultKeys:process.platform==="win32"?[]:"ctrl+z",description:"Suspend to background"},"app.thinking.cycle":{defaultKeys:"shift+tab",description:"Cycle thinking level"},"app.model.cycleForward":{defaultKeys:"ctrl+p",description:"Cycle to next model"},"app.model.cycleBackward":{defaultKeys:"shift+ctrl+p",description:"Cycle to previous model"},"app.model.select":{defaultKeys:"ctrl+l",description:"Open model selector"},"app.tools.expand":{defaultKeys:"ctrl+o",description:"Toggle tool output"},"app.thinking.toggle":{defaultKeys:"ctrl+t",description:"Toggle thinking blocks"},"app.session.toggleNamedFilter":{defaultKeys:"ctrl+n",description:"Toggle named session filter"},"app.editor.external":{defaultKeys:"ctrl+g",description:"Open external editor"},"app.message.followUp":{defaultKeys:"alt+enter",description:"Queue follow-up message"},"app.message.dequeue":{defaultKeys:"alt+up",description:"Restore queued messages"},"app.clipboard.pasteImage":{defaultKeys:process.platform==="win32"?"alt+v":"ctrl+v",description:"Paste image from clipboard"},"app.session.new":{defaultKeys:[],description:"Start a new session"},"app.session.tree":{defaultKeys:[],description:"Open session tree"},"app.session.fork":{defaultKeys:[],description:"Fork current session"},"app.session.resume":{defaultKeys:[],description:"Resume a session"},"app.tree.foldOrUp":{defaultKeys:["ctrl+left","alt+left"],description:"Fold tree branch or move up"},"app.tree.unfoldOrDown":{defaultKeys:["ctrl+right","alt+right"],description:"Unfold tree branch or move down"},"app.tree.editLabel":{defaultKeys:"shift+l",description:"Edit tree label"},"app.tree.toggleLabelTimestamp":{defaultKeys:"shift+t",description:"Toggle tree label timestamps"},"app.session.togglePath":{defaultKeys:"ctrl+p",description:"Toggle session path display"},"app.session.toggleSort":{defaultKeys:"ctrl+s",description:"Toggle session sort mode"},"app.session.rename":{defaultKeys:"ctrl+r",description:"Rename session"},"app.session.delete":{defaultKeys:"ctrl+d",description:"Delete session"},"app.session.deleteNoninvasive":{defaultKeys:"ctrl+backspace",description:"Delete session when query is empty"},"app.models.save":{defaultKeys:"ctrl+s",description:"Save model selection"},"app.models.enableAll":{defaultKeys:"ctrl+a",description:"Enable all models"},"app.models.clearAll":{defaultKeys:"ctrl+x",description:"Clear all models"},"app.models.toggleProvider":{defaultKeys:"ctrl+p",description:"Toggle all models for provider"},"app.models.reorderUp":{defaultKeys:"alt+up",description:"Move model up in order"},"app.models.reorderDown":{defaultKeys:"alt+down",description:"Move model down in order"},"app.tree.filter.default":{defaultKeys:"ctrl+d",description:"Tree filter: default view"},"app.tree.filter.noTools":{defaultKeys:"ctrl+t",description:"Tree filter: hide tool results"},"app.tree.filter.userOnly":{defaultKeys:"ctrl+u",description:"Tree filter: user messages only"},"app.tree.filter.labeledOnly":{defaultKeys:"ctrl+l",description:"Tree filter: labeled entries only"},"app.tree.filter.all":{defaultKeys:"ctrl+a",description:"Tree filter: show all entries"},"app.tree.filter.cycleForward":{defaultKeys:"ctrl+o",description:"Tree filter: cycle forward"},"app.tree.filter.cycleBackward":{defaultKeys:"shift+ctrl+o",description:"Tree filter: cycle backward"}},zk={cursorUp:"tui.editor.cursorUp",cursorDown:"tui.editor.cursorDown",cursorLeft:"tui.editor.cursorLeft",cursorRight:"tui.editor.cursorRight",cursorWordLeft:"tui.editor.cursorWordLeft",cursorWordRight:"tui.editor.cursorWordRight",cursorLineStart:"tui.editor.cursorLineStart",cursorLineEnd:"tui.editor.cursorLineEnd",jumpForward:"tui.editor.jumpForward",jumpBackward:"tui.editor.jumpBackward",pageUp:"tui.editor.pageUp",pageDown:"tui.editor.pageDown",deleteCharBackward:"tui.editor.deleteCharBackward",deleteCharForward:"tui.editor.deleteCharForward",deleteWordBackward:"tui.editor.deleteWordBackward",deleteWordForward:"tui.editor.deleteWordForward",deleteToLineStart:"tui.editor.deleteToLineStart",deleteToLineEnd:"tui.editor.deleteToLineEnd",yank:"tui.editor.yank",yankPop:"tui.editor.yankPop",undo:"tui.editor.undo",newLine:"tui.input.newLine",submit:"tui.input.submit",tab:"tui.input.tab",copy:"tui.input.copy",selectUp:"tui.select.up",selectDown:"tui.select.down",selectPageUp:"tui.select.pageUp",selectPageDown:"tui.select.pageDown",selectConfirm:"tui.select.confirm",selectCancel:"tui.select.cancel",interrupt:"app.interrupt",clear:"app.clear",exit:"app.exit",suspend:"app.suspend",cycleThinkingLevel:"app.thinking.cycle",cycleModelForward:"app.model.cycleForward",cycleModelBackward:"app.model.cycleBackward",selectModel:"app.model.select",expandTools:"app.tools.expand",toggleThinking:"app.thinking.toggle",toggleSessionNamedFilter:"app.session.toggleNamedFilter",externalEditor:"app.editor.external",followUp:"app.message.followUp",dequeue:"app.message.dequeue",pasteImage:"app.clipboard.pasteImage",newSession:"app.session.new",tree:"app.session.tree",fork:"app.session.fork",resume:"app.session.resume",treeFoldOrUp:"app.tree.foldOrUp",treeUnfoldOrDown:"app.tree.unfoldOrDown",treeEditLabel:"app.tree.editLabel",treeToggleLabelTimestamp:"app.tree.toggleLabelTimestamp",toggleSessionPath:"app.session.togglePath",toggleSessionSort:"app.session.toggleSort",renameSession:"app.session.rename",deleteSession:"app.session.delete",deleteSessionNoninvasive:"app.session.deleteNoninvasive"};function Vk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function W4(t){return t in zk}function U4(t){if(!Vk(t))return{};let e={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"){e[n]=i;continue}Array.isArray(i)&&i.every(s=>typeof s=="string")&&(e[n]=i)}return e}function Jk(t){let e={},n=!1;for(let[i,s]of Object.entries(t)){let o=W4(i)?zk[i]:i;if(o!==i&&(n=!0),i!==o&&Object.hasOwn(t,o)){n=!0;continue}e[o]=s}return{config:F4(e),migrated:n}}function F4(t){let e={};for(let i of Object.keys(Hk))Object.hasOwn(t,i)&&(e[i]=t[i]);let n=Object.keys(t).filter(i=>!Object.hasOwn(e,i)).sort();for(let i of n)e[i]=t[i];return e}function D4(t){if(A4(t))try{let e=JSON.parse(O4(t,"utf-8"));return Vk(e)?e:void 0}catch{return}}var Ps=class t extends ta{constructor(e={},n){super(Hk,e),this.configPath=n}static create(e=Le()){let n=L4(e,"keybindings.json"),i=t.loadFromFile(n);return new t(i,n)}reload(){this.configPath&&this.setUserBindings(t.loadFromFile(this.configPath))}getEffectiveConfig(){return this.getResolvedBindings()}static loadFromFile(e){let n=D4(e);return n?U4(Jk(n).config):{}}};import{spawnSync as j4}from"node:child_process";import{existsSync as q4}from"node:fs";import{unlink as G4}from"node:fs/promises";import*as e1 from"node:os";var V=class{constructor(e=n=>b.fg("border",n)){this.color=e}invalidate(){}render(e){return[this.color("\u2500".repeat(Math.max(1,e)))]}};function Qk(t){return t.toLowerCase().replace(/\s+/g," ").trim()}function $4(t){return`${t.id} ${t.name??""} ${t.allMessagesText} ${t.cwd}`}function C0(t){return!!t.name?.trim()}function B4(t,e){return e==="all"?!0:C0(t)}function N4(t){let e=t.trim();if(!e)return{mode:"tokens",tokens:[],regex:null};if(e.startsWith("re:")){let a=e.slice(3).trim();if(!a)return{mode:"regex",tokens:[],regex:null,error:"Empty regex"};try{return{mode:"regex",tokens:[],regex:new RegExp(a,"i")}}catch(c){let l=c instanceof Error?c.message:String(c);return{mode:"regex",tokens:[],regex:null,error:l}}}let n=[],i="",s=!1,o=!1,r=a=>{let c=i.trim();i="",c&&n.push({kind:a,value:c})};for(let a=0;a<e.length;a++){let c=e[a];if(c==='"'){s?(r("phrase"),s=!1):(r("fuzzy"),s=!0);continue}if(!s&&/\s/.test(c)){r("fuzzy");continue}i+=c}return s&&(o=!0),o?{mode:"tokens",tokens:e.split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0).map(a=>({kind:"fuzzy",value:a})),regex:null}:(r(s?"phrase":"fuzzy"),{mode:"tokens",tokens:n,regex:null})}function Yk(t,e){let n=$4(t);if(e.mode==="regex"){if(!e.regex)return{matches:!1,score:0};let o=n.search(e.regex);return o<0?{matches:!1,score:0}:{matches:!0,score:o*.1}}if(e.tokens.length===0)return{matches:!0,score:0};let i=0,s=null;for(let o of e.tokens){if(o.kind==="phrase"){s===null&&(s=Qk(n));let a=Qk(o.value);if(!a)continue;let c=s.indexOf(a);if(c<0)return{matches:!1,score:0};i+=c*.1;continue}let r=Sd(o.value,n);if(!r.matches)return{matches:!1,score:0};i+=r.score}return{matches:!0,score:i}}function Xk(t,e,n,i="all"){let s=i==="all"?t:t.filter(c=>B4(c,i));if(!e.trim())return s;let r=N4(e);if(r.error)return[];if(n==="recent"){let c=[];for(let l of s)Yk(l,r).matches&&c.push(l);return c}let a=[];for(let c of s){let l=Yk(c,r);l.matches&&a.push({session:c,score:l.score})}return a.sort((c,l)=>c.score!==l.score?c.score-l.score:l.session.modified.getTime()-c.session.modified.getTime()),a.map(c=>c.session)}function Zk(t){let e=e1.homedir();return t&&(t.startsWith(e)?`~${t.slice(e.length)}`:t)}function K4(t){let n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"now":i<60?`${i}m`:s<24?`${s}h`:o<7?`${o}d`:o<30?`${Math.floor(o/7)}w`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Al(t){return t&&xa(t)}var T0=class{constructor(e,n,i,s){this.loading=!1;this.loadProgress=null;this.showPath=!1;this.confirmingDeletePath=null;this.statusMessage=null;this.statusTimeout=null;this.showRenameHint=!1;this.scope=e,this.sortMode=n,this.nameFilter=i,this.requestRender=s}setScope(e){this.scope=e}setSortMode(e){this.sortMode=e}setNameFilter(e){this.nameFilter=e}setLoading(e){this.loading=e,this.loadProgress=null}setProgress(e,n){this.loadProgress={loaded:e,total:n}}setShowPath(e){this.showPath=e}setShowRenameHint(e){this.showRenameHint=e}setConfirmingDeletePath(e){this.confirmingDeletePath=e}clearStatusTimeout(){this.statusTimeout&&(clearTimeout(this.statusTimeout),this.statusTimeout=null)}setStatusMessage(e,n){this.clearStatusTimeout(),this.statusMessage=e,!(!e||!n)&&(this.statusTimeout=setTimeout(()=>{this.statusMessage=null,this.statusTimeout=null,this.requestRender()},n))}invalidate(){}render(e){let n=this.scope==="current"?"Resume Session (Current Folder)":"Resume Session (All)",i=b.bold(n),s=this.sortMode==="threaded"?"Threaded":this.sortMode==="recent"?"Recent":"Fuzzy",o=b.fg("muted","Sort: ")+b.fg("accent",s),r=this.nameFilter==="all"?"All":"Named",a=b.fg("muted","Name: ")+b.fg("accent",r),c;if(this.loading){let h=this.loadProgress?`${this.loadProgress.loaded}/${this.loadProgress.total}`:"...";c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent",`Loading ${h}`)}`}else this.scope==="current"?c=`${b.fg("accent","\u25C9 Current Folder")}${b.fg("muted"," | \u25CB All")}`:c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent","\u25C9 All")}`;let l=X(`${c} ${a} ${o}`,e,""),d=Math.max(0,e-j(l)-1),u=X(i,d,""),p=Math.max(0,e-j(u)-j(l)),m,g;if(this.confirmingDeletePath!==null){let h=`Delete session? ${ce("tui.select.confirm","confirm")} \xB7 ${ce("tui.select.cancel","cancel")}`;m=b.fg("error",X(h,e,"\u2026")),g=""}else if(this.statusMessage){let h=this.statusMessage.type==="error"?"error":"accent";m=b.fg(h,X(this.statusMessage.message,e,"\u2026")),g=""}else{let h=this.showPath?"(on)":"(off)",f=b.fg("muted"," \xB7 "),x=ce("tui.input.tab","scope")+f+b.fg("muted",'re:<pattern> regex \xB7 "phrase" exact'),y=[ce("app.session.toggleSort","sort"),ce("app.session.toggleNamedFilter","named"),ce("app.session.delete","delete"),ce("app.session.togglePath",`path ${h}`)];this.showRenameHint&&y.push(ce("app.session.rename","rename"));let w=y.join(f);m=X(x,e,"\u2026"),g=X(w,e,"\u2026")}return[`${u}${" ".repeat(p)}${l}`,m,g]}};function H4(t){let e=new Map;for(let s of t){let o=Al(s.path)??s.path;e.set(o,{session:s,children:[]})}let n=[];for(let s of t){let o=Al(s.path)??s.path,r=e.get(o),a=Al(s.parentSessionPath);a&&e.has(a)?e.get(a).children.push(r):n.push(r)}let i=s=>{s.sort((o,r)=>r.session.modified.getTime()-o.session.modified.getTime());for(let o of s)i(o.children)};return i(n),n}function z4(t){let e=[],n=(i,s,o,r)=>{e.push({session:i.session,depth:s,isLast:r,ancestorContinues:o});for(let a=0;a<i.children.length;a++){let c=a===i.children.length-1,l=s>0?!r:!1;n(i.children[a],s+1,[...o,l],c)}};for(let i=0;i<t.length;i++)n(t[i],0,[],i===t.length-1);return e}var k0=class{constructor(e,n,i,s,o,r){this.allSessions=[];this.filteredSessions=[];this.selectedIndex=0;this.showCwd=!1;this.sortMode="threaded";this.nameFilter="all";this.showPath=!1;this.confirmingDeletePath=null;this.onExit=()=>{};this.maxVisible=10;this._focused=!1;this.allSessions=e,this.filteredSessions=[],this.searchInput=new Je,this.showCwd=n,this.sortMode=i,this.nameFilter=s,this.keybindings=o,this.currentSessionCanonicalPath=Al(r),this.filterSessions(""),this.searchInput.onSubmit=()=>{if(this.filteredSessions[this.selectedIndex]){let a=this.filteredSessions[this.selectedIndex];this.onSelect&&this.onSelect(a.session.path)}}}getSelectedSessionPath(){return this.filteredSessions[this.selectedIndex]?.session.path}get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}setSortMode(e){this.sortMode=e,this.filterSessions(this.searchInput.getValue())}setNameFilter(e){this.nameFilter=e,this.filterSessions(this.searchInput.getValue())}setSessions(e,n){this.allSessions=e,this.showCwd=n,this.filterSessions(this.searchInput.getValue())}filterSessions(e){let n=e.trim(),i=this.nameFilter==="all"?this.allSessions:this.allSessions.filter(s=>C0(s));if(this.sortMode==="threaded"&&!n){let s=H4(i);this.filteredSessions=z4(s)}else{let s=Xk(i,e,this.sortMode,"all");this.filteredSessions=s.map(o=>({session:o,depth:0,isLast:!0,ancestorContinues:[]}))}this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredSessions.length-1))}setConfirmingDeletePath(e){this.confirmingDeletePath=e,this.onDeleteConfirmationChange?.(e)}startDeleteConfirmationForSelectedSession(){let e=this.filteredSessions[this.selectedIndex];if(e){if(this.isCurrentSessionPath(e.session.path)){this.onError?.("Cannot delete the currently active session");return}this.setConfirmingDeletePath(e.session.path)}}isCurrentSessionPath(e){return this.currentSessionCanonicalPath?(Al(e)??e)===this.currentSessionCanonicalPath:!1}invalidate(){}render(e){let n=[];if(n.push(...this.searchInput.render(e)),n.push(""),this.filteredSessions.length===0){let o;if(this.nameFilter==="named"){let r=he("app.session.toggleNamedFilter");this.showCwd?o=` No named sessions found. Press ${r} to show all.`:o=` No named sessions in current folder. Press ${r} to show all, or Tab to view all.`}else this.showCwd?o=" No sessions found":o=" No sessions in current folder. Press Tab to view all.";return n.push(b.fg("muted",X(o,e,"\u2026"))),n}let i=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredSessions.length-this.maxVisible)),s=Math.min(i+this.maxVisible,this.filteredSessions.length);for(let o=i;o<s;o++){let r=this.filteredSessions[o],a=r.session,c=o===this.selectedIndex,l=a.path===this.confirmingDeletePath,d=this.isCurrentSessionPath(a.path),u=this.buildTreePrefix(r),p=!!a.name,g=(a.name??a.firstMessage).replace(/[\x00-\x1f\x7f]/g," ").trim(),h=K4(a.modified),x=`${String(a.messageCount)} ${h}`;this.showCwd&&a.cwd&&(x=`${Zk(a.cwd)} ${x}`),this.showPath&&(x=`${Zk(a.path)} ${x}`);let y=c?b.fg("accent","\u203A "):" ",w=j(u),P=j(x)+2,_=e-2-w-P,R=X(g,Math.max(10,_),"\u2026"),L=null;l?L="error":d?L="accent":p&&(L="warning");let E=L?b.fg(L,R):R;c&&(E=b.bold(E));let W=y+b.fg("dim",u)+E,M=j(W),I=Math.max(1,e-M-j(x)),O=b.fg(l?"error":"dim",x),F=W+" ".repeat(I)+O;c&&(F=b.bg("selectedBg",F)),n.push(X(F,e))}if(i>0||s<this.filteredSessions.length){let o=` (${this.selectedIndex+1}/${this.filteredSessions.length})`,r=b.fg("muted",X(o,e,""));n.push(r)}return n}buildTreePrefix(e){if(e.depth===0)return"";let n=e.ancestorContinues.map(s=>s?"\u2502 ":" "),i=e.isLast?"\u2514\u2500 ":"\u251C\u2500 ";return n.join("")+i}handleInput(e){let n=ve();if(this.confirmingDeletePath!==null){if(n.matches(e,"tui.select.confirm")){let i=this.confirmingDeletePath;this.setConfirmingDeletePath(null),this.onDeleteSession?.(i);return}if(n.matches(e,"tui.select.cancel")){this.setConfirmingDeletePath(null);return}return}if(n.matches(e,"tui.input.tab")){this.onToggleScope&&this.onToggleScope();return}if(n.matches(e,"app.session.toggleSort")){this.onToggleSort?.();return}if(this.keybindings.matches(e,"app.session.toggleNamedFilter")){this.onToggleNameFilter?.();return}if(n.matches(e,"app.session.togglePath")){this.showPath=!this.showPath,this.onTogglePath?.(this.showPath);return}if(n.matches(e,"app.session.delete")){this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"app.session.rename")){let i=this.filteredSessions[this.selectedIndex];i&&this.onRenameSession?.(i.session.path);return}if(n.matches(e,"app.session.deleteNoninvasive")){if(this.searchInput.getValue().length>0){this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue());return}this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"tui.select.up"))this.selectedIndex=Math.max(0,this.selectedIndex-1);else if(n.matches(e,"tui.select.down"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+1);else if(n.matches(e,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisible);else if(n.matches(e,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+this.maxVisible);else if(n.matches(e,"tui.select.confirm")){let i=this.filteredSessions[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.session.path)}else n.matches(e,"tui.select.cancel")?this.onCancel&&this.onCancel():(this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue()))}};async function V4(t){let e=t.startsWith("-")?["--",t]:[t],n=j4("trash",e,{encoding:"utf-8"}),i=()=>{let s=[];n.error&&s.push(n.error.message);let o=n.stderr?.trim();return o&&s.push(o.split(`
|
|
291
|
+
`)[0]??o),s.length===0?null:`trash: ${s.join(" \xB7 ").slice(0,200)}`};if(n.status===0||!q4(t))return{ok:!0,method:"trash"};try{return await G4(t),{ok:!0,method:"unlink"}}catch(s){let o=s instanceof Error?s.message:String(s),r=i();return{ok:!1,method:"unlink",error:r?`${o} (${r})`:o}}}var Io=class extends K{constructor(n,i,s,o,r,a,c,l){super();this.canRename=!0;this.scope="current";this.sortMode="threaded";this.nameFilter="all";this.currentSessions=null;this.allSessions=null;this.currentLoading=!1;this.allLoading=!1;this.allLoadSeq=0;this.mode="list";this.renameInput=new Je;this.renameTargetPath=null;this._focused=!1;this.keybindings=c?.keybindings??Ps.create(),this.currentSessionsLoader=n,this.allSessionsLoader=i,this.onCancel=o,this.requestRender=a,this.header=new T0(this.scope,this.sortMode,this.nameFilter,this.requestRender);let d=c?.renameSession;this.renameSession=d,this.canRename=!!d,this.header.setShowRenameHint(c?.showRenameHint??this.canRename),this.sessionList=new k0([],!1,this.sortMode,this.nameFilter,this.keybindings,l),this.buildBaseLayout(this.sessionList),this.renameInput.onSubmit=p=>{this.confirmRename(p)};let u=()=>this.header.setStatusMessage(null);this.sessionList.onSelect=p=>{u(),s(p)},this.sessionList.onCancel=()=>{u(),o()},this.sessionList.onExit=()=>{u(),r()},this.sessionList.onToggleScope=()=>this.toggleScope(),this.sessionList.onToggleSort=()=>this.toggleSortMode(),this.sessionList.onToggleNameFilter=()=>this.toggleNameFilter(),this.sessionList.onRenameSession=p=>{if(!d||this.scope==="current"&&this.currentLoading||this.scope==="all"&&this.allLoading)return;let g=(this.scope==="all"?this.allSessions??[]:this.currentSessions??[]).find(h=>h.path===p);this.enterRenameMode(p,g?.name)},this.sessionList.onTogglePath=p=>{this.header.setShowPath(p),this.requestRender()},this.sessionList.onDeleteConfirmationChange=p=>{this.header.setConfirmingDeletePath(p),this.requestRender()},this.sessionList.onError=p=>{this.header.setStatusMessage({type:"error",message:p},3e3),this.requestRender()},this.sessionList.onDeleteSession=async p=>{let m=await V4(p);if(m.ok){this.currentSessions&&(this.currentSessions=this.currentSessions.filter(x=>x.path!==p)),this.allSessions&&(this.allSessions=this.allSessions.filter(x=>x.path!==p));let g=this.scope==="all"?this.allSessions??[]:this.currentSessions??[],h=this.scope==="all";this.sessionList.setSessions(g,h);let f=m.method==="trash"?"Session moved to trash":"Session deleted";this.header.setStatusMessage({type:"info",message:f},2e3),await this.refreshSessionsAfterMutation()}else{let g=m.error??"Unknown error";this.header.setStatusMessage({type:"error",message:`Failed to delete: ${g}`},3e3)}this.requestRender()},this.loadCurrentSessions()}handleInput(n){if(this.mode==="rename"){if(ve().matches(n,"tui.select.cancel")){this.exitRenameMode();return}this.renameInput.handleInput(n);return}this.sessionList.handleInput(n)}get focused(){return this._focused}set focused(n){this._focused=n,this.sessionList.focused=n,this.renameInput.focused=n,n&&this.mode==="rename"&&(this.renameInput.focused=!0)}buildBaseLayout(n,i){this.clear(),this.addChild(new U(1)),this.addChild(new V(s=>b.fg("accent",s))),this.addChild(new U(1)),(i?.showHeader??!0)&&(this.addChild(this.header),this.addChild(new U(1))),this.addChild(n),this.addChild(new U(1)),this.addChild(new V(s=>b.fg("accent",s)))}loadCurrentSessions(){this.loadScope("current","initial")}enterRenameMode(n,i){this.mode="rename",this.renameTargetPath=n,this.renameInput.setValue(i??""),this.renameInput.focused=!0;let s=new K;s.addChild(new A(b.bold("Rename Session"),1,0)),s.addChild(new U(1)),s.addChild(this.renameInput),s.addChild(new U(1)),s.addChild(new A(b.fg("muted",`${he("tui.select.confirm")} to save \xB7 ${he("tui.select.cancel")} to cancel`),1,0)),this.buildBaseLayout(s,{showHeader:!1}),this.requestRender()}exitRenameMode(){this.mode="list",this.renameTargetPath=null,this.buildBaseLayout(this.sessionList),this.requestRender()}async confirmRename(n){let i=n.trim();if(!i)return;let s=this.renameTargetPath;if(!s){this.exitRenameMode();return}let o=this.renameSession;if(!o){this.exitRenameMode();return}try{await o(s,i),await this.refreshSessionsAfterMutation()}finally{this.exitRenameMode()}}async loadScope(n,i){let s=n==="all";n==="current"?this.currentLoading=!0:this.allLoading=!0;let o=n==="all"?++this.allLoadSeq:void 0;this.header.setScope(n),this.header.setLoading(!0),this.requestRender();let r=(a,c)=>{n===this.scope&&(o!==void 0&&o!==this.allLoadSeq||(this.header.setProgress(a,c),this.requestRender()))};try{let a=await(n==="current"?this.currentSessionsLoader(r):this.allSessionsLoader(r));if(n==="current"?(this.currentSessions=a,this.currentLoading=!1):(this.allSessions=a,this.allLoading=!1),n!==this.scope||o!==void 0&&o!==this.allLoadSeq)return;this.header.setLoading(!1),this.sessionList.setSessions(a,s),this.requestRender(),n==="all"&&a.length===0&&(this.currentSessions?.length??0)===0&&this.onCancel()}catch(a){if(n==="current"?this.currentLoading=!1:this.allLoading=!1,n!==this.scope||o!==void 0&&o!==this.allLoadSeq)return;let c=a instanceof Error?a.message:String(a);this.header.setLoading(!1),this.header.setStatusMessage({type:"error",message:`Failed to load sessions: ${c}`},4e3),i==="initial"&&this.sessionList.setSessions([],s),this.requestRender()}}toggleSortMode(){this.sortMode=this.sortMode==="threaded"?"recent":this.sortMode==="recent"?"relevance":"threaded",this.header.setSortMode(this.sortMode),this.sessionList.setSortMode(this.sortMode),this.requestRender()}toggleNameFilter(){this.nameFilter=this.nameFilter==="all"?"named":"all",this.header.setNameFilter(this.nameFilter),this.sessionList.setNameFilter(this.nameFilter),this.requestRender()}async refreshSessionsAfterMutation(){await this.loadScope(this.scope,"refresh")}toggleScope(){if(this.scope==="current"){if(this.scope="all",this.header.setScope(this.scope),this.allSessions!==null){this.header.setLoading(!1),this.sessionList.setSessions(this.allSessions,!0),this.requestRender();return}this.allLoading||this.loadScope("all","toggle");return}this.scope="current",this.header.setScope(this.scope),this.header.setLoading(this.currentLoading),this.sessionList.setSessions(this.currentSessions??[],!1),this.requestRender()}getSessionList(){return this.sessionList}};import Kxe from"chalk";import*as _1 from"node:crypto";import*as Xn from"node:fs";import*as Za from"node:os";import*as Ve from"node:path";import{spawn as D0,spawnSync as X$}from"child_process";import{execFile as J4,spawnSync as Q4}from"child_process";import{existsSync as La,readFileSync as Ap,statSync as Y4,unwatchFile as X4,watchFile as Z4}from"fs";import{dirname as i1,join as Wa,resolve as t1}from"path";function n1(t){let e=t;for(;;){let n=Wa(e,".git");if(La(n))try{let s=Y4(n);if(s.isFile()){let o=Ap(n,"utf8").trim();if(o.startsWith("gitdir: ")){let r=t1(e,o.slice(8).trim()),a=Wa(r,"HEAD");if(!La(a))return null;let c=Wa(r,"commondir"),l=La(c)?t1(r,Ap(c,"utf8").trim()):r;return{repoDir:e,commonGitDir:l,headPath:a}}}else if(s.isDirectory()){let o=Wa(n,"HEAD");return La(o)?{repoDir:e,commonGitDir:n,headPath:o}:null}}catch{return null}let i=i1(e);if(i===e)return null;e=i}}function e$(t){let e=Q4("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return(e.status===0?e.stdout.trim():"")||null}function t$(t){return new Promise(e=>{J4("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8"},(n,i)=>{if(n){e(null);return}let s=i.trim();e(s||null)})})}var Op=class t{constructor(e){this.extensionStatuses=new Map;this.cachedBranch=void 0;this.gitPaths=void 0;this.headWatcher=null;this.reftableWatcher=null;this.reftableTablesListWatcher=null;this.reftableTablesListPath=null;this.branchChangeCallbacks=new Set;this.availableProviderCount=0;this.refreshTimer=null;this.gitWatcherRetryTimer=null;this.refreshInFlight=!1;this.refreshPending=!1;this.disposed=!1;this.cwd=e,this.gitPaths=n1(e),this.setupGitWatcher()}static{this.WATCH_DEBOUNCE_MS=500}getGitBranch(){return this.cachedBranch===void 0&&(this.cachedBranch=this.resolveGitBranchSync()),this.cachedBranch}getExtensionStatuses(){return this.extensionStatuses}onBranchChange(e){return this.branchChangeCallbacks.add(e),()=>this.branchChangeCallbacks.delete(e)}setExtensionStatus(e,n){n===void 0?this.extensionStatuses.delete(e):this.extensionStatuses.set(e,n)}clearExtensionStatuses(){this.extensionStatuses.clear()}getAvailableProviderCount(){return this.availableProviderCount}setAvailableProviderCount(e){this.availableProviderCount=e}setCwd(e){this.cwd!==e&&(this.cwd=e,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.cachedBranch=void 0,this.gitPaths=n1(e),this.setupGitWatcher(),this.notifyBranchChange())}dispose(){this.disposed=!0,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.branchChangeCallbacks.clear()}notifyBranchChange(){for(let e of this.branchChangeCallbacks)e()}scheduleRefresh(){if(!(this.disposed||this.refreshTimer)){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refreshGitBranchAsync()},t.WATCH_DEBOUNCE_MS)}}async refreshGitBranchAsync(){if(!this.disposed){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshInFlight=!0;try{let e=await this.resolveGitBranchAsync();if(this.disposed)return;if(this.cachedBranch!==void 0&&this.cachedBranch!==e){this.cachedBranch=e,this.notifyBranchChange();return}this.cachedBranch=e}finally{this.refreshInFlight=!1,this.refreshPending&&!this.disposed&&(this.refreshPending=!1,this.scheduleRefresh())}}}resolveGitBranchSync(){try{if(!this.gitPaths)return null;let e=Ap(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?e$(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}async resolveGitBranchAsync(){try{if(!this.gitPaths)return null;let e=Ap(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?await t$(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}clearGitWatchers(){mo(this.headWatcher),this.headWatcher=null,mo(this.reftableWatcher),this.reftableWatcher=null,mo(this.reftableTablesListWatcher),this.reftableTablesListWatcher=null,this.reftableTablesListPath&&(X4(this.reftableTablesListPath),this.reftableTablesListPath=null),this.gitWatcherRetryTimer&&(clearTimeout(this.gitWatcherRetryTimer),this.gitWatcherRetryTimer=null)}scheduleGitWatcherRetry(){this.disposed||this.gitWatcherRetryTimer||(this.gitWatcherRetryTimer=setTimeout(()=>{this.gitWatcherRetryTimer=null,this.setupGitWatcher()},zC))}handleGitWatcherError(){this.clearGitWatchers(),this.scheduleGitWatcherRetry()}setupGitWatcher(){if(this.clearGitWatchers(),!this.gitPaths||(this.headWatcher=ca(i1(this.gitPaths.headPath),(n,i)=>{(!i||i==="HEAD")&&this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.headWatcher))return;let e=Wa(this.gitPaths.commonGitDir,"reftable");if(La(e)){if(this.reftableWatcher=ca(e,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableWatcher)return;let n=Wa(e,"tables.list");if(La(n)){if(this.reftableTablesListPath=n,this.reftableTablesListWatcher=ca(n,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableTablesListWatcher)return;Z4(n,{interval:250},(i,s)=>{(i.mtimeMs!==s.mtimeMs||i.ctimeMs!==s.ctimeMs||i.size!==s.size)&&this.scheduleRefresh()})}}}};var M0=[{name:"settings",description:"Open settings menu"},{name:"model",description:"Select model (opens selector UI)"},{name:"scoped-models",description:"Enable/disable models for Ctrl+P cycling"},{name:"export",description:"Export session (HTML default, or specify path: .html/.jsonl)"},{name:"import",description:"Import and resume a session from a JSONL file"},{name:"share",description:"Share session as a secret GitHub gist"},{name:"copy",description:"Copy last agent message to clipboard"},{name:"name",description:"Set session display name"},{name:"session",description:"Show session info and stats"},{name:"changelog",description:"Show changelog entries"},{name:"hotkeys",description:"Show all keyboard shortcuts"},{name:"fork",description:"Create a new fork from a previous user message"},{name:"clone",description:"Duplicate the current session at the current position"},{name:"tree",description:"Navigate session tree (switch branches)"},{name:"login",description:"Configure provider authentication"},{name:"logout",description:"Remove provider authentication"},{name:"new",description:"Start a new session"},{name:"compact",description:"Manually compact the session context"},{name:"resume",description:"Resume a different session"},{name:"reload",description:"Reload keybindings, extensions, skills, prompts, and themes"},{name:"quit",description:`Quit ${Ot}`}];import{existsSync as n$,readFileSync as i$}from"fs";function I0(t){if(!n$(t))return[];try{let n=i$(t,"utf-8").split(`
|
|
292
292
|
`),i=[],s=[],o=null;for(let r of n)if(r.startsWith("## ")){o&&s.length>0&&i.push({...o,content:s.join(`
|
|
293
293
|
`).trim()});let a=r.match(/##\s+\[?(\d+)\.(\d+)\.(\d+)\]?/);a?(o={major:Number.parseInt(a[1],10),minor:Number.parseInt(a[2],10),patch:Number.parseInt(a[3],10)},s=[r]):(o=null,s=[])}else o&&s.push(r);return o&&s.length>0&&i.push({...o,content:s.join(`
|
|
294
294
|
`).trim()}),i}catch(e){return console.error(`Warning: Could not parse changelog: ${e}`),[]}}function s$(t,e){return t.major!==e.major?t.major-e.major:t.minor!==e.minor?t.minor-e.minor:t.patch-e.patch}function s1(t,e){let n=e.split(".").map(Number),i={major:n[0]||0,minor:n[1]||0,patch:n[2]||0,content:""};return t.filter(s=>s$(s,i)>0)}import{execSync as Fa,spawn as S$}from"child_process";import{platform as C$}from"os";import{spawnSync as c$}from"child_process";import{randomUUID as l$}from"crypto";import{readFileSync as r1,unlinkSync as u$}from"fs";import{tmpdir as d$}from"os";import{join as p$}from"path";import{createRequire as o$}from"module";var r$=o$(import.meta.url),ji=null,a$=process.platform!=="linux"||!!(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);if(!process.env.TERMUX_VERSION&&a$)try{ji=r$("@mariozechner/clipboard")}catch{ji=null}var Lp=["image/png","image/jpeg","image/webp","image/gif"],R0=1e3,m$=3e3,h$=5e3,g$=50*1024*1024;function P0(t=process.env){return!!t.WAYLAND_DISPLAY||t.XDG_SESSION_TYPE==="wayland"}function Ol(t){return t.split(";")[0]?.trim().toLowerCase()??t.toLowerCase()}function a1(t){switch(Ol(t)){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return null}}function c1(t){let e=t.map(i=>i.trim()).filter(Boolean).map(i=>({raw:i,base:Ol(i)}));for(let i of Lp){let s=e.find(o=>o.base===i);if(s)return s.raw}return e.find(i=>i.base.startsWith("image/"))?.raw??null}function f$(t){let e=Ol(t);return Lp.some(n=>n===e)}async function b$(t){let e=await Ma();if(!e)return null;try{let n=e.PhotonImage.new_from_byteslice(t);try{return n.get_bytes()}finally{n.free()}}catch{return null}}function Ua(t,e,n){let i=n?.timeoutMs??m$,s=n?.maxBufferBytes??g$,o=c$(t,e,{timeout:i,maxBuffer:s,env:n?.env});return o.error?{ok:!1,stdout:Buffer.alloc(0)}:o.status!==0?{ok:!1,stdout:Buffer.alloc(0)}:{ok:!0,stdout:Buffer.isBuffer(o.stdout)?o.stdout:Buffer.from(o.stdout??"",typeof o.stdout=="string"?"utf-8":void 0)}}function x$(){let t=Ua("wl-paste",["--list-types"],{timeoutMs:R0});if(!t.ok)return null;let e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean),n=c1(e);if(!n)return null;let i=Ua("wl-paste",["--type",n,"--no-newline"]);return!i.ok||i.stdout.length===0?null:{bytes:i.stdout,mimeType:Ol(n)}}function y$(t=process.env){if(t.WSL_DISTRO_NAME||t.WSLENV)return!0;try{let e=r1("/proc/version","utf-8");return/microsoft|wsl/i.test(e)}catch{return!1}}function v$(){let t=p$(d$(),`pi-wsl-clip-${l$()}.png`);try{let e=Ua("wslpath",["-w",t],{timeoutMs:R0});if(!e.ok)return null;let n=e.stdout.toString("utf-8").trim();if(!n)return null;let s=["Add-Type -AssemblyName System.Windows.Forms","Add-Type -AssemblyName System.Drawing",`$path = '${n.replaceAll("'","''")}'`,"$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }"].join("; "),o=Ua("powershell.exe",["-NoProfile","-Command",s],{timeoutMs:h$});if(!o.ok||o.stdout.toString("utf-8").trim()!=="ok")return null;let a=r1(t);return a.length===0?null:{bytes:new Uint8Array(a),mimeType:"image/png"}}catch{return null}finally{try{u$(t)}catch{}}}function w$(){let t=Ua("xclip",["-selection","clipboard","-t","TARGETS","-o"],{timeoutMs:R0}),e=[];t.ok&&(e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean));let n=e.length>0?c1(e):null,i=n?[n,...Lp]:[...Lp];for(let s of i){let o=Ua("xclip",["-selection","clipboard","-t",s,"-o"]);if(o.ok&&o.stdout.length>0)return{bytes:o.stdout,mimeType:Ol(s)}}return null}async function o1(){if(!ji||!ji.hasImage())return null;let t=await ji.getImageBinary();return!t||t.length===0?null:{bytes:t instanceof Uint8Array?t:Uint8Array.from(t),mimeType:"image/png"}}async function l1(t){let e=t?.env??process.env,n=t?.platform??process.platform;if(e.TERMUX_VERSION)return null;let i=null;if(n==="linux"){let s=y$(e),o=P0(e);(o||s)&&(i=x$()??w$()),!i&&s&&(i=v$()),!i&&!o&&(i=await o1())}else i=await o1();if(!i)return null;if(!f$(i.mimeType)){let s=await b$(i.bytes);return s?{bytes:s,mimeType:"image/png"}:null}return i}function u1(t){try{Fa("xclip -selection clipboard",t)}catch{Fa("xsel --clipboard --input",t)}}var T$=1e5;function k$(t=process.env){return!!(t.SSH_CONNECTION||t.SSH_CLIENT||t.MOSH_CONNECTION)}function M$(t){let e=Buffer.from(t).toString("base64");return e.length>T$?!1:(process.stdout.write(`\x1B]52;c;${e}\x07`),!0)}async function Ll(t){let e=!1,n=C$();try{ji&&n!=="linux"&&(await ji.setText(t),e=!0)}catch{}let i=k$();if(e&&!i)return;let s={input:t,timeout:5e3,stdio:["pipe","ignore","ignore"]};if(!e)try{if(n==="darwin")Fa("pbcopy",s),e=!0;else if(n==="win32")Fa("clip",s),e=!0;else{if(process.env.TERMUX_VERSION)try{Fa("termux-clipboard-set",s),e=!0}catch{}if(!e){let o=!!process.env.WAYLAND_DISPLAY,r=!!process.env.DISPLAY;if(P0()&&o)try{Fa("which wl-copy",{stdio:"ignore"});let c=S$("wl-copy",[],{stdio:["pipe","ignore","ignore"]});c.stdin.on("error",()=>{}),c.stdin.write(t),c.stdin.end(),c.unref(),e=!0}catch{r&&(u1(s),e=!0)}else r&&(u1(s),e=!0)}}}catch{}if(i||!e){let o=M$(t);e=e||o}if(!e)throw new Error("Failed to copy to clipboard")}function Wp(t){let e=process.versions.bun?`bun/${process.versions.bun}`:`node/${process.version}`;return`pi/${t} (${process.platform}; ${e}; ${process.arch})`}var I$="https://pi.dev/api/latest-version",R$=1e4;function d1(t){let e=t.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.*)?$/);if(e)return{major:Number.parseInt(e[1],10),minor:Number.parseInt(e[2],10),patch:Number.parseInt(e[3],10),prerelease:e[4]}}function P$(t,e){let n=d1(t),i=d1(e);if(!(!n||!i))return n.major!==i.major?n.major-i.major:n.minor!==i.minor?n.minor-i.minor:n.patch!==i.patch?n.patch-i.patch:n.prerelease===i.prerelease?0:n.prerelease?i.prerelease?n.prerelease.localeCompare(i.prerelease):-1:1}function p1(t,e){let n=P$(t,e);return n!==void 0?n>0:t.trim()!==e.trim()}async function m1(t,e={}){if(process.env.PI_SKIP_VERSION_CHECK||process.env.PI_OFFLINE)return;let n=await fetch(I$,{headers:{"User-Agent":Wp(t),accept:"application/json"},signal:AbortSignal.timeout(e.timeoutMs??R$)});if(!n.ok)return;let i=await n.json();if(typeof i.version!="string"||!i.version.trim())return;let s=typeof i.packageName=="string"&&i.packageName.trim()?i.packageName.trim():void 0,o=typeof i.note=="string"&&i.note.trim()?i.note.trim():void 0;return{version:i.version.trim(),packageName:s,...o?{note:o}:{}}}async function h1(t){try{let e=await m1(t);return e&&p1(e.version,t)?e:void 0}catch{return}}var vn=31,b1=36,_$=[255,255,255,127,255,240,255,127,255,237,255,127,255,219,255,127,255,183,255,127,255,119,254,127,63,248,254,127,223,255,254,127,223,63,252,127,159,195,251,127,111,252,244,127,247,15,247,127,247,255,247,127,247,255,227,127,247,7,232,127,239,248,103,112,15,255,187,111,241,0,208,91,253,63,236,83,193,255,239,87,159,253,238,95,159,252,174,95,31,120,172,95,63,0,80,108,127,0,220,119,255,192,63,120,255,1,248,127,255,3,156,120,255,7,140,124,255,15,206,120,255,255,207,127,255,255,207,120,255,255,223,120,255,255,223,125,255,255,63,126,255,255,255,127],E$=Math.ceil(vn/8),gt=Math.ceil(b1/2),g1=["typewriter","scanline","rain","fade","crt","glitch","dissolve"];function f1(t,e){if(e>=b1)return!1;let n=e*E$+Math.floor(t/8),i=t%8;return(_$[n]>>i&1)===0}function A$(t,e){let n=f1(t,e*2),i=f1(t,e*2+1);return n&&i?"\u2588":n?"\u2580":i?"\u2584":" "}function O$(){let t=[];for(let e=0;e<gt;e++){let n=[];for(let i=0;i<vn;i++)n.push(A$(i,e));t.push(n)}return t}var Da=class{constructor(e){this.interval=null;this.effectState={};this.cachedLines=[];this.cachedWidth=0;this.gridVersion=0;this.cachedVersion=-1;this.ui=e,this.effect=g1[Math.floor(Math.random()*g1.length)],this.finalGrid=O$(),this.currentGrid=this.createEmptyGrid(),this.initEffect(),this.startAnimation()}invalidate(){this.cachedWidth=0}render(e){if(e===this.cachedWidth&&this.cachedVersion===this.gridVersion)return this.cachedLines;let n=1,i=e-n;this.cachedLines=this.currentGrid.map(r=>{let a=r.slice(0,i).join(""),c=Math.max(0,e-n-a.length);return` ${b.fg("accent",a)}${" ".repeat(c)}`});let s="ARMIN SAYS HI",o=Math.max(0,e-n-s.length);return this.cachedLines.push(` ${b.fg("accent",s)}${" ".repeat(o)}`),this.cachedWidth=e,this.cachedVersion=this.gridVersion,this.cachedLines}createEmptyGrid(){return Array.from({length:gt},()=>Array(vn).fill(" "))}initEffect(){switch(this.effect){case"typewriter":this.effectState={pos:0};break;case"scanline":this.effectState={row:0};break;case"rain":this.effectState={drops:Array.from({length:vn},()=>({y:-Math.floor(Math.random()*gt*2),settled:0}))};break;case"fade":{let e=[];for(let n=0;n<gt;n++)for(let i=0;i<vn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}case"crt":this.effectState={expansion:0};break;case"glitch":this.effectState={phase:0,glitchFrames:8};break;case"dissolve":{this.currentGrid=Array.from({length:gt},()=>Array.from({length:vn},()=>{let n=[" ","\u2591","\u2592","\u2593","\u2588","\u2580","\u2584"];return n[Math.floor(Math.random()*n.length)]}));let e=[];for(let n=0;n<gt;n++)for(let i=0;i<vn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}}}startAnimation(){let e=this.effect==="glitch"?60:30;this.interval=setInterval(()=>{let n=this.tickEffect();this.updateDisplay(),this.ui.requestRender(),n&&this.stopAnimation()},1e3/e)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}tickEffect(){switch(this.effect){case"typewriter":return this.tickTypewriter();case"scanline":return this.tickScanline();case"rain":return this.tickRain();case"fade":return this.tickFade();case"crt":return this.tickCrt();case"glitch":return this.tickGlitch();case"dissolve":return this.tickDissolve();default:return!0}}tickTypewriter(){let e=this.effectState,n=3;for(let i=0;i<n;i++){let s=Math.floor(e.pos/vn),o=e.pos%vn;if(s>=gt)return!0;this.currentGrid[s][o]=this.finalGrid[s][o],e.pos++}return!1}tickScanline(){let e=this.effectState;if(e.row>=gt)return!0;for(let n=0;n<vn;n++)this.currentGrid[e.row][n]=this.finalGrid[e.row][n];return e.row++,!1}tickRain(){let e=this.effectState,n=!0;this.currentGrid=this.createEmptyGrid();for(let i=0;i<vn;i++){let s=e.drops[i];for(let r=gt-1;r>=gt-s.settled;r--)r>=0&&(this.currentGrid[r][i]=this.finalGrid[r][i]);if(s.settled>=gt)continue;n=!1;let o=-1;for(let r=gt-1-s.settled;r>=0;r--)if(this.finalGrid[r][i]!==" "){o=r;break}s.y++,s.y>=0&&s.y<gt&&(o>=0&&s.y>=o?(s.settled=gt-o,s.y=-Math.floor(Math.random()*5)-1):this.currentGrid[s.y][i]="\u2593")}return n}tickFade(){let e=this.effectState,n=15;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,o]=e.positions[e.idx];this.currentGrid[s][o]=this.finalGrid[s][o],e.idx++}return!1}tickCrt(){let e=this.effectState,n=Math.floor(gt/2);this.currentGrid=this.createEmptyGrid();let i=n-e.expansion,s=n+e.expansion;for(let o=Math.max(0,i);o<=Math.min(gt-1,s);o++)for(let r=0;r<vn;r++)this.currentGrid[o][r]=this.finalGrid[o][r];return e.expansion++,e.expansion>gt}tickGlitch(){let e=this.effectState;return e.phase<e.glitchFrames?(this.currentGrid=this.finalGrid.map(n=>{let i=Math.floor(Math.random()*7)-3,s=[...n];if(Math.random()<.3)return s.slice(i).concat(s.slice(0,i)).slice(0,vn);if(Math.random()<.2){let o=Math.floor(Math.random()*gt);return[...this.finalGrid[o]]}return s}),e.phase++,!1):(this.currentGrid=this.finalGrid.map(n=>[...n]),!0)}tickDissolve(){let e=this.effectState,n=20;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,o]=e.positions[e.idx];this.currentGrid[s][o]=this.finalGrid[s][o],e.idx++}return!1}updateDisplay(){this.gridVersion++}dispose(){this.stopAnimation()}};var L$="\x1B]133;A\x07",W$="\x1B]133;B\x07",U$="\x1B]133;C\x07",qi=class extends K{constructor(n,i=!1,s=Tt(),o="Thinking..."){super();this.hasToolCalls=!1;this.hideThinkingBlock=i,this.markdownTheme=s,this.hiddenThinkingLabel=o,this.contentContainer=new K,this.addChild(this.contentContainer),n&&this.updateContent(n)}invalidate(){super.invalidate(),this.lastMessage&&this.updateContent(this.lastMessage)}setHideThinkingBlock(n){this.hideThinkingBlock=n,this.lastMessage&&this.updateContent(this.lastMessage)}setHiddenThinkingLabel(n){this.hiddenThinkingLabel=n,this.lastMessage&&this.updateContent(this.lastMessage)}render(n){let i=super.render(n);return this.hasToolCalls||i.length===0||(i[0]=L$+i[0],i[i.length-1]=W$+U$+i[i.length-1]),i}updateContent(n){this.lastMessage=n,this.contentContainer.clear();let i=n.content.some(o=>o.type==="text"&&o.text.trim()||o.type==="thinking"&&o.thinking.trim());i&&this.contentContainer.addChild(new U(1));for(let o=0;o<n.content.length;o++){let r=n.content[o];if(r.type==="text"&&r.text.trim())this.contentContainer.addChild(new ze(r.text.trim(),1,0,this.markdownTheme));else if(r.type==="thinking"&&r.thinking.trim()){let a=n.content.slice(o+1).some(c=>c.type==="text"&&c.text.trim()||c.type==="thinking"&&c.thinking.trim());this.hideThinkingBlock?(this.contentContainer.addChild(new A(b.italic(b.fg("thinkingText",this.hiddenThinkingLabel)),1,0)),a&&this.contentContainer.addChild(new U(1))):(this.contentContainer.addChild(new ze(r.thinking.trim(),1,0,this.markdownTheme,{color:c=>b.fg("thinkingText",c),italic:!0})),a&&this.contentContainer.addChild(new U(1)))}}let s=n.content.some(o=>o.type==="toolCall");if(this.hasToolCalls=s,!s){if(n.stopReason==="aborted"){let o=n.errorMessage&&n.errorMessage!=="Request was aborted"?n.errorMessage:"Operation aborted";i?this.contentContainer.addChild(new U(1)):this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("error",o),1,0))}else if(n.stopReason==="error"){let o=n.errorMessage||"Unknown error";this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("error",`Error: ${o}`),1,0))}}}};var x1=20,_s=class extends K{constructor(n,i,s=!1){super();this.outputLines=[];this.status="running";this.exitCode=void 0;this.expanded=!1;this.command=n;let o=s?"dim":"bashMode",r=c=>b.fg(o,c);this.addChild(new U(1)),this.addChild(new V(r)),this.contentContainer=new K,this.addChild(this.contentContainer);let a=new A(b.fg(o,b.bold(`$ ${n}`)),1,0);this.contentContainer.addChild(a),this.loader=new Jt(i,c=>b.fg(o,c),c=>b.fg("muted",c),`Running... (${he("tui.select.cancel")} to cancel)`),this.contentContainer.addChild(this.loader),this.addChild(new V(r))}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}appendOutput(n){let s=ul(n).replace(/\r\n/g,`
|
|
@@ -313,7 +313,7 @@ Pi will resume when the editor exits.
|
|
|
313
313
|
`),await new Promise(c=>{let l=N$(o,[...r,s],{stdio:"inherit",shell:process.platform==="win32"});l.on("error",()=>c(null)),l.on("close",d=>c(d))})===0){let c=Ga.readFileSync(s,"utf-8").replace(/\n$/,"");this.editor.setText(c)}}finally{try{Ga.unlinkSync(s)}catch{}this.tui.start(),this.tui.requestRender(!0)}}};var Ka=class extends K{constructor(n,i,s,o,r){super();this._focused=!1;this.onSubmitCallback=s,this.onCancelCallback=o,this.baseTitle=n,this.addChild(new V),this.addChild(new U(1)),this.titleText=new A(b.fg("accent",n),1,0),this.addChild(this.titleText),this.addChild(new U(1)),r?.timeout&&r.timeout>0&&r.tui&&(this.countdown=new Es(r.timeout,r.tui,a=>this.titleText.setText(b.fg("accent",`${this.baseTitle} (${a}s)`)),()=>this.onCancelCallback())),this.input=new Je,this.addChild(this.input),this.addChild(new U(1)),this.addChild(new A(`${ce("tui.select.confirm","submit")} ${ce("tui.select.cancel","cancel")}`,1,0)),this.addChild(new U(1)),this.addChild(new V)}get focused(){return this._focused}set focused(n){this._focused=n,this.input.focused=n}handleInput(n){let i=ve();i.matches(n,"tui.select.confirm")||n===`
|
|
314
314
|
`?this.onSubmitCallback(this.input.getValue()):i.matches(n,"tui.select.cancel")?this.onCancelCallback():this.input.handleInput(n)}dispose(){this.countdown?.dispose()}};var Gi=class extends K{constructor(n,i,s,o,r){super();this.selectedIndex=0;this.options=i,this.onSelectCallback=s,this.onCancelCallback=o,this.onToggleToolsExpanded=r?.onToggleToolsExpanded,this.baseTitle=n,this.addChild(new V),this.addChild(new U(1)),this.titleText=new A(b.fg("accent",b.bold(n)),1,0),this.addChild(this.titleText),this.addChild(new U(1)),r?.timeout&&r.timeout>0&&r.tui&&(this.countdown=new Es(r.timeout,r.tui,a=>this.titleText.setText(b.fg("accent",b.bold(`${this.baseTitle} (${a}s)`))),()=>this.onCancelCallback())),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.addChild(new A(dt("\u2191\u2193","navigate")+" "+ce("tui.select.confirm","select")+" "+ce("tui.select.cancel","cancel"),1,0)),this.addChild(new U(1)),this.addChild(new V),this.updateList()}updateList(){this.listContainer.clear();for(let n=0;n<this.options.length;n++){let s=n===this.selectedIndex?b.fg("accent","\u2192 ")+b.fg("accent",this.options[n]):` ${b.fg("text",this.options[n])}`;this.listContainer.addChild(new A(s,1,0))}}handleInput(n){let i=ve();if(i.matches(n,"app.tools.expand"))this.onToggleToolsExpanded?.();else if(i.matches(n,"tui.select.up")||n==="k")this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList();else if(i.matches(n,"tui.select.down")||n==="j")this.selectedIndex=Math.min(this.options.length-1,this.selectedIndex+1),this.updateList();else if(i.matches(n,"tui.select.confirm")||n===`
|
|
315
315
|
`){let s=this.options[this.selectedIndex];s&&this.onSelectCallback(s)}else i.matches(n,"tui.select.cancel")&&this.onCancelCallback()}dispose(){this.countdown?.dispose()}};function j$(t){return t.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function Ha(t){return t<1e3?t.toString():t<1e4?`${(t/1e3).toFixed(1)}k`:t<1e6?`${Math.round(t/1e3)}k`:t<1e7?`${(t/1e6).toFixed(1)}M`:`${Math.round(t/1e6)}M`}var za=class{constructor(e,n){this.autoCompactEnabled=!0;this.session=e,this.footerData=n}setSession(e){this.session=e}setAutoCompactEnabled(e){this.autoCompactEnabled=e}invalidate(){}dispose(){}render(e){let n=this.session.state,i=0,s=0,o=0,r=0,a=0;for(let pe of this.session.sessionManager.getEntries())pe.type==="message"&&pe.message.role==="assistant"&&(i+=pe.message.usage.input,s+=pe.message.usage.output,o+=pe.message.usage.cacheRead,r+=pe.message.usage.cacheWrite,a+=pe.message.usage.cost.total);let c=this.session.getContextUsage(),l=c?.contextWindow??n.model?.contextWindow??0,d=c?.percent??0,u=c?.percent!==null?d.toFixed(1):"?",p=this.session.sessionManager.getCwd(),m=process.env.HOME||process.env.USERPROFILE;m&&p.startsWith(m)&&(p=`~${p.slice(m.length)}`);let g=this.footerData.getGitBranch();g&&(p=`${p} (${g})`);let h=this.session.sessionManager.getSessionName();h&&(p=`${p} \u2022 ${h}`);let f=[];i&&f.push(`\u2191${Ha(i)}`),s&&f.push(`\u2193${Ha(s)}`),o&&f.push(`R${Ha(o)}`),r&&f.push(`W${Ha(r)}`);let x=n.model?this.session.modelRegistry.isUsingOAuth(n.model):!1;if(a||x){let pe=`$${a.toFixed(3)}${x?" (sub)":""}`;f.push(pe)}let y,w=this.autoCompactEnabled?" (auto)":"",P=u==="?"?`?/${Ha(l)}${w}`:`${u}%/${Ha(l)}${w}`;d>90?y=b.fg("error",P):d>70?y=b.fg("warning",P):y=P,f.push(y);let _=f.join(" "),R=n.model?.id||"no-model",L=j(_);L>e&&(_=X(_,e,"..."),L=j(_));let E=2,W=R;if(n.model?.reasoning){let pe=n.thinkingLevel||"off";W=pe==="off"?`${R} \u2022 thinking off`:`${R} \u2022 ${pe}`}let M=W;this.footerData.getAvailableProviderCount()>1&&n.model&&(M=`(${n.model.provider}) ${W}`,L+E+j(M)>e&&(M=W));let I=j(M),O=L+E+I,F;if(O<=e){let pe=" ".repeat(e-L-I);F=_+pe+M}else{let pe=e-L-E;if(pe>0){let Ie=X(M,pe,""),et=j(Ie),Fe=" ".repeat(Math.max(0,e-L-et));F=_+Fe+Ie}else F=_}let N=b.fg("dim",_),H=F.slice(_.length),G=b.fg("dim",H),de=[X(b.fg("dim",p),e,b.fg("dim","...")),N+G],Te=this.footerData.getExtensionStatuses();if(Te.size>0){let Ie=Array.from(Te.entries()).sort(([et],[Fe])=>et.localeCompare(Fe)).map(([,et])=>j$(et)).join(" ");de.push(X(Ie,e,b.fg("dim","...")))}return de}};import{exec as q$}from"child_process";var Os=class extends K{constructor(n,i,s,o,r){super();this.abortController=new AbortController;this._focused=!1;this.tui=n,this.onComplete=s;let a=Pf().find(d=>d.id===i),c=o||a?.name||i,l=r??`Login to ${c}`;this.addChild(new V),this.addChild(new A(b.fg("accent",b.bold(l)),1,0)),this.contentContainer=new K,this.addChild(this.contentContainer),this.input=new Je,this.input.onSubmit=()=>{this.inputResolver&&(this.inputResolver(this.input.getValue()),this.inputResolver=void 0,this.inputRejecter=void 0)},this.input.onEscape=()=>{this.cancel()},this.addChild(new V)}get focused(){return this._focused}set focused(n){this._focused=n,this.input.focused=n}get signal(){return this.abortController.signal}cancel(){this.abortController.abort(),this.inputRejecter&&(this.inputRejecter(new Error("Login cancelled")),this.inputResolver=void 0,this.inputRejecter=void 0),this.onComplete(!1,"Login cancelled")}showAuth(n,i){this.contentContainer.clear(),this.contentContainer.addChild(new U(1));let s=`\x1B]8;;${n}\x07${n}\x1B]8;;\x07`;this.contentContainer.addChild(new A(b.fg("accent",s),1,0));let o=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",r=`\x1B]8;;${n}\x07${o}\x1B]8;;\x07`;this.contentContainer.addChild(new A(b.fg("dim",r),1,0)),i&&(this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("warning",i),1,0)));let a=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";q$(`${a} "${n}"`),this.tui.requestRender()}showManualInput(n){return this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("dim",n),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new A(`(${ce("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender(),new Promise((i,s)=>{this.inputResolver=i,this.inputRejecter=s})}showPrompt(n,i){return this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("text",n),1,0)),i&&this.contentContainer.addChild(new A(b.fg("dim",`e.g., ${i}`),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new A(`(${ce("tui.select.cancel","to cancel,")} ${ce("tui.select.confirm","to submit")})`,1,0)),this.input.setValue(""),this.tui.requestRender(),new Promise((s,o)=>{this.inputResolver=s,this.inputRejecter=o})}showInfo(n){this.contentContainer.clear(),this.contentContainer.addChild(new U(1));for(let i of n)this.contentContainer.addChild(new A(i,1,0));this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(`(${ce("tui.select.cancel","to close")})`,1,0)),this.tui.requestRender()}showWaiting(n){this.contentContainer.addChild(new U(1)),this.contentContainer.addChild(new A(b.fg("dim",n),1,0)),this.contentContainer.addChild(new A(`(${ce("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender()}showProgress(n){this.contentContainer.addChild(new A(b.fg("dim",n),1,0)),this.tui.requestRender()}handleInput(n){if(ve().matches(n,"tui.select.cancel")){this.cancel();return}this.input.handleInput(n)}};var Va=class extends K{constructor(n,i,s,o,r,a,c,l){super();this._focused=!1;this.allModels=[];this.scopedModelItems=[];this.activeModels=[];this.filteredModels=[];this.selectedIndex=0;this.scope="all";if(this.tui=n,this.currentModel=i,this.settingsManager=s,this.modelRegistry=o,this.scopedModels=r,this.scope=r.length>0?"scoped":"all",this.onSelectCallback=a,this.onCancelCallback=c,this.addChild(new V),this.addChild(new U(1)),r.length>0)this.scopeText=new A(this.getScopeText(),0,0),this.addChild(this.scopeText),this.scopeHintText=new A(this.getScopeHintText(),0,0),this.addChild(this.scopeHintText);else{let d="Only showing models from configured providers. Use /login to add providers.";this.addChild(new A(b.fg("warning",d),0,0))}this.addChild(new U(1)),this.searchInput=new Je,l&&this.searchInput.setValue(l),this.searchInput.onSubmit=()=>{this.filteredModels[this.selectedIndex]&&this.handleSelect(this.filteredModels[this.selectedIndex].model)},this.addChild(this.searchInput),this.addChild(new U(1)),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.addChild(new V),this.loadModels().then(()=>{l?this.filterModels(l):this.updateList(),this.tui.requestRender()})}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}async loadModels(){let n;this.modelRegistry.refresh();let i=this.modelRegistry.getError();i&&(this.errorMessage=i);try{n=(await this.modelRegistry.getAvailable()).map(r=>({provider:r.provider,id:r.id,model:r}))}catch(o){this.allModels=[],this.scopedModelItems=[],this.activeModels=[],this.filteredModels=[],this.errorMessage=o instanceof Error?o.message:String(o);return}this.allModels=this.sortModels(n),this.scopedModels=this.scopedModels.map(o=>{let r=this.modelRegistry.find(o.model.provider,o.model.id);return r?{...o,model:r}:o}),this.scopedModelItems=this.scopedModels.map(o=>({provider:o.model.provider,id:o.model.id,model:o.model})),this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels,this.filteredModels=this.activeModels;let s=this.filteredModels.findIndex(o=>Kn(this.currentModel,o.model));this.selectedIndex=s>=0?s:Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1))}sortModels(n){let i=[...n];return i.sort((s,o)=>{let r=Kn(this.currentModel,s.model),a=Kn(this.currentModel,o.model);return r&&!a?-1:!r&&a?1:s.provider.localeCompare(o.provider)}),i}getScopeText(){let n=this.scope==="all"?b.fg("accent","all"):b.fg("muted","all"),i=this.scope==="scoped"?b.fg("accent","scoped"):b.fg("muted","scoped");return`${b.fg("muted","Scope: ")}${n}${b.fg("muted"," | ")}${i}`}getScopeHintText(){return ce("tui.input.tab","scope")+b.fg("muted"," (all/scoped)")}setScope(n){if(this.scope===n)return;this.scope=n,this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels;let i=this.activeModels.findIndex(s=>Kn(this.currentModel,s.model));this.selectedIndex=i>=0?i:0,this.filterModels(this.searchInput.getValue()),this.scopeText&&this.scopeText.setText(this.getScopeText())}filterModels(n){this.filteredModels=n?Kt(this.activeModels,n,({id:i,provider:s})=>`${i} ${s} ${s}/${i} ${s} ${i}`):this.activeModels,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1)),this.updateList()}updateList(){this.listContainer.clear();let n=10,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredModels.length-n)),s=Math.min(i+n,this.filteredModels.length);for(let o=i;o<s;o++){let r=this.filteredModels[o];if(!r)continue;let a=o===this.selectedIndex,c=Kn(this.currentModel,r.model),l="";if(a){let d=b.fg("accent","\u2192 "),u=`${r.id}`,p=b.fg("muted",`[${r.provider}]`),m=c?b.fg("success"," \u2713"):"";l=`${d+b.fg("accent",u)} ${p}${m}`}else{let d=` ${r.id}`,u=b.fg("muted",`[${r.provider}]`),p=c?b.fg("success"," \u2713"):"";l=`${d} ${u}${p}`}this.listContainer.addChild(new A(l,0,0))}if(i>0||s<this.filteredModels.length){let o=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredModels.length})`);this.listContainer.addChild(new A(o,0,0))}if(this.errorMessage){let o=this.errorMessage.split(`
|
|
316
|
-
`);for(let r of o)this.listContainer.addChild(new A(b.fg("error",r),0,0))}else if(this.filteredModels.length===0)this.listContainer.addChild(new A(b.fg("muted"," No matching models"),0,0));else{let o=this.filteredModels[this.selectedIndex];this.listContainer.addChild(new U(1)),this.listContainer.addChild(new A(b.fg("muted",` Model Name: ${o.model.name}`),0,0))}}handleInput(n){let i=ve();if(i.matches(n,"tui.input.tab")){if(this.scopedModelItems.length>0){let s=this.scope==="all"?"scoped":"all";this.setScope(s),this.scopeHintText&&this.scopeHintText.setText(this.getScopeHintText())}return}if(i.matches(n,"tui.select.up")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredModels.length-1:this.selectedIndex-1,this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredModels.length-1?0:this.selectedIndex+1,this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredModels[this.selectedIndex];s&&this.handleSelect(s.model)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterModels(this.searchInput.getValue()))}handleSelect(n){this.settingsManager.setDefaultModelAndProvider(n.provider,n.id),this.onSelectCallback(n)}getSearchInput(){return this.searchInput}};var Ro=class extends K{constructor(n,i,s,o,r,a){super();this._focused=!1;this.selectedIndex=0;this.mode=n,this.authStorage=i,this.getAuthStatus=a??(l=>this.authStorage.getAuthStatus(l)),this.allProviders=s,this.filteredProviders=s,this.onSelectCallback=o,this.onCancelCallback=r,this.addChild(new V),this.addChild(new U(1));let c=n==="login"?"Select provider to configure:":"Select provider to logout:";this.addChild(new Yt(b.fg("accent",b.bold(c)),1,0)),this.addChild(new U(1)),this.searchInput=new Je,this.searchInput.onSubmit=()=>{let l=this.filteredProviders[this.selectedIndex];l&&this.onSelectCallback(l.id)},this.addChild(this.searchInput),this.addChild(new U(1)),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.addChild(new V),this.filterProviders("")}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}filterProviders(n){this.filteredProviders=n?Kt(this.allProviders,n,i=>`${i.name} ${i.id} ${i.authType}`):this.allProviders,this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,this.filteredProviders.length-1))),this.updateList()}updateList(){this.listContainer.clear();let n=8,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredProviders.length-n)),s=Math.min(i+n,this.filteredProviders.length);for(let o=i;o<s;o++){let r=this.filteredProviders[o];if(!r)continue;let a=o===this.selectedIndex,c=this.formatStatusIndicator(r),l="";if(a){let d=b.fg("accent","\u2192 "),u=b.fg("accent",r.name);l=d+u+c}else l=` ${b.fg("text",r.name)}`+c;this.listContainer.addChild(new Yt(l,1,0))}if(i>0||s<this.filteredProviders.length){let o=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredProviders.length})`);this.listContainer.addChild(new Yt(o,1,0))}if(this.filteredProviders.length===0){let o=this.allProviders.length===0?this.mode==="login"?"No providers available":"No providers logged in. Use /login first.":"No matching providers";this.listContainer.addChild(new Yt(b.fg("muted",` ${o}`),1,0))}}formatStatusIndicator(n){let i=this.authStorage.get(n.id);if(i?.type===n.authType)return b.fg("success"," \u2713 configured");if(i){let o=i.type==="oauth"?"subscription configured":"API key configured";return b.fg("muted"," \u2022 ")+b.fg("warning",o)}if(n.authType!=="api_key")return b.fg("muted"," \u2022 unconfigured");let s=this.getAuthStatus(n.id);switch(s.source){case"environment":return b.fg("success",` \u2713 env: ${s.label??"API key"}`);case"runtime":return b.fg("success"," \u2713 runtime API key");case"fallback":return b.fg("success"," \u2713 custom API key");case"models_json_key":return b.fg("success"," \u2713 key in models.json");case"models_json_command":return b.fg("success"," \u2713 command in models.json");default:return b.fg("muted"," \u2022 unconfigured")}}handleInput(n){let i=ve();if(i.matches(n,"tui.select.up")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.min(this.filteredProviders.length-1,this.selectedIndex+1),this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredProviders[this.selectedIndex];s&&this.onSelectCallback(s.id)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterProviders(this.searchInput.getValue()))}};function A0(t,e){return t===null||t.includes(e)}function G$(t,e){if(t===null)return[e];let n=t.indexOf(e);return n>=0?[...t.slice(0,n),...t.slice(n+1)]:[...t,e]}function M1(t,e,n){if(t===null)return null;let i=n??e,s=[...t];for(let o of i)s.includes(o)||s.push(o);return s.length===e.length?null:s}function I1(t,e,n){if(t===null)return n?e.filter(s=>!n.includes(s)):[];let i=new Set(n??t);return t.filter(s=>!i.has(s))}function K$(t,e,n){if(t===null)return null;let i=[...t],s=i.indexOf(e);if(s<0)return i;let o=s+n;if(o<0||o>=i.length)return i;let r=[...i];return[r[s],r[o]]=[r[o],r[s]],r}function H$(t,e){if(t===null)return e;let n=new Set(t);return[...t,...e.filter(i=>!n.has(i))]}var Fl=class extends K{constructor(n,i){super();this.modelsById=new Map;this.allIds=[];this.enabledIds=null;this.filteredItems=[];this.selectedIndex=0;this._focused=!1;this.maxVisible=8;this.isDirty=!1;this.callbacks=i;for(let s of n.allModels){let o=`${s.provider}/${s.id}`;this.modelsById.set(o,s),this.allIds.push(o)}this.enabledIds=n.enabledModelIds===null?null:[...n.enabledModelIds],this.filteredItems=this.buildItems(),this.addChild(new V),this.addChild(new U(1)),this.addChild(new A(b.fg("accent",b.bold("Model Configuration")),0,0)),this.addChild(new A(b.fg("muted",`Session-only. ${he("app.models.save")} to save to settings.`),0,0)),this.addChild(new U(1)),this.searchInput=new Je,this.addChild(this.searchInput),this.addChild(new U(1)),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.footerText=new A(this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new V),this.updateList()}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}buildItems(){return H$(this.enabledIds,this.allIds).filter(n=>this.modelsById.has(n)).map(n=>({fullId:n,model:this.modelsById.get(n),enabled:A0(this.enabledIds,n)}))}getFooterText(){let n=this.enabledIds?.length??this.allIds.length,s=this.enabledIds===null?"all enabled":`${n}/${this.allIds.length} enabled`,o=[`${he("tui.select.confirm")} toggle`,`${he("app.models.enableAll")} all`,`${he("app.models.clearAll")} clear`,`${he("app.models.toggleProvider")} provider`,`${he("app.models.reorderUp")}/${he("app.models.reorderDown")} reorder`,`${he("app.models.save")} save`,s];return this.isDirty?b.fg("dim",` ${o.join(" \xB7 ")} `)+b.fg("warning","(unsaved)"):b.fg("dim",` ${o.join(" \xB7 ")}`)}refresh(){let n=this.searchInput.getValue(),i=this.buildItems();this.filteredItems=n?Kt(i,n,s=>`${s.model.id} ${s.model.provider}`):i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(this.getFooterText())}notifyChange(){this.callbacks.onChange(this.enabledIds===null?null:[...this.enabledIds])}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new A(b.fg("muted"," No matching models"),0,0));return}let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),i=Math.min(n+this.maxVisible,this.filteredItems.length),s=this.enabledIds===null;for(let o=n;o<i;o++){let r=this.filteredItems[o],a=o===this.selectedIndex,c=a?b.fg("accent","\u2192 "):" ",l=a?b.fg("accent",r.model.id):r.model.id,d=b.fg("muted",` [${r.model.provider}]`),u=s?"":r.enabled?b.fg("success"," \u2713"):b.fg("dim"," \u2717");this.listContainer.addChild(new A(`${c}${l}${d}${u}`,0,0))}if((n>0||i<this.filteredItems.length)&&this.listContainer.addChild(new A(b.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let o=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new U(1)),this.listContainer.addChild(new A(b.fg("muted",` Model Name: ${o.model.name}`),0,0))}}handleInput(n){let i=ve();if(i.matches(n,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(i.matches(n,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}let s=i.matches(n,"app.models.reorderUp"),o=i.matches(n,"app.models.reorderDown");if(s||o){if(this.enabledIds===null)return;let r=this.filteredItems[this.selectedIndex];if(r&&A0(this.enabledIds,r.fullId)){let a=s?-1:1,l=this.enabledIds.indexOf(r.fullId)+a;l>=0&&l<this.enabledIds.length&&(this.enabledIds=K$(this.enabledIds,r.fullId,a),this.isDirty=!0,this.selectedIndex+=a,this.refresh(),this.notifyChange())}return}if(i.matches(n,"tui.select.confirm")){let r=this.filteredItems[this.selectedIndex];r&&(this.enabledIds=G$(this.enabledIds,r.fullId),this.isDirty=!0,this.refresh(),this.notifyChange());return}if(i.matches(n,"app.models.enableAll")){let r=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=M1(this.enabledIds,this.allIds,r),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.clearAll")){let r=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=I1(this.enabledIds,this.allIds,r),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.toggleProvider")){let r=this.filteredItems[this.selectedIndex];if(r){let a=r.model.provider,c=this.allIds.filter(d=>this.modelsById.get(d).provider===a),l=c.every(d=>A0(this.enabledIds,d));this.enabledIds=l?I1(this.enabledIds,this.allIds,c):M1(this.enabledIds,this.allIds,c),this.isDirty=!0,this.refresh(),this.notifyChange()}return}if(i.matches(n,"app.models.save")){this.callbacks.onPersist(this.enabledIds===null?null:[...this.enabledIds]),this.isDirty=!1,this.footerText.setText(this.getFooterText());return}if(Pe(n,ro.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Pe(n,ro.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(n),this.refresh()}getSearchInput(){return this.searchInput}};var z$={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},V$={off:"No reasoning",minimal:"Very brief reasoning (~1k tokens)",low:"Light reasoning (~2k tokens)",medium:"Moderate reasoning (~8k tokens)",high:"Deep reasoning (~16k tokens)",xhigh:"Maximum reasoning (~32k tokens)"},O0=class extends K{constructor(e,n,i){super(),this.state={...e};let s=[{id:"anthropic-extra-usage",label:"Anthropic extra usage",description:"Warn when Anthropic subscription auth may use paid extra usage",currentValue:this.state.anthropicExtraUsage??!0?"true":"false",values:["true","false"]}];this.settingsList=new aa(s,Math.min(s.length,10),Fd(),(o,r)=>{switch(o){case"anthropic-extra-usage":this.state={...this.state,anthropicExtraUsage:r==="true"},n({...this.state});break}},i),this.addChild(this.settingsList)}handleInput(e){this.settingsList.handleInput(e)}},Dp=class extends K{constructor(e,n,i,s,o,r,a){super(),this.addChild(new A(b.bold(b.fg("accent",e)),0,0)),n&&(this.addChild(new U(1)),this.addChild(new A(b.fg("muted",n),0,0))),this.addChild(new U(1)),this.selectList=new Qt(i,Math.min(i.length,10),yo(),z$);let c=i.findIndex(l=>l.value===s);c!==-1&&this.selectList.setSelectedIndex(c),this.selectList.onSelect=l=>{o(l.value)},this.selectList.onCancel=r,a&&(this.selectList.onSelectionChange=l=>{a(l.value)}),this.addChild(this.selectList),this.addChild(new U(1)),this.addChild(new A(b.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(e){this.selectList.handleInput(e)}},Ja=class extends K{constructor(e,n){super();let i=ut().images,s=fl("app.message.followUp"),o={...e.warnings},r=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:e.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:e.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:`${s} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,currentValue:e.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:e.transport,values:["sse","websocket","websocket-cached","auto"]},{id:"http-idle-timeout",label:"HTTP idle timeout",description:"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.",currentValue:Pp(e.httpIdleTimeoutMs),values:Ip.map(g=>g.label)},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:e.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:e.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:e.quietStartup?"true":"false",values:["true","false"]},{id:"install-telemetry",label:"Install telemetry",description:"Send an anonymous version/update ping after changelog-detected updates",currentValue:e.enableInstallTelemetry?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:e.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:e.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"warnings",label:"Warnings",description:"Enable or disable individual warnings",currentValue:"configure",submenu:(g,h)=>new O0(o,f=>{o=f,n.onWarningsChange(f)},()=>h())},{id:"thinking",label:"Thinking level",description:"Reasoning depth for thinking-capable models",currentValue:e.thinkingLevel,submenu:(g,h)=>new Dp("Thinking Level","Select reasoning depth for thinking-capable models",e.availableThinkingLevels.map(f=>({value:f,label:f,description:V$[f]})),g,f=>{n.onThinkingLevelChange(f),h(f)},()=>h())},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:e.currentTheme,submenu:(g,h)=>new Dp("Theme","Select color theme",e.availableThemes.map(f=>({value:f,label:f})),g,f=>{n.onThemeChange(f),h(f)},()=>{n.onThemePreview?.(g),h()},f=>{n.onThemePreview?.(f)})}];i&&(r.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:e.showImages?"true":"false",values:["true","false"]}),r.splice(2,0,{id:"image-width-cells",label:"Image width",description:"Preferred inline image width in terminal cells",currentValue:String(e.imageWidthCells),values:["60","80","120"]})),r.splice(i?3:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:e.autoResizeImages?"true":"false",values:["true","false"]});let a=r.findIndex(g=>g.id==="auto-resize-images");r.splice(a+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:e.blockImages?"true":"false",values:["true","false"]});let c=r.findIndex(g=>g.id==="block-images");r.splice(c+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:e.enableSkillCommands?"true":"false",values:["true","false"]});let l=r.findIndex(g=>g.id==="skill-commands");r.splice(l+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:e.showHardwareCursor?"true":"false",values:["true","false"]});let d=r.findIndex(g=>g.id==="show-hardware-cursor");r.splice(d+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(e.editorPaddingX),values:["0","1","2","3"]});let u=r.findIndex(g=>g.id==="editor-padding");r.splice(u+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(e.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=r.findIndex(g=>g.id==="autocomplete-max-visible");r.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:e.clearOnShrink?"true":"false",values:["true","false"]});let m=r.findIndex(g=>g.id==="clear-on-shrink");r.splice(m+1,0,{id:"terminal-progress",label:"Terminal progress",description:"Show OSC 9;4 progress indicators in the terminal tab bar",currentValue:e.showTerminalProgress?"true":"false",values:["true","false"]}),this.addChild(new V),this.settingsList=new aa(r,10,Fd(),(g,h)=>{switch(g){case"autocompact":n.onAutoCompactChange(h==="true");break;case"show-images":n.onShowImagesChange(h==="true");break;case"image-width-cells":n.onImageWidthCellsChange(parseInt(h,10));break;case"auto-resize-images":n.onAutoResizeImagesChange(h==="true");break;case"block-images":n.onBlockImagesChange(h==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(h==="true");break;case"steering-mode":n.onSteeringModeChange(h);break;case"follow-up-mode":n.onFollowUpModeChange(h);break;case"transport":n.onTransportChange(h);break;case"http-idle-timeout":{let f=Ip.find(x=>x.label===h);f&&n.onHttpIdleTimeoutMsChange(f.timeoutMs);break}case"hide-thinking":n.onHideThinkingBlockChange(h==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(h==="true");break;case"quiet-startup":n.onQuietStartupChange(h==="true");break;case"install-telemetry":n.onEnableInstallTelemetryChange(h==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(h);break;case"tree-filter-mode":n.onTreeFilterModeChange(h);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(h==="true");break;case"editor-padding":n.onEditorPaddingXChange(parseInt(h,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(parseInt(h,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(h==="true");break;case"terminal-progress":n.onShowTerminalProgressChange(h==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new V)}getSettingsList(){return this.settingsList}};var Qa=class extends lt{constructor(n,i=Tt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.skillBlock=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){if(this.clear(),this.expanded){let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m");this.addChild(new A(n,0,0));let i=`**${this.skillBlock.name}**
|
|
316
|
+
`);for(let r of o)this.listContainer.addChild(new A(b.fg("error",r),0,0))}else if(this.filteredModels.length===0)this.listContainer.addChild(new A(b.fg("muted"," No matching models"),0,0));else{let o=this.filteredModels[this.selectedIndex];this.listContainer.addChild(new U(1)),this.listContainer.addChild(new A(b.fg("muted",` Model Name: ${o.model.name}`),0,0))}}handleInput(n){let i=ve();if(i.matches(n,"tui.input.tab")){if(this.scopedModelItems.length>0){let s=this.scope==="all"?"scoped":"all";this.setScope(s),this.scopeHintText&&this.scopeHintText.setText(this.getScopeHintText())}return}if(i.matches(n,"tui.select.up")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredModels.length-1:this.selectedIndex-1,this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredModels.length-1?0:this.selectedIndex+1,this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredModels[this.selectedIndex];s&&this.handleSelect(s.model)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterModels(this.searchInput.getValue()))}handleSelect(n){this.settingsManager.setDefaultModelAndProvider(n.provider,n.id),this.onSelectCallback(n)}getSearchInput(){return this.searchInput}};var Ro=class extends K{constructor(n,i,s,o,r,a){super();this._focused=!1;this.selectedIndex=0;this.mode=n,this.authStorage=i,this.getAuthStatus=a??(l=>this.authStorage.getAuthStatus(l)),this.allProviders=s,this.filteredProviders=s,this.onSelectCallback=o,this.onCancelCallback=r,this.addChild(new V),this.addChild(new U(1));let c=n==="login"?"Select provider to configure:":"Select provider to logout:";this.addChild(new Yt(b.fg("accent",b.bold(c)),1,0)),this.addChild(new U(1)),this.searchInput=new Je,this.searchInput.onSubmit=()=>{let l=this.filteredProviders[this.selectedIndex];l&&this.onSelectCallback(l.id)},this.addChild(this.searchInput),this.addChild(new U(1)),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.addChild(new V),this.filterProviders("")}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}filterProviders(n){this.filteredProviders=n?Kt(this.allProviders,n,i=>`${i.name} ${i.id} ${i.authType}`):this.allProviders,this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,this.filteredProviders.length-1))),this.updateList()}updateList(){this.listContainer.clear();let n=8,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredProviders.length-n)),s=Math.min(i+n,this.filteredProviders.length);for(let o=i;o<s;o++){let r=this.filteredProviders[o];if(!r)continue;let a=o===this.selectedIndex,c=this.formatStatusIndicator(r),l="";if(a){let d=b.fg("accent","\u2192 "),u=b.fg("accent",r.name);l=d+u+c}else l=` ${b.fg("text",r.name)}`+c;this.listContainer.addChild(new Yt(l,1,0))}if(i>0||s<this.filteredProviders.length){let o=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredProviders.length})`);this.listContainer.addChild(new Yt(o,1,0))}if(this.filteredProviders.length===0){let o=this.allProviders.length===0?this.mode==="login"?"No providers available":"No providers logged in. Use /login first.":"No matching providers";this.listContainer.addChild(new Yt(b.fg("muted",` ${o}`),1,0))}}formatStatusIndicator(n){let i=this.authStorage.get(n.id);if(i?.type===n.authType)return b.fg("success"," \u2713 configured");if(i){let o=i.type==="oauth"?"subscription configured":"API key configured";return b.fg("muted"," \u2022 ")+b.fg("warning",o)}if(n.authType!=="api_key")return b.fg("muted"," \u2022 unconfigured");let s=this.getAuthStatus(n.id);switch(s.source){case"environment":return b.fg("success",` \u2713 env: ${s.label??"API key"}`);case"runtime":return b.fg("success"," \u2713 runtime API key");case"fallback":return b.fg("success"," \u2713 custom API key");case"models_json_key":return b.fg("success"," \u2713 key in models.json");case"models_json_command":return b.fg("success"," \u2713 command in models.json");default:return b.fg("muted"," \u2022 unconfigured")}}handleInput(n){let i=ve();if(i.matches(n,"tui.select.up")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.min(this.filteredProviders.length-1,this.selectedIndex+1),this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredProviders[this.selectedIndex];s&&this.onSelectCallback(s.id)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterProviders(this.searchInput.getValue()))}};function A0(t,e){return t===null||t.includes(e)}function G$(t,e){if(t===null)return[e];let n=t.indexOf(e);return n>=0?[...t.slice(0,n),...t.slice(n+1)]:[...t,e]}function M1(t,e,n){if(t===null)return null;let i=n??e,s=[...t];for(let o of i)s.includes(o)||s.push(o);return s.length===e.length?null:s}function I1(t,e,n){if(t===null)return n?e.filter(s=>!n.includes(s)):[];let i=new Set(n??t);return t.filter(s=>!i.has(s))}function K$(t,e,n){if(t===null)return null;let i=[...t],s=i.indexOf(e);if(s<0)return i;let o=s+n;if(o<0||o>=i.length)return i;let r=[...i];return[r[s],r[o]]=[r[o],r[s]],r}function H$(t,e){if(t===null)return e;let n=new Set(t);return[...t,...e.filter(i=>!n.has(i))]}var Fl=class extends K{constructor(n,i){super();this.modelsById=new Map;this.allIds=[];this.enabledIds=null;this.filteredItems=[];this.selectedIndex=0;this._focused=!1;this.maxVisible=8;this.isDirty=!1;this.callbacks=i;for(let s of n.allModels){let o=`${s.provider}/${s.id}`;this.modelsById.set(o,s),this.allIds.push(o)}this.enabledIds=n.enabledModelIds===null?null:[...n.enabledModelIds],this.filteredItems=this.buildItems(),this.addChild(new V),this.addChild(new U(1)),this.addChild(new A(b.fg("accent",b.bold("Model Configuration")),0,0)),this.addChild(new A(b.fg("muted",`Session-only. ${he("app.models.save")} to save to settings.`),0,0)),this.addChild(new U(1)),this.searchInput=new Je,this.addChild(this.searchInput),this.addChild(new U(1)),this.listContainer=new K,this.addChild(this.listContainer),this.addChild(new U(1)),this.footerText=new A(this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new V),this.updateList()}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}buildItems(){return H$(this.enabledIds,this.allIds).filter(n=>this.modelsById.has(n)).map(n=>({fullId:n,model:this.modelsById.get(n),enabled:A0(this.enabledIds,n)}))}getFooterText(){let n=this.enabledIds?.length??this.allIds.length,s=this.enabledIds===null?"all enabled":`${n}/${this.allIds.length} enabled`,o=[`${he("tui.select.confirm")} toggle`,`${he("app.models.enableAll")} all`,`${he("app.models.clearAll")} clear`,`${he("app.models.toggleProvider")} provider`,`${he("app.models.reorderUp")}/${he("app.models.reorderDown")} reorder`,`${he("app.models.save")} save`,s];return this.isDirty?b.fg("dim",` ${o.join(" \xB7 ")} `)+b.fg("warning","(unsaved)"):b.fg("dim",` ${o.join(" \xB7 ")}`)}refresh(){let n=this.searchInput.getValue(),i=this.buildItems();this.filteredItems=n?Kt(i,n,s=>`${s.model.id} ${s.model.provider}`):i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(this.getFooterText())}notifyChange(){this.callbacks.onChange(this.enabledIds===null?null:[...this.enabledIds])}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new A(b.fg("muted"," No matching models"),0,0));return}let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),i=Math.min(n+this.maxVisible,this.filteredItems.length),s=this.enabledIds===null;for(let o=n;o<i;o++){let r=this.filteredItems[o],a=o===this.selectedIndex,c=a?b.fg("accent","\u2192 "):" ",l=a?b.fg("accent",r.model.id):r.model.id,d=b.fg("muted",` [${r.model.provider}]`),u=s?"":r.enabled?b.fg("success"," \u2713"):b.fg("dim"," \u2717");this.listContainer.addChild(new A(`${c}${l}${d}${u}`,0,0))}if((n>0||i<this.filteredItems.length)&&this.listContainer.addChild(new A(b.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let o=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new U(1)),this.listContainer.addChild(new A(b.fg("muted",` Model Name: ${o.model.name}`),0,0))}}handleInput(n){let i=ve();if(i.matches(n,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(i.matches(n,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}let s=i.matches(n,"app.models.reorderUp"),o=i.matches(n,"app.models.reorderDown");if(s||o){if(this.enabledIds===null)return;let r=this.filteredItems[this.selectedIndex];if(r&&A0(this.enabledIds,r.fullId)){let a=s?-1:1,l=this.enabledIds.indexOf(r.fullId)+a;l>=0&&l<this.enabledIds.length&&(this.enabledIds=K$(this.enabledIds,r.fullId,a),this.isDirty=!0,this.selectedIndex+=a,this.refresh(),this.notifyChange())}return}if(i.matches(n,"tui.select.confirm")){let r=this.filteredItems[this.selectedIndex];r&&(this.enabledIds=G$(this.enabledIds,r.fullId),this.isDirty=!0,this.refresh(),this.notifyChange());return}if(i.matches(n,"app.models.enableAll")){let r=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=M1(this.enabledIds,this.allIds,r),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.clearAll")){let r=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=I1(this.enabledIds,this.allIds,r),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.toggleProvider")){let r=this.filteredItems[this.selectedIndex];if(r){let a=r.model.provider,c=this.allIds.filter(d=>this.modelsById.get(d).provider===a),l=c.every(d=>A0(this.enabledIds,d));this.enabledIds=l?I1(this.enabledIds,this.allIds,c):M1(this.enabledIds,this.allIds,c),this.isDirty=!0,this.refresh(),this.notifyChange()}return}if(i.matches(n,"app.models.save")){this.callbacks.onPersist(this.enabledIds===null?null:[...this.enabledIds]),this.isDirty=!1,this.footerText.setText(this.getFooterText());return}if(Pe(n,ro.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Pe(n,ro.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(n),this.refresh()}getSearchInput(){return this.searchInput}};var z$={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},V$={off:"No reasoning",minimal:"Very brief reasoning (~1k tokens)",low:"Light reasoning (~2k tokens)",medium:"Moderate reasoning (~8k tokens)",high:"Deep reasoning (~16k tokens)",xhigh:"Maximum reasoning (~32k tokens)"},O0=class extends K{constructor(e,n,i){super(),this.state={...e};let s=[{id:"anthropic-extra-usage",label:"Anthropic extra usage",description:"Warn when Anthropic subscription auth may use paid extra usage",currentValue:this.state.anthropicExtraUsage??!0?"true":"false",values:["true","false"]}];this.settingsList=new aa(s,Math.min(s.length,10),Fd(),(o,r)=>{o==="anthropic-extra-usage"&&(this.state={...this.state,anthropicExtraUsage:r==="true"},n({...this.state}))},i),this.addChild(this.settingsList)}handleInput(e){this.settingsList.handleInput(e)}},Dp=class extends K{constructor(e,n,i,s,o,r,a){super(),this.addChild(new A(b.bold(b.fg("accent",e)),0,0)),n&&(this.addChild(new U(1)),this.addChild(new A(b.fg("muted",n),0,0))),this.addChild(new U(1)),this.selectList=new Qt(i,Math.min(i.length,10),yo(),z$);let c=i.findIndex(l=>l.value===s);c!==-1&&this.selectList.setSelectedIndex(c),this.selectList.onSelect=l=>{o(l.value)},this.selectList.onCancel=r,a&&(this.selectList.onSelectionChange=l=>{a(l.value)}),this.addChild(this.selectList),this.addChild(new U(1)),this.addChild(new A(b.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(e){this.selectList.handleInput(e)}},Ja=class extends K{constructor(e,n){super();let i=ut().images,s=fl("app.message.followUp"),o={...e.warnings},r=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:e.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:e.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:`${s} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,currentValue:e.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:e.transport,values:["sse","websocket","websocket-cached","auto"]},{id:"http-idle-timeout",label:"HTTP idle timeout",description:"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.",currentValue:Pp(e.httpIdleTimeoutMs),values:Ip.map(g=>g.label)},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:e.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:e.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:e.quietStartup?"true":"false",values:["true","false"]},{id:"install-telemetry",label:"Install telemetry",description:"Send an anonymous version/update ping after changelog-detected updates",currentValue:e.enableInstallTelemetry?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:e.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:e.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"warnings",label:"Warnings",description:"Enable or disable individual warnings",currentValue:"configure",submenu:(g,h)=>new O0(o,f=>{o=f,n.onWarningsChange(f)},()=>h())},{id:"thinking",label:"Thinking level",description:"Reasoning depth for thinking-capable models",currentValue:e.thinkingLevel,submenu:(g,h)=>new Dp("Thinking Level","Select reasoning depth for thinking-capable models",e.availableThinkingLevels.map(f=>({value:f,label:f,description:V$[f]})),g,f=>{n.onThinkingLevelChange(f),h(f)},()=>h())},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:e.currentTheme,submenu:(g,h)=>new Dp("Theme","Select color theme",e.availableThemes.map(f=>({value:f,label:f})),g,f=>{n.onThemeChange(f),h(f)},()=>{n.onThemePreview?.(g),h()},f=>{n.onThemePreview?.(f)})}];i&&(r.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:e.showImages?"true":"false",values:["true","false"]}),r.splice(2,0,{id:"image-width-cells",label:"Image width",description:"Preferred inline image width in terminal cells",currentValue:String(e.imageWidthCells),values:["60","80","120"]})),r.splice(i?3:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:e.autoResizeImages?"true":"false",values:["true","false"]});let a=r.findIndex(g=>g.id==="auto-resize-images");r.splice(a+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:e.blockImages?"true":"false",values:["true","false"]});let c=r.findIndex(g=>g.id==="block-images");r.splice(c+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:e.enableSkillCommands?"true":"false",values:["true","false"]});let l=r.findIndex(g=>g.id==="skill-commands");r.splice(l+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:e.showHardwareCursor?"true":"false",values:["true","false"]});let d=r.findIndex(g=>g.id==="show-hardware-cursor");r.splice(d+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(e.editorPaddingX),values:["0","1","2","3"]});let u=r.findIndex(g=>g.id==="editor-padding");r.splice(u+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(e.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=r.findIndex(g=>g.id==="autocomplete-max-visible");r.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:e.clearOnShrink?"true":"false",values:["true","false"]});let m=r.findIndex(g=>g.id==="clear-on-shrink");r.splice(m+1,0,{id:"terminal-progress",label:"Terminal progress",description:"Show OSC 9;4 progress indicators in the terminal tab bar",currentValue:e.showTerminalProgress?"true":"false",values:["true","false"]}),this.addChild(new V),this.settingsList=new aa(r,10,Fd(),(g,h)=>{switch(g){case"autocompact":n.onAutoCompactChange(h==="true");break;case"show-images":n.onShowImagesChange(h==="true");break;case"image-width-cells":n.onImageWidthCellsChange(parseInt(h,10));break;case"auto-resize-images":n.onAutoResizeImagesChange(h==="true");break;case"block-images":n.onBlockImagesChange(h==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(h==="true");break;case"steering-mode":n.onSteeringModeChange(h);break;case"follow-up-mode":n.onFollowUpModeChange(h);break;case"transport":n.onTransportChange(h);break;case"http-idle-timeout":{let f=Ip.find(x=>x.label===h);f&&n.onHttpIdleTimeoutMsChange(f.timeoutMs);break}case"hide-thinking":n.onHideThinkingBlockChange(h==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(h==="true");break;case"quiet-startup":n.onQuietStartupChange(h==="true");break;case"install-telemetry":n.onEnableInstallTelemetryChange(h==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(h);break;case"tree-filter-mode":n.onTreeFilterModeChange(h);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(h==="true");break;case"editor-padding":n.onEditorPaddingXChange(parseInt(h,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(parseInt(h,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(h==="true");break;case"terminal-progress":n.onShowTerminalProgressChange(h==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new V)}getSettingsList(){return this.settingsList}};var Qa=class extends lt{constructor(n,i=Tt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.skillBlock=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){if(this.clear(),this.expanded){let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m");this.addChild(new A(n,0,0));let i=`**${this.skillBlock.name}**
|
|
317
317
|
|
|
318
318
|
`;this.addChild(new ze(i+this.skillBlock.content,0,0,this.markdownTheme,{color:s=>b.fg("customMessageText",s)}))}else{let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+b.fg("customMessageText",this.skillBlock.name)+b.fg("dim",` (${he("app.tools.expand")} to expand)`);this.addChild(new A(n,0,0))}}};async function R1(t,e){if(e==="image/png")return{data:t,mimeType:e};let n=await Ma();if(!n)return null;try{let i=new Uint8Array(Buffer.from(t,"base64")),s=n.PhotonImage.new_from_byteslice(i),o=mp(n,s,i);o!==s&&s.free();try{let r=o.get_bytes();return{data:Buffer.from(r).toString("base64"),mimeType:"image/png"}}finally{o.free()}}catch{return null}}var fi=class extends K{constructor(n,i,s,o={},r,a,c){super();this.rendererState={};this.imageComponents=[];this.imageSpacers=[];this.expanded=!1;this.isPartial=!0;this.executionStarted=!1;this.argsComplete=!1;this.convertedImages=new Map;this.hideComponent=!1;this.toolName=n,this.toolCallId=i,this.args=s,this.toolDefinition=r,this.builtInToolDefinition=t0(c)[n],this.showImages=o.showImages??!0,this.imageWidthCells=o.imageWidthCells??60,this.ui=a,this.cwd=c,this.addChild(new U(1)),this.contentBox=new lt(1,1,l=>b.bg("toolPendingBg",l)),this.contentText=new A("",1,1,l=>b.bg("toolPendingBg",l)),this.selfRenderContainer=new K,this.hasRendererDefinition()?this.addChild(this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox):this.addChild(this.contentText),this.updateDisplay()}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderShell(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderShell??this.builtInToolDefinition.renderShell??"default":this.builtInToolDefinition.renderShell??"default":this.toolDefinition?.renderShell??"default"}getRenderContext(n){return{args:this.args,toolCallId:this.toolCallId,invalidate:()=>{this.invalidate(),this.ui.requestRender()},lastComponent:n,state:this.rendererState,cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1}}createCallFallback(){return new A(b.fg("toolTitle",b.bold(this.toolName)),0,0)}createResultFallback(){let n=this.getTextOutput();if(n)return new A(b.fg("toolOutput",n),0,0)}updateArgs(n){this.args=n,this.updateDisplay()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(n,i=!1){this.result=n,this.isPartial=i,this.updateDisplay(),this.maybeConvertImagesForKitty()}maybeConvertImagesForKitty(){if(ut().images!=="kitty"||!this.result)return;let i=this.result.content.filter(s=>s.type==="image");for(let s=0;s<i.length;s++){let o=i[s];if(!o.data||!o.mimeType||o.mimeType==="image/png"||this.convertedImages.has(s))continue;let r=s;R1(o.data,o.mimeType).then(a=>{a&&(this.convertedImages.set(r,a),this.updateDisplay(),this.ui.requestRender())})}}setExpanded(n){this.expanded=n,this.updateDisplay()}setShowImages(n){this.showImages=n,this.updateDisplay()}setImageWidthCells(n){this.imageWidthCells=Math.max(1,Math.floor(n)),this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(n){return this.hideComponent?[]:super.render(n)}updateDisplay(){let n=this.isPartial?s=>b.bg("toolPendingBg",s):this.result?.isError?s=>b.bg("toolErrorBg",s):s=>b.bg("toolSuccessBg",s),i=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){let s=this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox;s instanceof lt&&s.setBgFn(n),s.clear();let o=this.getCallRenderer();if(!o)s.addChild(this.createCallFallback()),i=!0;else try{let r=o(this.args,b,this.getRenderContext(this.callRendererComponent));this.callRendererComponent=r,s.addChild(r),i=!0}catch{this.callRendererComponent=void 0,s.addChild(this.createCallFallback()),i=!0}if(this.result){let r=this.getResultRenderer();if(r)try{let a=r({content:this.result.content,details:this.result.details},{expanded:this.expanded,isPartial:this.isPartial},b,this.getRenderContext(this.resultRendererComponent));this.resultRendererComponent=a,s.addChild(a),i=!0}catch{this.resultRendererComponent=void 0;let a=this.createResultFallback();a&&(s.addChild(a),i=!0)}else{let a=this.createResultFallback();a&&(s.addChild(a),i=!0)}}}else this.contentText.setCustomBgFn(n),this.contentText.setText(this.formatToolExecution()),i=!0;for(let s of this.imageComponents)this.removeChild(s);this.imageComponents=[];for(let s of this.imageSpacers)this.removeChild(s);if(this.imageSpacers=[],this.result){let s=this.result.content.filter(r=>r.type==="image"),o=ut();for(let r=0;r<s.length;r++){let a=s[r];if(o.images&&this.showImages&&a.data&&a.mimeType){let c=this.convertedImages.get(r),l=c?.data??a.data,d=c?.mimeType??a.mimeType;if(o.images==="kitty"&&d!=="image/png")continue;let u=new U(1);this.addChild(u),this.imageSpacers.push(u);let p=new uo(l,d,{fallbackColor:m=>b.fg("toolOutput",m)},{maxWidthCells:this.imageWidthCells});this.imageComponents.push(p),this.addChild(p)}}}this.hasRendererDefinition()&&!i&&this.imageComponents.length===0&&(this.hideComponent=!0)}getTextOutput(){return On(this.result,this.showImages)}formatToolExecution(){let n=b.fg("toolTitle",b.bold(this.toolName)),i=JSON.stringify(this.args,null,2);i&&(n+=`
|
|
319
319
|
|
|
@@ -429,7 +429,7 @@ ${b.bold("Cost")}
|
|
|
429
429
|
`;for(let[oi,jt]of Fe){let ne=jt.description??jt.extensionPath,be=gl(oi,{capitalize:!0});Ie+=`| \`${be}\` | ${ne} |
|
|
430
430
|
`}}this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new V),this.chatContainer.addChild(new A(b.bold(b.fg("accent","Keyboard Shortcuts")),1,0)),this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new ze(Ie.trim(),1,1,this.getMarkdownThemeWithSettings())),this.chatContainer.addChild(new V),this.ui.requestRender()}async handleClearCommand(){this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{if((await this.runtimeHost.newSession()).cancelled)return;this.renderCurrentSessionState(),this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new A(`${b.fg("accent","\u2713 New session started")}`,1,1)),this.ui.requestRender()}catch(e){await this.handleFatalRuntimeError("Failed to create session",e)}}handleDebugCommand(){let e=this.ui.terminal.columns,n=this.ui.terminal.rows,i=this.ui.render(e),s=yw(),o=[`Debug output at ${new Date().toISOString()}`,`Terminal: ${e}x${n}`,`Total lines: ${i.length}`,"","=== All rendered lines with visible widths ===",...i.map((r,a)=>{let c=j(r),l=JSON.stringify(r);return`[${a}] (w=${c}) ${l}`}),"","=== Agent messages (JSONL) ===",...this.session.messages.map(r=>JSON.stringify(r)),""].join(`
|
|
431
431
|
`);Xn.mkdirSync(Ve.dirname(s),{recursive:!0}),Xn.writeFileSync(s,o),this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new A(`${b.fg("accent","\u2713 Debug log written")}
|
|
432
|
-
${b.fg("muted",s)}`,1,1)),this.ui.requestRender()}handleArminSaysHi(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Da(this.ui)),this.ui.requestRender()}handleDementedDelves(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Fp),this.ui.requestRender()}handleDaxnuts(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Ul(this.ui)),this.ui.requestRender()}checkDaxnutsEasterEgg(e){e.provider==="opencode"&&e.id.toLowerCase().includes("kimi-k2.5")&&this.handleDaxnuts()}async handleBashCommand(e,n=!1){let s=await this.session.extensionRunner.emitUserBash({type:"user_bash",command:e,excludeFromContext:n,cwd:this.sessionManager.getCwd()});if(s?.result){let r=s.result;this.bashComponent=new _s(e,this.ui,n),this.session.isStreaming?(this.pendingMessagesContainer.addChild(this.bashComponent),this.pendingBashComponents.push(this.bashComponent)):this.chatContainer.addChild(this.bashComponent),r.output&&this.bashComponent.appendOutput(r.output),this.bashComponent.setComplete(r.exitCode,r.cancelled,r.truncated?{truncated:!0,content:r.output}:void 0,r.fullOutputPath),this.session.recordBashResult(e,r,{excludeFromContext:n}),this.bashComponent=void 0,this.ui.requestRender();return}let o=this.session.isStreaming;this.bashComponent=new _s(e,this.ui,n),o?(this.pendingMessagesContainer.addChild(this.bashComponent),this.pendingBashComponents.push(this.bashComponent)):this.chatContainer.addChild(this.bashComponent),this.ui.requestRender();try{let r=await this.session.executeBash(e,a=>{this.bashComponent&&(this.bashComponent.appendOutput(a),this.ui.requestRender())},{excludeFromContext:n,operations:s?.operations});this.bashComponent&&this.bashComponent.setComplete(r.exitCode,r.cancelled,r.truncated?{truncated:!0,content:r.output}:void 0,r.fullOutputPath)}catch(r){this.bashComponent&&this.bashComponent.setComplete(void 0,!1),this.showError(`Bash command failed: ${r instanceof Error?r.message:"Unknown error"}`)}this.bashComponent=void 0,this.ui.requestRender()}async handleCompactCommand(e){if(this.sessionManager.getEntries().filter(s=>s.type==="message").length<2){this.showWarning("Nothing to compact (no messages yet)");return}this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{await this.session.compact(e)}catch{}}stop(){this.unregisterSignalHandlers(),this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.clearExtensionTerminalInputListeners(),this.footer.dispose(),this.footerDataProvider.dispose(),this.unsubscribe&&this.unsubscribe(),this.isInitialized&&(this.ui.stop(),this.isInitialized=!1)}};import
|
|
432
|
+
${b.fg("muted",s)}`,1,1)),this.ui.requestRender()}handleArminSaysHi(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Da(this.ui)),this.ui.requestRender()}handleDementedDelves(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Fp),this.ui.requestRender()}handleDaxnuts(){this.chatContainer.addChild(new U(1)),this.chatContainer.addChild(new Ul(this.ui)),this.ui.requestRender()}checkDaxnutsEasterEgg(e){e.provider==="opencode"&&e.id.toLowerCase().includes("kimi-k2.5")&&this.handleDaxnuts()}async handleBashCommand(e,n=!1){let s=await this.session.extensionRunner.emitUserBash({type:"user_bash",command:e,excludeFromContext:n,cwd:this.sessionManager.getCwd()});if(s?.result){let r=s.result;this.bashComponent=new _s(e,this.ui,n),this.session.isStreaming?(this.pendingMessagesContainer.addChild(this.bashComponent),this.pendingBashComponents.push(this.bashComponent)):this.chatContainer.addChild(this.bashComponent),r.output&&this.bashComponent.appendOutput(r.output),this.bashComponent.setComplete(r.exitCode,r.cancelled,r.truncated?{truncated:!0,content:r.output}:void 0,r.fullOutputPath),this.session.recordBashResult(e,r,{excludeFromContext:n}),this.bashComponent=void 0,this.ui.requestRender();return}let o=this.session.isStreaming;this.bashComponent=new _s(e,this.ui,n),o?(this.pendingMessagesContainer.addChild(this.bashComponent),this.pendingBashComponents.push(this.bashComponent)):this.chatContainer.addChild(this.bashComponent),this.ui.requestRender();try{let r=await this.session.executeBash(e,a=>{this.bashComponent&&(this.bashComponent.appendOutput(a),this.ui.requestRender())},{excludeFromContext:n,operations:s?.operations});this.bashComponent&&this.bashComponent.setComplete(r.exitCode,r.cancelled,r.truncated?{truncated:!0,content:r.output}:void 0,r.fullOutputPath)}catch(r){this.bashComponent&&this.bashComponent.setComplete(void 0,!1),this.showError(`Bash command failed: ${r instanceof Error?r.message:"Unknown error"}`)}this.bashComponent=void 0,this.ui.requestRender()}async handleCompactCommand(e){if(this.sessionManager.getEntries().filter(s=>s.type==="message").length<2){this.showWarning("Nothing to compact (no messages yet)");return}this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{await this.session.compact(e)}catch{}}stop(){this.unregisterSignalHandlers(),this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.clearExtensionTerminalInputListeners(),this.footer.dispose(),this.footerDataProvider.dispose(),this.unsubscribe&&this.unsubscribe(),this.isInitialized&&(this.ui.stop(),this.isInitialized=!1)}};import pCe from"chalk";import jl from"node:path";import Hi from"node:fs";var Ki=null,Ls=null,Bl=process.env.SLINGSHOT_DEBUG==="true";function Nl(){return Bl}function O1(t){Bl=t,t?$0():Ki=null}function L1(){return Ki}function $0(){if(Bl)try{if(typeof process<"u"&&process.versions?.node){Ls=zu("fs");let t=zu("path"),e=zu("os"),n=process.env.SLINGSHOT_LOG_DIR||t.join(e.homedir(),".sling"),i=t.join(n,"logs","analytics");Ls.existsSync(i)||Ls.mkdirSync(i,{recursive:!0});let s=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);Ki=t.join(i,`${s}.log`);let o=`
|
|
433
433
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
434
434
|
\u2551 SLINGSHOT ANALYTICS DEBUG LOG \u2551
|
|
435
435
|
\u2551 Started: ${new Date().toISOString()} \u2551
|
|
@@ -441,7 +441,7 @@ Log file: ${Ki}
|
|
|
441
441
|
`;Ls.appendFileSync(Ki,n)}catch{}}function ft(t,e){if(!(!Ki||!Ls||!Bl))try{let i=`[${new Date().toISOString()}] ${t}:
|
|
442
442
|
${JSON.stringify(e,null,2)}
|
|
443
443
|
|
|
444
|
-
`;Ls.appendFileSync(Ki,i)}catch{}}var Ws=null;function W1(t){if(!t)return;let e=t.trim();if(e)return e.replace(/\/+$/,"")}var we=class t{static{this.BASE_URL="base_url"}static{this.ANALYTICS_DOMAIN="analytics_domain"}static{this.CLIENT_ID="client_id"}static{this.PROJECT_ID="project_id"}static{this.WORKSPACE_ID="workspace_id"}static{this.defaultValues={[t.BASE_URL]:"https://sapientaiproducts.com",[t.ANALYTICS_DOMAIN]:"https://slingshot.sapientaiproducts.com",[t.CLIENT_ID]:"b97fbef7-cad9-4e56-9850-39e86c8fdf61",[t.PROJECT_ID]:"fa8121c4-e2fc-48f1-9478-8949c04e13cc",[t.WORKSPACE_ID]:"6e5756eb-d7e2-4d80-ad07-9d7a51600d85"}}static{this.LOGIN_PATH="/web/v1/studio-auth/login"}static{this.EXCHANGE_PATH="/api/v1/studio-auth/auth/desktop/exchange"}static{this.REFRESH_PATH="/api/v3/auth/refreshtoken"}static{this.REFRESH_CLIENT_NAME="machine"}static{this.API_BASE_PATH="/api/v1/llm"}static{this.SAGE_EVENTS_PATH="/api/v1/ai-portal/sage_events"}static{this.APP_TOKEN_PATH="/api/v3/auth/app-token"}static{this.CONFIG_SERVICE_PATH="/api/v2/configservice/client"}static{this.APP_TOKEN_REFRESH_BUFFER_MS=60*1e3}static{this.SLINGSHOT_APP_TOKEN_ENV="SLINGSHOT_APP_TOKEN_HEADER"}static{this.TOKEN_EXPIRY_BUFFER_MS=300*1e3}static{this.SAPI="/save/api/v1"}static{this.CLIENT_NAME="desktop"}static defaults(e){return this.defaultValues[e]}static getSettingsPath(){let e=jl.resolve(process.cwd(),".sling","sling.settings.json");if(Hi.existsSync(e))return e;let n=Le();return jl.resolve(n,"sling.settings.json")}static getSettings(){if(!Ws){let i=this.getSettingsPath();try{if(Hi.existsSync(i)){let s=Hi.readFileSync(i,"utf-8"),o=JSON.parse(s)||{};Ws={...this.defaultValues,...o}}else{let s=jl.dirname(i);Hi.existsSync(s)||Hi.mkdirSync(s,{recursive:!0}),Hi.writeFileSync(i,JSON.stringify(this.defaultValues,null,2),"utf-8"),Ws={...this.defaultValues}}}catch(s){ft("Error reading/writing sling.settings.json: ",s),Ws={...this.defaultValues}}}let e=W1(process.env.SLINGSHOT_API_DOMAIN),n=W1(process.env.SLINGSHOT_ANALYTICS_DOMAIN);return{...Ws,[t.BASE_URL]:e||Ws[t.BASE_URL],[t.ANALYTICS_DOMAIN]:n||Ws[t.ANALYTICS_DOMAIN]}}static updateSettings(e){let n=Le(),i=jl.resolve(n,"sling.settings.json");try{let o={...this.getSettings()||{},...e},r=jl.dirname(i);Hi.existsSync(r)||Hi.mkdirSync(r,{recursive:!0}),Hi.writeFileSync(i,JSON.stringify(o,null,2),"utf-8"),Ws=o}catch(s){ft("Error updating sling.settings.json: ",s)}}static getLoginUrl(e){let n=this.getSettings(),i=new URLSearchParams({client:this.CLIENT_NAME,port:String(e.port),localState:e.localState});return e.clientId&&i.set("clientId",e.clientId),`${n[t.BASE_URL]}${this.LOGIN_PATH}?${i.toString()}`}static getExchangeUrl(){return`${this.getSettings()[t.BASE_URL]}${this.EXCHANGE_PATH}`}static getRefreshUrl(){let e=this.getSettings(),n=new URLSearchParams({client:this.REFRESH_CLIENT_NAME});return`${e[t.BASE_URL]}${this.REFRESH_PATH}?${n.toString()}`}static getApiBaseUrl(){return`${this.getSettings()[t.BASE_URL]}${this.API_BASE_PATH}`}static getSageEventsUrl(){return`${this.getSettings()[t.ANALYTICS_DOMAIN]}${this.SAGE_EVENTS_PATH}`}static getTokenExpiryBuffer(){return this.TOKEN_EXPIRY_BUFFER_MS}static getDefaultProjectId(){let e=this.getSettings();return process.env.SLINGSHOT_PROJECT_ID||e[t.PROJECT_ID]}static getDefaultWorkspaceId(){let e=this.getSettings();return process.env.SLINGSHOT_WORKSPACE_ID||e[t.WORKSPACE_ID]}static getDefaultClientId(){let e=this.getSettings();return process.env.CLIENT_ID||e[t.CLIENT_ID]}static getUserActivityUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users/activity`}static getUserUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users`}static getAppTokenUrl(){return`${this.getSettings()[t.BASE_URL]}${this.APP_TOKEN_PATH}`}static getConfigServiceUrl(e){let n=this.getSettings(),i=this.getDefaultClientId(),s=new URLSearchParams({keys:e});return`${n[t.BASE_URL]}${this.CONFIG_SERVICE_PATH}/${i}?${s.toString()}`}static getAppTokenRefreshBuffer(){return this.APP_TOKEN_REFRESH_BUFFER_MS}};function ql(t){try{let e=t.split(".");if(e.length!==3)return 0;let n=JSON.parse(atob(e[1]));return n.exp?n.exp*1e3:0}catch{return 0}}function Bp(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function U1(){return`user_${Bp()}`}var B0="Xq7Wm2zR9pLkVbN4cD8fH3jT6yG1sA5",bB=BigInt(B0.length);function xB(t){if(t.length===0)return"";let e=0n;for(let i of t){let s=B0.indexOf(i);if(s===-1)throw new Error(`Cannot decode app_key: character "${i}" is not in the expected alphabet`);e=e*bB+BigInt(s)}let n=[];for(;e>0n;)n.unshift(Number(e&0xffn)),e>>=8n;for(let i of t)if(i===B0[0])n.unshift(0);else break;return new TextDecoder().decode(new Uint8Array(n))}var N0=new Map,Np=new Map;async function yB(t,e){let n=we.getConfigServiceUrl(t);je(`sling-config: fetching ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${e}`}})}catch(r){let a=r instanceof Error?r.message:String(r);throw new Error(`Cannot reach config service: ${a}`)}if(!i.ok){let r=`${i.status} ${i.statusText}`;try{let a=await i.json();a.message?r=String(a.message):a.error&&(r=String(a.error))}catch{}throw new Error(`Config service request failed: ${r}`)}let o=(await i.json())?.data?.config;if(!o||typeof o!="object")throw new Error("Config service response missing data.config");return o}async function F1(t,e){let n=N0.get(t);if(n)return n;let i=Np.get(t);if(i)return i;if(!e)throw new Error("Cannot reach config service: no Slingshot user token provided");let s=yB(t,e).then(o=>(N0.set(t,o),o)).finally(()=>{Np.delete(t)});return Np.set(t,s),s}var Gl=class{static async getSlingcliConfig(e){let n=await F1("slingcli",e),i=n.slingcli;if(!i||typeof i.app_id!="string"||typeof i.app_key!="string"||!i.app_id||!i.app_key)throw ft("sling-config: missing slingcli block",n),new Error("Config service did not return slingcli.app_id / slingcli.app_key for this client");return{app_id:i.app_id,app_key:xB(i.app_key)}}static async getRemoteConfig(e,n){return F1(e,n)}static clearCache(){N0.clear(),Np=new Map}};var Kl=null,j0=null,jp=null,ec=null;function D1(t){process.env[we.SLINGSHOT_APP_TOKEN_ENV]=`Bearer ${t}`}function vB(t){ec&&(clearTimeout(ec),ec=null);let e=t.expiresAt-Date.now();e<=0||(ec=setTimeout(()=>{ec=null,zi().catch(n=>{ft("app-token: scheduled refresh failed",n)})},e),ec.unref?.())}async function wB(t){let{app_id:e,app_key:n}=await Gl.getSlingcliConfig(t),i=Buffer.from(`${e}:${n}`).toString("base64"),s=we.getAppTokenUrl();je(`app-token: minting from ${s}`);let o;try{o=await fetch(s,{method:"GET",headers:{Accept:"application/json",Authorization:`Basic ${i}`}})}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Cannot reach app-token service: ${d}`)}if(!o.ok){let l=`${o.status} ${o.statusText}`;try{let d=await o.text()||"";d&&(l=d)}catch{}throw new Error(`App token request failed: ${l}`)}let r=await o.json();if(!r.app_token||typeof r.expires_in!="number")throw new Error("App token response missing app_token or expires_in");let a=we.getAppTokenRefreshBuffer(),c=Date.now()+r.expires_in*1e3-a;return je(`app-token: minted, expires at ${new Date(c).toISOString()}`),{token:r.app_token,expiresAt:c}}async function zi(t){if(t&&(j0=t),Kl&&Kl.expiresAt>Date.now())return D1(Kl.token),Kl.token;if(jp)return(await jp).token;if(!j0)throw new Error("Cannot mint app token: no Slingshot user token available (please /login slingshot first)");let n=wB(j0).then(s=>(Kl=s,D1(s.token),vB(s),s)).finally(()=>{jp=null});return jp=n,(await n).token}var Hl=null,q0=null;typeof process<"u"&&process.versions?.node&&(q0=import("node:http").then(t=>{Hl=t.createServer}));async function SB(){if(Hl||(q0&&await q0,Hl))return Hl;throw new Error("Slingshot OAuth requires Node.js")}async function G0(t){let e=await SB(),n,i,s,o=!1,r=new Promise((d,u)=>{i=d,s=u}),a=d=>{if(!o){o=!0;try{n.close()}catch{}d()}};n=e((d,u)=>{let p=new URL(d.url||"","http://127.0.0.1"),m=p.searchParams.get("code"),g=p.searchParams.get("state"),h=p.searchParams.get("clientId"),f=p.searchParams.get("error"),x=p.searchParams.get("error_description");if(f){u.writeHead(400,{"Content-Type":"text/html"}),u.end(`<html><body><h1>Login Failed</h1><p>${x||f}</p><p>You can close this window.</p></body></html>`),a(()=>s(new Error(`Login failed: ${x||f}`)));return}if(!m||!g){u.writeHead(400,{"Content-Type":"text/html"}),u.end("<html><body><h1>Login Failed</h1><p>Missing code or state in callback.</p><p>You can close this window.</p></body></html>"),a(()=>s(new Error("Missing code or state in callback")));return}u.writeHead(200,{"Content-Type":"text/html"}),u.end("<html><body><h1>Login Successful</h1><p>You can close this window and return to your terminal.</p><script>setTimeout(()=>window.close(),3000)</script></body></html>"),a(()=>i({code:m,state:g,clientId:h||""}))}),n.on("error",d=>{a(()=>s(d))});let c=setTimeout(()=>{a(()=>s(new Error("Login timeout - no callback received within 5 minutes")))},300*1e3);return n.on("close",()=>clearTimeout(c)),t&&t.addEventListener("abort",()=>{a(()=>s(new Error("Login cancelled")))}),{port:await new Promise((d,u)=>{n.once("error",u),n.listen(0,"127.0.0.1",()=>{let p=n.address();p&&typeof p=="object"?d(p.port):u(new Error("Failed to obtain loopback server port"))})}),result:r}}async function K0(t,e){if(!t)throw new Error("Missing exchange code");if(!e)throw new Error("Missing clientId for exchange");let n=we.getExchangeUrl(),i;try{i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify({code:t,clientId:e})})}catch(o){let r=o instanceof Error?o.message:String(o);throw new Error(`Cannot reach Studio Auth: ${r}`)}if(!i.ok){let o,r=`${i.status} ${i.statusText}`;try{let a=await i.json();o=a.error?.code,a.error?.message?r=a.error.message:a.message?r=a.message:o&&(r=o)}catch{}throw o==="INVALID_CALLBACK"?new Error("Login failed: exchange code is expired, already used, or bound to a different tenant. Please log in again."):new Error(`Code exchange failed: ${r}`)}let s=await i.json();if(!s.accessToken||!s.refreshToken)throw new Error("Exchange response missing accessToken or refreshToken");return s}function TB(){return CB(16).toString("hex")}function kB(t){let e=new URL(t),n=e.searchParams.get("code"),i=e.searchParams.get("state"),s=e.searchParams.get("clientId");if(!n||!i)throw new Error("Pasted URL is missing code or state");return{code:n,state:i,clientId:s||""}}async function H0(t){let e=process.env.SLINGSHOT_TOKEN;if(e){let d=ql(e);return console.log("Using Slingshot token from SLINGSHOT_TOKEN environment variable"),await zi(e),{refresh:"",access:e,expires:d>0?d-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:process.env.SLINGSHOT_PROJECT_ID,workspaceId:process.env.SLINGSHOT_WORKSPACE_ID}}let{port:n,result:i}=await G0(t.signal),s=TB(),o=we.getDefaultClientId(),r=we.getLoginUrl({port:n,localState:s,clientId:o||void 0});t.onAuth({url:r});let a;if(t.onManualCodeInput){let d=t.onManualCodeInput().then(kB);a=await Promise.race([i,d])}else a=await i;if(a.state!==s)throw new Error("CSRF check failed - state does not match localState");if(!a.clientId)throw new Error("Login callback did not include clientId");let c=await K0(a.code,a.clientId),l=ql(c.accessToken);return await zi(c.accessToken),{refresh:c.refreshToken,access:c.accessToken,expires:l>0?l-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:void 0,workspaceId:void 0}}import{randomUUID as MB}from"node:crypto";async function qp(t){if(!t.refresh)throw new Error("No refresh token available. Please login again.");let e;try{e=await zi()}catch(a){throw ft("auth/refresh: app token unavailable for refresh call",a),new Error(`Cannot refresh Slingshot token: app token unavailable (${a instanceof Error?a.message:String(a)}). Please /login slingshot.`)}let n=MB(),i={accept:"application/json",rt:t.refresh,"trace-id":n,Authorization:`Bearer ${e}`},s;try{let a=we.getRefreshUrl();s=await fetch(a,{headers:i})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach Slingshot server: ${c}`)}if(!s.ok){let a=`${s.status} ${s.statusText}`;try{let c=await s.json();c.message?a=String(c.message):c.error&&(a=String(c.error))}catch{}throw new Error(`Token refresh failed: ${a}`)}let o=await s.json();if(!o.accessToken)throw new Error("No access token in refresh response");let r=ql(o.accessToken);try{await zi(o.accessToken)}catch(a){throw ft("auth/refresh: app token refresh failed",a),a}return{refresh:o.refreshToken||t.refresh,access:o.accessToken,expires:r>0?r-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:t.projectId,workspaceId:t.workspaceId}}var $1=[{id:"gpt-5.4-nano",name:"GPT-5.4 nano",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-4.1",name:"GPT-4.1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768,provider:"slingshot",api:"openai-completions"},{id:"gpt-5",name:"GPT-5",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-mini",name:"GPT-5 Mini",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-nano",name:"GPT-5 Nano",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.1",name:"GPT-5.1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.2",name:"GPT-5.2",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.4-mini",name:"GPT-5.4 mini",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.4",name:"GPT-5.4",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.5",name:"GPT-5.5",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4@20250514",name:"Claude Opus 4",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4@20250514",name:"Claude Sonnet 4",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-5@20250929",name:"Claude Sonnet 4.5",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"o3",name:"O3",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o3-mini",name:"o3-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o4-mini",name:"o4-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536,provider:"slingshot",api:"openai-completions"}];var _o={name:"slingshot.cli",private:!0,type:"module",workspaces:["packages/*","packages/web-ui/example","packages/coding-agent/examples/extensions/with-deps","packages/coding-agent/examples/extensions/custom-provider-anthropic","packages/coding-agent/examples/extensions/custom-provider-gitlab-duo","packages/coding-agent/examples/extensions/custom-provider-qwen-cli"],scripts:{clean:"npm run clean --workspaces",build:"cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build && cd ../web-ui && npm run build",dev:'concurrently --names "ai,agent,coding-agent,web-ui,tui" --prefix-colors "cyan,yellow,red,white,green,magenta" "cd packages/ai && npm run dev" "cd packages/agent && npm run dev" "cd packages/coding-agent && npm run dev" "cd packages/web-ui && npm run dev" "cd packages/tui && npm run dev"',"dev:tsc":'concurrently --names "ai,web-ui" --prefix-colors "cyan,green" "cd packages/ai && npm run dev:tsc" "cd packages/web-ui && npm run dev:tsc"',check:"","check:browser-smoke":"","profile:tui":"node scripts/profile-coding-agent-node.mjs --mode tui","profile:rpc":"node scripts/profile-coding-agent-node.mjs --mode rpc",test:"npm run test --workspaces --if-present","version:patch":"npm version patch -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:minor":"npm version minor -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:major":"npm version major -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:set":"npm version -ws",prepublishOnly:"npm run clean && npm run build && npm run check",publish:"npm run prepublishOnly && npm publish -ws --access public","publish:dry":"npm run prepublishOnly && npm publish -ws --access public --dry-run","release:patch":"node scripts/release.mjs patch","release:minor":"node scripts/release.mjs minor","release:major":"node scripts/release.mjs major",prepare:"husky"},devDependencies:{"@anthropic-ai/sandbox-runtime":"^0.0.26","@biomejs/biome":"2.3.5","@types/node":"^22.19.18","@typescript/native-preview":"7.0.0-dev.20260120.1",concurrently:"^9.2.1",esbuild:"^0.25.0",husky:"^9.1.7",jiti:"^2.7.0",shx:"^0.4.0",tsx:"^4.20.3",typescript:"^5.9.2"},engines:{node:">=20.0.0"},slingVersion:"2.4.20260520-4",overrides:{rimraf:"6.1.3","fast-xml-parser":"5.7.2",gaxios:{rimraf:"6.1.3"}},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0","compound-engineering-pi":"^0.2.4","get-east-asian-width":"^1.4.0"}};var I1e=we.getRefreshUrl(),R1e=we.getApiBaseUrl(),P1e=we.getSageEventsUrl(),_1e=we.getTokenExpiryBuffer(),B1=we.getDefaultProjectId(),N1=we.getDefaultWorkspaceId(),j1=we.getDefaultClientId();async function Gp(t,e,n){let i=U1(),s=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot");if(!s){je("ERROR: No API key found");return}let o=s.startsWith("Bearer ")?s:`Bearer ${s}`,r=process.env.SLINGSHOT_PROJECT_ID||B1,a=process.env.SLINGSHOT_WORKSPACE_ID||N1,c=process.env.CLIENT_ID||j1,l={"Content-Type":"application/json",accept:"application/json","access-token":o,"x-project-id":r,"x-workspace-id":a,"x-client-id":c,"sage-trace-id":i,"User-Agent":"pi-slingshot/1.0.0"},d=parseFloat(process.env.SLINGSHOT_TEMPERATURE||"0.2"),u=parseFloat(process.env.SLINGSHOT_TOP_P||"0.8"),p={source:_o.name||"sling",ai_model_info:{ai_provider_name:e.model?.provider||"slingshot",sage_modl_name:e.model?.id||"unknown",sage_modl_option:{temperature:String(d),max_token_size:String(e.model?.maxTokens||16834),top_p:String(u)}},rag_info:{type:null,account_name:"dummy",project_names:[],repository_names:[],programming_language:null},tab_data:{tab_count:"1"},tags:null,slingshot_version:_o.slingVersion||"2.3.2",chat_type:"agent",...n||{}};return{headers:l,sageCommonData:p}}async function Kp(t,e,n,i){let s={eventName:t,sageCommonData:n,eventData:i};je(`Sending analytics event: ${t} : `+we.getSageEventsUrl());try{let o=await fetch(we.getSageEventsUrl(),{method:"POST",headers:e,body:JSON.stringify(s)});if(o.ok){let r=await o.json().catch(()=>{});if(r.error_code)throw new Error(`Analytics API error: ${r.error_code} - ${r.error_message||"No message"}`);je(`'SUCCESS: Event sent: ${t}`),je(`Response: ${JSON.stringify(r)}`),je("\u2500".repeat(66))}else{let r=await o.text().catch(()=>""),a={status:o.status,statusText:o.statusText,responseBody:r,requestHeaders:e};throw je(`ERROR: ${o.status} ${o.statusText}`),ft("Error Details",a),ft("Failed Request Body",s),new Error(`Analytics API error: ${o.status} ${o.statusText}`)}}catch(o){let r=o instanceof Error?o.message:String(o);console.warn("[Slingshot Analytics] Request that caused error:",r),je(`EXCEPTION: ${r}`),o instanceof Error&&o.stack&&je(`Stack trace: ${o.stack}`),ft("Request that caused exception",s)}}import zl from"chalk";function q1(t,e){return{render(n){let i=` \u26AC _______. __ __ .__ __. _______
|
|
444
|
+
`;Ls.appendFileSync(Ki,i)}catch{}}var Ws=null;function W1(t){if(!t)return;let e=t.trim();if(e)return e.replace(/\/+$/,"")}var we=class t{static{this.BASE_URL="base_url"}static{this.ANALYTICS_DOMAIN="analytics_domain"}static{this.CLIENT_ID="client_id"}static{this.PROJECT_ID="project_id"}static{this.WORKSPACE_ID="workspace_id"}static{this.defaultValues={[t.BASE_URL]:"https://sapientaiproducts.com",[t.ANALYTICS_DOMAIN]:"https://slingshot.sapientaiproducts.com",[t.CLIENT_ID]:"b97fbef7-cad9-4e56-9850-39e86c8fdf61",[t.PROJECT_ID]:"fa8121c4-e2fc-48f1-9478-8949c04e13cc",[t.WORKSPACE_ID]:"6e5756eb-d7e2-4d80-ad07-9d7a51600d85"}}static{this.LOGIN_PATH="/web/v1/studio-auth/login"}static{this.EXCHANGE_PATH="/api/v1/studio-auth/auth/desktop/exchange"}static{this.REFRESH_PATH="/api/v3/auth/refreshtoken"}static{this.REFRESH_CLIENT_NAME="machine"}static{this.API_BASE_PATH="/api/v1/llm"}static{this.SAGE_EVENTS_PATH="/api/v1/ai-portal/sage_events"}static{this.APP_TOKEN_PATH="/api/v3/auth/app-token"}static{this.CONFIG_SERVICE_PATH="/api/v2/configservice/client"}static{this.APP_TOKEN_REFRESH_BUFFER_MS=60*1e3}static{this.SLINGSHOT_APP_TOKEN_ENV="SLINGSHOT_APP_TOKEN_HEADER"}static{this.TOKEN_EXPIRY_BUFFER_MS=300*1e3}static{this.SAPI="/save/api/v1"}static{this.CLIENT_NAME="desktop"}static defaults(e){return this.defaultValues[e]}static getSettingsPath(){let e=jl.resolve(process.cwd(),".sling","sling.settings.json");if(Hi.existsSync(e))return e;let n=Le();return jl.resolve(n,"sling.settings.json")}static getSettings(){if(!Ws){let i=this.getSettingsPath();try{if(Hi.existsSync(i)){let s=Hi.readFileSync(i,"utf-8"),o=JSON.parse(s)||{};Ws={...this.defaultValues,...o}}else{let s=jl.dirname(i);Hi.existsSync(s)||Hi.mkdirSync(s,{recursive:!0}),Hi.writeFileSync(i,JSON.stringify(this.defaultValues,null,2),"utf-8"),Ws={...this.defaultValues}}}catch(s){ft("Error reading/writing sling.settings.json: ",s),Ws={...this.defaultValues}}}let e=W1(process.env.SLINGSHOT_API_DOMAIN),n=W1(process.env.SLINGSHOT_ANALYTICS_DOMAIN);return{...Ws,[t.BASE_URL]:e||Ws[t.BASE_URL],[t.ANALYTICS_DOMAIN]:n||Ws[t.ANALYTICS_DOMAIN]}}static updateSettings(e){let n=Le(),i=jl.resolve(n,"sling.settings.json");try{let o={...this.getSettings()||{},...e},r=jl.dirname(i);Hi.existsSync(r)||Hi.mkdirSync(r,{recursive:!0}),Hi.writeFileSync(i,JSON.stringify(o,null,2),"utf-8"),Ws=o}catch(s){ft("Error updating sling.settings.json: ",s)}}static getLoginUrl(e){let n=this.getSettings(),i=new URLSearchParams({client:this.CLIENT_NAME,port:String(e.port),localState:e.localState});return e.clientId&&i.set("clientId",e.clientId),`${n[t.BASE_URL]}${this.LOGIN_PATH}?${i.toString()}`}static getExchangeUrl(){return`${this.getSettings()[t.BASE_URL]}${this.EXCHANGE_PATH}`}static getRefreshUrl(){let e=this.getSettings(),n=new URLSearchParams({client:this.REFRESH_CLIENT_NAME});return`${e[t.BASE_URL]}${this.REFRESH_PATH}?${n.toString()}`}static getApiBaseUrl(){return`${this.getSettings()[t.BASE_URL]}${this.API_BASE_PATH}`}static getSageEventsUrl(){return`${this.getSettings()[t.ANALYTICS_DOMAIN]}${this.SAGE_EVENTS_PATH}`}static getTokenExpiryBuffer(){return this.TOKEN_EXPIRY_BUFFER_MS}static getDefaultProjectId(){let e=this.getSettings();return process.env.SLINGSHOT_PROJECT_ID||e[t.PROJECT_ID]}static getDefaultWorkspaceId(){let e=this.getSettings();return process.env.SLINGSHOT_WORKSPACE_ID||e[t.WORKSPACE_ID]}static getDefaultClientId(){let e=this.getSettings();return process.env.CLIENT_ID||e[t.CLIENT_ID]}static getUserActivityUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users/activity`}static getUserUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users`}static getAppTokenUrl(){return`${this.getSettings()[t.BASE_URL]}${this.APP_TOKEN_PATH}`}static getConfigServiceUrl(e){let n=this.getSettings(),i=this.getDefaultClientId(),s=new URLSearchParams({keys:e});return`${n[t.BASE_URL]}${this.CONFIG_SERVICE_PATH}/${i}?${s.toString()}`}static getAppTokenRefreshBuffer(){return this.APP_TOKEN_REFRESH_BUFFER_MS}};function ql(t){try{let e=t.split(".");if(e.length!==3)return 0;let n=JSON.parse(atob(e[1]));return n.exp?n.exp*1e3:0}catch{return 0}}function Bp(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function U1(){return`user_${Bp()}`}var B0="Xq7Wm2zR9pLkVbN4cD8fH3jT6yG1sA5",bB=BigInt(B0.length);function xB(t){if(t.length===0)return"";let e=0n;for(let i of t){let s=B0.indexOf(i);if(s===-1)throw new Error(`Cannot decode app_key: character "${i}" is not in the expected alphabet`);e=e*bB+BigInt(s)}let n=[];for(;e>0n;)n.unshift(Number(e&0xffn)),e>>=8n;for(let i of t)if(i===B0[0])n.unshift(0);else break;return new TextDecoder().decode(new Uint8Array(n))}var N0=new Map,Np=new Map;async function yB(t,e){let n=we.getConfigServiceUrl(t);je(`sling-config: fetching ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${e}`}})}catch(r){let a=r instanceof Error?r.message:String(r);throw new Error(`Cannot reach config service: ${a}`)}if(!i.ok){let r=`${i.status} ${i.statusText}`;try{let a=await i.json();a.message?r=String(a.message):a.error&&(r=String(a.error))}catch{}throw new Error(`Config service request failed: ${r}`)}let o=(await i.json())?.data?.config;if(!o||typeof o!="object")throw new Error("Config service response missing data.config");return o}async function F1(t,e){let n=N0.get(t);if(n)return n;let i=Np.get(t);if(i)return i;if(!e)throw new Error("Cannot reach config service: no Slingshot user token provided");let s=yB(t,e).then(o=>(N0.set(t,o),o)).finally(()=>{Np.delete(t)});return Np.set(t,s),s}var Gl=class{static async getSlingcliConfig(e){let n=await F1("slingcli",e),i=n.slingcli;if(!i||typeof i.app_id!="string"||typeof i.app_key!="string"||!i.app_id||!i.app_key)throw ft("sling-config: missing slingcli block",n),new Error("Config service did not return slingcli.app_id / slingcli.app_key for this client");return{app_id:i.app_id,app_key:xB(i.app_key)}}static async getRemoteConfig(e,n){return F1(e,n)}static clearCache(){N0.clear(),Np=new Map}};var Kl=null,j0=null,jp=null,ec=null;function D1(t){process.env[we.SLINGSHOT_APP_TOKEN_ENV]=`Bearer ${t}`}function vB(t){ec&&(clearTimeout(ec),ec=null);let e=t.expiresAt-Date.now();e<=0||(ec=setTimeout(()=>{ec=null,zi().catch(n=>{ft("app-token: scheduled refresh failed",n)})},e),ec.unref?.())}async function wB(t){let{app_id:e,app_key:n}=await Gl.getSlingcliConfig(t),i=Buffer.from(`${e}:${n}`).toString("base64"),s=we.getAppTokenUrl();je(`app-token: minting from ${s}`);let o;try{o=await fetch(s,{method:"GET",headers:{Accept:"application/json",Authorization:`Basic ${i}`}})}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Cannot reach app-token service: ${d}`)}if(!o.ok){let l=`${o.status} ${o.statusText}`;try{let d=await o.text()||"";d&&(l=d)}catch{}throw new Error(`App token request failed: ${l}`)}let r=await o.json();if(!r.app_token||typeof r.expires_in!="number")throw new Error("App token response missing app_token or expires_in");let a=we.getAppTokenRefreshBuffer(),c=Date.now()+r.expires_in*1e3-a;return je(`app-token: minted, expires at ${new Date(c).toISOString()}`),{token:r.app_token,expiresAt:c}}async function zi(t){if(t&&(j0=t),Kl&&Kl.expiresAt>Date.now())return D1(Kl.token),Kl.token;if(jp)return(await jp).token;if(!j0)throw new Error("Cannot mint app token: no Slingshot user token available (please /login slingshot first)");let n=wB(j0).then(s=>(Kl=s,D1(s.token),vB(s),s)).finally(()=>{jp=null});return jp=n,(await n).token}var Hl=null,q0=null;typeof process<"u"&&process.versions?.node&&(q0=import("node:http").then(t=>{Hl=t.createServer}));async function SB(){if(Hl||(q0&&await q0,Hl))return Hl;throw new Error("Slingshot OAuth requires Node.js")}async function G0(t){let e=await SB(),n,i,s,o=!1,r=new Promise((d,u)=>{i=d,s=u}),a=d=>{if(!o){o=!0;try{n.close()}catch{}d()}};n=e((d,u)=>{let p=new URL(d.url||"","http://127.0.0.1"),m=p.searchParams.get("code"),g=p.searchParams.get("state"),h=p.searchParams.get("clientId"),f=p.searchParams.get("error"),x=p.searchParams.get("error_description");if(f){u.writeHead(400,{"Content-Type":"text/html"}),u.end(`<html><body><h1>Login Failed</h1><p>${x||f}</p><p>You can close this window.</p></body></html>`),a(()=>s(new Error(`Login failed: ${x||f}`)));return}if(!m||!g){u.writeHead(400,{"Content-Type":"text/html"}),u.end("<html><body><h1>Login Failed</h1><p>Missing code or state in callback.</p><p>You can close this window.</p></body></html>"),a(()=>s(new Error("Missing code or state in callback")));return}u.writeHead(200,{"Content-Type":"text/html"}),u.end("<html><body><h1>Login Successful</h1><p>You can close this window and return to your terminal.</p><script>setTimeout(()=>window.close(),3000)</script></body></html>"),a(()=>i({code:m,state:g,clientId:h||""}))}),n.on("error",d=>{a(()=>s(d))});let c=setTimeout(()=>{a(()=>s(new Error("Login timeout - no callback received within 5 minutes")))},300*1e3);return n.on("close",()=>clearTimeout(c)),t&&t.addEventListener("abort",()=>{a(()=>s(new Error("Login cancelled")))}),{port:await new Promise((d,u)=>{n.once("error",u),n.listen(0,"127.0.0.1",()=>{let p=n.address();p&&typeof p=="object"?d(p.port):u(new Error("Failed to obtain loopback server port"))})}),result:r}}async function K0(t,e){if(!t)throw new Error("Missing exchange code");if(!e)throw new Error("Missing clientId for exchange");let n=we.getExchangeUrl(),i;try{i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify({code:t,clientId:e})})}catch(o){let r=o instanceof Error?o.message:String(o);throw new Error(`Cannot reach Studio Auth: ${r}`)}if(!i.ok){let o,r=`${i.status} ${i.statusText}`;try{let a=await i.json();o=a.error?.code,a.error?.message?r=a.error.message:a.message?r=a.message:o&&(r=o)}catch{}throw o==="INVALID_CALLBACK"?new Error("Login failed: exchange code is expired, already used, or bound to a different tenant. Please log in again."):new Error(`Code exchange failed: ${r}`)}let s=await i.json();if(!s.accessToken||!s.refreshToken)throw new Error("Exchange response missing accessToken or refreshToken");return s}function TB(){return CB(16).toString("hex")}function kB(t){let e=new URL(t),n=e.searchParams.get("code"),i=e.searchParams.get("state"),s=e.searchParams.get("clientId");if(!n||!i)throw new Error("Pasted URL is missing code or state");return{code:n,state:i,clientId:s||""}}async function H0(t){let e=process.env.SLINGSHOT_TOKEN;if(e){let d=ql(e);return console.log("Using Slingshot token from SLINGSHOT_TOKEN environment variable"),await zi(e),{refresh:"",access:e,expires:d>0?d-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:process.env.SLINGSHOT_PROJECT_ID,workspaceId:process.env.SLINGSHOT_WORKSPACE_ID}}let{port:n,result:i}=await G0(t.signal),s=TB(),o=we.getDefaultClientId(),r=we.getLoginUrl({port:n,localState:s,clientId:o||void 0});t.onAuth({url:r});let a;if(t.onManualCodeInput){let d=t.onManualCodeInput().then(kB);a=await Promise.race([i,d])}else a=await i;if(a.state!==s)throw new Error("CSRF check failed - state does not match localState");if(!a.clientId)throw new Error("Login callback did not include clientId");let c=await K0(a.code,a.clientId),l=ql(c.accessToken);return await zi(c.accessToken),{refresh:c.refreshToken,access:c.accessToken,expires:l>0?l-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:void 0,workspaceId:void 0}}import{randomUUID as MB}from"node:crypto";async function qp(t){if(!t.refresh)throw new Error("No refresh token available. Please login again.");let e;try{e=await zi()}catch(a){throw ft("auth/refresh: app token unavailable for refresh call",a),new Error(`Cannot refresh Slingshot token: app token unavailable (${a instanceof Error?a.message:String(a)}). Please /login slingshot.`)}let n=MB(),i={accept:"application/json",rt:t.refresh,"trace-id":n,Authorization:`Bearer ${e}`},s;try{let a=we.getRefreshUrl();s=await fetch(a,{headers:i})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach Slingshot server: ${c}`)}if(!s.ok){let a=`${s.status} ${s.statusText}`;try{let c=await s.json();c.message?a=String(c.message):c.error&&(a=String(c.error))}catch{}throw new Error(`Token refresh failed: ${a}`)}let o=await s.json();if(!o.accessToken)throw new Error("No access token in refresh response");let r=ql(o.accessToken);try{await zi(o.accessToken)}catch(a){throw ft("auth/refresh: app token refresh failed",a),a}return{refresh:o.refreshToken||t.refresh,access:o.accessToken,expires:r>0?r-we.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:t.projectId,workspaceId:t.workspaceId}}var $1=[{id:"gpt-5.4-nano",name:"GPT-5.4 nano",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-4.1",name:"GPT-4.1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768,provider:"slingshot",api:"openai-completions"},{id:"gpt-5",name:"GPT-5",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-mini",name:"GPT-5 Mini",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-nano",name:"GPT-5 Nano",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.1",name:"GPT-5.1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.2",name:"GPT-5.2",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.4-mini",name:"GPT-5.4 mini",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.4",name:"GPT-5.4",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.5",name:"GPT-5.5",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4@20250514",name:"Claude Opus 4",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4@20250514",name:"Claude Sonnet 4",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-5@20250929",name:"Claude Sonnet 4.5",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"o3",name:"O3",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o3-mini",name:"o3-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o4-mini",name:"o4-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536,provider:"slingshot",api:"openai-completions"}];var _o={name:"slingshot.cli",private:!0,type:"module",workspaces:["packages/*","packages/web-ui/example","packages/coding-agent/examples/extensions/with-deps","packages/coding-agent/examples/extensions/custom-provider-anthropic","packages/coding-agent/examples/extensions/custom-provider-gitlab-duo","packages/coding-agent/examples/extensions/custom-provider-qwen-cli"],scripts:{clean:"npm run clean --workspaces",build:"cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build && cd ../web-ui && npm run build",dev:'concurrently --names "ai,agent,coding-agent,web-ui,tui" --prefix-colors "cyan,yellow,red,white,green,magenta" "cd packages/ai && npm run dev" "cd packages/agent && npm run dev" "cd packages/coding-agent && npm run dev" "cd packages/web-ui && npm run dev" "cd packages/tui && npm run dev"',"dev:tsc":'concurrently --names "ai,web-ui" --prefix-colors "cyan,green" "cd packages/ai && npm run dev:tsc" "cd packages/web-ui && npm run dev:tsc"',check:"","check:browser-smoke":"","profile:tui":"node scripts/profile-coding-agent-node.mjs --mode tui","profile:rpc":"node scripts/profile-coding-agent-node.mjs --mode rpc",test:"npm run test --workspaces --if-present","version:patch":"npm version patch -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:minor":"npm version minor -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:major":"npm version major -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:set":"npm version -ws",prepublishOnly:"npm run clean && npm run build && npm run check",publish:"npm run prepublishOnly && npm publish -ws --access public","publish:dry":"npm run prepublishOnly && npm publish -ws --access public --dry-run","release:patch":"node scripts/release.mjs patch","release:minor":"node scripts/release.mjs minor","release:major":"node scripts/release.mjs major",prepare:"husky"},devDependencies:{concurrently:"^9.2.1","@anthropic-ai/sandbox-runtime":"0.0.26","@biomejs/biome":"2.3.5","@types/node":"22.19.19","@typescript/native-preview":"7.0.0-dev.20260120.1",esbuild:"0.28.0",husky:"9.1.7",jiti:"2.7.0",shx:"0.4.0",tsx:"4.22.1",typescript:"5.9.3"},engines:{node:">=20.0.0"},slingVersion:"2.4.20260520-5",overrides:{rimraf:"6.1.3","fast-xml-parser":"5.7.2",gaxios:{rimraf:"6.1.3"}},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0","compound-engineering-pi":"^0.2.4","get-east-asian-width":"^1.4.0"}};var M1e=we.getRefreshUrl(),I1e=we.getApiBaseUrl(),R1e=we.getSageEventsUrl(),P1e=we.getTokenExpiryBuffer(),B1=we.getDefaultProjectId(),N1=we.getDefaultWorkspaceId(),j1=we.getDefaultClientId();async function Gp(t,e,n){let i=U1(),s=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot");if(!s){je("ERROR: No API key found");return}let o=s.startsWith("Bearer ")?s:`Bearer ${s}`,r=process.env.SLINGSHOT_PROJECT_ID||B1,a=process.env.SLINGSHOT_WORKSPACE_ID||N1,c=process.env.CLIENT_ID||j1,l={"Content-Type":"application/json",accept:"application/json","access-token":o,"x-project-id":r,"x-workspace-id":a,"x-client-id":c,"sage-trace-id":i,"User-Agent":"pi-slingshot/1.0.0"},d=parseFloat(process.env.SLINGSHOT_TEMPERATURE||"0.2"),u=parseFloat(process.env.SLINGSHOT_TOP_P||"0.8"),p={source:_o.name||"sling",ai_model_info:{ai_provider_name:e.model?.provider||"slingshot",sage_modl_name:e.model?.id||"unknown",sage_modl_option:{temperature:String(d),max_token_size:String(e.model?.maxTokens||16834),top_p:String(u)}},rag_info:{type:null,account_name:"dummy",project_names:[],repository_names:[],programming_language:null},tab_data:{tab_count:"1"},tags:null,slingshot_version:_o.slingVersion||"2.3.2",chat_type:"agent",...n||{}};return{headers:l,sageCommonData:p}}async function Kp(t,e,n,i){let s={eventName:t,sageCommonData:n,eventData:i};je(`Sending analytics event: ${t} : `+we.getSageEventsUrl());try{let o=await fetch(we.getSageEventsUrl(),{method:"POST",headers:e,body:JSON.stringify(s)});if(o.ok){let r=await o.json().catch(()=>{});if(r.error_code)throw new Error(`Analytics API error: ${r.error_code} - ${r.error_message||"No message"}`);je(`'SUCCESS: Event sent: ${t}`),je(`Response: ${JSON.stringify(r)}`),je("\u2500".repeat(66))}else{let r=await o.text().catch(()=>""),a={status:o.status,statusText:o.statusText,responseBody:r,requestHeaders:e};throw je(`ERROR: ${o.status} ${o.statusText}`),ft("Error Details",a),ft("Failed Request Body",s),new Error(`Analytics API error: ${o.status} ${o.statusText}`)}}catch(o){let r=o instanceof Error?o.message:String(o);console.warn("[Slingshot Analytics] Request that caused error:",r),je(`EXCEPTION: ${r}`),o instanceof Error&&o.stack&&je(`Stack trace: ${o.stack}`),ft("Request that caused exception",s)}}import zl from"chalk";function q1(t,e){return{render(n){let i=` \u26AC _______. __ __ .__ __. _______
|
|
445
445
|
\u274D \xB7 \u274D / || | | | | \\ | | / _____|
|
|
446
446
|
\u2726 \u26AC \u2726 | (----\`| | | | | \\| | | | __
|
|
447
447
|
\u26AC \xB7 \u26AC \u26AC \xB7 \u26AC \\ \\ | | | | | . \` | | | |_ |
|
|
@@ -449,10 +449,10 @@ ${JSON.stringify(e,null,2)}
|
|
|
449
449
|
\u274D \xB7 \u274D |_______/ |_______||__| |__| \\__| \\______/
|
|
450
450
|
\u26AC `.split(`
|
|
451
451
|
`).map(o=>zl.bold(zl.white(zl.bgRed((o+" ".repeat(n)).substring(0,n))))),s=` Slingshot coding agent v${_o.slingVersion}`;return[...i,zl.bgGray(zl.dim(s+" ".repeat(n)).substring(0,n))]},invalidate(){}}}import rre from"chalk";var z0=["Accomplishing","Actioning","Actualizing","Architecting","Baking","Beaming","Beboppin'","Befuddling","Billowing","Blanching","Bloviating","Boogieing","Boondoggling","Booping","Bootstrapping","Brewing","Bunning","Burrowing","Calculating","Canoodling","Caramelizing","Cascading","Catapulting","Cerebrating","Channeling","Channelling","Choreographing","Churning","Clauding","Coalescing","Cogitating","Combobulating","Composing","Computing","Concocting","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Crystallizing","Cultivating","Deciphering","Deliberating","Determining","Dilly-dallying","Discombobulating","Doing","Doodling","Drizzling","Ebbing","Effecting","Elucidating","Embellishing","Enchanting","Envisioning","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flamb\xE9ing","Flibbertigibbeting","Flowing","Flummoxing","Fluttering","Forging","Forming","Frolicking","Frosting","Gallivanting","Galloping","Garnishing","Generating","Gesticulating","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hatching","Herding","Honking","Hullaballooing","Hyperspacing","Ideating","Imagining","Improvising","Incubating","Inferring","Infusing","Ionizing","Jitterbugging","Julienning","Kneading","Leavening","Levitating","Lollygagging","Manifesting","Marinating","Meandering","Metamorphosing","Misting","Moonwalking","Moseying","Mulling","Mustering","Musing","Nebulizing","Nesting","Newspapering","Noodling","Nucleating","Orbiting","Orchestrating","Osmosing","Perambulating","Percolating","Perusing","Philosophising","Photosynthesizing","Pollinating","Pondering","Pontificating","Pouncing","Precipitating","Prestidigitating","Processing","Proofing","Propagating","Puttering","Puzzling","Quantumizing","Razzle-dazzling","Razzmatazzing","Recombobulating","Reticulating","Roosting","Ruminating","Saut\xE9ing","Scampering","Schlepping","Scurrying","Seasoning","Shenaniganing","Shimmying","Simmering","Skedaddling","Sketching","Slithering","Smooshing","Sock-hopping","Spelunking","Spinning","Sprouting","Stewing","Sublimating","Swirling","Swooping","Symbioting","Synthesizing","Tempering","Thinking","Thundering","Tinkering","Tomfoolering","Topsy-turvying","Transfiguring","Transmuting","Twisting","Undulating","Unfurling","Unravelling","Vibing","Waddling","Wandering","Warping","Whatchamacalliting","Whirlpooling","Whirring","Whisking","Wibbling","Working","Wrangling","Zesting","Zigzagging"];import Ec from"node:path";import{existsSync as ew}from"node:fs";import{homedir as HA}from"node:os";function J0(t,e){e==="random"&&(e=Object.keys(V0)[Math.floor(Math.random()*Object.keys(V0).length)]);let n=V0[e||"dots"];t.ui.setWorkingIndicator(n)}var V0={dots:{intervalMs:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{intervalMs:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{intervalMs:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{intervalMs:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{intervalMs:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{intervalMs:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{intervalMs:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{intervalMs:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{intervalMs:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{intervalMs:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{intervalMs:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{intervalMs:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{intervalMs:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{intervalMs:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{intervalMs:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{intervalMs:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{intervalMs:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{intervalMs:130,frames:["-","\\","|","/"]},line2:{intervalMs:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{intervalMs:80,frames:["/ "," - "," "," |"," |"," "," - ","/ "]},pipe:{intervalMs:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{intervalMs:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{intervalMs:200,frames:[". ",".. ","..."," .."," ."," "]},star:{intervalMs:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{intervalMs:80,frames:["+","x","*"]},flip:{intervalMs:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{intervalMs:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{intervalMs:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{intervalMs:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{intervalMs:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{intervalMs:120,frames:[".","o","O","\xB0","O","o","."]},noise:{intervalMs:100,frames:["\u2593","\u2592","\u2591"]},bounce:{intervalMs:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{intervalMs:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{intervalMs:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{intervalMs:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{intervalMs:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{intervalMs:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{intervalMs:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{intervalMs:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{intervalMs:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{intervalMs:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{intervalMs:100,frames:["\u256B","\u256A"]},toggle:{intervalMs:250,frames:["\u22B6","\u22B7"]},toggle2:{intervalMs:80,frames:["\u25AB","\u25AA"]},toggle3:{intervalMs:120,frames:["\u25A1","\u25A0"]},toggle4:{intervalMs:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{intervalMs:100,frames:["\u25AE","\u25AF"]},toggle6:{intervalMs:300,frames:["\u101D","\u1040"]},toggle7:{intervalMs:80,frames:["\u29BE","\u29BF"]},toggle8:{intervalMs:100,frames:["\u25CD","\u25CC"]},toggle9:{intervalMs:100,frames:["\u25C9","\u25CE"]},toggle10:{intervalMs:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{intervalMs:50,frames:["\u29C7","\u29C6"]},toggle12:{intervalMs:120,frames:["\u2617","\u2616"]},toggle13:{intervalMs:80,frames:["=","*","-"]},arrow:{intervalMs:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{intervalMs:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{intervalMs:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{intervalMs:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{intervalMs:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{intervalMs:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{intervalMs:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{intervalMs:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{intervalMs:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{intervalMs:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{intervalMs:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{intervalMs:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{intervalMs:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{intervalMs:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{intervalMs:120,frames:["\u2590|____________\u258C","\u2590_|___________\u258C","\u2590__|__________\u258C","\u2590___|_________\u258C","\u2590____|________\u258C","\u2590_____|_______\u258C","\u2590______|______\u258C","\u2590_______|_____\u258C","\u2590________|____\u258C","\u2590_________|___\u258C","\u2590__________|__\u258C","\u2590___________|_\u258C","\u2590____________|\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{intervalMs:100,frames:["d","q","p","b"]},weather:{intervalMs:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{intervalMs:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{intervalMs:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{intervalMs:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{intervalMs:150,frames:["-","=","\u2261"]},betaWave:{intervalMs:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{intervalMs:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{intervalMs:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{intervalMs:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{intervalMs:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{intervalMs:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{intervalMs:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{intervalMs:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{intervalMs:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{intervalMs:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{intervalMs:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{intervalMs:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]},fish:{intervalMs:80,frames:["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","\xBA> ~~~~~~~~~~~~~~~~~","(\xBA> ~~~~~~~~~~~~~~~~","((\xBA> ~~~~~~~~~~~~~~~","<((\xBA> ~~~~~~~~~~~~~~","><((\xBA> ~~~~~~~~~~~~~"," ><((\xBA> ~~~~~~~~~~~~","~ ><((\xBA> ~~~~~~~~~~~","~~ <>((\xBA> ~~~~~~~~~~","~~~ ><((\xBA> ~~~~~~~~~","~~~~ <>((\xBA> ~~~~~~~~","~~~~~ ><((\xBA> ~~~~~~~","~~~~~~ <>((\xBA> ~~~~~~","~~~~~~~ ><((\xBA> ~~~~~","~~~~~~~~ <>((\xBA> ~~~~","~~~~~~~~~ ><((\xBA> ~~~","~~~~~~~~~~ <>((\xBA> ~~","~~~~~~~~~~~ ><((\xBA> ~","~~~~~~~~~~~~ <>((\xBA> ","~~~~~~~~~~~~~ ><((\xBA>","~~~~~~~~~~~~~~ <>((\xBA","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}};import{createTwoFilesPatch as RB}from"diff";import{readFile as PB,writeFile as _B,rm as EB,mkdir as AB}from"node:fs/promises";import{dirname as OB,relative as LB,resolve as WB}from"node:path";var G1="filechanges:baseline",K1="filechanges:clear",H1="filechanges:untrack";function UB(t){return t.startsWith("@")?t.slice(1):t}function Q0(t,e){let n=UB(e),i=WB(t,n),s=LB(t,i),o=s&&!s.startsWith("..")&&s!==""?s:n;return{absPath:i,relPath:o}}async function Y0(t){try{return await PB(t,"utf-8")}catch{return null}}function X0(t){let e=0,n=0;for(let i of t.split(`
|
|
452
|
-
`))i.startsWith("+++ ")||i.startsWith("--- ")||i.startsWith("@@")||(i.startsWith("+")?e++:i.startsWith("-")&&n++);return{added:e,removed:n}}function FB(t,e){return`(+${t}/-${e})`}function DB(t,e){let n=e.match(/^\+(\d+)\/\-(\d+)$/);if(!n)return t.fg("muted",e);let i=Number(n[1]),s=Number(n[2]),o=i===0?t.fg("text",`+${i}`):t.fg("success",`+${i}`),r=s===0?t.fg("text",`-${s}`):t.fg("error",`-${s}`);return o+t.fg("text","/")+r}function $B(t,e){if(t.size===0)return;let n=0,i=0;for(let s of t.values())s.kind==="new"?i++:n++;return e?e.fg("muted",`\u0394 ${n} + ${i}`):`\u0394 ${n} + ${i}`}function z1(t,e){if(t.size===0)return;let n=[...t.values()].sort((o,r)=>r.updatedAt-o.updatedAt),i=8,s=[];for(let o of n.slice(0,i)){let r=o.kind==="new"?"+":"\u0394";if(!e){s.push(`${r} ${o.displayPath} ${FB(o.added,o.removed)}`);continue}let a=e.fg("muted",`${r} `)+e.fg("muted",`${o.displayPath} `),c,l=o.added===0?e.fg("text",`+${o.added}`):e.fg("success",`+${o.added}`),d=o.removed===0?e.fg("text",`-${o.removed}`):e.fg("error",`-${o.removed}`);c=e.fg("text","(")+l+e.fg("text","/")+d+e.fg("text",")"),s.push(a+c)}return n.length>i&&s.push(e?e.fg("dim",`\u2026and ${n.length-i} more`):`\u2026and ${n.length-i} more`),s}function Z0(t,e,n){return RB(t,t,e??"",n,"","",{context:3})}async function BB(t){await AB(OB(t),{recursive:!0})}function V1(t){let e=new Map,n=new Map,i=new Map;function s(u){u?.hasUI&&(u.ui.setStatus("filechanges",$B(n,u.ui.theme)),u.ui.setWidget("filechanges",z1(n,u.ui.theme)))}async function o(u,p){let m=e.get(p);if(!m)return;let g=await Y0(m.absPath);if(m.originalContent===null){if(g===null){n.delete(p);return}let w=m.path,P=Z0(w,null,g),{added:_,removed:R}=X0(P);n.set(p,{path:m.path,absPath:m.absPath,displayPath:w,originalContent:null,currentContent:g,diff:P,added:_,removed:R,kind:"new",updatedAt:Date.now()});return}if(g===null){let w=m.path,P=Z0(w,m.originalContent,""),{added:_,removed:R}=X0(P);n.set(p,{path:m.path,absPath:m.absPath,displayPath:w,originalContent:m.originalContent,currentContent:"",diff:P,added:_,removed:R,kind:"edited",updatedAt:Date.now()});return}if(g===m.originalContent){n.delete(p);return}let h=m.path,f=Z0(h,m.originalContent,g),{added:x,removed:y}=X0(f);n.set(p,{path:m.path,absPath:m.absPath,displayPath:h,originalContent:m.originalContent,currentContent:g,diff:f,added:x,removed:y,kind:"edited",updatedAt:Date.now()})}async function r(u,p){e.clear(),n.clear(),i.clear(),t.appendEntry(K1,{timestamp:Date.now(),reason:p}),s(u)}async function a(u){if(await u.waitForIdle(),n.size===0){u.hasUI&&u.ui.notify("filechanges: nothing to decline.","info");return}let p=u.args?.includes("force")??!1;if(u.hasUI&&!p){if(!await u.ui.confirm("Decline sling changes?","This will revert ALL currently logged sling changes (overwrite files / delete created files)."))return}else if(!u.hasUI&&!p)throw new Error("Decline requires confirmation. Run: /
|
|
452
|
+
`))i.startsWith("+++ ")||i.startsWith("--- ")||i.startsWith("@@")||(i.startsWith("+")?e++:i.startsWith("-")&&n++);return{added:e,removed:n}}function FB(t,e){return`(+${t}/-${e})`}function DB(t,e){let n=e.match(/^\+(\d+)\/\-(\d+)$/);if(!n)return t.fg("muted",e);let i=Number(n[1]),s=Number(n[2]),o=i===0?t.fg("text",`+${i}`):t.fg("success",`+${i}`),r=s===0?t.fg("text",`-${s}`):t.fg("error",`-${s}`);return o+t.fg("text","/")+r}function $B(t,e){if(t.size===0)return;let n=0,i=0;for(let s of t.values())s.kind==="new"?i++:n++;return e?e.fg("muted",`\u0394 ${n} + ${i}`):`\u0394 ${n} + ${i}`}function z1(t,e){if(t.size===0)return;let n=[...t.values()].sort((o,r)=>r.updatedAt-o.updatedAt),i=8,s=[];for(let o of n.slice(0,i)){let r=o.kind==="new"?"+":"\u0394";if(!e){s.push(`${r} ${o.displayPath} ${FB(o.added,o.removed)}`);continue}let a=e.fg("muted",`${r} `)+e.fg("muted",`${o.displayPath} `),c,l=o.added===0?e.fg("text",`+${o.added}`):e.fg("success",`+${o.added}`),d=o.removed===0?e.fg("text",`-${o.removed}`):e.fg("error",`-${o.removed}`);c=e.fg("text","(")+l+e.fg("text","/")+d+e.fg("text",")"),s.push(a+c)}return n.length>i&&s.push(e?e.fg("dim",`\u2026and ${n.length-i} more`):`\u2026and ${n.length-i} more`),s}function Z0(t,e,n){return RB(t,t,e??"",n,"","",{context:3})}async function BB(t){await AB(OB(t),{recursive:!0})}function V1(t){let e=new Map,n=new Map,i=new Map;function s(u){u?.hasUI&&(u.ui.setStatus("filechanges",$B(n,u.ui.theme)),u.ui.setWidget("filechanges",z1(n,u.ui.theme)))}async function o(u,p){let m=e.get(p);if(!m)return;let g=await Y0(m.absPath);if(m.originalContent===null){if(g===null){n.delete(p);return}let w=m.path,P=Z0(w,null,g),{added:_,removed:R}=X0(P);n.set(p,{path:m.path,absPath:m.absPath,displayPath:w,originalContent:null,currentContent:g,diff:P,added:_,removed:R,kind:"new",updatedAt:Date.now()});return}if(g===null){let w=m.path,P=Z0(w,m.originalContent,""),{added:_,removed:R}=X0(P);n.set(p,{path:m.path,absPath:m.absPath,displayPath:w,originalContent:m.originalContent,currentContent:"",diff:P,added:_,removed:R,kind:"edited",updatedAt:Date.now()});return}if(g===m.originalContent){n.delete(p);return}let h=m.path,f=Z0(h,m.originalContent,g),{added:x,removed:y}=X0(f);n.set(p,{path:m.path,absPath:m.absPath,displayPath:h,originalContent:m.originalContent,currentContent:g,diff:f,added:x,removed:y,kind:"edited",updatedAt:Date.now()})}async function r(u,p){e.clear(),n.clear(),i.clear(),t.appendEntry(K1,{timestamp:Date.now(),reason:p}),s(u)}async function a(u){if(await u.waitForIdle(),n.size===0){u.hasUI&&u.ui.notify("filechanges: nothing to decline.","info");return}let p=u.args?.includes("force")??!1;if(u.hasUI&&!p){if(!await u.ui.confirm("Decline sling changes?","This will revert ALL currently logged sling changes (overwrite files / delete created files)."))return}else if(!u.hasUI&&!p)throw new Error("Decline requires confirmation. Run: /s:filechanges-decline force");let m=[...n.values()].sort((f,x)=>x.updatedAt-f.updatedAt),g=0,h=[];for(let f of m)try{f.originalContent===null?await EB(f.absPath,{force:!0}):(await BB(f.absPath),await _B(f.absPath,f.originalContent,"utf-8")),g++}catch(x){h.push(`${f.displayPath}: ${x?.message??String(x)}`)}await r(u,"decline"),u.hasUI&&(h.length===0?u.ui.notify(`filechanges: declined changes for ${g} file(s).`,"info"):(u.ui.notify(`filechanges: declined with ${h.length} error(s). Run /s:filechanges to inspect; see console for details.`,"warning"),console.warn(`[filechanges] decline errors:
|
|
453
453
|
`+h.join(`
|
|
454
|
-
`))))}async function c(u){if(await u.waitForIdle(),n.size===0){u.hasUI&&u.ui.notify("filechanges: nothing to accept.","info");return}let p=u.args?.includes("force")??!1;if(u.hasUI&&!p){if(!await u.ui.confirm("Accept sling changes?","This will keep current files as-is and clear the modification log."))return}else if(!u.hasUI&&!p)throw new Error("Accept requires confirmation. Run: /filechanges-accept force");let m=n.size;await r(u,"accept"),u.hasUI&&u.ui.notify(`filechanges: accepted changes for ${m} file(s).`,"info")}function l(u){return u?u.split(/\s+/g).map(p=>p.trim()).filter(Boolean):[]}t.registerCommand("
|
|
455
|
-
`));return}for(;;){await p.waitForIdle(),s(p);let m=[...n.values()].sort((y,w)=>w.updatedAt-y.updatedAt);if(m.length===0){p.ui.notify("filechanges: no sling made modifications recorded.","info");return}let g=[{value:"__accept__",label:"Accept changes (clear log)",description:"Keep current files"},{value:"__decline__",label:"Undo changes (revert)",description:"Restore original contents"},{value:"__sep__",label:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",description:""},...m.map(y=>({value:y.path,label:`${y.kind==="new"?"+":"\u0394"} ${y.displayPath}`,description:`+${y.added}/-${y.removed}`}))],h=await p.ui.custom((y,w,P,_)=>{let R=new K;R.addChild(new V(E=>w.fg("accent",E))),R.addChild(new A(w.fg("accent",w.bold("File changes")),1,0));let L=new Qt(g,Math.min(14,g.length),{selectedPrefix:E=>w.fg("accent",E),selectedText:E=>w.fg("accent",E),description:E=>DB(w,E),scrollInfo:E=>w.fg("dim",E),noMatch:E=>w.fg("warning",E)});return L.onSelect=E=>{E.value!=="__sep__"&&_(E.value)},L.onCancel=()=>_(null),R.addChild(L),R.addChild(new A(w.fg("dim","\u2191\u2193 navigate \u2022 enter select \u2022 esc close"),1,0)),R.addChild(new V(E=>w.fg("accent",E))),{render:E=>R.render(E),invalidate:()=>R.invalidate(),handleInput:E=>{L.handleInput(E),y.requestRender()}}},{overlay:!0});if(!h)return;if(h==="__accept__"){await c(p);return}if(h==="__decline__"){await a(p);return}let f=n.get(h);if(!f){p.ui.notify("filechanges: entry not found (maybe log was cleared).","warning");continue}let x="```diff\n"+(f.diff.trimEnd()||"(no diff)")+"\n```";await p.ui.custom((y,w,P,_)=>{let R=new K;return R.addChild(new V(L=>w.fg("accent",L))),R.addChild(new A(w.fg("accent",w.bold(f.displayPath)),1,0)),R.addChild(new ze(x,1,0,Tt())),R.addChild(new A(w.fg("dim","esc to go back"),1,0)),R.addChild(new V(L=>w.fg("accent",L))),{render:L=>R.render(L),invalidate:()=>R.invalidate(),handleInput:L=>{Pe(L,ro.escape)||Pe(L,ro.ctrl("c"))?_():y.requestRender()}}},{overlay:!0})}}}),t.registerCommand("
|
|
454
|
+
`))))}async function c(u){if(await u.waitForIdle(),n.size===0){u.hasUI&&u.ui.notify("filechanges: nothing to accept.","info");return}let p=u.args?.includes("force")??!1;if(u.hasUI&&!p){if(!await u.ui.confirm("Accept sling changes?","This will keep current files as-is and clear the modification log."))return}else if(!u.hasUI&&!p)throw new Error("Accept requires confirmation. Run: /filechanges-accept force");let m=n.size;await r(u,"accept"),u.hasUI&&u.ui.notify(`filechanges: accepted changes for ${m} file(s).`,"info")}function l(u){return u?u.split(/\s+/g).map(p=>p.trim()).filter(Boolean):[]}t.registerCommand("s:filechanges",{description:"Show files changed by sling and inspect diffs",handler:async(u,p)=>{if(p.args=l(u),await p.waitForIdle(),s(p),!p.hasUI){if([...n.values()].sort((h,f)=>f.updatedAt-h.updatedAt).length===0){console.log("filechanges: no sling made modifications recorded.");return}let g=z1(n)??[];console.log(g.join(`
|
|
455
|
+
`));return}for(;;){await p.waitForIdle(),s(p);let m=[...n.values()].sort((y,w)=>w.updatedAt-y.updatedAt);if(m.length===0){p.ui.notify("filechanges: no sling made modifications recorded.","info");return}let g=[{value:"__accept__",label:"Accept changes (clear log)",description:"Keep current files"},{value:"__decline__",label:"Undo changes (revert)",description:"Restore original contents"},{value:"__sep__",label:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",description:""},...m.map(y=>({value:y.path,label:`${y.kind==="new"?"+":"\u0394"} ${y.displayPath}`,description:`+${y.added}/-${y.removed}`}))],h=await p.ui.custom((y,w,P,_)=>{let R=new K;R.addChild(new V(E=>w.fg("accent",E))),R.addChild(new A(w.fg("accent",w.bold("File changes")),1,0));let L=new Qt(g,Math.min(14,g.length),{selectedPrefix:E=>w.fg("accent",E),selectedText:E=>w.fg("accent",E),description:E=>DB(w,E),scrollInfo:E=>w.fg("dim",E),noMatch:E=>w.fg("warning",E)});return L.onSelect=E=>{E.value!=="__sep__"&&_(E.value)},L.onCancel=()=>_(null),R.addChild(L),R.addChild(new A(w.fg("dim","\u2191\u2193 navigate \u2022 enter select \u2022 esc close"),1,0)),R.addChild(new V(E=>w.fg("accent",E))),{render:E=>R.render(E),invalidate:()=>R.invalidate(),handleInput:E=>{L.handleInput(E),y.requestRender()}}},{overlay:!0});if(!h)return;if(h==="__accept__"){await c(p);return}if(h==="__decline__"){await a(p);return}let f=n.get(h);if(!f){p.ui.notify("filechanges: entry not found (maybe log was cleared).","warning");continue}let x="```diff\n"+(f.diff.trimEnd()||"(no diff)")+"\n```";await p.ui.custom((y,w,P,_)=>{let R=new K;return R.addChild(new V(L=>w.fg("accent",L))),R.addChild(new A(w.fg("accent",w.bold(f.displayPath)),1,0)),R.addChild(new ze(x,1,0,Tt())),R.addChild(new A(w.fg("dim","esc to go back"),1,0)),R.addChild(new V(L=>w.fg("accent",L))),{render:L=>R.render(L),invalidate:()=>R.invalidate(),handleInput:L=>{Pe(L,ro.escape)||Pe(L,ro.ctrl("c"))?_():y.requestRender()}}},{overlay:!0})}}}),t.registerCommand("s:filechanges-accept",{description:"Accept sling made changes (keeps files, clears log)",handler:async(u,p)=>{p.args=l(u),await c(p)}}),t.registerCommand("s:filechanges-decline",{description:"Decline sling made changes (reverts files, clears log)",handler:async(u,p)=>{p.args=l(u),await a(p)}});async function d(u){e.clear(),n.clear(),i.clear();for(let p of u.sessionManager.getBranch())if(p.type==="custom"){if(p.customType===K1){e.clear(),n.clear();continue}if(p.customType===G1){let m=p.data;if(!m?.path)continue;let{absPath:g,relPath:h}=Q0(u.cwd,m.path);e.set(h,{path:h,absPath:g,originalContent:typeof m.originalContent=="string"?m.originalContent:null,createdAt:typeof m.timestamp=="number"?m.timestamp:Date.now()});continue}if(p.customType===H1){let m=p.data;if(!m?.path)continue;let{relPath:g}=Q0(u.cwd,m.path);e.delete(g),n.delete(g);continue}}for(let p of e.keys())await o(u,p);s(u)}t.on("session_start",async(u,p)=>{await d(p)}),t.on("session_before_switch",async(u,p)=>{await d(p)}),t.on("session_tree",async(u,p)=>{await d(p)}),t.on("session_before_fork",async(u,p)=>{await d(p)}),t.on("tool_call",async(u,p)=>{if(hl("edit",u)||hl("write",u)){let{absPath:m,relPath:g}=Q0(p.cwd,u.input.path),h=await Y0(m);i.set(u.toolCallId,{path:g,absPath:m,before:h})}}),t.on("tool_result",async(u,p)=>{if(u.isError){i.delete(u.toolCallId);return}if(!Yd(u)&&!Xd(u))return;let m=i.get(u.toolCallId);if(i.delete(u.toolCallId),!m)return;e.has(m.path)||(e.set(m.path,{path:m.path,absPath:m.absPath,originalContent:m.before,createdAt:Date.now()}),t.appendEntry(G1,{path:m.path,originalContent:m.before,timestamp:Date.now()})),await o(p,m.path);let g=e.get(m.path),h=await Y0(m.absPath);g&&(g.originalContent!==null&&h===g.originalContent||g.originalContent===null&&h===null)&&(e.delete(m.path),n.delete(m.path),t.appendEntry(H1,{path:m.path,timestamp:Date.now()})),s(p)})}import{readFileSync as au,writeFileSync as PI,existsSync as cc,mkdirSync as _I,readdirSync as k8}from"node:fs";import{join as Ji,dirname as EI}from"node:path";import{homedir as cu}from"node:os";function NB(t){return Buffer.byteLength(t,"utf8")}function jB(t){let e=[];for(let n of t){let i=n.replace(/\r/g,"");if(i.length===0){e.push("");continue}e.push(...i.split(`
|
|
456
456
|
`))}return e}var Vl=class{constructor(e){this.commands=[];this.commandIndex=new Map;this.totalLines=0;this.totalBytes=0;this.truncatedCommands=0;this.settings=e}startCommand(e,n,i){let s={id:e,command:n,cwdAtStart:i,startedAt:Date.now(),output:[],outputBytes:0,exitCode:null,finishedAt:null,truncated:!1};return this.commands.push(s),this.commandIndex.set(e,s),this.enforceLimits(),s}appendOutput(e,n){let i=this.commandIndex.get(e);if(!i||!n)return;let s=jB([n]);if(s.length===0)return;i.output.push(...s);let o=s.reduce((r,a)=>r+NB(a)+1,0);i.outputBytes+=o,this.totalLines+=s.length,this.totalBytes+=o,this.enforceLimits()}finishCommand(e,n){let i=this.commandIndex.get(e);i&&(i.exitCode=n,i.finishedAt=Date.now())}clear(){this.commands=[],this.commandIndex.clear(),this.totalLines=0,this.totalBytes=0,this.truncatedCommands=0}getSnapshot(){return{commands:this.commands.map(e=>({...e,output:[...e.output]})),totalLines:this.totalLines,totalBytes:this.totalBytes,truncatedCommands:this.truncatedCommands}}enforceLimits(){for(;this.commands.length>1&&(this.totalLines>this.settings.transcriptMaxLines||this.totalBytes>this.settings.transcriptMaxBytes);){let e=this.commands.shift();if(!e)break;this.commandIndex.delete(e.id),this.totalLines=Math.max(0,this.totalLines-e.output.length),this.totalBytes=Math.max(0,this.totalBytes-e.outputBytes),this.truncatedCommands+=1,e.truncated=!0}}};import{readdirSync as ZB}from"node:fs";import{spawnSync as eN}from"node:child_process";import{basename as tN,dirname as nN,isAbsolute as iN,join as sN,resolve as oN}from"node:path";import{existsSync as Hp,mkdirSync as qB,readFileSync as zp,writeFileSync as GB}from"node:fs";import{dirname as KB,join as Jl}from"node:path";import{homedir as HB}from"node:os";function J1(){return process.env.HOME||process.env.USERPROFILE||HB()}function zB(){return Jl(J1(),".pi","agent","powerline-footer","bash-history")}function VB(t){return t.replace(/^[/\\]+|[/\\]+$/g,"").replace(/[\\/]+/g,"-")||"root"}function Q1(t){return Jl(zB(),`${VB(t)}.json`)}function JB(t){if(!Array.isArray(t))return[];let e=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=typeof n.command=="string"?n.command.trim():"",s=typeof n.cwd=="string"?n.cwd.trim():"",o=typeof n.timestamp=="number"&&Number.isFinite(n.timestamp)?n.timestamp:0;!i||!s||!o||e.push({command:i,cwd:s,timestamp:o})}return e}function Ql(t){let e=Q1(t);if(!Hp(e))return[];try{let n=JSON.parse(zp(e,"utf8"));return typeof n!="object"||n===null||Array.isArray(n)?[]:JB(n.entries).sort((i,s)=>s.timestamp-i.timestamp)}catch(n){return console.debug(`[powerline-footer] Failed to read bash project history from ${e}:`,n),[]}}function Y1(t,e,n){let i=e.trim();if(!i)return;let s=Ql(t),o=[{command:i,cwd:n,timestamp:Date.now()},...s.filter(a=>a.command!==i)].slice(0,500),r=Q1(t);try{qB(KB(r),{recursive:!0}),GB(r,JSON.stringify({version:1,entries:o},null,2)+`
|
|
457
457
|
`)}catch(a){console.debug(`[powerline-footer] Failed to persist bash project history to ${r}:`,a)}}function QB(t){let e=t.trim();if(!e)return null;if(!e.startsWith(":"))return e;let n=e.split(";");return n.length<2?null:n.slice(1).join(";").trim()||null}function YB(t){return t.map(e=>e.trim()).filter(Boolean)}function XB(t){let e=t.matchAll(/^\s*-\s*cmd:\s*(.+)$/gm),n=[];for(let i of e){let s=i[1]?.trim();s&&n.push(s)}return n}function Yl(t){let e=t.split("/").pop()?.toLowerCase()??"",n=J1();try{if(e.includes("zsh")){let s=process.env.HISTFILE||Jl(n,".zsh_history");return Hp(s)?zp(s,"utf8").split(`
|
|
458
458
|
`).map(QB).filter(o=>!!o).reverse():[]}if(e.includes("fish")){let s=Jl(n,".local","share","fish","fish_history");return Hp(s)?XB(zp(s,"utf8")).reverse():[]}let i=process.env.HISTFILE||Jl(n,".bash_history");return Hp(i)?YB(zp(i,"utf8").split(`
|
|
@@ -503,7 +503,7 @@ print -r -- "${tu}:$PWD"
|
|
|
503
503
|
`);this.buffer=i.pop()??"";for(let s of i){let o=s.trimEnd();if(!this.state.ready){o.startsWith(`${tu}:`)&&(this.state.ready=!0,this.state.cwd=o.slice(tu.length+1)||this.state.cwd,this.readyResolve?.(),this.readyResolve=null,this.readyReject=null,this.onStateChange());continue}if(o.startsWith(`${Xp}:`)){let[,r,a]=o.split(":");a&&(this.state.cwd=a),this.currentCommandId=r??this.currentCommandId,this.onStateChange();continue}if(o.startsWith(`${Zp}:`)){let[,r,a,c]=o.split(":"),l=Number.parseInt(a??"1",10);if(this.state.running=!1,this.state.lastExitCode=Number.isFinite(l)?l:1,c&&(this.state.cwd=c),r){this.transcript.finishCommand(r,this.state.lastExitCode);let u=this.transcript.getSnapshot().commands.find(p=>p.id===r);u&&this.state.lastExitCode===0&&this.onCommandSuccess(u.command,this.state.cwd)}this.currentCommandId=null,this.onStateChange();continue}this.currentCommandId&&(this.transcript.appendOutput(this.currentCommandId,o),this.onStateChange())}}};import{existsSync as ON,readFileSync as LN}from"node:fs";import{join as WN,dirname as UN}from"node:path";import{fileURLToPath as FN}from"node:url";var nb={model:"#d787af",shellMode:"accent",path:"#00afaf",gitDirty:"warning",gitClean:"success",thinking:"thinkingOff",thinkingMinimal:"thinkingMinimal",thinkingLow:"thinkingLow",thinkingMedium:"thinkingMedium",context:"dim",contextWarn:"warning",contextError:"error",cost:"text",tokens:"muted",separator:"dim",border:"borderMuted"},uM=["#b281d6","#d787af","#febc38","#e4c00f","#89d281","#00afaf","#178fb9","#b281d6"],tm=null,dM=0,tc=null,tb=0,pM=5e3,nm=new Set;function mM(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function DN(t){if(!mM(t))return{};let e={};for(let[n,i]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(nb,n)||typeof i!="string")continue;let s=i.trim();s&&(e[n]=s)}return e}function $N(){let t=UN(FN(import.meta.url));return WN(t,"theme.json")}function ib(){let t=Date.now();if(tc&&t-tb<pM)return tc;let e=$N();try{if(ON(e)){let n=LN(e,"utf-8"),i=JSON.parse(n);return tc=mM(i)?i:{},tb=t,tc}}catch(n){console.debug(`[powerline-theme] Failed to load ${e}:`,n)}return tc={},tb=t,tc}function BN(){let t=Date.now();return tm&&t-dM<pM||(tm=DN(ib().colors),dM=t),tm}function NN(t,e){return BN()[t]??e?.[t]??nb[t]}function jN(t){return typeof t=="string"&&/^#[0-9a-fA-F]{6}$/.test(t)}function hM(t){let e=t.replace("#",""),n=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),s=parseInt(e.slice(4,6),16);return`\x1B[38;2;${n};${i};${s}m`}function nc(t,e,n){if(jN(e))return`${hM(e)}${n}\x1B[0m`;try{return t.fg(e,n)}catch(i){let s=String(e);return nm.has(s)||(nm.add(s),nm.size>200&&nm.clear(),console.debug(`[powerline-theme] Invalid theme color "${s}"; falling back to "text".`,i)),t.fg("text",n)}}function gM(t,e,n,i){let s=NN(e,i);return nc(t,s,n)}function fM(t){let e="",n=0;for(let i of t)i===" "||i===":"?e+=i:(e+=hM(uM[n%uM.length])+i,n++);return e+"\x1B[0m"}function im(){return{...nb}}var ic=im(),bM={...ic,model:"text",path:"text",gitClean:"dim"},qN={...ic,model:"accent",path:"success",tokens:"muted",cost:"warning"},sc={default:{leftSegments:["model","thinking","shell_mode","path","git","context_pct","cache_read","cost"],rightSegments:[],secondarySegments:["extension_statuses"],separator:"powerline-thin",colors:ic,segmentOptions:{model:{showThinkingLevel:!1},path:{mode:"basename"},git:{showBranch:!0,showStaged:!0,showUnstaged:!0,showUntracked:!0}}},minimal:{leftSegments:["shell_mode","path","git"],rightSegments:["context_pct"],separator:"slash",colors:bM,segmentOptions:{path:{mode:"basename"},git:{showBranch:!0,showStaged:!1,showUnstaged:!1,showUntracked:!1}}},compact:{leftSegments:["model","shell_mode","git"],rightSegments:["cost","context_pct"],separator:"powerline-thin",colors:ic,segmentOptions:{model:{showThinkingLevel:!1},git:{showBranch:!0,showStaged:!0,showUnstaged:!0,showUntracked:!1}}},full:{leftSegments:["hostname","model","thinking","shell_mode","path","git","subagents"],rightSegments:["token_in","token_out","cache_read","cost","context_pct","time_spent","time","extension_statuses"],separator:"powerline",colors:ic,segmentOptions:{model:{showThinkingLevel:!1},path:{mode:"abbreviated",maxLength:50},git:{showBranch:!0,showStaged:!0,showUnstaged:!0,showUntracked:!0},time:{format:"24h",showSeconds:!1}}},nerd:{leftSegments:["hostname","model","thinking","shell_mode","path","git","session","subagents"],rightSegments:["token_in","token_out","cache_read","cache_write","cost","context_pct","context_total","time_spent","time","extension_statuses"],separator:"powerline",colors:qN,segmentOptions:{model:{showThinkingLevel:!1},path:{mode:"abbreviated",maxLength:60},git:{showBranch:!0,showStaged:!0,showUnstaged:!0,showUntracked:!0},time:{format:"24h",showSeconds:!0}}},ascii:{leftSegments:["model","shell_mode","path","git"],rightSegments:["token_total","cost","context_pct"],separator:"ascii",colors:bM,segmentOptions:{model:{showThinkingLevel:!0},path:{mode:"abbreviated",maxLength:40},git:{showBranch:!0,showStaged:!0,showUnstaged:!0,showUntracked:!0}}},custom:{leftSegments:["model","shell_mode","path","git"],rightSegments:["token_total","cost","context_pct"],separator:"powerline-thin",colors:ic,segmentOptions:{}}};function sb(t){return sc[t]??sc.default}function nu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function xM(t,e){if(typeof t!="string")return null;let n=t.trim().toLowerCase();return e.includes(n)?n:null}function GN(t){if(typeof t!="string")return null;let e=t.trim();return e&&/^[a-zA-Z0-9_-]+$/.test(e)?e:null}function KN(t){return t==="left"||t==="right"||t==="secondary"?t:"right"}function HN(t){if(typeof t!="string")return;let e=t.trim();return e||void 0}function zN(t){if(typeof t!="string")return;let e=t.trim();return e||void 0}function yM(t,e){if(!nu(t))return null;let n=GN(e??t.id);if(!n)return null;let i=typeof t.statusKey=="string"&&t.statusKey.trim()?t.statusKey.trim():n;return{id:n,statusKey:i,position:KN(t.position),color:HN(t.color),prefix:zN(t.prefix),hideWhenMissing:t.hideWhenMissing!==!1,excludeFromExtensionStatuses:t.excludeFromExtensionStatuses!==!1}}function VN(t){let e=[];if(Array.isArray(t))for(let i of t){let s=yM(i);s&&e.push(s)}else if(nu(t))for(let[i,s]of Object.entries(t)){let o=yM(s,i);o&&e.push(o)}let n=new Map;for(let i of e)n.set(i.id,i);return[...n.values()]}function ob(t,e){let n={preset:"default",customItems:[],mouseScroll:!0,fixedEditor:!0},i=xM(t,e);return i?{...n,preset:i}:nu(t)?{preset:xM(t.preset,e)??n.preset,customItems:VN(t.customItems),mouseScroll:t.mouseScroll!==!1,fixedEditor:t.fixedEditor!==!1}:n}function vM(t,e){let n=[...t.leftSegments],i=[...t.rightSegments],s=[...t.secondarySegments??[]];for(let o of e){let r=`custom:${o.id}`;o.position==="left"?n.push(r):o.position==="secondary"?s.push(r):i.push(r)}return{leftSegments:n,rightSegments:i,secondarySegments:s}}function wM(t,e){return nu(t)?{...t,preset:e}:e}function SM(t,e,n){return nu(t)?{...t,...e}:{preset:n,...e}}function rb(t){let e=new Set;for(let n of t)n.excludeFromExtensionStatuses&&e.add(n.statusKey);return e}function CM(t){return t.trimStart().startsWith("[")}function TM(t,e){let n=[];for(let[i,s]of t.entries())e.has(i)||!s||!CM(s)||n.push(s);return n}function ab(t){if(!t||j(t)<=0)return null;let e=t.replace(/(\x1b\[[0-9;]*m|\s|·|[|])+$/,"");return j(e)>0?e:null}function kM(t){return CM(t)?null:ab(t)}var iu=" \xB7 ",JN={minimal:"[min]",low:"[low]",medium:"[med]",high:"[high]",xhigh:"[xhi]"},QN={minimal:"\uF0E7 min",low:"\uF10C low",medium:"\uF192 med",high:"\uF111 high",xhigh:"\uF06D xhi"};function MM(t){return cb()?QN[t]:JN[t]}var IM={pi:"\uE22C",model:"\uEC19",folder:"\uF115",branch:"\uF126",git:"\uF1D3",tokens:"\uE26B",context:"\uE70F",cost:"\uF155",time:"\uF017",agents:"\uF0C0",cache:"\uF1C0",input:"\uF090",output:"\uF08B",host:"\uF109",session:"\uF550",auto:"\u{F0068}",warning:"\uF071"},YN={pi:"\u2B55\uFE0F",model:"\u{1F9E0}",folder:"\u{1F5C2}\uFE0F",branch:"\u2387",git:"\u2387",tokens:"\u229B",context:"\u25EB",cost:"$",time:"\u25F7",agents:"AG",cache:"cache",input:"in:",output:"out:",host:"host",session:"id",auto:"AC",warning:"!"};function XN(t){if(typeof t!="object"||t===null||Array.isArray(t))return{};let e={},n=Object.keys(IM);for(let i of n){let s=t[i];typeof s=="string"&&(e[i]=s)}return e}var ZN={powerlineLeft:"\uE0B0",powerlineRight:"\uE0B2",powerlineThinLeft:"\uE0B1",powerlineThinRight:"\uE0B3",slash:"/",pipe:"|",block:"\u2588",space:" ",asciiLeft:">",asciiRight:"<",dot:"\xB7"},e6={powerlineLeft:">",powerlineRight:"<",powerlineThinLeft:"|",powerlineThinRight:"|",slash:"/",pipe:"|",block:"#",space:" ",asciiLeft:">",asciiRight:"<",dot:"."};function cb(){if(process.env.POWERLINE_NERD_FONTS==="1")return!0;if(process.env.POWERLINE_NERD_FONTS==="0")return!1;if(process.env.GHOSTTY_RESOURCES_DIR)return!0;let t=(process.env.TERM_PROGRAM||"").toLowerCase();return["iterm","wezterm","kitty","ghostty","alacritty"].some(n=>t.includes(n))}function Wt(){return{...cb()?IM:YN,...XN(ib().icons)}}function RM(){return cb()?ZN:e6}function sm(t){let e=RM();switch(t){case"powerline":return{left:e.powerlineLeft,right:e.powerlineRight,endCaps:{left:e.powerlineRight,right:e.powerlineLeft,useBgAsFg:!0}};case"powerline-thin":return{left:e.powerlineThinLeft,right:e.powerlineThinRight,endCaps:{left:e.powerlineRight,right:e.powerlineLeft,useBgAsFg:!0}};case"slash":return{left:` ${e.slash} `,right:` ${e.slash} `};case"pipe":return{left:` ${e.pipe} `,right:` ${e.pipe} `};case"block":return{left:e.block,right:e.block};case"none":return{left:e.space,right:e.space};case"ascii":return{left:e.asciiLeft,right:e.asciiRight};case"dot":return{left:e.dot,right:e.dot};case"chevron":return{left:"\u203A",right:"\u2039"};case"star":return{left:"\u2726",right:"\u2726"};default:return sm("powerline-thin")}}import{hostname as t6}from"node:os";import{basename as PM}from"node:path";function pt(t,e,n){return gM(t.theme,e,n,t.colors)}function en(t,e){return t?`${t} ${e}`:e}function Ao(t){return t<1e3?t.toString():t<1e4?`${(t/1e3).toFixed(1)}k`:t<1e6?`${Math.round(t/1e3)}k`:t<1e7?`${(t/1e6).toFixed(1)}M`:`${Math.round(t/1e6)}M`}function n6(t){let e=Math.floor(t/1e3),n=Math.floor(e/60),i=Math.floor(n/60);return i>0?`${i}h${n%60}m`:n>0?`${n}m${e%60}s`:`${e}s`}var i6={id:"model",render(t){let e=Wt(),n=t.options.model??{},i=t.model?.name||t.model?.id||"no-model";i.startsWith("Claude ")&&(i=i.slice(7));let s=en(e.model,i);if(n.showThinkingLevel!==!1&&t.model?.reasoning){let o=t.thinkingLevel||"off";if(o!=="off"){let r=MM(o);r&&(s+=`${iu}${r}`)}}return{content:pt(t,"model",s),visible:!0}}},s6={id:"shell_mode",render(t){if(!t.shellModeActive)return{content:"",visible:!1};let e=t.shellName??"shell",n=t.shellRunning?"run":"idle",i=t.shellCwd?PM(t.shellCwd):null,s=[e,n];return i&&s.push(i),{content:pt(t,"shellMode",s.join(iu)),visible:!0}}},o6={id:"path",render(t){let e=Wt(),n=t.options.path??{},i=n.mode??"basename",s=t.shellModeActive&&t.shellCwd?t.shellCwd:t.cwd??process.cwd(),o=process.env.HOME||process.env.USERPROFILE;if(i==="basename")s=PM(s)||s;else if(o&&s.startsWith(o)&&(s=`~${s.slice(o.length)}`),s.startsWith("/work/")&&(s=s.slice(6)),i==="abbreviated"){let a=n.maxLength??40;s.length>a&&(s=`\u2026${s.slice(-(a-1))}`)}let r=en(e.folder,s);return{content:pt(t,"path",r),visible:!0}}},r6={id:"git",render(t){let e=Wt(),n=t.options.git??{},{branch:i,staged:s,unstaged:o,untracked:r}=t.git,a=s>0||o>0||r>0?{staged:s,unstaged:o,untracked:r}:null;if(!i&&!a)return{content:"",visible:!1};let c=a&&(a.staged>0||a.unstaged>0||a.untracked>0),l=n.showBranch!==!1,d=c?"gitDirty":"gitClean",u="";if(l&&i&&(u=pt(t,d,en(e.branch,i))),a){let p=[];if(n.showUnstaged!==!1&&a.unstaged>0&&p.push(nc(t.theme,"warning",`*${a.unstaged}`)),n.showStaged!==!1&&a.staged>0&&p.push(nc(t.theme,"success",`+${a.staged}`)),n.showUntracked!==!1&&a.untracked>0&&p.push(nc(t.theme,"muted",`?${a.untracked}`)),p.length>0){let m=p.join(" ");!u&&l===!1?u=pt(t,d,e.git?`${e.git} `:"")+m:u+=u?` ${m}`:m}}return u?{content:u,visible:!0}:{content:"",visible:!1}}},a6={id:"thinking",render(t){let e=t.thinkingLevel||"off",s=`think:${{off:"off",minimal:"min",low:"low",medium:"med",high:"high",xhigh:"xhigh"}[e]||e}`;return e==="high"||e==="xhigh"?{content:fM(s),visible:!0}:e==="minimal"?{content:pt(t,"thinkingMinimal",s),visible:!0}:e==="low"?{content:pt(t,"thinkingLow",s),visible:!0}:e==="medium"?{content:pt(t,"thinkingMedium",s),visible:!0}:{content:pt(t,"thinking",s),visible:!0}}},c6={id:"subagents",render(){return{content:"",visible:!1}}},l6={id:"token_in",render(t){let e=Wt(),{input:n}=t.usageStats;if(!n)return{content:"",visible:!1};let i=en(e.input,Ao(n));return{content:pt(t,"tokens",i),visible:!0}}},u6={id:"token_out",render(t){let e=Wt(),{output:n}=t.usageStats;if(!n)return{content:"",visible:!1};let i=en(e.output,Ao(n));return{content:pt(t,"tokens",i),visible:!0}}},d6={id:"token_total",render(t){let e=Wt(),{input:n,output:i,cacheRead:s,cacheWrite:o}=t.usageStats,r=n+i+s+o;if(!r)return{content:"",visible:!1};let a=en(e.tokens,Ao(r));return{content:pt(t,"tokens",a),visible:!0}}},p6={id:"cost",render(t){let{cost:e}=t.usageStats,n=t.usingSubscription;if(!e&&!n)return{content:"",visible:!1};let i=n?"(sub)":`$${e.toFixed(2)}`;return{content:pt(t,"cost",i),visible:!0}}},m6={id:"context_pct",render(t){if(t.customCompactionEnabled)return{content:"",visible:!1};let e=Wt(),n=t.contextPercent,i=t.contextWindow,s=t.autoCompactEnabled&&e.auto?` ${e.auto}`:"",o=`${n.toFixed(1)}%/${Ao(i)}${s}`,r;return n>90?r=en(e.context,pt(t,"contextError",o)):n>70?r=en(e.context,pt(t,"contextWarn",o)):r=en(e.context,pt(t,"context",o)),{content:r,visible:!0}}},h6={id:"context_total",render(t){if(t.customCompactionEnabled)return{content:"",visible:!1};let e=Wt(),n=t.contextWindow;return n?{content:pt(t,"context",en(e.context,Ao(n))),visible:!0}:{content:"",visible:!1}}},g6={id:"time_spent",render(t){let e=Wt(),n=Date.now()-t.sessionStartTime;return n<1e3?{content:"",visible:!1}:{content:en(e.time,n6(n)),visible:!0}}},f6={id:"time",render(t){let e=Wt(),n=t.options.time??{},i=new Date,s=i.getHours(),o="";n.format==="12h"&&(o=s>=12?"pm":"am",s=s%12||12);let r=i.getMinutes().toString().padStart(2,"0"),a=`${s}:${r}`;return n.showSeconds&&(a+=`:${i.getSeconds().toString().padStart(2,"0")}`),a+=o,{content:en(e.time,a),visible:!0}}},b6={id:"session",render(t){let e=Wt(),i=t.sessionId?.slice(0,8)||"new";return{content:en(e.session,i),visible:!0}}},x6={id:"hostname",render(){let t=Wt(),e=t6().split(".")[0];return{content:en(t.host,e),visible:!0}}},y6={id:"cache_read",render(t){let e=Wt(),{cacheRead:n}=t.usageStats;if(!n)return{content:"",visible:!1};let s=[e.cache,e.input,Ao(n)].filter(Boolean).join(" ");return{content:pt(t,"tokens",s),visible:!0}}},v6={id:"cache_write",render(t){let e=Wt(),{cacheWrite:n}=t.usageStats;if(!n)return{content:"",visible:!1};let s=[e.cache,e.output,Ao(n)].filter(Boolean).join(" ");return{content:pt(t,"tokens",s),visible:!0}}},w6={id:"extension_statuses",render(t){let e=t.extensionStatuses;if(!e||e.size===0)return{content:"",visible:!1};let n=[];for(let[s,o]of e.entries()){if(t.hiddenExtensionStatusKeys.has(s))continue;let r=o?kM(o):null;r&&n.push(r)}return n.length===0?{content:"",visible:!1}:{content:n.join(` ${iu} `),visible:!0}}},S6={model:i6,shell_mode:s6,path:o6,git:r6,thinking:a6,subagents:c6,token_in:l6,token_out:u6,token_total:d6,cost:p6,context_pct:m6,context_total:h6,time_spent:g6,time:f6,session:b6,hostname:x6,cache_read:y6,cache_write:v6,extension_statuses:w6};function C6(t,e){let n=t.slice(7),i=e.customItemsById.get(n);if(!i)return{content:"",visible:!1};let s=e.extensionStatuses.get(i.statusKey),o=s?ab(s):null;if(!o)return i.hideWhenMissing?{content:"",visible:!1}:{content:i.prefix??i.id,visible:!0};let r=o;return i.prefix&&(r=`${i.prefix}${iu}${r}`),i.color&&(r=nc(e.theme,i.color,r)),{content:r,visible:!0}}function _M(t,e){if(t.startsWith("custom:"))return C6(t,e);let n=S6[t];return n?n.render(e):{content:"",visible:!1}}import{spawn as T6}from"node:child_process";var k6=1e3,M6=500,Zn=null,Oo=null,lb=null,ub=null,db=0,pb=0;function I6(t){let e=0,n=0,i=0;for(let s of t.split(`
|
|
504
504
|
`)){if(!s)continue;let o=s[0],r=s[1];if(o==="?"&&r==="?"){i++;continue}o&&o!==" "&&o!=="?"&&e++,r&&r!==" "&&n++}return{staged:e,unstaged:n,untracked:i}}function mb(t,e=200){return new Promise(n=>{let i=T6("git",t,{stdio:["ignore","pipe","pipe"]}),s="",o=!1,r=c=>{o||(o=!0,clearTimeout(a),n(c))};i.stdout.on("data",c=>{s+=c.toString()}),i.on("close",c=>{r(c===0?s.trim():null)}),i.on("error",()=>{r(null)});let a=setTimeout(()=>{i.kill(),r(null)},e)})}async function R6(){let t=await mb(["branch","--show-current"]);if(t===null)return null;if(t)return t;let e=await mb(["rev-parse","--short","HEAD"]);return e?`${e} (detached)`:"detached"}async function P6(){let t=await mb(["status","--porcelain"],500);return t===null?null:I6(t)}function _6(t){let e=Date.now();if(Oo&&e-Oo.timestamp<M6)return Oo.branch;if(!ub){let n=pb;ub=R6().then(i=>{n===pb&&(Oo={branch:i,timestamp:Date.now()}),ub=null})}return Oo?Oo.branch:t}function EM(t){let e=Date.now(),n=_6(t);if(Zn&&e-Zn.timestamp<k6)return{branch:n,staged:Zn.staged,unstaged:Zn.unstaged,untracked:Zn.untracked};if(!lb){let i=db;lb=P6().then(s=>{i===db&&(Zn=s?{staged:s.staged,unstaged:s.unstaged,untracked:s.untracked,timestamp:Date.now()}:{staged:0,unstaged:0,untracked:0,timestamp:Date.now()}),lb=null})}return Zn?{branch:n,staged:Zn.staged,unstaged:Zn.unstaged,untracked:Zn.untracked}:{branch:n,staged:0,unstaged:0,untracked:0}}function om(){Zn=null,db++}function hb(){Oo=null,pb++}var wn={getBgAnsi:(t,e,n)=>`\x1B[48;2;${t};${e};${n}m`,getFgAnsi:(t,e,n)=>`\x1B[38;2;${t};${e};${n}m`,getFgAnsi256:t=>`\x1B[38;5;${t}m`,reset:"\x1B[0m"};function E6(t){let e=t.replace("#","");return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}var A6={sep:244,model:"#d787af",path:"#00afaf",gitClean:"#5faf5f",accent:"#febc38"};function AM(t){let e=A6[t];if(e===void 0||e==="")return"";if(typeof e=="number")return wn.getFgAnsi256(e);if(typeof e=="string"&&e.startsWith("#")){let[n,i,s]=E6(e);return wn.getFgAnsi(n,i,s)}return""}function ei(t,e){let n=AM(t);return n?`${n}${e}`:e}function Lo(t){return AM(t)}import{readdirSync as cm,existsSync as bi,statSync as lm,readFileSync as O6}from"node:fs";import{join as De,basename as fb}from"node:path";import{homedir as LM}from"node:os";var L6=[" xxxxxxxxxxxxxx "," xxxxxxxxxxxxxxxxxxxxx "," xxxxxxx;:+xxxxxxx+:;xxxxxxx "," xxxxxxxx .xxxxxxx. xxxxxxxx "," xxxxxxxxxxxxxx+;+xxxxxxxxxxxxxxx "," xxxxxxxxxxxxxxx+ +xxxxxxxxxxxxxxx "," xxxx..xxx+ xx+ +xx. +xxx:.xxxxx","xxxx; +xx+ .xxx xxx: +xx+ ;xxxx","xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx","xxxxxxxx+ ;xx; +xx+ +xxxxxxxx","xxxxxxxx+ ;xx+ ;xx; ;xxxxxxxx","xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx","xxxx; +xx+ .xxx xxx: +xx+ ;xxxx"," xxxx.:xxx+ xx+ xxx +xxx. xxxxx"," xxxxxxxxxxx+xxx+ +xxx+xxxxxxxxxxx "," xxxxxxxxxxxxxxx+:+xxxxxxxxxxxxxxx "," xxxxxxxx .xxxxxxx. xxxxxxxx "," xxxxxxx;:+xxxxxxx+:;xxxxxxx "," xxxxxxxxxxxxxxxxxxxxx "," xxxxxxxxxxxxxx "],gb=["\x1B[0;38;5;196;49m","\x1B[0;38;5;196;49m","\x1B[0;38;5;197;49m","\x1B[0;38;5;198;49m","\x1B[0;38;5;197;49m","\x1B[0;38;5;196;49m","\x1B[0;38;5;196;49m"];function um(t){return`\x1B[1m${t}\x1B[22m`}function Xe(t){return Lo("sep")+t+wn.reset}function W6(t){let e=wn.reset,n="",i=0,s=Math.max(1,Math.floor(t.length/gb.length));for(let o=0;o<t.length;o++){o>0&&o%s===0&&i<gb.length-1&&i++;let r=t[o];r!==" "?n+=gb[i]+r+e:n+=r}return n}function rm(t,e){let n=j(t);if(n>e)return X(t,e,"\u2026");if(n===e)return t;let i=Math.floor((e-n)/2),s=e-n-i;return" ".repeat(i)+t+" ".repeat(s)}function OM(t,e){let n=j(t);return n>e?X(t,e,"\u2026"):t+" ".repeat(e-n)}function U6(t,e){let n=L6.map(i=>W6(i));return["",rm(um("Welcome back!"),e),"",...n.map(i=>rm(i,e)),"",rm(ei("model",t.modelName),e),rm(Xe(t.providerName),e)]}function F6(t,e){let i=` ${Xe("\u2500".repeat(e-2))}`,s=[];if(t.recentSessions.length===0)s.push(` ${Xe("No recent sessions")}`);else for(let u of t.recentSessions.slice(0,3))s.push(` ${Xe("\u2022 ")}${ei("path",u.name)}${Xe(` (${u.timeAgo})`)}`);let o=[],{contextFiles:r,extensions:a,skills:c,promptTemplates:l}=t.loadedCounts,d=Xe("- ");return r>0||a>0||c>0||l>0?(r>0&&o.push(` ${d}${ei("gitClean",`${r}`)} context file${r!==1?"s":""}`),a>0&&o.push(` ${d}${ei("gitClean",`${a}`)} extension${a!==1?"s":""}`),c>0&&o.push(` ${d}${ei("gitClean",`${c}`)} skill${c!==1?"s":""}`),l>0&&o.push(` ${d}${ei("gitClean",`${l}`)} prompt template${l!==1?"s":""}`)):o.push(` ${Xe("No extensions loaded")}`),[` ${um(ei("accent","Tips"))}`,` ${Xe("/")} for commands`,` ${Xe("!")} to run bash`,` ${Xe("Shift+Tab")} cycle thinking`,i,` ${um(ei("accent","Loaded"))}`,...o,i,` ${um(ei("accent","Recent sessions"))}`,...s,""]}function WM(t,e,n){if(e<58)return[];let r=Math.min(e,Math.max(76,Math.min(e-2,96))),a=40,c=Math.max(1,r-a-3),l="\u2500",d=Xe("\u2502"),u=Xe("\u2554"),p=Xe("\u2557"),m=Xe("\u255A"),g=Xe("\u255D"),h=U6(t,a),f=F6(t,c),x=[],y=" sling - Slingshot agent ",P=Xe(l.repeat(1))+ei("model",y),_=1+j(y),R=r-2-_,L=R>0?Xe(l.repeat(R)):"";x.push(u+P+L+p);let E=Math.max(h.length,f.length);for(let W=0;W<E;W++){let M=OM(h[W]??"",a),I=OM(f[W]??"",c);x.push(d+M+d+I+d)}return x.push(m+n+g),x}var dm=class{constructor(e,n,i=[],s={contextFiles:0,extensions:0,skills:0,promptTemplates:0}){this.countdown=10;this.data={modelName:e,providerName:n,recentSessions:i,loadedCounts:s}}setCountdown(e){this.countdown=e}invalidate(){}render(e){if(e<44)return[];let o=Math.min(e,Math.max(76,Math.min(e-2,96))),r=` Press any key to continue (${this.countdown}s) `,a=Xe(r),c=o-2,l=j(r),d=Math.floor((c-l)/2),u=c-l-d,p="\u2500",m=Xe(p.repeat(Math.max(0,d)))+a+Xe(p.repeat(Math.max(0,u)));return WM(this.data,e,m)}},pm=class{constructor(e,n,i=[],s={contextFiles:0,extensions:0,skills:0,promptTemplates:0}){this.data={modelName:e,providerName:n,recentSessions:i,loadedCounts:s}}invalidate(){}render(e){if(e<44)return[];let o=Math.min(e,Math.max(76,Math.min(e-2,96))),r="\u2500",a=26,c=Math.max(1,o-a-3),l=Xe(r.repeat(a))+Xe("\u2534")+Xe(r.repeat(c)),d=WM(this.data,e,l);return d.length>0&&d.push(""),d}},am=new Set;function Vi(t,e){let n=e instanceof Error?e.message:String(e),i=`${t}:${n}`;am.has(i)||(am.add(i),am.size>500&&am.clear(),console.debug(`[powerline-welcome] ${t}:`,e))}function bb(){let t=process.env.HOME||process.env.USERPROFILE||LM(),e=process.cwd(),n=0,i=0,s=0,o=0,r=[De(t,".pi","agent","AGENTS.md"),De(t,".claude","AGENTS.md"),De(e,"AGENTS.md"),De(e,".pi","AGENTS.md"),De(e,".claude","AGENTS.md")];for(let h of r)bi(h)&&n++;let a=[De(t,".pi","agent","extensions"),De(e,"extensions"),De(e,".pi","extensions")],c=new Set,l=[De(t,".pi","agent","settings.json"),De(e,".pi","settings.json")];for(let h of l)if(bi(h))try{let f=JSON.parse(O6(h,"utf-8")),x=null;if(typeof f=="object"&&f!==null&&!Array.isArray(f)&&(x=f.packages),Array.isArray(x))for(let y of x){let w=null,P=null;if(typeof y=="string"?w=y:typeof y=="object"&&y!==null&&!Array.isArray(y)&&(w=y.source,P=y.extensions),typeof w!="string")continue;let _=w.trim();if(!_.startsWith("npm:")||Array.isArray(P)&&P.length===0)continue;let R=_.slice(4),L=R.lastIndexOf("@"),E=L>0?R.slice(0,L):R;!E||c.has(E)||(c.add(E),i++)}}catch(f){Vi(`Failed to read settings at ${h}`,f)}for(let h of a)if(bi(h))try{let f=cm(h);for(let x of f){let y=De(h,x);try{if(lm(y).isDirectory())(bi(De(y,"index.ts"))||bi(De(y,"index.js"))||bi(De(y,"package.json")))&&(c.has(x)||(c.add(x),i++));else if((x.endsWith(".ts")||x.endsWith(".js"))&&!x.startsWith(".")){let P=x.endsWith(".ts")?".ts":".js",_=fb(x,P);c.has(_)||(c.add(_),i++)}}catch(w){Vi(`Failed to inspect extension entry ${y}`,w)}}}catch(f){Vi(`Failed to scan extensions dir ${h}`,f)}let d=[De(t,".pi","agent","skills"),De(e,".pi","skills"),De(e,"skills")],u=new Set;for(let h of d)if(bi(h))try{let f=cm(h);for(let x of f){let y=De(h,x);try{lm(y).isDirectory()&&bi(De(y,"SKILL.md"))&&(u.has(x)||(u.add(x),s++))}catch(w){Vi(`Failed to inspect skill entry ${y}`,w)}}}catch(f){Vi(`Failed to scan skills dir ${h}`,f)}let p=[De(t,".pi","agent","commands"),De(t,".claude","commands"),De(e,".pi","commands"),De(e,".claude","commands")],m=new Set;function g(h){if(bi(h))try{let f=cm(h);for(let x of f){let y=De(h,x);try{if(lm(y).isDirectory())g(y);else if(x.endsWith(".md")){let P=fb(x,".md");m.has(P)||(m.add(P),o++)}}catch(w){Vi(`Failed to inspect prompt template entry ${y}`,w)}}}catch(f){Vi(`Failed to scan prompt template dir ${h}`,f)}}for(let h of p)g(h);return{contextFiles:n,extensions:i,skills:s,promptTemplates:o}}function xb(t=3){let e=process.env.HOME||process.env.USERPROFILE||LM(),n=[De(e,".pi","agent","sessions"),De(e,".pi","sessions")],i=[];function s(c){if(bi(c))try{let l=cm(c);for(let d of l){let u=De(c,d);try{let p=lm(u);if(p.isDirectory())s(u);else if(d.endsWith(".jsonl")){let m=fb(c),g=m;if(m.startsWith("--")){let h=m.split("-").filter(f=>f);g=h[h.length-1]||m}i.push({name:g,mtime:p.mtimeMs})}}catch(p){Vi(`Failed to inspect session entry ${u}`,p)}}}catch(l){Vi(`Failed to scan sessions dir ${c}`,l)}}for(let c of n)s(c);if(i.length===0)return[];i.sort((c,l)=>l.mtime-c.mtime);let o=new Set,r=[];for(let c of i)o.has(c.name)||(o.add(c.name),r.push(c));let a=Date.now();return r.slice(0,t).map(c=>({name:c.name.length>20?c.name.slice(0,17)+"\u2026":c.name,timeAgo:D6(a-c.mtime)}))}function D6(t){let e=Math.floor(t/1e3),n=Math.floor(e/60),i=Math.floor(n/60),s=Math.floor(i/24);return s>0?`${s}d ago`:i>0?`${i}h ago`:n>0?`${n}m ago`:"just now"}function UM(t){let e=null;return{schedule(n){if(e)return;let i=t.getGeneration();e=setTimeout(()=>{e=null,!(!t.isEnabled()||i!==t.getGeneration())&&t.dismiss(n)},0)},cancel(){e&&(clearTimeout(e),e=null)}}}function FM(t,e){let n=null;return{schedule(i=e){n||(n=setTimeout(()=>{n=null,t()},i))},cancel(){n&&(clearTimeout(n),n=null)}}}function DM(t){return typeof t=="object"&&t!==null}function $M(t){if(!DM(t)||typeof t.getContextUsage!="function")return null;let e=t.getContextUsage();if(!DM(e))return null;let n=e.tokens,i=e.contextWindow;if(typeof n!="number"||!Number.isFinite(n)||typeof i!="number"||!Number.isFinite(i)||i<=0)return null;let s=e.percent;return{contextTokens:n,contextWindow:i,contextPercent:typeof s=="number"&&Number.isFinite(s)?s:n/i*100}}var yb="\x1B_pi:c\x07";function oc(t,e){return!t||e<=0?[]:t.filter(n=>n!=null).map(n=>j(n)>e?X(n,e,"",!0):n)}function su(t,e){return e<=0?[]:t.length<=e?t:t.slice(t.length-e)}function $6(t,e){if(e<=0)return[];if(t.length<=e)return t;let n=t.findIndex(o=>o.includes(yb));if(n!==-1){let o=Math.max(0,Math.min(n-e+1,t.length-e));return t.slice(o,o+e)}let i=t.findIndex(o=>o.replace(/\x1b\[[0-9;]*m/g,"").trimStart().startsWith("\u2192 "));if(i===-1)return t.slice(0,e);let s=Math.max(0,Math.min(i-Math.floor(e/2),t.length-e));return t.slice(s,s+e)}function B6(t){let e=null;return{lines:t.map((i,s)=>{let o=i.indexOf(yb);return o===-1?i:(e||(e={row:s,col:j(i.slice(0,o))}),i.slice(0,o)+i.slice(o+yb.length))}),cursor:e}}function BM(t){let e=Math.max(1,t.width),n=Math.max(1,t.terminalRows-1),i=oc(t.statusLines,e),s=oc(t.topLines,e),o=oc(t.editorLines,e),r=oc(t.secondaryLines,e),a=oc(t.transcriptLines,e),c=oc(t.lastPromptLines,e),l=$6(o,n),d=n-l.length,u=su(s,d);d-=u.length;let p=su(r,d);d-=p.length;let m=su(c,d);d-=m.length;let g=su(i,d);d-=g.length;let h=su(a,d);return B6([...g,...u,...l,...p,...h,...m])}var N6=1200,j6=5e3,NM=100,q6=500,VM={up:"super+up",down:"super+down"};function Us(){return"\x1B[?2026h"}function Fs(){return"\x1B[?2026l"}function jM(t,e){return`\x1B[${t};${e}r`}function Cb(){return"\x1B[r"}function hm(t,e){return`\x1B[${t};${e}H`}function JM(){return"\x1B[2K"}function G6(){return"\x1B[?25l"}function K6(){return"\x1B[?25h"}function H6(){return"\x1B[?1049h"}function QM(){return"\x1B[?1049l"}function YM(){return"\x1B[?1007h"}function z6(){return"\x1B[?1007l"}function qM(){return"\x1B[?1002h\x1B[?1006h"}function Sb(){return"\x1B[?1006l\x1B[?1002l\x1B[?1000l"}function GM(t){return t==="kitty"?"\x1B[>7u":"\x1B[>4;2m"}function V6(t){return t==="kitty"?"\x1B[<u":"\x1B[>4;0m"}function XM(){return"\x1B[<999u\x1B[>4;0m"}function ZM(){return Us()+Cb()+Sb()+YM()+QM()+XM()+Fs()}function J6(t,e=VM){return Vn(t)?0:Un(t,e.up)||Pe(t,"pageUp")||Pe(t,"ctrl+shift+up")||/^\x1b\[(?:5;9(?::[12])?~|1;6(?::[12])?A|57421;9(?::[12])?u|57419;6(?::[12])?u)$/.test(t)?10:Un(t,e.down)||Pe(t,"pageDown")||Pe(t,"ctrl+shift+down")||/^\x1b\[(?:6;9(?::[12])?~|1;6(?::[12])?B|57422;9(?::[12])?u|57420;6(?::[12])?u)$/.test(t)?-10:0}function Q6(t){let e=/\x1b\[<(\d+);(\d+);(\d+)([Mm])/g,n=[],i=0;for(let s of t.matchAll(e)){if(s.index!==i)return null;i=s.index+s[0].length,n.push({code:Number(s[1]),col:Number(s[2]),row:Number(s[3]),final:s[4]})}return n.length>0&&i===t.length?n:null}function fm(t){return t&-61}function Y6(t){if(t.final!=="M")return 0;let e=fm(t.code);return e===64?3:e===65?-3:0}function X6(t){return t.final==="M"&&fm(t.code)===0&&(t.code&32)===0}function KM(t){return t.final==="M"&&fm(t.code)===0&&(t.code&32)!==0}function Z6(t){return t.final==="M"&&fm(t.code)===2&&(t.code&32)===0}function e8(t){return t.final==="m"}function eI(t){return t.replace(/\x1b\][^\x07]*(?:\x07|\x1b\\)/g,"")}function vb(t){return eI(t).replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,"")}var t8=new Intl.Segmenter(void 0,{granularity:"grapheme"});function mm(t,e,n){let i=0,s="";for(let{segment:o}of t8.segment(t)){let r=Math.max(0,j(o));i>=e&&i<n&&(s+=o),i+=r}return s}function HM(t,e){return t.line===e.line?t.col-e.col:t.line-e.line}function n8(t){let e=t;for(;e;){let n=Object.getOwnPropertyDescriptor(e,"rows");if(n)return n;e=Object.getPrototypeOf(e)}}function i8(t,e){if(e?.get){let i=e.get.call(t);return typeof i=="number"&&Number.isFinite(i)?i:24}let n=Reflect.get(t,"rows");return typeof n=="number"&&Number.isFinite(n)?n:24}function Tb(t,e){return j(t)>e?X(t,e,"",!0):t}function s8(t,e){return Tb(eI(t),e)}function zM(t){return t.includes(" ")?t.replace(/\t/g," "):t}function wb(t,e,n,i){if(t.lines.length===0)return"";let s=Math.max(1,e-t.lines.length+1),o=Cb();for(let r=0;r<t.lines.length;r++)o+=hm(s+r,1),o+=JM(),o+=Tb(t.lines[r]??"",n);return t.cursor&&i?(o+=hm(s+t.cursor.row,Math.max(1,t.cursor.col+1)),o+=K6()):o+=G6(),o}var gm=class{constructor(e){this.extendedKeyboardMode=null;this.originalCompositeLineAt=null;this.patchedRenders=[];this.removeInputListener=null;this.emergencyCleanup=null;this.mouseReportingResumeTimer=null;this.clipboardRestoreTimer=null;this.installed=!1;this.disposed=!1;this.writing=!1;this.renderPassActive=!1;this.renderPassCluster=null;this.renderingCluster=!1;this.renderingScrollableRoot=!1;this.checkingOverlay=!1;this.scrollOffset=0;this.maxScrollOffset=0;this.lastRootLineCount=0;this.rootLines=[];this.visibleRootStart=0;this.visibleScrollableRows=0;this.visibleRootLines=[];this.visibleClusterLines=[];this.selectionArea=null;this.selectionAnchor=null;this.selectionFocus=null;this.selectionDragging=!1;this.preserveSelectionFocusOnRelease=!1;this.lastLeftPress=null;this.tui=e.tui,this.terminal=e.terminal,this.renderCluster=e.renderCluster,this.getShowHardwareCursor=e.getShowHardwareCursor??(()=>!1),this.mouseScroll=e.mouseScroll!==!1,this.keyboardScrollShortcuts=e.keyboardScrollShortcuts??VM,this.onCopySelection=e.onCopySelection??null,this.rowsDescriptor=n8(e.terminal),this.originalWrite=e.terminal.write.bind(e.terminal),this.originalDoRender=typeof e.tui.doRender=="function"?e.tui.doRender.bind(e.tui):null,this.originalRender=typeof e.tui.render=="function"?e.tui.render.bind(e.tui):null}install(){if(!this.installed){if(typeof this.terminal.write!="function")throw new Error("[powerline-footer] Fixed editor compositor expected terminal.write(data) to exist");this.originalWrite(Us()+H6()+this.enableAlternateScreenKeyboardMode()+z6()+(this.mouseScroll?qM():"")+Fs()),this.emergencyCleanup=()=>{this.disposed||this.restoreTerminalStateForExit()},process.once("exit",this.emergencyCleanup),Object.defineProperty(this.terminal,"rows",{configurable:!0,get:()=>this.getScrollableRows()}),this.originalRender&&(this.tui.render=e=>this.renderScrollableRoot(e)),typeof this.tui.addInputListener=="function"&&(this.removeInputListener=this.tui.addInputListener(e=>this.handleInput(e))),this.terminal.write=e=>this.write(e),this.originalDoRender&&(this.tui.doRender=()=>{this.renderPassActive=!0,this.renderPassCluster=null;try{this.originalDoRender?.(),this.requestRepaint()}finally{this.renderPassActive=!1,this.renderPassCluster=null}}),typeof this.tui.compositeLineAt=="function"&&(this.originalCompositeLineAt=this.tui.compositeLineAt.bind(this.tui),this.tui.compositeLineAt=(e,n,i,s,o)=>this.originalCompositeLineAt?.(zM(e),zM(n),i,s,o)??""),this.installed=!0}}hideRenderable(e){if(this.patchedRenders.some(i=>i.target===e))return;let n=e.render.bind(e);this.patchedRenders.push({target:e,originalRender:n}),e.render=()=>[]}renderHidden(e,n){return(this.patchedRenders.find(o=>o.target===e)?.originalRender??e.render.bind(e))(n)}jumpToPreviousRootTarget(e){return this.jumpToRootTarget(e,"previous")}jumpToNextRootTarget(e){return this.jumpToRootTarget(e,"next")}jumpToRootBottom(){return this.disposed||this.hasVisibleOverlay()||this.scrollOffset===0?!1:(this.clearSelection(),this.lastLeftPress=null,this.scrollOffset=0,this.requestRender(),!0)}jumpToRootTarget(e,n){if(this.disposed||e.length===0||this.hasVisibleOverlay())return!1;let i=this.visibleRootStart,s=n==="previous"?e.filter(o=>o<i).sort((o,r)=>r-o):e.filter(o=>o>i).sort((o,r)=>o-r);for(let o of s){let r=Math.max(0,Math.min(this.lastRootLineCount-Math.max(1,this.visibleScrollableRows)-o,this.maxScrollOffset));if(r!==this.scrollOffset)return this.clearSelection(),this.lastLeftPress=null,this.scrollOffset=r,this.requestRender(),!0}return!1}requestRepaint(){if(this.disposed||this.hasVisibleOverlay())return;let e=this.getRawRows(),n=Math.max(1,this.terminal.columns||80),i=this.getCluster(n,e);i.lines.length!==0&&this.originalWrite(Us()+wb(this.decorateCluster(i),e,n,this.getShowHardwareCursor())+Fs())}dispose(e={}){if(!this.disposed){this.disposed=!0;for(let n of this.patchedRenders.splice(0))n.target.render=n.originalRender;this.removeInputListener?.(),this.removeInputListener=null,this.emergencyCleanup&&(process.removeListener("exit",this.emergencyCleanup),this.emergencyCleanup=null),this.mouseReportingResumeTimer&&(clearTimeout(this.mouseReportingResumeTimer),this.mouseReportingResumeTimer=null),this.clipboardRestoreTimer&&(clearTimeout(this.clipboardRestoreTimer),this.clipboardRestoreTimer=null),this.terminal.write=this.originalWrite,this.originalDoRender&&(this.tui.doRender=this.originalDoRender),this.originalRender&&(this.tui.render=this.originalRender),this.originalCompositeLineAt&&(this.tui.compositeLineAt=this.originalCompositeLineAt,this.originalCompositeLineAt=null),this.rowsDescriptor?Object.defineProperty(this.terminal,"rows",this.rowsDescriptor):Reflect.deleteProperty(this.terminal,"rows"),this.restoreTerminalState(e)}}getRawRows(){return Math.max(2,i8(this.terminal,this.rowsDescriptor))}getScrollableRows(){if(this.disposed||this.writing||this.renderingCluster||this.checkingOverlay||this.hasVisibleOverlay())return this.getRawRows();let e=this.getRawRows(),n=Math.max(1,this.terminal.columns||80),i=this.getCluster(n,e);return Math.max(1,e-i.lines.length)}renderScrollableRoot(e){if(!this.originalRender||this.disposed||this.renderingScrollableRoot)return this.originalRender?.(e)??[];if(this.hasVisibleOverlay())return this.originalRender(e).map(n=>s8(n,Math.max(1,e)));this.renderingScrollableRoot=!0;try{let n=this.refreshRootWindow(e);return this.visibleRootLines.map((i,s)=>this.renderSelectionHighlight(i,n+s,"root"))}finally{this.renderingScrollableRoot=!1}}refreshRootWindow(e){if(!this.originalRender)return this.updateVisibleRootWindow();let n=this.getRawRows(),i=Math.max(1,e),s=this.getCluster(i,n),o=Math.max(1,n-s.lines.length),r=this.originalRender(i);return this.rootLines=r,this.scrollOffset>0&&this.lastRootLineCount>0&&r.length>this.lastRootLineCount&&(this.scrollOffset+=r.length-this.lastRootLineCount),this.lastRootLineCount=r.length,this.maxScrollOffset=Math.max(0,r.length-o),this.scrollOffset=Math.max(0,Math.min(this.scrollOffset,this.maxScrollOffset)),this.updateVisibleRootWindow(o)}handleInput(e){if(this.disposed||this.hasVisibleOverlay())return;let n=this.mouseScroll?Q6(e):null;if(n){for(let s of n)this.handleMousePacket(s);return{consume:!0}}let i=J6(e,this.keyboardScrollShortcuts);if(i!==0)return this.scrollBy(i),{consume:!0}}handleMousePacket(e){let n=Y6(e);if(n!==0){this.selectionDragging=!1,this.scrollBy(n);return}let i=this.selectionLocationForPacket(e);if(Z6(e)){this.selectionDragging=!1,this.preserveSelectionFocusOnRelease=!1;let s=this.isLocationInsideSelection(i)?this.getSelectedText():"";if(s){this.onCopySelection?.(s),this.lastLeftPress=null,this.pauseMouseReportingForContextMenu(s);return}this.clearSelection(),this.lastLeftPress=null,this.pauseMouseReportingForContextMenu();return}if(!this.scrollSelectionAtViewportEdge(e)){if(this.selectionDragging&&e8(e)){this.finishSelection(e,i);return}if(i){if(X6(e)){this.startSelection(i);return}if(this.selectionDragging&&KM(e)&&i.area===this.selectionArea){this.lastLeftPress=null,this.preserveSelectionFocusOnRelease=!1,this.selectionFocus=i.point,this.requestRender();return}}}}updateVisibleRootWindow(e=this.visibleScrollableRows){let n=Math.max(1,e),i=Math.max(0,this.rootLines.length-n-this.scrollOffset),s=this.rootLines.slice(i,i+n);for(;s.length<n;)s.push("");return this.visibleRootStart=i,this.visibleScrollableRows=n,this.visibleRootLines=s,i}finishSelection(e,n){this.preserveSelectionFocusOnRelease||(this.selectionFocus=n?.area===this.selectionArea?n.point:this.clampedSelectionPointForPacket(e,this.selectionArea)),this.preserveSelectionFocusOnRelease=!1,this.selectionDragging=!1;let i=this.getSelectedText();i?(this.lastLeftPress=null,this.onCopySelection?.(i)):this.clearSelection(),this.requestRender()}startSelection(e){let n=Date.now(),i=e.point.line;if(this.lastLeftPress&&this.lastLeftPress.area===e.area&&this.lastLeftPress.line===i&&n-this.lastLeftPress.at<=q6){this.selectionArea=e.area,this.selectionAnchor={line:i,col:0},this.selectionFocus={line:i,col:this.selectionLineWidth(e.area,i)},this.selectionDragging=!0,this.preserveSelectionFocusOnRelease=!0,this.lastLeftPress=null,this.requestRender();return}this.selectionArea=e.area,this.selectionAnchor=e.point,this.selectionFocus=e.point,this.selectionDragging=!0,this.preserveSelectionFocusOnRelease=!1,this.lastLeftPress={area:e.area,line:i,at:n},this.requestRender()}selectionLocationForPacket(e){if(e.row<1)return null;let n=Math.max(0,e.col-1);if(e.row<=this.visibleScrollableRows)return{area:"root",point:{line:this.visibleRootStart+e.row-1,col:n}};let i=e.row-this.visibleScrollableRows-1;return i>=this.visibleClusterLines.length?null:{area:"cluster",point:{line:i,col:n}}}scrollSelectionAtViewportEdge(e){if(!this.selectionDragging||this.selectionArea!=="root"||!KM(e))return!1;let n=e.row<=1?1:e.row>=this.visibleScrollableRows?-1:0;if(n===0)return!1;let i=Math.max(0,Math.min(this.scrollOffset+n,this.maxScrollOffset));if(i===this.scrollOffset)return!1;this.lastLeftPress=null,this.preserveSelectionFocusOnRelease=!0,this.scrollOffset=i;let s=this.updateVisibleRootWindow(),o=n>0?s:s+Math.max(0,this.visibleScrollableRows-1);return this.selectionFocus={line:o,col:Math.max(0,e.col-1)},this.requestRender(),!0}clampedSelectionPointForPacket(e,n){if(n==="cluster")return{line:Math.max(0,Math.min(e.row-this.visibleScrollableRows-1,this.visibleClusterLines.length-1)),col:Math.max(0,e.col-1)};let i=Math.max(1,Math.min(e.row,this.visibleScrollableRows));return{line:this.visibleRootStart+i-1,col:Math.max(0,e.col-1)}}renderSelectionHighlight(e,n,i){let s=this.getSelectionRangeForLine(n,i);if(!s)return e;let o=vb(e),r=Math.max(0,Math.min(s.startCol,j(o))),a=Math.max(r,Math.min(s.endCol,j(o)));if(r===a)return e;let c=mm(o,0,r),l=mm(o,r,a),d=mm(o,a,Number.POSITIVE_INFINITY);return`${c}\x1B[7m${l}\x1B[27m${d}`}selectionLineWidth(e,n){let i=e==="root"?this.visibleRootLines:this.visibleClusterLines,s=e==="root"?this.visibleRootStart:0;return j(vb(i[n-s]??""))}getSelectedText(){if(!this.selectionArea||!this.selectionAnchor||!this.selectionFocus)return"";let e=HM(this.selectionAnchor,this.selectionFocus)<=0?this.selectionAnchor:this.selectionFocus,n=e===this.selectionAnchor?this.selectionFocus:this.selectionAnchor;if(e.line===n.line&&e.col===n.col)return"";let i=this.selectionArea==="root"?this.rootLines:this.visibleClusterLines,s=[];for(let o=e.line;o<=n.line;o++){let r=vb(i[o]??""),a=o===e.line?e.col:0,c=o===n.line?n.col:Number.POSITIVE_INFINITY;s.push(mm(r,a,c))}return s.join(`
|
|
505
505
|
`).replace(/[ \t]+$/gm,"").trimEnd()}getSelectionRangeForLine(e,n){if(this.selectionArea!==n||!this.selectionAnchor||!this.selectionFocus)return null;let i=HM(this.selectionAnchor,this.selectionFocus)<=0?this.selectionAnchor:this.selectionFocus,s=i===this.selectionAnchor?this.selectionFocus:this.selectionAnchor;return e<i.line||e>s.line?null:{startCol:e===i.line?i.col:0,endCol:e===s.line?s.col:Number.POSITIVE_INFINITY}}isLocationInsideSelection(e){if(!e||e.area!==this.selectionArea)return!1;let n=this.getSelectionRangeForLine(e.point.line,e.area);return!!(n&&e.point.col>=n.startCol&&e.point.col<n.endCol)}scrollBy(e){let n=Math.max(1,this.terminal.columns||80);this.refreshRootWindow(n);let i=Math.max(0,Math.min(this.scrollOffset+e,this.maxScrollOffset));i!==this.scrollOffset&&(this.clearSelection(),this.lastLeftPress=null,this.scrollOffset=i,this.repaintScrollableViewport(n),this.requestRender())}requestRender(){typeof this.tui.requestRender=="function"&&this.tui.requestRender()}repaintScrollableViewport(e){if(this.disposed||this.writing||this.hasVisibleOverlay())return;let n=this.getRawRows(),i=this.getCluster(e,n),s=Math.max(1,n-i.lines.length),o=this.updateVisibleRootWindow(s),r=Us()+jM(1,s)+hm(1,1);for(let a=0;a<s;a++)a>0&&(r+=`\r
|
|
506
|
-
`),r+=JM(),r+=Tb(this.renderSelectionHighlight(this.visibleRootLines[a]??"",o+a,"root"),e);r+=wb(this.decorateCluster(i),n,e,this.getShowHardwareCursor()),r+=Fs(),this.originalWrite(r)}pauseMouseReportingForContextMenu(e=null){this.mouseReportingResumeTimer&&clearTimeout(this.mouseReportingResumeTimer),this.clipboardRestoreTimer&&(clearTimeout(this.clipboardRestoreTimer),this.clipboardRestoreTimer=null),this.originalWrite(Us()+Sb()+Fs()),this.mouseReportingResumeTimer=setTimeout(()=>{this.mouseReportingResumeTimer=null,this.disposed||this.originalWrite(Us()+qM()+Fs())},N6),typeof this.mouseReportingResumeTimer=="object"&&"unref"in this.mouseReportingResumeTimer&&this.mouseReportingResumeTimer.unref();let n=this.onCopySelection;if(!e||!n)return;let i=Math.ceil(j6/NM),s=()=>{this.clipboardRestoreTimer=setTimeout(()=>{this.clipboardRestoreTimer=null,!this.disposed&&(i-=1,this.getSelectedText()===e&&(n(e),i>0&&s()))},NM),typeof this.clipboardRestoreTimer=="object"&&"unref"in this.clipboardRestoreTimer&&this.clipboardRestoreTimer.unref()};s()}clearSelection(){this.selectionArea=null,this.selectionAnchor=null,this.selectionFocus=null,this.selectionDragging=!1,this.preserveSelectionFocusOnRelease=!1}activeExtendedKeyboardMode(){return this.terminal.kittyProtocolActive===!0?"kitty":Reflect.get(this.terminal,"_modifyOtherKeysActive")===!0?"modifyOtherKeys":null}enableAlternateScreenKeyboardMode(){return this.extendedKeyboardMode=this.activeExtendedKeyboardMode(),this.extendedKeyboardMode?GM(this.extendedKeyboardMode):""}restoreTerminalState(e={}){let n=this.extendedKeyboardMode??this.activeExtendedKeyboardMode(),i=!e.resetExtendedKeyboardModes&&this.extendedKeyboardMode===null&&n!==null;this.originalWrite(Us()+Cb()+(this.mouseScroll?Sb():"")+(n?V6(n):"")+YM()+QM()+(i&&n?GM(n):"")+(e.resetExtendedKeyboardModes?XM():"")+Fs())}restoreTerminalStateForExit(){try{this.restoreTerminalState({resetExtendedKeyboardModes:!0})}catch{}}write(e){if(this.disposed||this.writing||this.hasVisibleOverlay()){this.originalWrite(e);return}this.writing=!0;try{let n=this.getRawRows(),i=Math.max(1,this.terminal.columns||80),s=this.getCluster(i,n),o=s.lines.length;if(o===0||n<=2){this.originalWrite(e);return}let r=Math.max(1,n-o),a=typeof this.tui.hardwareCursorRow=="number"?this.tui.hardwareCursorRow:typeof this.tui.cursorRow=="number"?this.tui.cursorRow:0,c=typeof this.tui.previousViewportTop=="number"?this.tui.previousViewportTop:0,l=Math.max(1,Math.min(r,a-c+1)),d=Us()+jM(1,r)+hm(l,1)+e+wb(this.decorateCluster(s),n,i,this.getShowHardwareCursor())+Fs();this.originalWrite(d)}finally{this.writing=!1}}getCluster(e,n){if(this.renderPassActive&&this.renderPassCluster?.width===e&&this.renderPassCluster.terminalRows===n)return this.renderPassCluster.cluster;let i=this.withClusterRender(()=>this.renderCluster(e,n));return this.visibleClusterLines=i.lines,this.renderPassActive&&(this.renderPassCluster={width:e,terminalRows:n,cluster:i}),i}decorateCluster(e){return this.selectionArea!=="cluster"?e:{...e,lines:e.lines.map((n,i)=>this.renderSelectionHighlight(n,i,"cluster"))}}withClusterRender(e){let n=this.renderingCluster;this.renderingCluster=!0;try{return e()}finally{this.renderingCluster=n}}hasVisibleOverlay(){if(this.checkingOverlay)return!1;this.checkingOverlay=!0;try{if(typeof this.tui.hasOverlay=="function"&&this.tui.hasOverlay())return!0;let e=Reflect.get(this.tui,"overlayStack");return Array.isArray(e)?e.some(n=>n&&n.hidden!==!0):!1}finally{this.checkingOverlay=!1}}};import{existsSync as iI,readFileSync as sI,writeFileSync as
|
|
506
|
+
`),r+=JM(),r+=Tb(this.renderSelectionHighlight(this.visibleRootLines[a]??"",o+a,"root"),e);r+=wb(this.decorateCluster(i),n,e,this.getShowHardwareCursor()),r+=Fs(),this.originalWrite(r)}pauseMouseReportingForContextMenu(e=null){this.mouseReportingResumeTimer&&clearTimeout(this.mouseReportingResumeTimer),this.clipboardRestoreTimer&&(clearTimeout(this.clipboardRestoreTimer),this.clipboardRestoreTimer=null),this.originalWrite(Us()+Sb()+Fs()),this.mouseReportingResumeTimer=setTimeout(()=>{this.mouseReportingResumeTimer=null,this.disposed||this.originalWrite(Us()+qM()+Fs())},N6),typeof this.mouseReportingResumeTimer=="object"&&"unref"in this.mouseReportingResumeTimer&&this.mouseReportingResumeTimer.unref();let n=this.onCopySelection;if(!e||!n)return;let i=Math.ceil(j6/NM),s=()=>{this.clipboardRestoreTimer=setTimeout(()=>{this.clipboardRestoreTimer=null,!this.disposed&&(i-=1,this.getSelectedText()===e&&(n(e),i>0&&s()))},NM),typeof this.clipboardRestoreTimer=="object"&&"unref"in this.clipboardRestoreTimer&&this.clipboardRestoreTimer.unref()};s()}clearSelection(){this.selectionArea=null,this.selectionAnchor=null,this.selectionFocus=null,this.selectionDragging=!1,this.preserveSelectionFocusOnRelease=!1}activeExtendedKeyboardMode(){return this.terminal.kittyProtocolActive===!0?"kitty":Reflect.get(this.terminal,"_modifyOtherKeysActive")===!0?"modifyOtherKeys":null}enableAlternateScreenKeyboardMode(){return this.extendedKeyboardMode=this.activeExtendedKeyboardMode(),this.extendedKeyboardMode?GM(this.extendedKeyboardMode):""}restoreTerminalState(e={}){let n=this.extendedKeyboardMode??this.activeExtendedKeyboardMode(),i=!e.resetExtendedKeyboardModes&&this.extendedKeyboardMode===null&&n!==null;this.originalWrite(Us()+Cb()+(this.mouseScroll?Sb():"")+(n?V6(n):"")+YM()+QM()+(i&&n?GM(n):"")+(e.resetExtendedKeyboardModes?XM():"")+Fs())}restoreTerminalStateForExit(){try{this.restoreTerminalState({resetExtendedKeyboardModes:!0})}catch{}}write(e){if(this.disposed||this.writing||this.hasVisibleOverlay()){this.originalWrite(e);return}this.writing=!0;try{let n=this.getRawRows(),i=Math.max(1,this.terminal.columns||80),s=this.getCluster(i,n),o=s.lines.length;if(o===0||n<=2){this.originalWrite(e);return}let r=Math.max(1,n-o),a=typeof this.tui.hardwareCursorRow=="number"?this.tui.hardwareCursorRow:typeof this.tui.cursorRow=="number"?this.tui.cursorRow:0,c=typeof this.tui.previousViewportTop=="number"?this.tui.previousViewportTop:0,l=Math.max(1,Math.min(r,a-c+1)),d=Us()+jM(1,r)+hm(l,1)+e+wb(this.decorateCluster(s),n,i,this.getShowHardwareCursor())+Fs();this.originalWrite(d)}finally{this.writing=!1}}getCluster(e,n){if(this.renderPassActive&&this.renderPassCluster?.width===e&&this.renderPassCluster.terminalRows===n)return this.renderPassCluster.cluster;let i=this.withClusterRender(()=>this.renderCluster(e,n));return this.visibleClusterLines=i.lines,this.renderPassActive&&(this.renderPassCluster={width:e,terminalRows:n,cluster:i}),i}decorateCluster(e){return this.selectionArea!=="cluster"?e:{...e,lines:e.lines.map((n,i)=>this.renderSelectionHighlight(n,i,"cluster"))}}withClusterRender(e){let n=this.renderingCluster;this.renderingCluster=!0;try{return e()}finally{this.renderingCluster=n}}hasVisibleOverlay(){if(this.checkingOverlay)return!1;this.checkingOverlay=!0;try{if(typeof this.tui.hasOverlay=="function"&&this.tui.hasOverlay())return!0;let e=Reflect.get(this.tui,"overlayStack");return Array.isArray(e)?e.some(n=>n&&n.hidden!==!0):!1}finally{this.checkingOverlay=!1}}};import{existsSync as iI,readFileSync as sI,writeFileSync as oIe,mkdirSync as rIe}from"node:fs";import{join as Pb,dirname as cIe}from"node:path";import{homedir as oI}from"node:os";var o8="openai-codex/gpt-5.4-mini",r8=`Generate a 2-4 word "{theme}" themed loading message ending in "...".
|
|
507
507
|
|
|
508
508
|
Task: {task}
|
|
509
509
|
|
|
@@ -519,14 +519,14 @@ Output only the message, nothing else.`;var a8="You generate short themed loadin
|
|
|
519
519
|
`),!0}catch(l){return console.debug(`[sling-footer] Failed to persist powerline setting to ${a}:`,l),!1}}function Y8(t,e=process.cwd()){return DI(e,n=>wM(n,t))}function CI(t,e,n){return DI(t,i=>SM(i,e,n))}var TI=Object.keys(sc);function X8(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(sc,t)}function Z8(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();return X8(e)?e:null}function Ds(t){return t.trim().length>0}function ou(t,e){return e?.getExpandedText?.()??t.ui.getEditorText()}function kI(t,e){let n=t.replace(/\s+/g," ").trim();return n?X(n,e,"\u2026"):"(empty)"}function ej(t,e){return!Ds(e)||t[0]===e?!1:(t.unshift(e),t.length>wm&&(t.length=wm),!0)}function Sm(t){let e=t.trim().toLowerCase().split("+");if(e.length<=1)return e[0]??"";let n=new Map(AI.map((s,o)=>[s,o]));return[...e.slice(0,-1).sort((s,o)=>(n.get(s)??99)-(n.get(o)??99)),e[e.length-1]].join("+")}function $I(){let t=new Set([...P8,...R8].map(Sm));for(let e of Object.values(na)){let n=e.defaultKeys,i=n===void 0?[]:Array.isArray(n)?n:[n];for(let s of i)t.add(Sm(s))}return t}function tj(t){let e=t.toLowerCase();return/^[a-z0-9]$/i.test(t)||/^f([1-9]|1[0-2])$/i.test(t)||E8.has(e)?!0:OI.has(t)}function BI(t){if(typeof t!="string")return null;let e=t.trim();if(!e||/\s/.test(e))return null;let n=e.split("+");if(n.some(a=>a.length===0))return null;let i=n.slice(0,-1).map(a=>{let c=a.toLowerCase();return c==="cmd"||c==="command"?"super":c});if(new Set(i).size!==i.length)return null;for(let a of i)if(!_8.has(a))return null;let s=n[n.length-1];if(!tj(s))return null;let o=OI.has(s)?s:s.toLowerCase(),r=Sm([...i,o].join("+"));return eb(r)&&!rM(r)?null:r}function ac(t){return aM(Sm(t))}function nj(t,e){let n=Ab[t];if(!e.has(ac(n)))return n;for(let i of Ob){let s=Ab[i];if(!e.has(ac(s)))return s}return null}function MI(t){let e={...Ab},n=t.powerlineShortcuts;if(bt(n))for(let s of Ob){let o=BI(n[s]);o&&(e[s]=o)}let i=new Set(Array.from($I(),ac));for(let s of Ob){let o=e[s],r=ac(o);if(!i.has(r)){i.add(r);continue}let a=nj(s,i);if(!a){console.debug(`[sling-footer] Shortcut conflict for ${s}: "${o}" is already in use`);continue}console.debug(`[sling-footer] Shortcut conflict for ${s}: "${o}" replaced with "${a}"`),e[s]=a,i.add(ac(a))}return e}function II(t){let e=bt(t.bashMode)?t.bashMode:{},n=BI(e.toggleShortcut),i=n&&!$I().has(ac(n))?n:_b.toggleShortcut;n&&i!==n&&console.debug(`[sling-footer] Bash mode shortcut conflict: "${n}" replaced with "${i}"`);let s=typeof e.transcriptMaxLines=="number"&&Number.isFinite(e.transcriptMaxLines)?Math.max(100,Math.floor(e.transcriptMaxLines)):_b.transcriptMaxLines,o=typeof e.transcriptMaxBytes=="number"&&Number.isFinite(e.transcriptMaxBytes)?Math.max(16*1024,Math.floor(e.transcriptMaxBytes)):_b.transcriptMaxBytes;return{toggleShortcut:i,transcriptMaxLines:s,transcriptMaxBytes:o}}function ij(t,e){let n=_M(t,e);return!n.visible||!n.content?{content:"",width:0,visible:!1}:{content:n.content,width:j(n.content),visible:!0}}function RI(t,e){if(t.length===0)return"";let n=sm(e.separator),i=Lo("sep"),s=n.left;return" "+t.join(` ${i}${s}${wn.reset} `)+wn.reset+" "}function sj(t,e,n){let i=sm(e.separator),s=j(i.left)+2,o=vM(e,qe.customItems),r=[...o.leftSegments,...o.rightSegments],a=o.secondarySegments,c=[...r,...a],l=[];for(let x of c){let{content:y,width:w,visible:P}=ij(x,t);P&&l.push({content:y,width:w})}if(l.length===0)return{topContent:"",secondaryContent:""};let d=2,u=d,p=[],m=[],g=!1;for(let x of l){let y=x.width+(p.length>0?s:0);!g&&u+y<=n?(p.push(x.content),u+=y):(g=!0,m.push(x))}let h=d,f=[];for(let x of m){let y=x.width+(f.length>0?s:0);if(h+y<=n)f.push(x.content),h+=y;else break}return{topContent:RI(p,e),secondaryContent:RI(f,e)}}function Wb(t){let e=SI();qe=ob(e.powerline,TI);let n=MI(e),i=II(e),s=!0,o=Date.now(),r=0,a=null,c=null,l=null,d=null,u=null,p=!1,m=null,g=null,h=null,f=null,x=null,y=null,w=null,P=null,_=null,R=!1,L=!1,E="",W=!0,M=null,I=wI(),O=null,F=!1,N=new Vl(i),H=new Zl,G=null,Z=0,de=null,Te=0,pe=!0,Ie=!1,et=0,Fe=()=>process.env.SHELL||"/bin/sh",oi=()=>G?.state.cwd??a?.cwd??process.cwd(),jt=UM({dismiss:v=>ju(v),getGeneration:()=>r,isEnabled:()=>s}),ne=FM(()=>{let v=Date.now()-et;if(pe&&!Ie&&v<ym){ne.schedule(Math.max(0,ym-v));return}m?.requestRender()},W8),be=()=>{de=null,pe=!0},ye=v=>{pe=!0,ne.schedule(v)},tt=(v={})=>{if(pe=!0,v.deferDuringTyping!==!1&&Date.now()-et<ym){ne.schedule();return}Ie=!0,ne.cancel(),ne.schedule(0)},At=v=>{g?.(),g=null;let S=v;if(typeof S.setExtensionStatus!="function")return;let D=S.setExtensionStatus,q=S.clearExtensionStatuses,te=function(He,_e){D.call(this,He,_e),tt()};S.setExtensionStatus=te;let J=null;typeof q=="function"&&(J=function(){q.call(this),tt()},S.clearExtensionStatuses=J),g=()=>{S.setExtensionStatus===te&&(S.setExtensionStatus=D),J&&S.clearExtensionStatuses===J&&(S.clearExtensionStatuses=q)}},Ii=v=>{let S=Eo(Ql(a?.cwd??process.cwd()).map(q=>q.command),v,50),D=Eo(Yl(Fe()),v,50);return[...new Set([...S,...D])]},qt=async()=>(G||(G=new em(Fe(),a?.cwd??process.cwd(),N,ye,(v,S)=>Y1(a?.cwd??process.cwd(),v,S))),await G.ensureReady(),G),Tn=async(v,S)=>{try{await(await qt()).runCommand(v),ye()}catch(D){let q=D instanceof Error?D.message:String(D);S.ui.notify(`Failed to run shell command: ${q}`,"error")}},Ri=async(v,S)=>{if(v!==F){if(!v&&G?.state.running){S.ui.notify("Wait for the current shell command to finish before leaving bash mode","warning");return}if(v){try{let D=await qt();F=!0,O?.dismissBashModeUi?.(),O?.refreshGhostSuggestion?.(),ye(),S.ui.notify(`Bash mode enabled (${D.state.shellName})`,"info")}catch(D){G?.dispose(),G=null,F=!1,ye();let q=D instanceof Error?D.message:String(D);S.ui.notify(`Failed to start shell session: ${q}`,"error")}return}F=v,O?.dismissBashModeUi?.(),ye(),S.ui.notify("Bash mode disabled","info")}};function Ac(v){return{selectedPrefix:S=>v.fg("accent",S),selectedText:S=>v.fg("accent",S),description:S=>v.fg("muted",S),scrollInfo:S=>v.fg("dim",S),noMatch:S=>v.fg("warning",S)}}async function Zs(v,S,D,q,te){return v.ui.custom((J,Y,He,_e)=>{let ct=new Qt(q,te,Ac(Y)),st=ue=>Y.fg("dim",ue),kn=(ue,Re)=>`${st("\u2502")}${X(ue,Re,"\u2026",!0)}${st("\u2502")}`;return ct.onSelect=ue=>_e(ue),ct.onCancel=()=>_e(null),{render:ue=>{let Re=Math.max(1,ue-2),Ge=[];Ge.push(st(`\u256D${"\u2500".repeat(Re)}\u256E`)),Ge.push(kn(Y.fg("accent",Y.bold(S)),Re)),Ge.push(st(`\u251C${"\u2500".repeat(Re)}\u2524`));for(let It of ct.render(Re))Ge.push(kn(It,Re));return Ge.push(st(`\u251C${"\u2500".repeat(Re)}\u2524`)),Ge.push(kn(Y.fg("dim",D),Re)),Ge.push(st(`\u2570${"\u2500".repeat(Re)}\u256F`)),Ge},invalidate:()=>ct.invalidate(),handleInput:ue=>{ct.handleInput(ue),J.requestRender()}}},{overlay:!0,overlayOptions:()=>({verticalAlign:"center",horizontalAlign:"center"})})}t.on("session_start",async(v,S)=>{G?.dispose(),G=null,r++,o=Date.now(),a=S,mI=G8(S.cwd),E="",p=!1,u=null,M=null;let D=SI(S.cwd);i=II(D),n=MI(D),W=D.showLastPrompt!==!1,qe=ob(D.powerline,TI),I=wI(),F=!1,N=new Vl(i),H=new Zl,l=typeof S.getThinkingLevel=="function"?()=>S.getThinkingLevel():null,d=l?.()??null,S.hasUI&&S.ui.setStatus("stash",void 0),cI(S),s&&S.hasUI&&(Ku(S),v.reason==="startup"?D.quietStartup===!0?cO(S):lO(S):ju(S))}),t.on("session_shutdown",async()=>{r++,_?.(),_=null,R=!1,L=!1,jt.cancel(),ne.cancel(),g?.(),g=null,Gu({resetExtendedKeyboardModes:!0}),P?.(),P=null,G?.dispose(),G=null,F=!1,a=null,c=null,l=null,d=null,u=null,m=null,O=null,be()});let Oc=v=>[/\bgit\s+(checkout|switch|branch\s+-[dDmM]|merge|rebase|pull|reset|worktree)/,/\bgit\s+stash\s+(pop|apply)/].some(D=>D.test(v));t.on("tool_result",async v=>{if((v.toolName==="write"||v.toolName==="edit")&&om(),v.toolName==="bash"&&v.input?.command){let S=String(v.input.command);Oc(S)&&(om(),hb(),setTimeout(()=>ye(),100))}}),t.on("user_bash",async v=>{Oc(v.command)&&(om(),hb(),setTimeout(()=>ye(),100),setTimeout(()=>ye(),300),setTimeout(()=>ye(),500))}),t.on("model_select",async(v,S)=>{a=S,ye()}),t.on("thinking_level_select",async(v,S)=>{a=S,d=l?.()??(typeof v.level=="string"?v.level:null),tt({deferDuringTyping:!1})}),t.on("session_tree",async(v,S)=>{a=S,d=null,u=null,tt({deferDuringTyping:!1})}),t.on("before_agent_start",async(v,S)=>{E=v.prompt,S.hasUI&&lI(v.prompt,S.ui.setWorkingMessage)}),t.on("agent_start",async(v,S)=>{p=!0,u=null,uI(),ju(S),a=S}),t.on("message_update",async(v,S)=>{Eb(v.message)&&v.message.stopReason!=="error"&&v.message.stopReason!=="aborted"&&vm(v.message.usage)>0&&(u=v.message.usage,a=S,pe=!0,ne.schedule(U8))}),t.on("message_end",async(v,S)=>{a=S,Eb(v.message)&&(v.message.stopReason==="error"||v.message.stopReason==="aborted"?u=null:vm(v.message.usage)>0&&(u=v.message.usage)),tt({deferDuringTyping:!1})}),t.on("turn_end",async(v,S)=>{a=S,tt({deferDuringTyping:!1})}),t.on("tool_call",async(v,S)=>{if(ju(S),S.hasUI){let D=qh(S);dI(v.toolName,v.input,S.ui.setWorkingMessage,D)}});function qh(v){let S=v.sessionManager?.getBranch?.()??[];for(let D=S.length-1;D>=0;D--){let q=S[D];if(q.type==="message"&&q.message?.role==="assistant"){let te=q.message.content;if(!Array.isArray(te))continue;for(let J of te)if(J.type==="text"&&J.text){let Y=J.text.trim();if(Y.length>0)return Y.slice(0,200)}}}}function ju(v){jt.cancel(),_?(_(),_=null):L=!0,R&&(R=!1,v.ui.setHeader(void 0))}function Lc(v){!_&&L&&!R||jt.schedule(v)}function zA(v){ej(I,v)&&Q8(I)}function qu(v,S,D){Ll(S),D&&v.ui.notify(D,"info")}function Gh(v){let S=ou(v,O);return Ds(S)?S:(v.ui.notify("Editor is empty","info"),null)}async function VA(v){let S=[...I],D=S.map((J,Y)=>({value:String(Y),label:`#${Y+1} ${kI(J,hI)}`})),q=await Zs(v,"Stash history","\u2191\u2193 navigate \u2022 enter insert \u2022 esc cancel",D,Math.min(D.length,10));if(!q)return null;let te=Number.parseInt(q.value,10);return S[te]??null}async function JA(v,S){let D=S.map((J,Y)=>({value:String(Y),label:`#${Y+1} ${kI(J,hI)}`})),q=await Zs(v,"Recent project prompts","\u2191\u2193 navigate \u2022 enter insert \u2022 esc cancel",D,Math.min(D.length,10));if(!q)return null;let te=Number.parseInt(q.value,10);return S[te]??null}async function QA(v,S,D){let q=[];if(S>0&&q.push({value:"stash",label:"Stashed prompts",description:`${S} saved`}),D>0&&q.push({value:"project",label:"Recent project prompts",description:`${D} recent`}),q.length===0)return null;if(q.length===1)return q[0]?.value==="project"?"project":"stash";let te=await Zs(v,"Prompt history","\u2191\u2193 navigate \u2022 enter open \u2022 esc cancel",q,q.length);return te?te.value==="project"?"project":"stash":null}async function YA(v,S){let D=ou(v,O);if(!Ds(D)){v.ui.setEditorText(S),v.ui.notify("Inserted prompt","info");return}let q=await v.ui.select("Insert prompt",["Replace","Append","Cancel"]);if(q==="Replace"){v.ui.setEditorText(S),v.ui.notify("Replaced editor with prompt","info");return}if(q==="Append"){let te=D.endsWith(`
|
|
520
520
|
`)||S.startsWith(`
|
|
521
521
|
`)?"":`
|
|
522
|
-
`;v.ui.setEditorText(`${D}${te}${S}`),v.ui.notify("Appended prompt","info")}}function tw(v){return Vn(v)?!1:v==="\xDF"||v==="\x1Bs"||v==="\x1BS"||/^\x1b\[(?:83|115)(?::\d*)?(?::\d*)?;3(?::\d+)?u$/.test(v)||v==="\x1B[27;3;115~"||v==="\x1B[27;3;83~"||Pe(v,"alt+s")}function XA(v){return gI.find(({shortcutKey:S})=>Un(v,n[S]))?.action??null}function ZA(v){return Un(v,n.stashHistory)||n.stashHistory==="ctrl+alt+h"&&(/^\x1b\[104(?::\d*)?(?::\d*)?;7(?::\d+)?u$/.test(v)||v==="\x1B[27;7;104~"||v==="\x1B[27;7;72~")}function nw(v){if(Vn(v))return null;if(ZA(v))return{kind:"stashHistory"};if(Un(v,n.copyEditor))return{kind:"copyEditor"};if(Un(v,n.cutEditor))return{kind:"cutEditor"};if(Un(v,i.toggleShortcut))return{kind:"bashMode"};let S=XA(v);return S?{kind:"chat",action:S}:null}function Kh(v,S){if(S.kind==="stashHistory"){zh(v);return}if(S.kind==="copyEditor"||S.kind==="cutEditor"){let D=Gh(v);if(!D)return;qu(v,D,S.kind==="copyEditor"?"Copied editor text":void 0),S.kind==="cutEditor"&&(v.ui.setEditorText(""),v.ui.notify("Cut editor text","info"));return}if(S.kind==="bashMode"){Ri(!F,v);return}if(S.action.kind==="bottom"){rO(v);return}oO(v,S.action.role,S.action.direction)}function Hh(v){let S=ou(v,O),D=M!==null;if(!Ds(S)){if(!D){v.ui.notify("Nothing to stash","info");return}v.ui.setEditorText(M),M=null,v.ui.setStatus("stash",void 0),v.ui.notify("Stash restored","info");return}M=S,zA(S),v.ui.setEditorText(""),v.ui.setStatus("stash","stash"),v.ui.notify(D?"Stash updated":"Text stashed","info")}async function zh(v){let S=[];try{S=V8(v.cwd,I8)}catch(te){let J=te instanceof Error?te.message:String(te);v.ui.notify(`Failed to load project prompts: ${J}`,"warning")}if(I.length===0&&S.length===0){v.ui.notify("No prompt history yet","info");return}let D=await QA(v,I.length,S.length);if(!D)return;let q=D==="project"?await JA(v,S):await VA(v);q&&await YA(v,q)}t.on("agent_end",async(v,S)=>{p=!1,u=null,a=S,S.hasUI&&(pI(S.ui.setWorkingMessage),M!==null&&(S.ui.getEditorText().trim()===""?(S.ui.setEditorText(M),M=null,S.ui.setStatus("stash",void 0),S.ui.notify("Stash restored","info")):S.ui.notify("Stash preserved \u2014 clear editor then Alt+S to restore","info"))),ye()}),t.registerCommand("ss:footer",{description:"Configure sling footer status (toggle, preset)",handler:async(v,S)=>{if(a=S,!v?.trim()){s=!s,s?(Ku(S),S.ui.notify("sling footer enabled","info")):(G?.dispose(),G=null,N.clear(),F=!1,_?.(),_=null,R=!1,L=!1,jt.cancel(),Lb().savedPromptHistory=[],M=null,S.ui.setStatus("stash",void 0),g?.(),g=null,Gu(),P?.(),P=null,S.ui.setEditorComponent(void 0),S.ui.setFooter(void 0),S.ui.setHeader(void 0),S.ui.setWidget("powerline-top",void 0),S.ui.setWidget("powerline-secondary",void 0),S.ui.setWidget("powerline-bash-transcript",void 0),S.ui.setWidget("powerline-status",void 0),S.ui.setWidget("powerline-last-prompt",void 0),c=null,m=null,O=null,ne.cancel(),be(),S.ui.notify("sling footer disabled","info"));return}let D=v.trim().toLowerCase(),q=/^mouse-scroll(?:\s+(on|off|toggle))?$/.exec(D);if(q){let He=q[1]??"toggle";qe.mouseScroll=He==="toggle"?!qe.mouseScroll:He==="on",s&&S.hasUI&&qe.fixedEditor&&m&&O&&Vh(S,m),CI(S.cwd,{mouseScroll:qe.mouseScroll},qe.preset)?S.ui.notify(`sling mouse scroll ${qe.mouseScroll?"enabled":"disabled"}`,"info"):S.ui.notify(`sling mouse scroll ${qe.mouseScroll?"enabled":"disabled"} (not persisted; check settings.json)`,"warning");return}let te=/^fixed-editor(?:\s+(on|off|toggle))?$/.exec(D);if(te){let He=te[1]??"toggle";qe.fixedEditor=He==="toggle"?!qe.fixedEditor:He==="on",s&&S.hasUI&&Ku(S),CI(S.cwd,{fixedEditor:qe.fixedEditor},qe.preset)?S.ui.notify(`sling fixed editor ${qe.fixedEditor?"enabled":"disabled"}`,"info"):S.ui.notify(`sling fixed editor ${qe.fixedEditor?"enabled":"disabled"} (not persisted; check settings.json)`,"warning");return}let J=Z8(v);if(J){qe.preset=J,be(),s&&Ku(S),Y8(J,S.cwd)?S.ui.notify(`Preset set to: ${J}`,"info"):S.ui.notify(`Preset set to: ${J} (not persisted; check settings.json)`,"warning");return}let Y=Object.keys(sc).join(", ");S.ui.notify(`Available presets: ${Y}`,"info")}}),t.registerCommand("ss:stash-history",{description:"Open prompt history picker",handler:async(v,S)=>{if(S.hasUI){if(!s){S.ui.notify("sling footer is disabled","info");return}await zh(S)}}}),t.registerCommand("ss:bash-mode",{description:"Toggle sticky bash mode (on, off, toggle)",handler:async(v,S)=>{let D=v?.trim().toLowerCase()||"toggle";if(D==="on"){await Ri(!0,S);return}if(D==="off"){await Ri(!1,S);return}if(D==="toggle"){await Ri(!F,S);return}S.ui.notify("Usage: /bash-mode [on|off|toggle]","warning")}}),t.registerCommand("ss:bash-reset",{description:"Reset the managed bash session",handler:async(v,S)=>{if(G?.dispose(),G=null,N.clear(),F)try{await qt()}catch(D){F=!1;let q=D instanceof Error?D.message:String(D);S.ui.notify(`Failed to restart shell session: ${q}`,"error"),ye();return}ye(),S.ui.notify("Bash session reset","info")}}),t.registerShortcut(i.toggleShortcut,{description:"Toggle bash mode",handler:async v=>{!s||!v.hasUI||await Ri(!F,v)}}),t.registerShortcut("alt+s",{description:"Stash/restore editor text",handler:async v=>{!s||!v.hasUI||Hh(v)}}),t.registerShortcut(n.stashHistory,{description:"Open prompt history picker",handler:async v=>{!s||!v.hasUI||await zh(v)}}),t.registerShortcut(n.copyEditor,{description:"Copy full editor text",handler:async v=>{if(!s||!v.hasUI)return;let S=Gh(v);S&&qu(v,S,"Copied editor text")}}),t.registerShortcut(n.cutEditor,{description:"Cut full editor text",handler:async v=>{if(!s||!v.hasUI)return;let S=Gh(v);S&&(qu(v,S),v.ui.setEditorText(""),v.ui.notify("Cut editor text","info"))}});for(let{shortcutKey:v,description:S,action:D}of gI)t.registerShortcut(n[v],{description:S,handler:async q=>{!s||!q.hasUI||Kh(q,{kind:"chat",action:D})}});function eO(v,S){let D=sb(qe.preset),q=D.colors??im(),te=0,J=0,Y=0,He=0,_e=0,ct,st=null,kn=v.sessionManager?.getBranch?.()??[];for(let ri of kn){if(!bt(ri)||(ri.type==="thinking_level_change"&&typeof ri.thinkingLevel=="string"&&(st=ri.thinkingLevel),ri.type!=="message"||!Eb(ri.message)))continue;let _i=ri.message;_i.stopReason==="error"||_i.stopReason==="aborted"||(te+=_i.usage.input,J+=_i.usage.output,Y+=_i.usage.cacheRead,He+=_i.usage.cacheWrite,_e+=_i.usage.cost.total,vm(_i.usage)>0&&(ct=_i))}let ue=p?u??ct?.usage:ct?.usage,Re=p&&u?null:$M(v),Ge=Re?.contextTokens??(ue?vm(ue):0),It=Re?.contextWindow??v.model?.contextWindow??0,Pi=Re?.contextPercent??(It>0?Ge/It*100:0),Wc=c?.getGitBranch()??null,Hu=EM(Wc),qn=c?.getExtensionStatuses()??new Map,Gr=new Map(qe.customItems.map(ri=>[ri.id,ri])),xs=rb(qe.customItems),wt=v.model?v.modelRegistry?.isUsingOAuth?.(v.model)??!1:!1,Kr=d??st??l?.()??"off";return{model:v.model,thinkingLevel:Kr,sessionId:v.sessionManager?.getSessionId?.(),cwd:v.cwd,usageStats:{input:te,output:J,cacheRead:Y,cacheWrite:He,cost:_e},contextPercent:Pi,contextWindow:It,autoCompactEnabled:v.settingsManager?.getCompactionSettings?.()?.enabled??!0,customCompactionEnabled:mI||qn.has(M8),usingSubscription:wt,sessionStartTime:o,shellModeActive:F,shellRunning:G?.state.running??!1,shellName:G?.state.shellName??null,shellCwd:G?.state.cwd??null,git:Hu,extensionStatuses:qn,hiddenExtensionStatusKeys:xs,customItemsById:Gr,options:D.segmentOptions??{},theme:S,colors:q}}function iw(v,S){let D=Date.now(),q=p?L8:O8;if(de&&Z===v){let He=D-et<ym;if(!Ie&&He&&(pe||D-Te>=q)||!pe&&D-Te<q)return de}let te=sb(qe.preset),J=eO(a,S);return Z=v,de=sj(J,te,v),Te=D,pe=!1,Ie=!1,de}function sw(v){if(!a||!c)return[];let S=c.getExtensionStatuses();if(!S||S.size===0)return[];let D=rb(qe.customItems),q=[];for(let te of TM(S,D)){let J=` ${te}`;j(J)<=v&&q.push(J)}return q}function ow(v,S){if(!a)return[];let D=iw(v,S);return D.topContent?[D.topContent]:[]}function rw(v,S){if(!a)return[];let D=iw(v,S);return D.secondaryContent?[D.secondaryContent]:[]}function aw(v,S){if(!F)return[];let D=N.getSnapshot();if(D.commands.length===0)return[];let q=[];D.truncatedCommands>0&&q.push(` ${S.fg("dim",`\u2026 ${D.truncatedCommands} earlier command${D.truncatedCommands===1?"":"s"} truncated`)}`);let te=D.commands.slice(-4);for(let J of te){let Y=(G?.state.shellName??"shell")==="fish"?">":"$",He=J.exitCode===null?S.fg("accent","running"):J.exitCode===0?S.fg("success","ok"):S.fg("error",`exit ${J.exitCode}`),_e=X(J.command.replace(/\s+/g," ").trim(),Math.max(8,v-8),"\u2026");q.push(` ${S.fg("accent",Y)} ${_e} ${S.fg("dim","(")}${He}${S.fg("dim",")")}`);let ct=J.output.slice(-6);for(let st of ct)q.push(` ${X(st,Math.max(1,v-3),"\u2026")}`)}return q.slice(-16)}function cw(v){if(F||!W||!E)return[];let S=` ${Lo("sep")}\u21B3${wn.reset} `,D=v-j(S);if(D<10)return[];let q=E.replace(/\s+/g," ").trim();if(!q)return[];q=X(q,D,"\u2026");let te=`${Lo("sep")}${q}${wn.reset}`,J=`${S}${te}`;return[X(J,v,"\u2026")]}function Gu(v){let S=h!==null;if(h?.dispose(v),!S&&v?.resetExtendedKeyboardModes)try{process.stdout.write(ZM())}catch{}h=null,f=null,x=null,y=null,w=null}function tO(v,S){let D=Array.isArray(v?.children)?v.children:[],q=D.findIndex(te=>Array.isArray(te?.children)&&te.children.includes(S));return q===-1?null:{container:D[q],index:q}}function Vh(v,S){if(Gu(),!v.hasUI||!qe.fixedEditor)return;if(!S?.terminal||typeof S.terminal.write!="function")throw new Error("[sling-footer] Fixed editor compositor could not find tui.terminal.write()");if(!O)throw new Error("[sling-footer] Fixed editor compositor expected the custom editor to be installed first");let D=tO(S,O);if(!D)throw new Error("[sling-footer] Fixed editor compositor could not find the editor container in TUI children");let q=Array.isArray(S.children)?S.children:[];x=D.container;let te=q[D.index-2]??null;f=te&&typeof te.render=="function"?te:null,y=q[D.index-1]??null,w=q[D.index+1]??null;let J;J=new gm({tui:S,terminal:S.terminal,mouseScroll:qe.mouseScroll,keyboardScrollShortcuts:{up:n.scrollChatUp,down:n.scrollChatDown},onCopySelection:Y=>qu(v,Y),getShowHardwareCursor:()=>typeof S.getShowHardwareCursor=="function"&&S.getShowHardwareCursor(),renderCluster:(Y,He)=>{let _e=a?.ui?.theme??v.ui.theme,ct=f?J.renderHidden(f,Y).filter(ue=>j(ue)>0):[],st=y?J.renderHidden(y,Y):[],kn=w?J.renderHidden(w,Y):[];return BM({width:Y,terminalRows:He,statusLines:[...st,...sw(Y),...ct],topLines:ow(Y,_e),editorLines:x?J.renderHidden(x,Y):[],secondaryLines:[...rw(Y,_e),...kn],transcriptLines:aw(Y,_e),lastPromptLines:cw(Y)})}}),h=J,f?.render&&J.hideRenderable(f),y?.render&&J.hideRenderable(y),J.hideRenderable(x),w?.render&&J.hideRenderable(w),J.install(),S.requestRender(!0)}function nO(v,S){let D=typeof v=="object"&&v!==null?v.constructor?.name:void 0;return S==="assistant"?D==="AssistantMessageComponent":D==="UserMessageComponent"||D==="SkillInvocationMessageComponent"}function iO(v,S){if(typeof v!="object"||v===null)return 0;let D=Reflect.get(v,"render");if(typeof D!="function")return 0;let q=D.call(v,S);return Array.isArray(q)?q.length:0}function lw(v,S,D,q){let te=iO(v,S);if(nO(v,D))return{targets:[q],lineCount:te};let J=typeof v=="object"&&v!==null?Reflect.get(v,"children"):null;if(!Array.isArray(J)||J.length===0)return{targets:[],lineCount:te};let Y=[],He=q,_e=0;for(let ct of J){let st=lw(ct,S,D,He);Y.push(...st.targets),He+=st.lineCount,_e+=st.lineCount}return{targets:Y,lineCount:Math.max(te,_e)}}function sO(v){let S=Array.isArray(m?.children)?m.children:[],D=Math.max(1,m?.terminal?.columns??80),q=[],te=0;for(let J of S){let Y=lw(J,D,v,te);q.push(...Y.targets),te+=Y.lineCount}return[...new Set(q)].sort((J,Y)=>J-Y)}function oO(v,S,D){if(!h){v.ui.notify("Chat message jumps require /ss:footer fixed-editor on","warning");return}let q=sO(S),te=S==="assistant"?"LLM":"user";if(q.length===0){v.ui.notify(`No ${te} messages found`,"info");return}(D==="previous"?h.jumpToPreviousRootTarget(q):h.jumpToNextRootTarget(q))||v.ui.notify(`No ${D} ${te} message`,"info")}function rO(v){if(!h){v.ui.notify("Chat bottom jump requires /ss:footer fixed-editor on","warning");return}h.jumpToRootBottom()}function Jh(){h?.jumpToRootBottom()}function aO(v){v.ui.setWidget("powerline-status",()=>({dispose(){},invalidate(){ye()},render(S){return sw(S)}}),{placement:"aboveEditor"}),v.ui.setWidget("powerline-top",(S,D)=>({dispose(){},invalidate(){be()},render(q){return ow(q,D)}}),{placement:"aboveEditor"}),v.ui.setWidget("powerline-secondary",(S,D)=>({dispose(){},invalidate(){be()},render(q){return rw(q,D)}}),{placement:"belowEditor"}),v.ui.setWidget("powerline-bash-transcript",(S,D)=>({dispose(){},invalidate(){},render(q){return aw(q,D)}}),{placement:"belowEditor"}),v.ui.setWidget("powerline-last-prompt",()=>({dispose(){},invalidate(){},render(S){return cw(S)}}),{placement:"belowEditor"})}function Ku(v){if(ru(O),!s)return;P?.(),P=typeof v.ui.onTerminalInput=="function"?v.ui.onTerminalInput(q=>{if(!s||!v.hasUI||m?.hasOverlay?.())return;if(tw(q))return Hh(v),Lc(v),m?.requestRender(),{consume:!0};let te=nw(q);if(te)return Kh(v,te),Lc(v),m?.requestRender(),{consume:!0}}):null,Gu(),v.ui.setWidget("powerline-top",void 0),v.ui.setWidget("powerline-secondary",void 0),v.ui.setWidget("powerline-bash-transcript",void 0),v.ui.setWidget("powerline-status",void 0),v.ui.setWidget("powerline-last-prompt",void 0);let S=!1,D=(q,te,J)=>{let Y=new Yp(q,te,J,{keybindings:J,isBashModeActive:()=>F,isShellRunning:()=>G?.state.running??!1,onExitBashMode:()=>{Ri(!1,v)},onSubmitCommand:ue=>void Tn(ue,v),onEditorSubmit:()=>Jh(),editorBoundaryShortcuts:{start:n.editorStart,end:n.editorEnd},onInterrupt:()=>{G?.interrupt(),v.ui.notify("Sent interrupt to shell","info")},onNotify:(ue,Re="info")=>v.ui.notify(ue,Re),getHistoryEntries:ue=>Ii(ue),resolveGhostSuggestion:async(ue,Re)=>{let Ge=eu(ue);if(Ge){let It=await H.getGhostSuggestion(Ge.command,oi(),Fe(),Re);return It?{...It,value:`${Ge.prefix}${It.value}`}:null}return H.getGhostSuggestion(ue,oi(),Fe(),Re)}}),He=()=>{let ue=Reflect.get(Y,"autocompleteProvider");if(!(!ue||typeof ue!="object")&&typeof Reflect.get(ue,"getSuggestions")=="function"&&typeof Reflect.get(ue,"applyCompletion")=="function")return ue},_e=()=>{if(Y.hasWrappedProvider())return!0;let ue=He();if(!ue)return!1;let Re=new Vp,Ge=new Jp;return Y.installAutocompleteProvider(new Qp(ue,Re,Ge,()=>F)),!0},ct;Object.defineProperty(Y,"onSubmit",{configurable:!0,get:()=>ct,set(ue){ct=typeof ue=="function"?Re=>{Jh(),ue(Re)}:ue}}),O=Y,N8(Y),B8(Y),_e();let st=Y.handleInput.bind(Y);Y.handleInput=ue=>{if(et=Date.now(),tw(ue)){Hh(v),Lc(v);return}let Re=nw(ue);if(Re){Kh(v,Re),Lc(v);return}if(!S&&!He()){S=!0,ru(Y),v.ui.setEditorComponent(D),qe.fixedEditor&&Vh(v,q),O?.handleInput(ue);return}_e();let Ge=J.matches(ue,"app.message.followUp")?ou(v,Y):"";Lc(v),st(ue),Ds(Ge)&&!Ds(ou(v,Y))&&Jh()};let kn=Y.render.bind(Y);return Y.render=ue=>{if(ue<10)return kn(ue);let Re=wt=>`${Lo("sep")}${wt}${wn.reset}`,Ge=F?"$":">",Pi=` ${`${wn.getFgAnsi(200,200,200)}${Ge}${wn.reset}`} `,Wc=" ",Hu=Math.max(1,ue-3),qn=kn(Hu);if(qn.length===0)return qn;let Gr=qn.length-1;for(let wt=qn.length-1;wt>=1;wt--){let Kr=qn[wt]?.replace(/\x1b\[[0-9;]*m/g,"")||"";if(Kr.length>0&&/^─{3,}/.test(Kr)){Gr=wt;break}}let xs=[];xs.push(" "+Re("\u2500".repeat(ue-2)));for(let wt=1;wt<Gr;wt++){let Kr=wt===1?Pi:Wc;xs.push(`${Kr}${qn[wt]||""}`)}Gr===1&&xs.push(`${Pi}${" ".repeat(Hu)}`),xs.push(" "+Re("\u2500".repeat(ue-2)));for(let wt=Gr+1;wt<qn.length;wt++)xs.push(qn[wt]||"");return xs},Y};v.ui.setEditorComponent(D),v.ui.setFooter((q,te,J)=>{c=J,m=q,At(J);let Y=J.onBranchChange(()=>ye());return{dispose(){Y(),g?.(),g=null},invalidate(){ye()},render(){return[]}}}),qe.fixedEditor?m&&Vh(v,m):aO(v)}function cO(v){let S=v.model?.name||v.model?.id||"No model",D=v.model?.provider||"Unknown",q=bb(),te=xb(3),J=new pm(S,D,te,q);R=!0,v.ui.setHeader(()=>({render(Y){return J.render(Y)},invalidate(){J.invalidate()}}))}function lO(v){let S=v.model?.name||v.model?.id||"No model",D=v.model?.provider||"Unknown",q=bb(),te=xb(3),J=r;setTimeout(()=>{if(!s||L||p||J!==r){L=!1;return}(v.sessionManager?.getBranch?.()??[]).some(_e=>bt(_e)?_e.type==="tool_call"||_e.type==="tool_result"?!0:_e.type==="message"&&bt(_e.message)&&_e.message.role==="assistant":!1)||v.ui.custom((_e,ct,st,kn)=>{let ue=new dm(S,D,te,q),Re=10,Ge=!1,It=null,Pi=()=>{Ge||(Ge=!0,It&&clearInterval(It),_=null,kn())};return It=setInterval(()=>{Ge||(Re--,ue.setCountdown(Re),_e.requestRender(),Re<=0&&Pi())},1e3),_=Pi,L&&(L=!1,Pi()),{focused:!1,invalidate:()=>ue.invalidate(),render:Wc=>ue.render(Wc),handleInput:()=>Pi(),dispose:()=>{Ge=!0,It&&clearInterval(It)}}},{overlay:!0,overlayOptions:()=>({verticalAlign:"center",horizontalAlign:"center"})}).catch(_e=>{console.debug("[sling-footer] Welcome overlay failed:",_e)})},100)}}function NI(t,e){let n=0,i=0,s=async()=>{try{return i=(await(await fetch(we.getUserUrl(),{headers:{Authorization:`Bearer ${e()?.access||""}`,Accept:"application/json",projectId:e()?.projectId||"",workspaceId:e()?.workspaceId||""}})).json()).remainingCredits||0,je("Fetched user data for credits: "+i),i}catch(o){ft("Error fetching user data for credits",o)}return 0};t.on("session_start",async(o,r)=>{r.ui.setStatus("ss-credit","0")}),t.on("before_agent_start",async(o,r)=>{s().then(a=>{r.ui.setStatus("ss-credit",`${a.toFixed(2)}`)})}),t.on("agent_end",async(o,r)=>{s().then(a=>{r.ui.setStatus("ss-credit",`${a.toFixed(2)}`)})})}var Nt=fO(LA(),1);var _c=t=>t==null?"N/A":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?Math.round(t/1e3)+"k":t.toString();var joe=["context_tag","context_log","context_checkout"],$h=null,mn=null,Bh=t=>joe.includes(t),WA=(t,e)=>{if(e.toLowerCase()==="root"){let i=t.getTree();return i.length>0?i[0].entry.id:e}if(/^[0-9a-f]{8,}$/i.test(e))return e;let n=[...t.getTree()];for(;n.length>0;){let i=n.pop();if(t.getLabel(i.entry.id)===e)return i.entry.id;i.children?.length&&n.push(...i.children)}return e},qoe=Nt.Type.Object({limit:Nt.Type.Optional(Nt.Type.Number({description:"History limit for visible entries (default: 50)."})),verbose:Nt.Type.Optional(Nt.Type.Boolean({description:"If true, show ALL messages. If false (default), collapses intermediate AI steps and only shows 'milestones': User messages, Tags, Branch Points, and Summaries."}))}),Goe=Nt.Type.Object({target:Nt.Type.String({description:"Where to jump/squash to. Can be a tag name (e.g., 'task-start'), a commit ID, or 'root'. This is the base for your new branch."}),message:Nt.Type.String({description:"The 'Carryover Message' for the new branch. A summary of your *current* progress/lessons that you want to bring with you to the new state. This ensures you don't lose key information when switching contexts. Good summary message: '[Status] + [Reason] + [Important Changes] + [Carryover Data]'"}),backupTag:Nt.Type.Optional(Nt.Type.String({description:"Optional tag name to apply to the CURRENT state before checking out. Use this to create an automatic backup of the history you are about to leave/squash."}))}),Koe=Nt.Type.Object({name:Nt.Type.String({description:"The tag/milestone name. Use meaningful names."}),target:Nt.Type.Optional(Nt.Type.String({description:"The commit ID to tag. Defaults to HEAD (current state)."}))});function UA(t){t.registerCommand("ss:acm",{description:"Enable agentic context management for the current session",handler:async(n,i)=>{$h=i,i.ui.notify("Agentic Context Management enabled.","info"),t.sendMessage({customType:"ss-context",content:"use context-management skill",display:!1},{deliverAs:"followUp"}),n&&t.sendUserMessage(n)}});let e=(n,i,s)=>{let o=[...i].reverse();for(;o.length>0;){let r=o.pop();if(n.getLabel(r.entry.id)===s)return r.entry.id;if(r.children?.length)for(let a=r.children.length-1;a>=0;a--)o.push(r.children[a])}return null};t.registerTool({name:"context_tag",label:"Context Tag",description:"Creates a 'Save Point' (Bookmark) in the history. Use this before trying risky changes or when a feature is stable. 'Untagged progress is risky'.",parameters:Koe,async execute(n,i,s,o,r){let a=r.sessionManager,c=e(a,a.getTree(),i.name);if(c)return{content:[{type:"text",text:`Error: Tag '${i.name}' already exists at ${c}. Tag names must be unique. Use a different name or delete the existing tag first.`}],details:{}};let l=i.target?WA(a,i.target):void 0;if(!l){let d=a.getBranch();for(let u=d.length-1;u>=0;u--){let p=d[u];if(p.type==="message"&&p.message.role==="toolResult"){let m=p.message;if(Bh(m.toolName))continue;l=p.id;break}if(p.type==="message"&&p.message.role==="assistant"&&!p.message.content.some(h=>h.type==="toolCall"&&Bh(h.name))){l=p.id;break}l=p.id;break}l||(l=a.getLeafId()??"")}return t.setLabel(l,i.name),{content:[{type:"text",text:`Created tag '${i.name}' at ${l}`}],details:{}}}}),t.registerTool({name:"context_log",label:"Context Log",description:"Show the entire history structure (status, message, tags, milestones). Analogous to 'git log --graph --oneline --decorate'",parameters:qoe,async execute(n,i,s,o,r){let a=r.sessionManager,c=a.getBranch(),l=a.getLeafId(),d=i.verbose??!1,u=i.limit??50,p=new Set(c.map(W=>W.id)),m=[];c.forEach(W=>{m.push(W),a.getChildren(W.id).forEach(I=>{(I.type==="branch_summary"||I.type==="compaction")&&!p.has(I.id)&&m.push(I)})});let g=W=>{if(W.type==="branch_summary"||W.type==="compaction")return W.summary||"[No summary provided]";if(W.type==="label")return`tag: ${W.label}`;if(W.type==="message"){let M=W.message;if(M.role==="toolResult"){let I=M;if(!d&&Bh(I.toolName))return"";let F=(H=>H.map(G=>G.type==="text"?G.text:"").join(" ").trim())(I.content),N=I.details;return(I.toolName==="read"||I.toolName==="edit")&&N&&"path"in N&&typeof N.path=="string"&&(F=`${N.path}: ${F}`),`(${I.toolName}) ${F}`}if(M.role==="bashExecution")return`[Bash] ${M.command}`;if(M.role==="user"||M.role==="assistant"){let I="";typeof M.content=="string"?I=M.content:Array.isArray(M.content)&&(I=M.content.map(F=>typeof F=="object"&&F!==null&&"text"in F?F.text:"").join(" ").trim());let O="";return M.role==="assistant"&&(O=M.content.filter(N=>N.type==="toolCall").filter(N=>d||!Bh(N.name)).map(N=>`call: ${N.name}(${JSON.stringify(N.arguments)})`).join("; ")),[I,O].filter(Boolean).join(" ")}}return""},h=W=>W.id===l||c.length>0&&W.id===c[0].id||a.getLabel(W.id)?!0:W.type==="label"?!1:W.type==="branch_summary"||W.type==="compaction"||a.getChildren(W.id).length>1||W.type==="message"&&W.message.role==="user",f=new Set;m.forEach(W=>{(d||h(W))&&f.add(W.id)});let x=m.filter(W=>f.has(W.id));if(x.length>u){let W=new Set(x.slice(-u).map(M=>M.id));f.clear(),W.forEach(M=>f.add(M))}let y=[],w=0;m.forEach(W=>{if(!f.has(W.id)){w++;return}w>0&&(y.push(` : ... (${w} hidden messages) ...`),w=0);let M=W.id===l,I=a.getLabel(W.id),O=g(W).replace(/\s+/g," "),F=W.type.toUpperCase();if(W.type==="message"){let Te=W.message;F=Te.role==="assistant"?"AI":Te.role==="user"?"USER":Te.role==="bashExecution"?"BASH":"TOOL"}else(W.type==="branch_summary"||W.type==="compaction")&&(F="SUMMARY");if(F==="CUSTOM_MESSAGE")return;let N=W.id,G=[c.length>0&&W.id===c[0].id?"ROOT":null,M?"HEAD":null,I?`tag: ${I}`:null].filter(Boolean).join(", "),Z=O.length>100?O.slice(0,100)+"...":O,de=M?"*":F==="USER"?"\u2022":"|";y.push(`${de} ${N}${G?` (${G})`:""} [${F}] ${Z}`)}),w>0&&y.push(` : ... (${w} hidden messages) ...`);let P=await r.getContextUsage(),_="Unknown";P&&(_=`${P.percent.toFixed(1)}% (${_c(P.tokens)}/${_c(P.contextWindow)})`);let R=0,L="None";for(let W=c.length-1;W>=0;W--){let M=c[W].id,I=a.getLabel(M);if(I){L=I;break}R++}return{content:[{type:"text",text:["[Context Dashboard]",`\u2022 Context Usage: ${_}`,`\u2022 Segment Size: ${R} steps since last tag '${L}'`,"---------------------------------------------------"].join(`
|
|
522
|
+
`;v.ui.setEditorText(`${D}${te}${S}`),v.ui.notify("Appended prompt","info")}}function tw(v){return Vn(v)?!1:v==="\xDF"||v==="\x1Bs"||v==="\x1BS"||/^\x1b\[(?:83|115)(?::\d*)?(?::\d*)?;3(?::\d+)?u$/.test(v)||v==="\x1B[27;3;115~"||v==="\x1B[27;3;83~"||Pe(v,"alt+s")}function XA(v){return gI.find(({shortcutKey:S})=>Un(v,n[S]))?.action??null}function ZA(v){return Un(v,n.stashHistory)||n.stashHistory==="ctrl+alt+h"&&(/^\x1b\[104(?::\d*)?(?::\d*)?;7(?::\d+)?u$/.test(v)||v==="\x1B[27;7;104~"||v==="\x1B[27;7;72~")}function nw(v){if(Vn(v))return null;if(ZA(v))return{kind:"stashHistory"};if(Un(v,n.copyEditor))return{kind:"copyEditor"};if(Un(v,n.cutEditor))return{kind:"cutEditor"};if(Un(v,i.toggleShortcut))return{kind:"bashMode"};let S=XA(v);return S?{kind:"chat",action:S}:null}function Kh(v,S){if(S.kind==="stashHistory"){zh(v);return}if(S.kind==="copyEditor"||S.kind==="cutEditor"){let D=Gh(v);if(!D)return;qu(v,D,S.kind==="copyEditor"?"Copied editor text":void 0),S.kind==="cutEditor"&&(v.ui.setEditorText(""),v.ui.notify("Cut editor text","info"));return}if(S.kind==="bashMode"){Ri(!F,v);return}if(S.action.kind==="bottom"){rO(v);return}oO(v,S.action.role,S.action.direction)}function Hh(v){let S=ou(v,O),D=M!==null;if(!Ds(S)){if(!D){v.ui.notify("Nothing to stash","info");return}v.ui.setEditorText(M),M=null,v.ui.setStatus("stash",void 0),v.ui.notify("Stash restored","info");return}M=S,zA(S),v.ui.setEditorText(""),v.ui.setStatus("stash","stash"),v.ui.notify(D?"Stash updated":"Text stashed","info")}async function zh(v){let S=[];try{S=V8(v.cwd,I8)}catch(te){let J=te instanceof Error?te.message:String(te);v.ui.notify(`Failed to load project prompts: ${J}`,"warning")}if(I.length===0&&S.length===0){v.ui.notify("No prompt history yet","info");return}let D=await QA(v,I.length,S.length);if(!D)return;let q=D==="project"?await JA(v,S):await VA(v);q&&await YA(v,q)}t.on("agent_end",async(v,S)=>{p=!1,u=null,a=S,S.hasUI&&(pI(S.ui.setWorkingMessage),M!==null&&(S.ui.getEditorText().trim()===""?(S.ui.setEditorText(M),M=null,S.ui.setStatus("stash",void 0),S.ui.notify("Stash restored","info")):S.ui.notify("Stash preserved \u2014 clear editor then Alt+S to restore","info"))),ye()}),t.registerCommand("s:footer",{description:"Configure sling footer status (toggle, preset)",handler:async(v,S)=>{if(a=S,!v?.trim()){s=!s,s?(Ku(S),S.ui.notify("sling footer enabled","info")):(G?.dispose(),G=null,N.clear(),F=!1,_?.(),_=null,R=!1,L=!1,jt.cancel(),Lb().savedPromptHistory=[],M=null,S.ui.setStatus("stash",void 0),g?.(),g=null,Gu(),P?.(),P=null,S.ui.setEditorComponent(void 0),S.ui.setFooter(void 0),S.ui.setHeader(void 0),S.ui.setWidget("powerline-top",void 0),S.ui.setWidget("powerline-secondary",void 0),S.ui.setWidget("powerline-bash-transcript",void 0),S.ui.setWidget("powerline-status",void 0),S.ui.setWidget("powerline-last-prompt",void 0),c=null,m=null,O=null,ne.cancel(),be(),S.ui.notify("sling footer disabled","info"));return}let D=v.trim().toLowerCase(),q=/^mouse-scroll(?:\s+(on|off|toggle))?$/.exec(D);if(q){let He=q[1]??"toggle";qe.mouseScroll=He==="toggle"?!qe.mouseScroll:He==="on",s&&S.hasUI&&qe.fixedEditor&&m&&O&&Vh(S,m),CI(S.cwd,{mouseScroll:qe.mouseScroll},qe.preset)?S.ui.notify(`sling mouse scroll ${qe.mouseScroll?"enabled":"disabled"}`,"info"):S.ui.notify(`sling mouse scroll ${qe.mouseScroll?"enabled":"disabled"} (not persisted; check settings.json)`,"warning");return}let te=/^fixed-editor(?:\s+(on|off|toggle))?$/.exec(D);if(te){let He=te[1]??"toggle";qe.fixedEditor=He==="toggle"?!qe.fixedEditor:He==="on",s&&S.hasUI&&Ku(S),CI(S.cwd,{fixedEditor:qe.fixedEditor},qe.preset)?S.ui.notify(`sling fixed editor ${qe.fixedEditor?"enabled":"disabled"}`,"info"):S.ui.notify(`sling fixed editor ${qe.fixedEditor?"enabled":"disabled"} (not persisted; check settings.json)`,"warning");return}let J=Z8(v);if(J){qe.preset=J,be(),s&&Ku(S),Y8(J,S.cwd)?S.ui.notify(`Preset set to: ${J}`,"info"):S.ui.notify(`Preset set to: ${J} (not persisted; check settings.json)`,"warning");return}let Y=Object.keys(sc).join(", ");S.ui.notify(`Available presets: ${Y}`,"info")}}),t.registerCommand("s:stash-history",{description:"Open prompt history picker",handler:async(v,S)=>{if(S.hasUI){if(!s){S.ui.notify("sling footer is disabled","info");return}await zh(S)}}}),t.registerCommand("s:bash-mode",{description:"Toggle sticky bash mode (on, off, toggle)",handler:async(v,S)=>{let D=v?.trim().toLowerCase()||"toggle";if(D==="on"){await Ri(!0,S);return}if(D==="off"){await Ri(!1,S);return}if(D==="toggle"){await Ri(!F,S);return}S.ui.notify("Usage: /bash-mode [on|off|toggle]","warning")}}),t.registerCommand("s:bash-reset",{description:"Reset the managed bash session",handler:async(v,S)=>{if(G?.dispose(),G=null,N.clear(),F)try{await qt()}catch(D){F=!1;let q=D instanceof Error?D.message:String(D);S.ui.notify(`Failed to restart shell session: ${q}`,"error"),ye();return}ye(),S.ui.notify("Bash session reset","info")}}),t.registerShortcut(i.toggleShortcut,{description:"Toggle bash mode",handler:async v=>{!s||!v.hasUI||await Ri(!F,v)}}),t.registerShortcut("alt+s",{description:"Stash/restore editor text",handler:async v=>{!s||!v.hasUI||Hh(v)}}),t.registerShortcut(n.stashHistory,{description:"Open prompt history picker",handler:async v=>{!s||!v.hasUI||await zh(v)}}),t.registerShortcut(n.copyEditor,{description:"Copy full editor text",handler:async v=>{if(!s||!v.hasUI)return;let S=Gh(v);S&&qu(v,S,"Copied editor text")}}),t.registerShortcut(n.cutEditor,{description:"Cut full editor text",handler:async v=>{if(!s||!v.hasUI)return;let S=Gh(v);S&&(qu(v,S),v.ui.setEditorText(""),v.ui.notify("Cut editor text","info"))}});for(let{shortcutKey:v,description:S,action:D}of gI)t.registerShortcut(n[v],{description:S,handler:async q=>{!s||!q.hasUI||Kh(q,{kind:"chat",action:D})}});function eO(v,S){let D=sb(qe.preset),q=D.colors??im(),te=0,J=0,Y=0,He=0,_e=0,ct,st=null,kn=v.sessionManager?.getBranch?.()??[];for(let ri of kn){if(!bt(ri)||(ri.type==="thinking_level_change"&&typeof ri.thinkingLevel=="string"&&(st=ri.thinkingLevel),ri.type!=="message"||!Eb(ri.message)))continue;let _i=ri.message;_i.stopReason==="error"||_i.stopReason==="aborted"||(te+=_i.usage.input,J+=_i.usage.output,Y+=_i.usage.cacheRead,He+=_i.usage.cacheWrite,_e+=_i.usage.cost.total,vm(_i.usage)>0&&(ct=_i))}let ue=p?u??ct?.usage:ct?.usage,Re=p&&u?null:$M(v),Ge=Re?.contextTokens??(ue?vm(ue):0),It=Re?.contextWindow??v.model?.contextWindow??0,Pi=Re?.contextPercent??(It>0?Ge/It*100:0),Wc=c?.getGitBranch()??null,Hu=EM(Wc),qn=c?.getExtensionStatuses()??new Map,Gr=new Map(qe.customItems.map(ri=>[ri.id,ri])),xs=rb(qe.customItems),wt=v.model?v.modelRegistry?.isUsingOAuth?.(v.model)??!1:!1,Kr=d??st??l?.()??"off";return{model:v.model,thinkingLevel:Kr,sessionId:v.sessionManager?.getSessionId?.(),cwd:v.cwd,usageStats:{input:te,output:J,cacheRead:Y,cacheWrite:He,cost:_e},contextPercent:Pi,contextWindow:It,autoCompactEnabled:v.settingsManager?.getCompactionSettings?.()?.enabled??!0,customCompactionEnabled:mI||qn.has(M8),usingSubscription:wt,sessionStartTime:o,shellModeActive:F,shellRunning:G?.state.running??!1,shellName:G?.state.shellName??null,shellCwd:G?.state.cwd??null,git:Hu,extensionStatuses:qn,hiddenExtensionStatusKeys:xs,customItemsById:Gr,options:D.segmentOptions??{},theme:S,colors:q}}function iw(v,S){let D=Date.now(),q=p?L8:O8;if(de&&Z===v){let He=D-et<ym;if(!Ie&&He&&(pe||D-Te>=q)||!pe&&D-Te<q)return de}let te=sb(qe.preset),J=eO(a,S);return Z=v,de=sj(J,te,v),Te=D,pe=!1,Ie=!1,de}function sw(v){if(!a||!c)return[];let S=c.getExtensionStatuses();if(!S||S.size===0)return[];let D=rb(qe.customItems),q=[];for(let te of TM(S,D)){let J=` ${te}`;j(J)<=v&&q.push(J)}return q}function ow(v,S){if(!a)return[];let D=iw(v,S);return D.topContent?[D.topContent]:[]}function rw(v,S){if(!a)return[];let D=iw(v,S);return D.secondaryContent?[D.secondaryContent]:[]}function aw(v,S){if(!F)return[];let D=N.getSnapshot();if(D.commands.length===0)return[];let q=[];D.truncatedCommands>0&&q.push(` ${S.fg("dim",`\u2026 ${D.truncatedCommands} earlier command${D.truncatedCommands===1?"":"s"} truncated`)}`);let te=D.commands.slice(-4);for(let J of te){let Y=(G?.state.shellName??"shell")==="fish"?">":"$",He=J.exitCode===null?S.fg("accent","running"):J.exitCode===0?S.fg("success","ok"):S.fg("error",`exit ${J.exitCode}`),_e=X(J.command.replace(/\s+/g," ").trim(),Math.max(8,v-8),"\u2026");q.push(` ${S.fg("accent",Y)} ${_e} ${S.fg("dim","(")}${He}${S.fg("dim",")")}`);let ct=J.output.slice(-6);for(let st of ct)q.push(` ${X(st,Math.max(1,v-3),"\u2026")}`)}return q.slice(-16)}function cw(v){if(F||!W||!E)return[];let S=` ${Lo("sep")}\u21B3${wn.reset} `,D=v-j(S);if(D<10)return[];let q=E.replace(/\s+/g," ").trim();if(!q)return[];q=X(q,D,"\u2026");let te=`${Lo("sep")}${q}${wn.reset}`,J=`${S}${te}`;return[X(J,v,"\u2026")]}function Gu(v){let S=h!==null;if(h?.dispose(v),!S&&v?.resetExtendedKeyboardModes)try{process.stdout.write(ZM())}catch{}h=null,f=null,x=null,y=null,w=null}function tO(v,S){let D=Array.isArray(v?.children)?v.children:[],q=D.findIndex(te=>Array.isArray(te?.children)&&te.children.includes(S));return q===-1?null:{container:D[q],index:q}}function Vh(v,S){if(Gu(),!v.hasUI||!qe.fixedEditor)return;if(!S?.terminal||typeof S.terminal.write!="function")throw new Error("[sling-footer] Fixed editor compositor could not find tui.terminal.write()");if(!O)throw new Error("[sling-footer] Fixed editor compositor expected the custom editor to be installed first");let D=tO(S,O);if(!D)throw new Error("[sling-footer] Fixed editor compositor could not find the editor container in TUI children");let q=Array.isArray(S.children)?S.children:[];x=D.container;let te=q[D.index-2]??null;f=te&&typeof te.render=="function"?te:null,y=q[D.index-1]??null,w=q[D.index+1]??null;let J;J=new gm({tui:S,terminal:S.terminal,mouseScroll:qe.mouseScroll,keyboardScrollShortcuts:{up:n.scrollChatUp,down:n.scrollChatDown},onCopySelection:Y=>qu(v,Y),getShowHardwareCursor:()=>typeof S.getShowHardwareCursor=="function"&&S.getShowHardwareCursor(),renderCluster:(Y,He)=>{let _e=a?.ui?.theme??v.ui.theme,ct=f?J.renderHidden(f,Y).filter(ue=>j(ue)>0):[],st=y?J.renderHidden(y,Y):[],kn=w?J.renderHidden(w,Y):[];return BM({width:Y,terminalRows:He,statusLines:[...st,...sw(Y),...ct],topLines:ow(Y,_e),editorLines:x?J.renderHidden(x,Y):[],secondaryLines:[...rw(Y,_e),...kn],transcriptLines:aw(Y,_e),lastPromptLines:cw(Y)})}}),h=J,f?.render&&J.hideRenderable(f),y?.render&&J.hideRenderable(y),J.hideRenderable(x),w?.render&&J.hideRenderable(w),J.install(),S.requestRender(!0)}function nO(v,S){let D=typeof v=="object"&&v!==null?v.constructor?.name:void 0;return S==="assistant"?D==="AssistantMessageComponent":D==="UserMessageComponent"||D==="SkillInvocationMessageComponent"}function iO(v,S){if(typeof v!="object"||v===null)return 0;let D=Reflect.get(v,"render");if(typeof D!="function")return 0;let q=D.call(v,S);return Array.isArray(q)?q.length:0}function lw(v,S,D,q){let te=iO(v,S);if(nO(v,D))return{targets:[q],lineCount:te};let J=typeof v=="object"&&v!==null?Reflect.get(v,"children"):null;if(!Array.isArray(J)||J.length===0)return{targets:[],lineCount:te};let Y=[],He=q,_e=0;for(let ct of J){let st=lw(ct,S,D,He);Y.push(...st.targets),He+=st.lineCount,_e+=st.lineCount}return{targets:Y,lineCount:Math.max(te,_e)}}function sO(v){let S=Array.isArray(m?.children)?m.children:[],D=Math.max(1,m?.terminal?.columns??80),q=[],te=0;for(let J of S){let Y=lw(J,D,v,te);q.push(...Y.targets),te+=Y.lineCount}return[...new Set(q)].sort((J,Y)=>J-Y)}function oO(v,S,D){if(!h){v.ui.notify("Chat message jumps require /s:footer fixed-editor on","warning");return}let q=sO(S),te=S==="assistant"?"LLM":"user";if(q.length===0){v.ui.notify(`No ${te} messages found`,"info");return}(D==="previous"?h.jumpToPreviousRootTarget(q):h.jumpToNextRootTarget(q))||v.ui.notify(`No ${D} ${te} message`,"info")}function rO(v){if(!h){v.ui.notify("Chat bottom jump requires /s:footer fixed-editor on","warning");return}h.jumpToRootBottom()}function Jh(){h?.jumpToRootBottom()}function aO(v){v.ui.setWidget("powerline-status",()=>({dispose(){},invalidate(){ye()},render(S){return sw(S)}}),{placement:"aboveEditor"}),v.ui.setWidget("powerline-top",(S,D)=>({dispose(){},invalidate(){be()},render(q){return ow(q,D)}}),{placement:"aboveEditor"}),v.ui.setWidget("powerline-secondary",(S,D)=>({dispose(){},invalidate(){be()},render(q){return rw(q,D)}}),{placement:"belowEditor"}),v.ui.setWidget("powerline-bash-transcript",(S,D)=>({dispose(){},invalidate(){},render(q){return aw(q,D)}}),{placement:"belowEditor"}),v.ui.setWidget("powerline-last-prompt",()=>({dispose(){},invalidate(){},render(S){return cw(S)}}),{placement:"belowEditor"})}function Ku(v){if(ru(O),!s)return;P?.(),P=typeof v.ui.onTerminalInput=="function"?v.ui.onTerminalInput(q=>{if(!s||!v.hasUI||m?.hasOverlay?.())return;if(tw(q))return Hh(v),Lc(v),m?.requestRender(),{consume:!0};let te=nw(q);if(te)return Kh(v,te),Lc(v),m?.requestRender(),{consume:!0}}):null,Gu(),v.ui.setWidget("powerline-top",void 0),v.ui.setWidget("powerline-secondary",void 0),v.ui.setWidget("powerline-bash-transcript",void 0),v.ui.setWidget("powerline-status",void 0),v.ui.setWidget("powerline-last-prompt",void 0);let S=!1,D=(q,te,J)=>{let Y=new Yp(q,te,J,{keybindings:J,isBashModeActive:()=>F,isShellRunning:()=>G?.state.running??!1,onExitBashMode:()=>{Ri(!1,v)},onSubmitCommand:ue=>{Tn(ue,v)},onEditorSubmit:()=>Jh(),editorBoundaryShortcuts:{start:n.editorStart,end:n.editorEnd},onInterrupt:()=>{G?.interrupt(),v.ui.notify("Sent interrupt to shell","info")},onNotify:(ue,Re="info")=>v.ui.notify(ue,Re),getHistoryEntries:ue=>Ii(ue),resolveGhostSuggestion:async(ue,Re)=>{let Ge=eu(ue);if(Ge){let It=await H.getGhostSuggestion(Ge.command,oi(),Fe(),Re);return It?{...It,value:`${Ge.prefix}${It.value}`}:null}return H.getGhostSuggestion(ue,oi(),Fe(),Re)}}),He=()=>{let ue=Reflect.get(Y,"autocompleteProvider");if(!(!ue||typeof ue!="object")&&typeof Reflect.get(ue,"getSuggestions")=="function"&&typeof Reflect.get(ue,"applyCompletion")=="function")return ue},_e=()=>{if(Y.hasWrappedProvider())return!0;let ue=He();if(!ue)return!1;let Re=new Vp,Ge=new Jp;return Y.installAutocompleteProvider(new Qp(ue,Re,Ge,()=>F)),!0},ct;Object.defineProperty(Y,"onSubmit",{configurable:!0,get:()=>ct,set(ue){ct=typeof ue=="function"?Re=>{Jh(),ue(Re)}:ue}}),O=Y,N8(Y),B8(Y),_e();let st=Y.handleInput.bind(Y);Y.handleInput=ue=>{if(et=Date.now(),tw(ue)){Hh(v),Lc(v);return}let Re=nw(ue);if(Re){Kh(v,Re),Lc(v);return}if(!S&&!He()){S=!0,ru(Y),v.ui.setEditorComponent(D),qe.fixedEditor&&Vh(v,q),O?.handleInput(ue);return}_e();let Ge=J.matches(ue,"app.message.followUp")?ou(v,Y):"";Lc(v),st(ue),Ds(Ge)&&!Ds(ou(v,Y))&&Jh()};let kn=Y.render.bind(Y);return Y.render=ue=>{if(ue<10)return kn(ue);let Re=wt=>`${Lo("sep")}${wt}${wn.reset}`,Ge=F?"$":">",Pi=` ${`${wn.getFgAnsi(200,200,200)}${Ge}${wn.reset}`} `,Wc=" ",Hu=Math.max(1,ue-3),qn=kn(Hu);if(qn.length===0)return qn;let Gr=qn.length-1;for(let wt=qn.length-1;wt>=1;wt--){let Kr=qn[wt]?.replace(/\x1b\[[0-9;]*m/g,"")||"";if(Kr.length>0&&/^─{3,}/.test(Kr)){Gr=wt;break}}let xs=[];xs.push(" "+Re("\u2500".repeat(ue-2)));for(let wt=1;wt<Gr;wt++){let Kr=wt===1?Pi:Wc;xs.push(`${Kr}${qn[wt]||""}`)}Gr===1&&xs.push(`${Pi}${" ".repeat(Hu)}`),xs.push(" "+Re("\u2500".repeat(ue-2)));for(let wt=Gr+1;wt<qn.length;wt++)xs.push(qn[wt]||"");return xs},Y};v.ui.setEditorComponent(D),v.ui.setFooter((q,te,J)=>{c=J,m=q,At(J);let Y=J.onBranchChange(()=>ye());return{dispose(){Y(),g?.(),g=null},invalidate(){ye()},render(){return[]}}}),qe.fixedEditor?m&&Vh(v,m):aO(v)}function cO(v){let S=v.model?.name||v.model?.id||"No model",D=v.model?.provider||"Unknown",q=bb(),te=xb(3),J=new pm(S,D,te,q);R=!0,v.ui.setHeader(()=>({render(Y){return J.render(Y)},invalidate(){J.invalidate()}}))}function lO(v){let S=v.model?.name||v.model?.id||"No model",D=v.model?.provider||"Unknown",q=bb(),te=xb(3),J=r;setTimeout(()=>{if(!s||L||p||J!==r){L=!1;return}(v.sessionManager?.getBranch?.()??[]).some(_e=>bt(_e)?_e.type==="tool_call"||_e.type==="tool_result"?!0:_e.type==="message"&&bt(_e.message)&&_e.message.role==="assistant":!1)||v.ui.custom((_e,ct,st,kn)=>{let ue=new dm(S,D,te,q),Re=10,Ge=!1,It=null,Pi=()=>{Ge||(Ge=!0,It&&clearInterval(It),_=null,kn())};return It=setInterval(()=>{Ge||(Re--,ue.setCountdown(Re),_e.requestRender(),Re<=0&&Pi())},1e3),_=Pi,L&&(L=!1,Pi()),{focused:!1,invalidate:()=>ue.invalidate(),render:Wc=>ue.render(Wc),handleInput:()=>Pi(),dispose:()=>{Ge=!0,It&&clearInterval(It)}}},{overlay:!0,overlayOptions:()=>({verticalAlign:"center",horizontalAlign:"center"})}).catch(_e=>{console.debug("[sling-footer] Welcome overlay failed:",_e)})},100)}}function NI(t,e){let n=0,i=0,s=async()=>{try{return i=(await(await fetch(we.getUserUrl(),{headers:{Authorization:`Bearer ${e()?.access||""}`,Accept:"application/json",projectId:e()?.projectId||"",workspaceId:e()?.workspaceId||""}})).json()).remainingCredits||0,je("Fetched user data for credits: "+i),i}catch(o){ft("Error fetching user data for credits",o)}return 0};t.on("session_start",async(o,r)=>{r.ui.setStatus("ss-credit","0")}),t.on("before_agent_start",async(o,r)=>{s().then(a=>{r.ui.setStatus("ss-credit",`${a.toFixed(2)}`)})}),t.on("agent_end",async(o,r)=>{s().then(a=>{r.ui.setStatus("ss-credit",`${a.toFixed(2)}`)})})}var Nt=fO(LA(),1);var _c=t=>t==null?"N/A":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?Math.round(t/1e3)+"k":t.toString();var joe=["context_tag","context_log","context_checkout"],$h=null,mn=null,Bh=t=>joe.includes(t),WA=(t,e)=>{if(e.toLowerCase()==="root"){let i=t.getTree();return i.length>0?i[0].entry.id:e}if(/^[0-9a-f]{8,}$/i.test(e))return e;let n=[...t.getTree()];for(;n.length>0;){let i=n.pop();if(t.getLabel(i.entry.id)===e)return i.entry.id;i.children?.length&&n.push(...i.children)}return e},qoe=Nt.Type.Object({limit:Nt.Type.Optional(Nt.Type.Number({description:"History limit for visible entries (default: 50)."})),verbose:Nt.Type.Optional(Nt.Type.Boolean({description:"If true, show ALL messages. If false (default), collapses intermediate AI steps and only shows 'milestones': User messages, Tags, Branch Points, and Summaries."}))}),Goe=Nt.Type.Object({target:Nt.Type.String({description:"Where to jump/squash to. Can be a tag name (e.g., 'task-start'), a commit ID, or 'root'. This is the base for your new branch."}),message:Nt.Type.String({description:"The 'Carryover Message' for the new branch. A summary of your *current* progress/lessons that you want to bring with you to the new state. This ensures you don't lose key information when switching contexts. Good summary message: '[Status] + [Reason] + [Important Changes] + [Carryover Data]'"}),backupTag:Nt.Type.Optional(Nt.Type.String({description:"Optional tag name to apply to the CURRENT state before checking out. Use this to create an automatic backup of the history you are about to leave/squash."}))}),Koe=Nt.Type.Object({name:Nt.Type.String({description:"The tag/milestone name. Use meaningful names."}),target:Nt.Type.Optional(Nt.Type.String({description:"The commit ID to tag. Defaults to HEAD (current state)."}))});function UA(t){t.registerCommand("s:acm",{description:"Enable agentic context management for the current session",handler:async(n,i)=>{$h=i,i.ui.notify("Agentic Context Management enabled.","info"),t.sendMessage({customType:"ss-context",content:"use context-management skill",display:!1},{deliverAs:"followUp"}),n&&t.sendUserMessage(n)}});let e=(n,i,s)=>{let o=[...i].reverse();for(;o.length>0;){let r=o.pop();if(n.getLabel(r.entry.id)===s)return r.entry.id;if(r.children?.length)for(let a=r.children.length-1;a>=0;a--)o.push(r.children[a])}return null};t.registerTool({name:"context_tag",label:"Context Tag",description:"Creates a 'Save Point' (Bookmark) in the history. Use this before trying risky changes or when a feature is stable. 'Untagged progress is risky'.",parameters:Koe,async execute(n,i,s,o,r){let a=r.sessionManager,c=e(a,a.getTree(),i.name);if(c)return{content:[{type:"text",text:`Error: Tag '${i.name}' already exists at ${c}. Tag names must be unique. Use a different name or delete the existing tag first.`}],details:{}};let l=i.target?WA(a,i.target):void 0;if(!l){let d=a.getBranch();for(let u=d.length-1;u>=0;u--){let p=d[u];if(p.type==="message"&&p.message.role==="toolResult"){let m=p.message;if(Bh(m.toolName))continue;l=p.id;break}if(p.type==="message"&&p.message.role==="assistant"&&!p.message.content.some(h=>h.type==="toolCall"&&Bh(h.name))){l=p.id;break}l=p.id;break}l||(l=a.getLeafId()??"")}return t.setLabel(l,i.name),{content:[{type:"text",text:`Created tag '${i.name}' at ${l}`}],details:{}}}}),t.registerTool({name:"context_log",label:"Context Log",description:"Show the entire history structure (status, message, tags, milestones). Analogous to 'git log --graph --oneline --decorate'",parameters:qoe,async execute(n,i,s,o,r){let a=r.sessionManager,c=a.getBranch(),l=a.getLeafId(),d=i.verbose??!1,u=i.limit??50,p=new Set(c.map(W=>W.id)),m=[];c.forEach(W=>{m.push(W),a.getChildren(W.id).forEach(I=>{(I.type==="branch_summary"||I.type==="compaction")&&!p.has(I.id)&&m.push(I)})});let g=W=>{if(W.type==="branch_summary"||W.type==="compaction")return W.summary||"[No summary provided]";if(W.type==="label")return`tag: ${W.label}`;if(W.type==="message"){let M=W.message;if(M.role==="toolResult"){let I=M;if(!d&&Bh(I.toolName))return"";let F=(H=>H.map(G=>G.type==="text"?G.text:"").join(" ").trim())(I.content),N=I.details;return(I.toolName==="read"||I.toolName==="edit")&&N&&"path"in N&&typeof N.path=="string"&&(F=`${N.path}: ${F}`),`(${I.toolName}) ${F}`}if(M.role==="bashExecution")return`[Bash] ${M.command}`;if(M.role==="user"||M.role==="assistant"){let I="";typeof M.content=="string"?I=M.content:Array.isArray(M.content)&&(I=M.content.map(F=>typeof F=="object"&&F!==null&&"text"in F?F.text:"").join(" ").trim());let O="";return M.role==="assistant"&&(O=M.content.filter(N=>N.type==="toolCall").filter(N=>d||!Bh(N.name)).map(N=>`call: ${N.name}(${JSON.stringify(N.arguments)})`).join("; ")),[I,O].filter(Boolean).join(" ")}}return""},h=W=>W.id===l||c.length>0&&W.id===c[0].id||a.getLabel(W.id)?!0:W.type==="label"?!1:W.type==="branch_summary"||W.type==="compaction"||a.getChildren(W.id).length>1||W.type==="message"&&W.message.role==="user",f=new Set;m.forEach(W=>{(d||h(W))&&f.add(W.id)});let x=m.filter(W=>f.has(W.id));if(x.length>u){let W=new Set(x.slice(-u).map(M=>M.id));f.clear(),W.forEach(M=>f.add(M))}let y=[],w=0;m.forEach(W=>{if(!f.has(W.id)){w++;return}w>0&&(y.push(` : ... (${w} hidden messages) ...`),w=0);let M=W.id===l,I=a.getLabel(W.id),O=g(W).replace(/\s+/g," "),F=W.type.toUpperCase();if(W.type==="message"){let Te=W.message;F=Te.role==="assistant"?"AI":Te.role==="user"?"USER":Te.role==="bashExecution"?"BASH":"TOOL"}else(W.type==="branch_summary"||W.type==="compaction")&&(F="SUMMARY");if(F==="CUSTOM_MESSAGE")return;let N=W.id,G=[c.length>0&&W.id===c[0].id?"ROOT":null,M?"HEAD":null,I?`tag: ${I}`:null].filter(Boolean).join(", "),Z=O.length>100?O.slice(0,100)+"...":O,de=M?"*":F==="USER"?"\u2022":"|";y.push(`${de} ${N}${G?` (${G})`:""} [${F}] ${Z}`)}),w>0&&y.push(` : ... (${w} hidden messages) ...`);let P=await r.getContextUsage(),_="Unknown";P&&(_=`${P.percent.toFixed(1)}% (${_c(P.tokens)}/${_c(P.contextWindow)})`);let R=0,L="None";for(let W=c.length-1;W>=0;W--){let M=c[W].id,I=a.getLabel(M);if(I){L=I;break}R++}return{content:[{type:"text",text:["[Context Dashboard]",`\u2022 Context Usage: ${_}`,`\u2022 Segment Size: ${R} steps since last tag '${L}'`,"---------------------------------------------------"].join(`
|
|
523
523
|
`)+`
|
|
524
524
|
`+(y.join(`
|
|
525
525
|
`)||"(Root Path Only)")}],details:{}}}}),t.registerTool({name:"context_checkout",label:"Context Checkout",description:"Navigate to ANY point in the conversation history. This checkout only resets *conversation history*, NOT disk files. ALWAYS provide a detailed 'message' to bridge context.",parameters:Goe,async execute(n,i,s,o,r){if(!$h)return r.ui.setEditorText(`/acm ${r.ui.getEditorText()||"continue"}`),{content:[{type:"text",text:"Agentic context management is not enabled. Ask the user to run `/acm` in the pi to enable it, then retry."}],details:{}};let a=r.sessionManager,c=WA(a,i.target),l=a.getLeafId();if(l===c)return{content:[{type:"text",text:`Already at target ${c}`}],details:{}};i.backupTag&&l&&t.setLabel(l,i.backupTag);let d=l?a.getLabel(l):void 0,p=`(summary from ${d?`tag: ${d}`:l||"unknown"})
|
|
526
526
|
${i.message}`,m=await a.branchWithSummary(c,p);return mn=i,mn.nid=m,mn.tid=c,mn.enrichedMessage=p,{content:[{type:"text",text:"checkout start"}],details:{}}}}),t.on("turn_end",async(n,i)=>{mn&&i.abort()}),t.on("agent_end",async(n,i)=>{mn&&$h&&(await $h.navigateTree(mn.nid,{summarize:!1}),i.ui.notify(`Checked out ${mn.target}${mn.target===mn.tid?"":`(${mn.tid})`}
|
|
527
527
|
Backup tag created: ${mn.backupTag||"none"}
|
|
528
|
-
message: ${mn.enrichedMessage}`,"info"),mn=null,t.sendMessage({customType:"ss-context",content:"context_checkout complete. A summary of your previous branch was injected above. Read it to understand your new state. Execute the 'Next Step' from the summary",display:!1},{triggerTurn:!0}))})}function FA(t){t.registerCommand("
|
|
529
|
-
`),"info");return}let u=0;if(await n.ui.custom((p,m,g,h)=>{let f="by-source",x=$A(l,f),y=[...x],w=y.findIndex(F=>F.type==="item");w<0&&(w=0);let P=new Je;function _(F,N){let H=F+N;for(;H>=0&&H<y.length;){if(y[H]?.type==="item")return H;H+=N}return F}function R(F){let N=ere(F);if(!N){y=[...x],E();return}let H=new Set,G=new Set;for(let Z of x)Z.type==="item"&&N(Z.item)&&H.add(Z.item);for(let Z of l)for(let de of Z.items)H.has(de)&&G.add(Z);y=[];for(let Z of x)(Z.type==="group"&&G.has(Z.group)||Z.type==="item"&&H.has(Z.item))&&y.push(Z);E()}function L(){x=$A(l,f),R(P.getValue())}function E(){let F=y.findIndex(N=>N.type==="item");w=F>=0?F:0}let W={invalidate(){},render(F){let N=m.bold("Skill Configuration"),H=m.fg("muted"," \xB7 "),G=dt("space","toggle")+H+dt("tab","view")+H+dt("esc","close"),Z=j(G),de=j(N),Te=Math.max(1,F-de-Z);return[X(`${N}${" ".repeat(Te)}${G}`,F,""),m.fg("muted","Filter: name \xB7 /path \xB7 @source")]}},M=15,I={invalidate(){},render(F){let N=[];if(N.push(...P.render(F)),N.push(""),y.length===0)return N.push(m.fg("muted"," No skills found")),N;let H=Math.max(0,Math.min(w-Math.floor(M/2),y.length-M)),G=Math.min(H+M,y.length);for(let pe=H;pe<G;pe++){let Ie=y[pe];if(!Ie)continue;let et=pe===w;if(Ie.type==="group"){let Fe=m.fg("accent",m.bold(Ie.group.label));N.push(X(` ${Fe}`,F,""))}else{let Fe=et?"> ":" ",oi=Ie.item.enabled?m.fg("success","[x]"):m.fg("dim","[ ]"),jt=et?m.bold(Ie.item.displayName):Ie.item.displayName;N.push(X(`${Fe} ${oi} ${jt}`,F,"..."))}}let Z=y.filter(pe=>pe.type==="item").length,de=y[w]?.type==="item"?y.slice(0,w+1).filter(pe=>pe.type==="item").length:0,Te=zoe[f];return H>0||G<y.length?N.push(m.fg("dim",` ${de}/${Z} ${Te}`)):N.push(m.fg("dim",` ${Te}`)),N}},O=new K;return O.addChild(new U(1)),O.addChild(new V),O.addChild(new U(1)),O.addChild(W),O.addChild(new U(1)),O.addChild(I),O.addChild(new U(1)),O.addChild(new V),{render(F){return O.render(F)},invalidate(){O.invalidate()},handleInput(F){let N=ve();if(N.matches(F,"tui.select.up")){w=_(w,-1),p.requestRender();return}if(N.matches(F,"tui.select.down")){w=_(w,1),p.requestRender();return}if(N.matches(F,"tui.select.pageUp")){let H=Math.max(0,w-M);for(;H<y.length&&y[H]?.type!=="item";)H++;H<y.length&&(w=H),p.requestRender();return}if(N.matches(F,"tui.select.pageDown")){let H=Math.min(y.length-1,w+M);for(;H>=0&&y[H]?.type!=="item";)H--;H>=0&&(w=H),p.requestRender();return}if(N.matches(F,"tui.select.cancel")){h(void 0);return}if(Pe(F,"ctrl+c")){h(void 0);return}if(Pe(F,"tab")){f=Voe(f),L(),p.requestRender();return}if(F===" "||N.matches(F,"tui.select.confirm")){let H=y[w];if(H?.type==="item"){let G=!H.item.enabled;ore(H.item,G,o,i),H.item.enabled=G;for(let Z of l){let de=Z.items.find(Te=>Te.path===H.item.path);de&&(de.enabled=G)}u++,f==="active-first"&&L()}p.requestRender();return}P.handleInput(F),R(P.getValue()),p.requestRender()}}}),u>0){if(await n.ui.confirm("Reload Required",`${u} skill change(s) saved. Reload pi now?`)){await n.reload();return}n.ui.notify("Changes saved to settings. Use /reload to apply.","info")}}})}async function Qv(t,e){let n=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot"),i=new Date;return fetch(`${we.getUserActivityUrl()}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n||""}`,Accept:"application/json"},body:JSON.stringify({...t,activity_entity_type:"slingcli",activity_entity_id:_o.slingVersion||"dev",activity_startdate:t.activity_startdate?.toISOString()||i.toISOString(),activity_enddate:t.activity_enddate?.toISOString()||i.toISOString(),metadata:t.metadata||{}})}).then(s=>s.json()).then(s=>{je("User activity posted successfully, credits used: "+s.credits_used+"/"+s.remainingCredits)}).catch(s=>{ft("Error posting user activity:",s)}),{}}import GA from"node:path";var Nh=null,Yv=0,qA=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Xv(t){let e=GA.basename(process.cwd());return t?`\u2B55\uFE0F - ${t} - ${e}`:`\u2B55\uFE0F - ${e}`}function Zv(t){Nh&&(clearInterval(Nh),Nh=null),Yv=0;let e=t.sessionManager.getSessionName();t.ui.setTitle(Xv(e))}function KA(t){Zv(t),Nh=setInterval(()=>{let e=qA[Yv%qA.length],n=GA.basename(process.cwd()),i=t.sessionManager.getSessionName(),s=i?`${e} ${Xv(i)}`:`${e} ${Xv()}`;t.ui.setTitle(s),Yv++},80)}var jh=null;function qr(t){t.ui.setWorkingMessage(rre.magenta(z0[Math.floor(Math.random()*z0.length)]+"..."))}function are(t){$0(),V1(t),NI(t,()=>jh),Jv(t),Wb(t),UA(t),FA(t),t.on("resources_discover",async o=>{let r=Ec.join(HA(),".pi","agent"),a=Ec.join(HA(),".agents"),l=[Ec.join(o.cwd,".sling","agent"),a,r],d=[],u=[],p=[];for(let m of l){let g=Ec.join(m,"skills");ew(g)&&d.push(g);let h=Ec.join(m,"prompts");ew(h)&&u.push(h);let f=Ec.join(m,"themes");ew(f)&&p.push(f)}return{skillPaths:d,promptPaths:u,themePaths:p}});let e=new WeakSet;t.on("session_start",async(o,r)=>{r.ui.setStatus("ss-credit","0");let a=r.modelRegistry.authStorage;if(!e.has(a)){let l=a.getOAuthProviders.bind(a);a.getOAuthProviders=()=>l().filter(d=>d.id==="slingshot"),e.add(a)}r.hasUI&&r.ui.setHeader(q1);let c=r.modelRegistry.authStorage.get("slingshot");if(c?.type==="oauth"&&typeof c.access=="string"&&c.access)try{await zi(c.access)}catch(l){je(`session_start: app-token fetch failed: ${l instanceof Error?l.message:String(l)}`)}});let n=!1;t.registerProvider("slingshot",{baseUrl:we.getApiBaseUrl(),api:"openai-completions",apiKey:"SLINGSHOT_API_KEY",models:$1,headers:{"X-App-Authorization":we.SLINGSHOT_APP_TOKEN_ENV},oauth:{name:"Slingshot",login:H0,refreshToken:qp,getApiKey:o=>(jh=o,t.appendEntry("slingshot_credentials",o),o.access)}}),t.registerCommand("
|
|
528
|
+
message: ${mn.enrichedMessage}`,"info"),mn=null,t.sendMessage({customType:"ss-context",content:"context_checkout complete. A summary of your previous branch was injected above. Read it to understand your new state. Execute the 'Next Step' from the summary",display:!1},{triggerTurn:!0}))})}function FA(t){t.registerCommand("s:context",{description:"Show context usage visualization",handler:async(e,n)=>{let i=await n.getContextUsage();if(!i){n.ui.notify("Context usage info not available.","warning");return}let o=n.sessionManager.getBranch(),r=n.getSystemPrompt(),a=t.getActiveTools(),l=t.getAllTools().filter(W=>a.includes(W.name)),d=W=>Math.ceil(W.length/4),u=0,p=0,m=0;for(let W of o)if(W.type==="message"){let M=W.message;if(M.role==="user"){if(typeof M.content=="string")u+=d(M.content);else if(Array.isArray(M.content))for(let I of M.content)I.type==="text"&&(u+=d(I.text))}else if(M.role==="assistant"){if(typeof M.content=="string")u+=d(M.content);else if(Array.isArray(M.content))for(let I of M.content)I.type==="text"&&(u+=d(I.text)),I.type==="toolCall"&&(p+=d(JSON.stringify(I)))}else if(M.role==="toolResult"){if(Array.isArray(M.content))for(let I of M.content)I.type==="text"&&(m+=d(I.text))}else M.role==="bashExecution"&&(p+=d(M.command||""))}else(W.type==="branch_summary"||W.type==="compaction")&&(u+=d(W.summary||""));let g=d(r),h=d(JSON.stringify(l)),f=i.tokens,x=i.contextWindow;if(f==null||x==null||i.percent==null){n.ui.notify("Context usage info not available.","warning");return}let y=g+h+u+p+m,w=y>0?f/y:1,P=Math.round(g*w),_=Math.round(h*w),R=Math.round(u*w),L=Math.round(p*w),E=Math.round(m*w);await n.ui.custom((W,M,I,O)=>{let F=new K;F.addChild(new V(ne=>M.fg("accent",ne))),F.addChild(new A(M.fg("accent",M.bold(" Context Usage")),1,0)),F.addChild(new U(1));let N=[{label:"System Prompt",value:P,color:"muted"},{label:"System Tools",value:_,color:"dim"},{label:"Tool Call",value:L+E,color:"success"},{label:"Messages",value:R,color:"accent"}],H=Math.max(0,f-(P+_+R+L+E));H>10&&N.push({label:"Other",value:H,color:"dim"}),N.push({label:"Available",value:Math.max(0,x-f),color:"borderMuted"});let G=10,Z=5,de=G*Z,Te=[];for(N.forEach(ne=>{if(ne.label==="Available")return;let be=Math.round(ne.value/x*de);be===0&&ne.value>0&&(be=1);for(let ye=0;ye<be&&Te.length<de;ye++)Te.push({color:ne.color,filled:!0})});Te.length<de;)Te.push({color:"borderMuted",filled:!1});let pe=[];for(let ne=0;ne<Z;ne++){let be="";for(let ye=0;ye<G;ye++){let tt=Te[ne*G+ye];be+=M.fg(tt.color,tt.filled?"\u25A0 ":"\u25A1 ")}pe.push(be.trimEnd())}let Ie=`${M.fg("text",M.bold("Total Usage".padEnd(16)))} ${M.fg("text",M.bold(_c(f).padStart(7)))} ${M.fg("text",M.bold(`(${i.percent.toFixed(1).padStart(5)}%)`))}`,et=N.map(ne=>{let be=ne.label.padEnd(14),ye=_c(ne.value).padStart(7),tt=(ne.value/x*100).toFixed(1).padStart(5),At=ne.label==="Available"?"\u25A1":"\u25A0";return`${M.fg(ne.color,At)} ${M.fg("text",be)} ${M.fg("accent",ye)} (${tt}%)`}),Fe=[Ie,"",...et],oi=20,jt=Math.max(pe.length,Fe.length);for(let ne=0;ne<jt;ne++){let be=(pe[ne]||"").padEnd(oi),ye=Fe[ne]||"";F.addChild(new A(` ${be} ${ye}`,1,0))}return F.addChild(new U(1)),F.addChild(new A(M.fg("dim"," Press any key to close"),1,0)),F.addChild(new V(ne=>M.fg("accent",ne))),{render:ne=>F.render(ne),invalidate:()=>F.invalidate(),handleInput:ne=>O(void 0)}},{overlay:!0})}})}import{basename as DA,dirname as BA,join as Hoe,relative as NA}from"node:path";var Vv=["by-source","a-z","active-first"],zoe={"by-source":"By source","a-z":"A\u2013Z","active-first":"Active first"};function Voe(t){let e=Vv.indexOf(t);return Vv[(e+1)%Vv.length]??"by-source"}function Joe(t){return t.origin==="package"?`${t.source} (${t.scope})`:t.source==="auto"?t.scope==="user"?"User (~/.sling/agent/)":"Project (.sling/)":t.scope==="user"?"User settings":"Project settings"}function Qoe(t){let e=new Map;for(let i of t){let{path:s,enabled:o,metadata:r}=i,a=`${r.origin}:${r.scope}:${r.source}`;e.has(a)||e.set(a,{key:a,label:Joe(r),scope:r.scope,origin:r.origin,source:r.source,items:[]});let c=DA(s),l=DA(BA(s)),d=c==="SKILL.md"?l:c.endsWith(".md")?c.replace(/\.md$/,""):c;e.get(a)?.items.push({path:s,enabled:o,metadata:r,displayName:d,groupKey:a})}let n=Array.from(e.values());n.sort((i,s)=>i.origin!==s.origin?i.origin==="package"?-1:1:i.scope!==s.scope?i.scope==="user"?-1:1:i.source.localeCompare(s.source));for(let i of n)i.items.sort((s,o)=>s.displayName.localeCompare(o.displayName));return n}function Yoe(t){let e=[];for(let n of t){e.push({type:"group",group:n});for(let i of n.items)e.push({type:"item",item:i})}return e}function Xoe(t){let e=t.flatMap(n=>n.items);return e.sort((n,i)=>n.displayName.localeCompare(i.displayName)),e.map(n=>({type:"item",item:n}))}function Zoe(t){let e=t.flatMap(n=>n.items);return e.sort((n,i)=>n.enabled!==i.enabled?n.enabled?-1:1:n.displayName.localeCompare(i.displayName)),e.map(n=>({type:"item",item:n}))}function $A(t,e){switch(e){case"by-source":return Yoe(t);case"a-z":return Xoe(t);case"active-first":return Zoe(t)}}function ere(t){let e=t.trim();if(e.length===0)return;if(e.startsWith("/")){let i=e.slice(1).toLowerCase();return i.length===0?void 0:s=>s.path.toLowerCase().includes(i)}if(e.startsWith("@")){let i=e.slice(1).toLowerCase();return i.length===0?void 0:s=>s.metadata.source.toLowerCase().includes(i)}let n=e.toLowerCase();return i=>i.displayName.toLowerCase().includes(n)}function tre(t,e){let n=Le(),i=Hoe(e,".sling"),s=t.metadata.scope==="project"?i:n;return NA(s,t.path)}function nre(t){let e=t.metadata.baseDir??BA(t.path);return NA(e,t.path)}function jA(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")?t.slice(1):t}function ire(t,e,n,i){let s=t.metadata.scope,r=[...(s==="project"?n.getProjectSettings():n.getGlobalSettings()).skills??[]],a=tre(t,i),c=r.filter(l=>jA(l)!==a);c.push(e?`+${a}`:`-${a}`),s==="project"?n.setProjectSkillPaths(c):n.setSkillPaths(c)}function sre(t,e,n){let i=t.metadata.scope,o=[...(i==="project"?n.getProjectSettings():n.getGlobalSettings()).packages??[]],r=o.findIndex(p=>(typeof p=="string"?p:p.source)===t.metadata.source);if(r===-1)return;let a=o[r];if(a===void 0)return;typeof a=="string"&&(a={source:a},o[r]=a);let c=[...a.skills??[]],l=nre(t),d=c.filter(p=>jA(p)!==l);d.push(e?`+${l}`:`-${l}`),d.length>0?a.skills=d:delete a.skills,a.extensions!==void 0||a.skills!==void 0||a.prompts!==void 0||a.themes!==void 0||(o[r]=a.source),i==="project"?n.setProjectPackages(o):n.setPackages(o)}function ore(t,e,n,i){t.metadata.origin==="top-level"?ire(t,e,n,i):sre(t,e,n)}function Jv(t){t.registerCommand("s:skills-manager",{description:"Enable/disable skills",getArgumentCompletions:e=>{let n=[{value:"list",description:"List skills with enabled/disabled state"}],i=(e??"").toLowerCase(),s=n.filter(o=>o.value.startsWith(i)||o.description.toLowerCase().includes(i));return s.length>0?s.map(o=>({value:o.value,label:`${o.value} - ${o.description}`})):null},handler:async(e,n)=>{let i=n.cwd,s=Le(),o=gi.create(i,s),c=(await new Ni({cwd:i,agentDir:s,settingsManager:o}).resolve()).skills;if(c.length===0){n.ui.notify("No skills found.","info");return}let l=Qoe(c);if(e.trim().toLowerCase()==="list"||!n.hasUI){let p=[];for(let m of l){p.push(`${m.label}`);for(let g of m.items){let h=g.enabled?"[x]":"[ ]";p.push(` ${h} ${g.displayName}`)}}n.ui.notify(p.join(`
|
|
529
|
+
`),"info");return}let u=0;if(await n.ui.custom((p,m,g,h)=>{let f="by-source",x=$A(l,f),y=[...x],w=y.findIndex(F=>F.type==="item");w<0&&(w=0);let P=new Je;function _(F,N){let H=F+N;for(;H>=0&&H<y.length;){if(y[H]?.type==="item")return H;H+=N}return F}function R(F){let N=ere(F);if(!N){y=[...x],E();return}let H=new Set,G=new Set;for(let Z of x)Z.type==="item"&&N(Z.item)&&H.add(Z.item);for(let Z of l)for(let de of Z.items)H.has(de)&&G.add(Z);y=[];for(let Z of x)(Z.type==="group"&&G.has(Z.group)||Z.type==="item"&&H.has(Z.item))&&y.push(Z);E()}function L(){x=$A(l,f),R(P.getValue())}function E(){let F=y.findIndex(N=>N.type==="item");w=F>=0?F:0}let W={invalidate(){},render(F){let N=m.bold("Skill Configuration"),H=m.fg("muted"," \xB7 "),G=dt("space","toggle")+H+dt("tab","view")+H+dt("esc","close"),Z=j(G),de=j(N),Te=Math.max(1,F-de-Z);return[X(`${N}${" ".repeat(Te)}${G}`,F,""),m.fg("muted","Filter: name \xB7 /path \xB7 @source")]}},M=15,I={invalidate(){},render(F){let N=[];if(N.push(...P.render(F)),N.push(""),y.length===0)return N.push(m.fg("muted"," No skills found")),N;let H=Math.max(0,Math.min(w-Math.floor(M/2),y.length-M)),G=Math.min(H+M,y.length);for(let pe=H;pe<G;pe++){let Ie=y[pe];if(!Ie)continue;let et=pe===w;if(Ie.type==="group"){let Fe=m.fg("accent",m.bold(Ie.group.label));N.push(X(` ${Fe}`,F,""))}else{let Fe=et?"> ":" ",oi=Ie.item.enabled?m.fg("success","[x]"):m.fg("dim","[ ]"),jt=et?m.bold(Ie.item.displayName):Ie.item.displayName;N.push(X(`${Fe} ${oi} ${jt}`,F,"..."))}}let Z=y.filter(pe=>pe.type==="item").length,de=y[w]?.type==="item"?y.slice(0,w+1).filter(pe=>pe.type==="item").length:0,Te=zoe[f];return H>0||G<y.length?N.push(m.fg("dim",` ${de}/${Z} ${Te}`)):N.push(m.fg("dim",` ${Te}`)),N}},O=new K;return O.addChild(new U(1)),O.addChild(new V),O.addChild(new U(1)),O.addChild(W),O.addChild(new U(1)),O.addChild(I),O.addChild(new U(1)),O.addChild(new V),{render(F){return O.render(F)},invalidate(){O.invalidate()},handleInput(F){let N=ve();if(N.matches(F,"tui.select.up")){w=_(w,-1),p.requestRender();return}if(N.matches(F,"tui.select.down")){w=_(w,1),p.requestRender();return}if(N.matches(F,"tui.select.pageUp")){let H=Math.max(0,w-M);for(;H<y.length&&y[H]?.type!=="item";)H++;H<y.length&&(w=H),p.requestRender();return}if(N.matches(F,"tui.select.pageDown")){let H=Math.min(y.length-1,w+M);for(;H>=0&&y[H]?.type!=="item";)H--;H>=0&&(w=H),p.requestRender();return}if(N.matches(F,"tui.select.cancel")){h(void 0);return}if(Pe(F,"ctrl+c")){h(void 0);return}if(Pe(F,"tab")){f=Voe(f),L(),p.requestRender();return}if(F===" "||N.matches(F,"tui.select.confirm")){let H=y[w];if(H?.type==="item"){let G=!H.item.enabled;ore(H.item,G,o,i),H.item.enabled=G;for(let Z of l){let de=Z.items.find(Te=>Te.path===H.item.path);de&&(de.enabled=G)}u++,f==="active-first"&&L()}p.requestRender();return}P.handleInput(F),R(P.getValue()),p.requestRender()}}}),u>0){if(await n.ui.confirm("Reload Required",`${u} skill change(s) saved. Reload pi now?`)){await n.reload();return}n.ui.notify("Changes saved to settings. Use /reload to apply.","info")}}})}async function Qv(t,e){let n=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot"),i=new Date;return fetch(`${we.getUserActivityUrl()}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n||""}`,Accept:"application/json"},body:JSON.stringify({...t,activity_entity_type:"slingcli",activity_entity_id:_o.slingVersion||"dev",activity_startdate:t.activity_startdate?.toISOString()||i.toISOString(),activity_enddate:t.activity_enddate?.toISOString()||i.toISOString(),metadata:t.metadata||{}})}).then(s=>s.json()).then(s=>{je("User activity posted successfully, credits used: "+s.credits_used+"/"+s.remainingCredits)}).catch(s=>{ft("Error posting user activity:",s)}),{}}import GA from"node:path";var Nh=null,Yv=0,qA=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Xv(t){let e=GA.basename(process.cwd());return t?`\u2B55\uFE0F - ${t} - ${e}`:`\u2B55\uFE0F - ${e}`}function Zv(t){Nh&&(clearInterval(Nh),Nh=null),Yv=0;let e=t.sessionManager.getSessionName();t.ui.setTitle(Xv(e))}function KA(t){Zv(t),Nh=setInterval(()=>{let e=qA[Yv%qA.length],n=GA.basename(process.cwd()),i=t.sessionManager.getSessionName(),s=i?`${e} ${Xv(i)}`:`${e} ${Xv()}`;t.ui.setTitle(s),Yv++},80)}var jh=null;function qr(t){t.ui.setWorkingMessage(rre.magenta(z0[Math.floor(Math.random()*z0.length)]+"..."))}function are(t){$0(),V1(t),NI(t,()=>jh),Jv(t),Wb(t),UA(t),FA(t),t.on("resources_discover",async o=>{let r=Ec.join(HA(),".pi","agent"),a=Ec.join(HA(),".agents"),l=[Ec.join(o.cwd,".sling","agent"),a,r],d=[],u=[],p=[];for(let m of l){let g=Ec.join(m,"skills");ew(g)&&d.push(g);let h=Ec.join(m,"prompts");ew(h)&&u.push(h);let f=Ec.join(m,"themes");ew(f)&&p.push(f)}return{skillPaths:d,promptPaths:u,themePaths:p}});let e=new WeakSet;t.on("session_start",async(o,r)=>{r.ui.setStatus("ss-credit","0");let a=r.modelRegistry.authStorage;if(!e.has(a)){let l=a.getOAuthProviders.bind(a);a.getOAuthProviders=()=>l().filter(d=>d.id==="slingshot"),e.add(a)}r.hasUI&&r.ui.setHeader(q1);let c=r.modelRegistry.authStorage.get("slingshot");if(c?.type==="oauth"&&typeof c.access=="string"&&c.access)try{await zi(c.access)}catch(l){je(`session_start: app-token fetch failed: ${l instanceof Error?l.message:String(l)}`)}});let n=!1;t.registerProvider("slingshot",{baseUrl:we.getApiBaseUrl(),api:"openai-completions",apiKey:"SLINGSHOT_API_KEY",models:$1,headers:{"X-App-Authorization":we.SLINGSHOT_APP_TOKEN_ENV},oauth:{name:"Slingshot",login:H0,refreshToken:qp,getApiKey:o=>(jh=o,t.appendEntry("slingshot_credentials",o),o.access)}}),t.registerCommand("s:settings",{description:"slingshot specific settings",handler:async(o,r)=>{let a=we.getSettings();t.sendMessage({customType:"slingshot-settings",content:JSON.stringify(a,null,2),display:!0})}}),t.registerCommand("s:debug",{description:"Toggle Slingshot debug logging",handler:async(o,r)=>{let a=!Nl();if(O1(a),a){let c="Slingshot Debug: ENABLED \u2705",l=L1();l&&(c+=`
|
|
530
530
|
|
|
531
531
|
Log file:
|
|
532
532
|
${l}`),t.sendMessage({customType:"slingshot-debug-status",content:c,display:!0})}else t.sendMessage({customType:"slingshot-debug-status",content:"Slingshot Debug: DISABLED \u274C",display:!0})}}),t.registerCommand("refresh-token",{description:"Manually refresh Slingshot OAuth token",handler:async(o,r)=>{try{let a=r.modelRegistry.authStorage,c=a.get("slingshot");if(!c||c.type!=="oauth"){r.ui.notify("No Slingshot OAuth credentials found. Please use /login slingshot first.","error");return}r.ui.setStatus("refresh","Refreshing Slingshot token...");let l=await qp(c);a.set("slingshot",{type:"oauth",...l}),jh=l,t.appendEntry("slingshot_credentials",l),r.ui.setStatus("refresh",void 0),r.ui.notify("Slingshot token refreshed successfully!","info")}catch(a){r.ui.setStatus("refresh",void 0);let c=a instanceof Error?a.message:String(a);r.ui.notify(`Failed to refresh token: ${c}`,"error")}}});let i=Bp(),s=new Date;t.on("before_agent_start",async(o,r)=>{try{s=new Date,KA(r),qr(r),J0(r,"random");let a=await Gp(o,r);if(!a?.headers||!a.sageCommonData)return;i=Bp(),Kp("agentExecutionStatus",a.headers,a.sageCommonData,{agent_id:i,agent_name:"Sling_Coding_Assistant",agent_execution_status:"Started",agent_correlation_id:i,agent_type:"Temp"})}catch(a){Nl()&&(je(`CRITICAL ERROR in event handler: ${a?.message||a}`),a?.stack&&je(a.stack))}}),t.on("agent_end",async(o,r)=>{try{Zv(r);let a=0,c=0,l=0,d=0,u=0;for(let m of r.sessionManager.getEntries())m.type==="message"&&m.message.role==="assistant"&&(a+=m.message.usage.input,c+=m.message.usage.output,l+=m.message.usage.cacheRead,d+=m.message.usage.cacheWrite,u+=m.message.usage.cost.total);Qv({activity_type:"slingcli:agent:execute",activity_entity_id:i,activity_entity_type:"coding_agent",total_tokens:a+c,activity_startdate:s,activity_enddate:new Date,credits_used:0,metadata:{correlation_id:i,cost:u}},r).then(m=>{m.credits_used&&r.ui.notify(`Credits used: ${m.credits_used.toFixed(4)}`,"info"),m.remainingCredits&&r.ui.setStatus("ss-credit",`${m.remainingCredits.toFixed(2)}`)});let p=await Gp(o,r);if(!p?.headers||!p.sageCommonData)return;Kp("agentExecutionStatus",p.headers,p.sageCommonData,{agent_id:i,agent_name:"Sling_Coding_Assistant",agent_execution_status:"Success",agent_correlation_id:i,agent_type:"Temp",tools_list:[]})}catch(a){t.sendMessage({customType:"slingshot-analytics-error",content:"[Slingshot] Analytics error. Run /slingshot-debug for details.",display:!0}),Nl()&&(je(`CRITICAL ERROR in event handler: ${a?.message||a}`),a?.stack&&je(a.stack))}}),t.on("tool_execution_start",async(o,r)=>{qr(r)}),t.on("tool_result",async(o,r)=>{if(qr(r),o.toolName==="write"||o.toolName==="edit")try{let a=await Gp(o,r,jh);if(!a?.headers||!a.sageCommonData||o.isError)return;let c=o.input.path+"",d=c.split(".").pop()||"",u="";o.toolName==="write"?u=o.input.content+"":o.toolName==="edit"&&(u=(o.details?.diff+"").split(`
|