import{d as e}from"./config-Bphz_1Sc.js";import{t}from"./xling-DyktHkvX.js";const n=[{name:`tool-claude-code`,baseUrl:`cli:claude`,apiKey:``,models:[`claude-code`],priority:999,timeout:6e4},{name:`tool-codex`,baseUrl:`cli:codex`,apiKey:``,models:[`codex`],priority:999,timeout:6e4},{name:`tool-gemini-cli`,baseUrl:`cli:gemini`,apiKey:``,models:[`gemini-cli`],priority:999,timeout:6e4}];var r=class n{#e;#t;#n;constructor(e){this.#e=this.#r(s(e.prompt.providers)),this.#n=e.prompt.defaultModel,this.#t=this.#i()}#r(t){return[...t].sort((t,n)=>e(t.priority)-e(n.priority))}#i(){let e=new Map;for(let t of this.#e)for(let n of t.models)e.has(n)||e.set(n,[]),e.get(n).push(t);return e}getProvidersForModel(e){return this.#t.get(e)||[]}getAllModels(){return Array.from(this.#t.keys()).sort()}getAllProviders(){return[...this.#e]}getProviderByName(e){return this.#e.find(t=>t.name===e)}getDefaultModel(){return this.#n}isModelSupported(e){return this.#t.has(e)}getStats(){return{providerCount:this.#e.length,modelCount:this.#t.size,defaultModel:this.#n}}async reload(){let e=new t,n=e.readConfig(e.resolvePath(`user`));this.#e=this.#r(s(n.prompt.providers)),this.#n=n.prompt.defaultModel,this.#t=this.#i()}static async fromConfig(){let e=new t;return new n(e.readConfig(e.resolvePath(`user`)))}getProvidersWithFallback(e){if(e){let t=this.getProvidersForModel(e);if(t.length>0)return{model:e,providers:t}}if(this.#n){let e=this.getProvidersForModel(this.#n);if(e.length>0)return{model:this.#n,providers:e}}return null}};let i=null;async function a(){return i||=await r.fromConfig(),i}function o(){i=null}function s(e){let t=new Set(e.map(e=>e.name)),r=n.filter(e=>!t.has(e.name));return[...e,...r]}export{a as n,o as r,r as t};