import{e as g,q as f,s as _,K as m,n as I}from"./index-DjCrtoJM.js";import{a as S,u as P}from"./use-mcp-client-Wf5qUXFF.js";function A(t,e){return{queryKey:m.aiProviderKeys(e),staleTime:6e4,queryFn:async()=>(await t.callTool({name:"AI_PROVIDER_KEY_LIST",arguments:{}})).structuredContent??null}}function q(){const t=g.c(10),{org:e}=f();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:S,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const o=P(s);let i;t[3]!==e.id?(i=m.aiProviders(e.id),t[3]=e.id,t[4]=i):i=t[4];let l;t[5]!==o?(l=async()=>(await o.callTool({name:"AI_PROVIDERS_LIST",arguments:{}})).structuredContent,t[5]=o,t[6]=l):l=t[6];let n;t[7]!==i||t[8]!==l?(n={queryKey:i,staleTime:1/0,queryFn:l},t[7]=i,t[8]=l,t[9]=n):n=t[9];const{data:r}=_(n);return r}function v(){const t=g.c(8),{org:e}=f();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:S,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const o=P(s);let i;t[3]!==o||t[4]!==e.id?(i=A(o,e.id),t[3]=o,t[4]=e.id,t[5]=i):i=t[5];const{data:l}=_(i);let n;return t[6]!==l?.keys?(n=l?.keys??[],t[6]=l?.keys,t[7]=n):n=t[7],n}function R(t){const e=g.c(18),{org:s}=f();let o;e[0]!==s.id||e[1]!==s.slug?(o={connectionId:S,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=o):o=e[2];const i=P(o);let l;e[3]!==t||e[4]!==s.id?(l=m.aiProviderModels(s.id,t??""),e[3]=t,e[4]=s.id,e[5]=l):l=e[5];const n=!!t;let r;e[6]!==i||e[7]!==t?(r=async()=>(await i.callTool({name:"AI_PROVIDERS_LIST_MODELS",arguments:{keyId:t}})).structuredContent??null,e[6]=i,e[7]=t,e[8]=r):r=e[8];let u;e[9]!==l||e[10]!==n||e[11]!==r?(u={queryKey:l,enabled:n,staleTime:6e4,queryFn:r},e[9]=l,e[10]=n,e[11]=r,e[12]=u):u=e[12];const{data:a,isLoading:T}=I(u);let c;e[13]!==a?.models?(c=a?.models??[],e[13]=a?.models,e[14]=c):c=e[14];const y=!!t&&T;let d;return e[15]!==c||e[16]!==y?(d={models:c,isLoading:y},e[15]=c,e[16]=y,e[17]=d):d=e[17],d}function p(t){const e=g.c(14),{org:s}=f();let o;e[0]!==s.id||e[1]!==s.slug?(o={connectionId:S,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=o):o=e[2];const i=P(o);let l;e[3]!==t||e[4]!==s.id?(l=m.aiProviderModels(s.id,t),e[3]=t,e[4]=s.id,e[5]=l):l=e[5];let n;e[6]!==i||e[7]!==t?(n=async()=>(await i.callTool({name:"AI_PROVIDERS_LIST_MODELS",arguments:{keyId:t}})).structuredContent??null,e[6]=i,e[7]=t,e[8]=n):n=e[8];let r;e[9]!==l||e[10]!==n?(r={queryKey:l,staleTime:6e4,queryFn:n},e[9]=l,e[10]=n,e[11]=r):r=e[11];const{data:u}=_(r);let a;return e[12]!==u?.models?(a=u?.models??[],e[12]=u?.models,e[13]=a):a=e[13],a}export{A as a,R as b,q as c,p as d,v as u};
