UNPKG

decocms

Version:

Deco CMS โ€” Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) โ€ข 20.5 kB
import{c as L,b as ce,aH as Ae,aI as we,r as Q,j as s,eb as Ee,gm as Fe,t as he,gl as De,gZ as xe,b9 as Ke,a6 as Te,an as Oe,q as Re,K as be,i as $e,e as Ue,gK as ge,B as me,e3 as je,J as Le,m as ve,a_ as Ge,aL as ze,aM as Be,aN as He,aO as qe,bc as Qe,aP as Ve,aQ as We,aR as Ze,i9 as Ye}from"./index-DoEtSiIe.js";import{i as Je}from"./AlertCircle-GoAGGV0G.js";import{u as Pe,a as pe,i as Xe,b as et,p as tt,g as st,e as it}from"./use-ai-providers-BwkzkRi2.js";import{i as lt}from"./CheckCircle-vIQcB0iT.js";import{d as nt,o as rt}from"./use-organization-settings-CgKOO7Ms.js";import{S as at}from"./schema-CG6ylG0z.js";import{M as ot}from"./select-model-D0BbDHat.js";import{u as ct}from"./use-debounced-autosave-DN03qSfm.js";import{u as dt,P as Se,D as mt}from"./plan-usage-card-DnVnSftp.js";import{i as ft}from"./Minus-CFYZtYi9.js";import{u as ke,a as ut,c as pt,d as gt}from"./use-entitlements-4v7LU4jM.js";import{u as ht,a as xt,C as jt,i as vt,f as bt,F as St,S as Ne,P as Me}from"./plan-ladder-DNa_CJD5.js";import{g as yt,a as ye}from"./own-accounts-section-Ox_H5E7F.js";import{P as _t,C as _e}from"./index-BVDmO57n.js";import{R as It}from"./require-capability-FcSdruCZ.js";import"./task-board-BRF3ZwKz.js";import"./drawer-DO0sMAej.js";import"./use-mobile-BjsAkqwr.js";import"./chat-context-vJ6R-Clt.js";import"./use-panel-navigate-DHff9CS9.js";import"./thread-route-D-UE3Db_.js";import"./use-project-scope-AMUoXt2c.js";import"./repository-binding-BAQCDq-W.js";import"./use-mcp-client-86j-Nolb.js";import"./auth-IBAsOARn.js";import"./use-view-draft-kind-hbAZo1QG.js";import"./use-blog-view-DJnS2ipo.js";import"./thread-intent-R2KI8ie_.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-C0me6Edt.js";import"./session-runtime-CZKHty5X.js";import"./use-current-view-C2fbVQ-O.js";import"./use-in-settings-LMUeu63D.js";import"./use-decopilot-events-DwNDOIa1.js";import"./use-org-fs-C62_MbqW.js";import"./useInfiniteQuery-9vIAXgqG.js";import"./infiniteQueryObserver-BRGiYBJv.js";import"./Plus-BoPsX_T8.js";import"./badge-DONoxQO7.js";import"./popover-mrQ4T9ru.js";import"./toggle-group-CtXgLS7e.js";import"./active-indicator-CCMhAsc_.js";import"./tooltip-DhlWzeQv.js";import"./index-BFFHlwFA.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Tool01-D90Wr5xR.js";import"./switch-C5tCt-1T.js";import"./github-icon-YYYF_UPl.js";import"./Trash01-Ctp9Olbr.js";import"./use-date-fns-locale-DQRGqxvr.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./Eye-DwRCQHLk.js";import"./checkbox-CkODjqKt.js";import"./select-OlcoUSVg.js";import"./index-BdQq_4o_.js";import"./ChevronDown-Dm2xO7jf.js";import"./ChevronUp-BKdcyIOm.js";import"./ArrowLeft-DuGHc_Gh.js";import"./ChevronSelectorVertical-Cvgyclsz.js";import"./Key01-DfLmV_su.js";import"./SearchMd-BGRe_18c.js";import"./Monitor01-DUhT2Mcw.js";import"./Image01-BRABRo3v.js";import"./access-gate-4Yp7vAaA.js";import"./capability-load-error-C6JoLBp9.js";const Ct=e=>e.capabilities?.includes("image")===!0,Pt=e=>Xe(e),kt=e=>et(e),Nt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ct},{key:"web_search",filter:Pt},{key:"deep_research",filter:kt}];function Mt(e){const t=L.c(27),{slot:n,onSlotChange:m,filterModels:r,defaultKeyId:c}=e,l=Pe(),i=l.some(o=>o.id===n?.keyId)?n?.keyId:null,[v,y]=Q.useState(i??c),[_,u]=Q.useState(i);_!==i&&(u(i),i&&y(i));let I;t[0]!==l||t[1]!==c||t[2]!==v?(I=l.some(o=>o.id===v)?v:c,t[0]=l,t[1]=c,t[2]=v,t[3]=I):I=t[3];const a=I;let d;t[4]!==a||t[5]!==l?(d=a?l.find(o=>o.id===a):null,t[4]=a,t[5]=l,t[6]=d):d=t[6];const p=d,{models:N,isLoading:C}=pe(r?a??void 0:void 0),h=r?C||N.some(r):!0;let x;t[7]!==n||t[8]!==p?.providerId||t[9]!==i?(x=n&&i?{modelId:n.modelId,title:n.title??n.modelId,keyId:n.keyId,providerId:p?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=n,t[8]=p?.providerId,t[9]=i,t[10]=x):x=t[10];const b=x,g=ce();if(r&&!h){let o;t[11]!==g?(o=g("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[11]=g,t[12]=o):o=t[12];let M;return t[13]!==o?(M=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:o}),t[13]=o,t[14]=M):M=t[14],M}let P;t[15]!==g?(P=g("settings.simpleModeSection.pickModel"),t[15]=g,t[16]=P):P=t[16];let j;t[17]===Symbol.for("react.memo_cache_sentinel")?(j=o=>y(o),t[17]=j):j=t[17];let S;t[18]!==a||t[19]!==m?(S=o=>{const M=o.keyId??a??"";y(M),m({keyId:M,modelId:o.modelId,title:o.title})},t[18]=a,t[19]=m,t[20]=S):S=t[20];let w;return t[21]!==a||t[22]!==r||t[23]!==b||t[24]!==P||t[25]!==S?(w=s.jsx(ot,{variant:"bordered",placeholder:P,model:b,credentialId:a,filterModels:r,onCredentialChange:j,onModelChange:S}),t[21]=a,t[22]=r,t[23]=b,t[24]=P,t[25]=S,t[26]=w):w=t[26],w}function At(e){const t=L.c(10),{isPending:n,showSaved:m}=e,r=ce();if(n){let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ke,{size:12,className:"animate-spin"}),t[0]=c):c=t[0];let l;t[1]!==r?(l=r("settings.simpleModeSection.saving"),t[1]=r,t[2]=l):l=t[2];let i;return t[3]!==l?(i=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,l]}),t[3]=l,t[4]=i):i=t[4],i}if(m){let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(lt,{size:12}),t[5]=c):c=t[5];let l;t[6]!==r?(l=r("settings.simpleModeSection.saved"),t[6]=r,t[7]=l):l=t[7];let i;return t[8]!==l?(i=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,l]}),t[8]=l,t[9]=i):i=t[9],i}return null}function wt(){const e=L.c(48),t=ce(),n=Pe(),m=nt(),r=n.length>0;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Ae(at),e[0]=c):c=e[0];let l;e[1]!==m?(l={resolver:c,values:m,mode:"onChange"},e[1]=m,e[2]=l):l=e[2];const i=we(l),{mutate:v,isPending:y,isSuccess:_}=rt(),u=i.formState.isDirty;let I;e[3]!==i||e[4]!==m||e[5]!==t||e[6]!==v?(I={delayMs:250,save:async()=>{const f=i.getValues();v(f,{onSuccess:()=>i.reset(f,{keepValues:!0}),onError:R=>{i.reset(m),he.error(t("settings.simpleModeSection.failedToSave",{error:R.message}))}})}},e[3]=i,e[4]=m,e[5]=t,e[6]=v,e[7]=I):I=e[7];const{schedule:a}=ct(I),d=n[0],p=n[1],N=n[2],{models:C}=pe(d?.id),{models:h}=pe(p?.id),{models:x}=pe(N?.id);let b,g;e[8]!==i||e[9]!==r?(b=()=>{r||i.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},g=[r,i],e[8]=i,e[9]=r,e[10]=b,e[11]=g):(b=e[10],g=e[11]),Q.useEffect(b,g);let P;e[12]!==n||e[13]!==i||e[14]!==d||e[15]!==p||e[16]!==N||e[17]!==C||e[18]!==h||e[19]!==x?(P=()=>{const f=i.getValues(),R=new Set(n.map(Et)),O={};d?.id&&(O[d.id]=C),p?.id&&(O[p.id]=h),N?.id&&(O[N.id]=x);const $=G=>G!=null&&!R.has(G.keyId),A={fast:$(f.tiers.fast)?null:f.tiers.fast,smart:$(f.tiers.smart)?null:f.tiers.smart,thinking:$(f.tiers.thinking)?null:f.tiers.thinking,image:$(f.tiers.image)?null:f.tiers.image,web_search:$(f.tiers.web_search)?null:f.tiers.web_search,deep_research:$(f.tiers.deep_research)?null:f.tiers.deep_research},H=!A.fast||!A.smart||!A.thinking||!A.image||!A.web_search||!A.deep_research,q=A.fast===f.tiers.fast&&A.smart===f.tiers.smart&&A.thinking===f.tiers.thinking&&A.image===f.tiers.image&&A.web_search===f.tiers.web_search&&A.deep_research===f.tiers.deep_research;if(!H&&q)return;const U=tt(n,O);i.reset({tiers:{fast:A.fast??U.chat.fast,smart:A.smart??U.chat.smart,thinking:A.thinking??U.chat.thinking,image:A.image??U.image,web_search:A.web_search??U.webSearch,deep_research:A.deep_research??U.deepResearch}},{keepDirty:!0})},e[12]=n,e[13]=i,e[14]=d,e[15]=p,e[16]=N,e[17]=C,e[18]=h,e[19]=x,e[20]=P):P=e[20];const j=d?.id,S=p?.id,w=N?.id;let o;e[21]!==n||e[22]!==i||e[23]!==C||e[24]!==h||e[25]!==x||e[26]!==j||e[27]!==S||e[28]!==w?(o=[i,n,C,h,x,j,S,w],e[21]=n,e[22]=i,e[23]=C,e[24]=h,e[25]=x,e[26]=j,e[27]=S,e[28]=w,e[29]=o):o=e[29],Q.useEffect(P,o);let M;e[30]!==t?(M=f=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[f]||f,e[30]=t,e[31]=M):M=e[31];const F=M;let D;e[32]!==t?(D=t("settings.simpleModeSection.defaultModels"),e[32]=t,e[33]=D):D=e[33];const T=_&&!u;let K;e[34]!==y||e[35]!==T?(K=s.jsx(At,{isPending:y,showSaved:T}),e[34]=y,e[35]=T,e[36]=K):K=e[36];let E;e[37]!==n[0]?.id||e[38]!==i.control||e[39]!==F||e[40]!==a?(E=Nt.map(f=>s.jsx(Ee,{control:i.control,name:`tiers.${f.key}`,render:R=>{const{field:O}=R;return s.jsx(Fe,{title:F(f.key),action:s.jsx(Mt,{slot:O.value,defaultKeyId:n[0]?.id??null,filterModels:f.filter,onSlotChange:$=>{O.onChange($),a()}})})}},f.key)),e[37]=n[0]?.id,e[38]=i.control,e[39]=F,e[40]=a,e[41]=E):E=e[41];let z;e[42]!==E?(z=s.jsx(De,{children:E}),e[42]=E,e[43]=z):z=e[43];let B;return e[44]!==D||e[45]!==K||e[46]!==z?(B=s.jsx(xe,{title:D,actions:K,children:z}),e[44]=D,e[45]=K,e[46]=z,e[47]=B):B=e[47],B}function Et(e){return e.id}function Ie(e){return e==="starter"||e==="business"?e:null}function Ce(){const e=L.c(93),t=ce(),n=ke(),{data:m,isLoading:r,isError:c}=ut(),{data:l,isLoading:i,isError:v,refetch:y}=ht(),{data:_}=xt(),{mutate:u,isPending:I}=dt("ORGANIZATION_BILLING_CHECKOUT_START","settings.planUsage.changeFailed"),{org:a}=Te(),d=Oe(),p=Re(),N=m?.features.invoice_upgrade===!0,C=m?.plan.id===jt;let h;e[0]!==a.id?(h=be.orgBillingAccount(a.id),e[0]=a.id,e[1]=h):h=e[1];const x=N||C;let b;e[2]!==d?(b=()=>d.call("ORGANIZATION_BILLING_GET",{}),e[2]=d,e[3]=b):b=e[3];let g;e[4]!==h||e[5]!==x||e[6]!==b?(g={queryKey:h,enabled:x,staleTime:6e4,queryFn:b},e[4]=h,e[5]=x,e[6]=b,e[7]=g):g=e[7];const{data:P}=$e(g),j=N&&P?.subscribed===!1,[S,w]=Q.useState(null);let o;e[8]!==d?(o=k=>d.call("AI_PLAN_INVOICE_UPGRADE",{planId:k}),e[8]=d,e[9]=o):o=e[9];let M;e[10]!==a.id||e[11]!==p||e[12]!==t?(M=()=>{p.invalidateQueries({queryKey:be.aiPlanEntitlements(a.id)}),he.success(t("settings.planUsage.changed"))},e[10]=a.id,e[11]=p,e[12]=t,e[13]=M):M=e[13];let F;e[14]!==t?(F=k=>he.error(t("settings.planUsage.changeFailed",{message:k.message})),e[14]=t,e[15]=F):F=e[15];let D;e[16]!==o||e[17]!==M||e[18]!==F?(D={mutationFn:o,onSuccess:M,onError:F},e[16]=o,e[17]=M,e[18]=F,e[19]=D):D=e[19];const{mutate:T,isPending:K}=Ue(D);if(!n||c)return null;const E=m?.plan.id??null;if(vt(E)){let k;e[20]!==t?(k=t("settings.plans.title"),e[20]=t,e[21]=k):k=e[21];const de=m?.plan.name??"";let le;e[22]!==t||e[23]!==de?(le=t("settings.plans.managed",{plan:de}),e[22]=t,e[23]=de,e[24]=le):le=e[24];let ne;e[25]!==le?(ne=s.jsx("p",{className:"text-sm text-muted-foreground",children:le}),e[25]=le,e[26]=ne):ne=e[26];let re;e[27]!==t?(re=t("settings.plans.custom.cta"),e[27]=t,e[28]=re):re=e[28];let ae;e[29]!==re?(ae=s.jsx(me,{variant:"outline",size:"sm",asChild:!0,children:s.jsx("a",{href:Ne,children:re})}),e[29]=re,e[30]=ae):ae=e[30];let oe;e[31]!==ne||e[32]!==ae?(oe=s.jsxs(ge,{className:"p-5 flex-row items-center justify-between gap-3",children:[ne,ae]}),e[31]=ne,e[32]=ae,e[33]=oe):oe=e[33];let ue;return e[34]!==oe||e[35]!==k?(ue=s.jsx(xe,{title:k,children:oe}),e[34]=oe,e[35]=k,e[36]=ue):ue=e[36],ue}const z=l?.findIndex(k=>k.id===E)??-1,B=l?.[z+1]?.id??null,f=C?P?.subscribed===!0:E!==null&&E!=="free";let R;e[37]!==t?(R=t("settings.plans.title"),e[37]=t,e[38]=R):R=e[38];let O;e[39]!==E||e[40]!==v||e[41]!==K||e[42]!==i||e[43]!==r||e[44]!==I||e[45]!==j||e[46]!==C||e[47]!==l||e[48]!==_||e[49]!==y||e[50]!==u||e[51]!==f||e[52]!==B||e[53]!==t?(O=i||r?s.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:Array.from({length:3}).map(Ft)}):v||!l?s.jsxs(ge,{className:"p-5 flex-row items-center justify-between gap-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:t("settings.plans.loadFailed")}),s.jsx(me,{variant:"outline",size:"sm",onClick:()=>y(),children:t("settings.planUsage.retry")})]}):s.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[l.map((k,de)=>s.jsx(Dt,{plan:k,index:de,price:_?.[k.id],subscribed:f,isCurrent:k.id===E,emphasis:k.id===B,disabled:I||K,onChoose:()=>u(k.id),onInvoice:j&&Ie(k.id)?()=>w(k):void 0},k.id)),s.jsx(Kt,{index:l.length,isCurrent:C})]}),e[39]=E,e[40]=v,e[41]=K,e[42]=i,e[43]=r,e[44]=I,e[45]=j,e[46]=C,e[47]=l,e[48]=_,e[49]=y,e[50]=u,e[51]=f,e[52]=B,e[53]=t,e[54]=O):O=e[54];const $=S!==null;let A;e[55]===Symbol.for("react.memo_cache_sentinel")?(A=k=>!k&&w(null),e[55]=A):A=e[55];let H;e[56]!==t?(H=t("settings.plans.invoice.cta"),e[56]=t,e[57]=H):H=e[57];let q;e[58]!==H?(q=s.jsx(ze,{children:H}),e[58]=H,e[59]=q):q=e[59];const U=S?.name??"";let G;e[60]!==t||e[61]!==U?(G=t("settings.plans.invoice.confirm",{plan:U}),e[60]=t,e[61]=U,e[62]=G):G=e[62];let V;e[63]!==G?(V=s.jsx(Be,{children:G}),e[63]=G,e[64]=V):V=e[64];let W;e[65]!==q||e[66]!==V?(W=s.jsxs(He,{children:[q,V]}),e[65]=q,e[66]=V,e[67]=W):W=e[67];let Z;e[68]!==t?(Z=t("settings.plans.invoice.cancel"),e[68]=t,e[69]=Z):Z=e[69];let Y;e[70]!==Z?(Y=s.jsx(qe,{children:Z}),e[70]=Z,e[71]=Y):Y=e[71];let J;e[72]!==S||e[73]!==T?(J=()=>{const k=S&&Ie(S.id);k&&T(k)},e[72]=S,e[73]=T,e[74]=J):J=e[74];let X;e[75]!==t?(X=t("settings.plans.invoice.switch"),e[75]=t,e[76]=X):X=e[76];let ee;e[77]!==J||e[78]!==X?(ee=s.jsx(Qe,{onClick:J,children:X}),e[77]=J,e[78]=X,e[79]=ee):ee=e[79];let te;e[80]!==Y||e[81]!==ee?(te=s.jsxs(Ve,{children:[Y,ee]}),e[80]=Y,e[81]=ee,e[82]=te):te=e[82];let se;e[83]!==W||e[84]!==te?(se=s.jsxs(We,{children:[W,te]}),e[83]=W,e[84]=te,e[85]=se):se=e[85];let ie;e[86]!==$||e[87]!==se?(ie=s.jsx(Ze,{open:$,onOpenChange:A,children:se}),e[86]=$,e[87]=se,e[88]=ie):ie=e[88];let fe;return e[89]!==ie||e[90]!==R||e[91]!==O?(fe=s.jsxs(xe,{title:R,children:[O,ie]}),e[89]=ie,e[90]=R,e[91]=O,e[92]=fe):fe=e[92],fe}function Ft(e,t){return s.jsx(je,{className:"h-80 w-full rounded-xl"},t)}function Dt(e){const t=L.c(37),{plan:n,index:m,price:r,subscribed:c,isCurrent:l,emphasis:i,disabled:v,onChoose:y,onInvoice:_}=e,u=ce(),[I]=Le(),a=n.id==="starter"&&!c,d=l&&"ring-1 ring-primary shadow-none";let p;t[0]!==d?(p=ve("p-6 gap-6",d),t[0]=d,t[1]=p):p=t[1];let N;t[2]!==n.name?(N=s.jsx("h3",{className:"text-base font-medium leading-tight",children:n.name}),t[2]=n.name,t[3]=N):N=t[3];let C;t[4]!==_||t[5]!==I||t[6]!==r||t[7]!==u||t[8]!==a?(C=r!==void 0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-2xl font-semibold leading-none tracking-tight tabular-nums",children:bt(r,I.language)}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[u("settings.plans.perMonth"),a&&!_&&s.jsxs(s.Fragment,{children:[" ยท ",s.jsx("span",{className:"text-success font-medium",children:u("settings.plans.firstMonthFree")})]})]})]}),t[4]=_,t[5]=I,t[6]=r,t[7]=u,t[8]=a,t[9]=C):C=t[9];let h;t[10]!==N||t[11]!==C?(h=s.jsxs("div",{className:"flex flex-col gap-3",children:[N,C]}),t[10]=N,t[11]=C,t[12]=h):h=t[12];let x;t[13]!==m?(x=s.jsx(Me,{index:m}),t[13]=m,t[14]=x):x=t[14];let b;t[15]!==h||t[16]!==x?(b=s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h,x]}),t[15]=h,t[16]=x,t[17]=b):b=t[17];let g;t[18]!==v||t[19]!==i||t[20]!==l||t[21]!==y||t[22]!==_||t[23]!==c||t[24]!==u||t[25]!==a?(g=l?s.jsx("div",{className:"flex h-8 items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:u("settings.plans.currentPlan")}):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(me,{variant:i?"default":"outline",className:"w-full",disabled:v,onClick:y,children:u(c?"settings.planUsage.changePlan":a?"settings.plans.startTrial":"settings.planUsage.subscribe")}),_&&s.jsx(me,{variant:"outline",className:"w-full",disabled:v,onClick:_,children:u("settings.plans.invoice.cta")})]}),t[18]=v,t[19]=i,t[20]=l,t[21]=y,t[22]=_,t[23]=c,t[24]=u,t[25]=a,t[26]=g):g=t[26];let P;t[27]!==n.features||t[28]!==u?(P=St.map(w=>{const o=n.features[w]===!0;return s.jsxs("li",{className:ve("flex items-center gap-2.5 text-sm",!o&&"text-muted-foreground/70"),children:[o?s.jsx(Ge,{size:16,className:"shrink-0 text-success"}):s.jsx(ft,{size:16,className:"shrink-0 text-muted-foreground/50"}),s.jsx("span",{children:u(`settings.planUsage.feature.${w}`)})]},w)}),t[27]=n.features,t[28]=u,t[29]=P):P=t[29];let j;t[30]!==P?(j=s.jsx("ul",{className:"flex flex-col gap-3 pt-6 border-t border-border",children:P}),t[30]=P,t[31]=j):j=t[31];let S;return t[32]!==j||t[33]!==p||t[34]!==b||t[35]!==g?(S=s.jsxs(ge,{className:p,children:[b,g,j]}),t[32]=j,t[33]=p,t[34]=b,t[35]=g,t[36]=S):S=t[36],S}function Kt(e){const t=L.c(25),{index:n,isCurrent:m}=e,r=ce(),c=m&&"ring-1 ring-primary shadow-none";let l;t[0]!==c?(l=ve("p-6 gap-6",c),t[0]=c,t[1]=l):l=t[1];let i;t[2]!==r?(i=r("settings.plans.custom.name"),t[2]=r,t[3]=i):i=t[3];let v;t[4]!==i?(v=s.jsx("h3",{className:"text-base font-medium leading-tight",children:i}),t[4]=i,t[5]=v):v=t[5];let y;t[6]!==r?(y=r("settings.plans.custom.description"),t[6]=r,t[7]=y):y=t[7];let _;t[8]!==y?(_=s.jsx("span",{className:"text-sm text-muted-foreground",children:y}),t[8]=y,t[9]=_):_=t[9];let u;t[10]!==v||t[11]!==_?(u=s.jsxs("div",{className:"flex flex-col gap-3",children:[v,_]}),t[10]=v,t[11]=_,t[12]=u):u=t[12];let I;t[13]!==n?(I=s.jsx(Me,{index:n}),t[13]=n,t[14]=I):I=t[14];let a;t[15]!==u||t[16]!==I?(a=s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u,I]}),t[15]=u,t[16]=I,t[17]=a):a=t[17];let d;t[18]!==m||t[19]!==r?(d=m?s.jsx("div",{className:"flex h-8 items-center justify-center rounded-md border border-dashed border-border text-sm text-muted-foreground",children:r("settings.plans.currentPlan")}):s.jsx(me,{variant:"outline",className:"w-full",asChild:!0,children:s.jsx("a",{href:Ne,children:r("settings.plans.custom.cta")})}),t[18]=m,t[19]=r,t[20]=d):d=t[20];let p;return t[21]!==d||t[22]!==l||t[23]!==a?(p=s.jsxs(ge,{className:l,children:[a,d]}),t[21]=d,t[22]=l,t[23]=a,t[24]=p):p=t[24],p}function Tt(e){const t=L.c(3),{error:n}=e;let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Je,{size:16}),t[0]=m):m=t[0];let r;return t[1]!==n.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[m,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",n.message]})]}),t[1]=n.message,t[2]=r):r=t[2],r}function Ot(){const e=L.c(30),t=st();let n;e[0]!==t?(n=yt(t),e[0]=t,e[1]=n):n=e[1];const{hasHostedProvider:m,hasDeco:r}=n,[c,l]=Q.useState(!1),[i,v]=Q.useState(null),y=it(),_=pt("model_choice"),u=gt(),I=ke(),a=r&&!I;let d;e[2]!==y?.providers?(d=y?.providers??[],e[2]=y?.providers,e[3]=d):d=e[3];const p=d;if(!u){let j;return e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(je,{className:"h-64 w-full"}),e[4]=j):j=e[4],j}if(!m){let j,S;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Se,{}),S=s.jsx(Ce,{}),e[5]=j,e[6]=S):(j=e[5],S=e[6]);let w;e[7]!==p?(w=s.jsx(_t,{providers:p,onSelect:v}),e[7]=p,e[8]=w):w=e[8];let o;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ye,{onAddKey:()=>l(!0)}),e[9]=o):o=e[9];const M=i!==null||c;let F;e[10]===Symbol.for("react.memo_cache_sentinel")?(F=E=>{E||(v(null),l(!1))},e[10]=F):F=e[10];const D=i??void 0;let T;e[11]!==M||e[12]!==D?(T=s.jsx(_e,{open:M,onOpenChange:F,initialProvider:D}),e[11]=M,e[12]=D,e[13]=T):T=e[13];let K;return e[14]!==w||e[15]!==T?(K=s.jsxs(s.Fragment,{children:[j,S,w,o,T]}),e[14]=w,e[15]=T,e[16]=K):K=e[16],K}let N,C;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Se,{}),C=s.jsx(Ce,{}),e[17]=N,e[18]=C):(N=e[17],C=e[18]);let h;e[19]!==a?(h=a?s.jsx(mt,{}):null,e[19]=a,e[20]=h):h=e[20];let x;e[21]!==_?(x=_?s.jsx(Q.Suspense,{fallback:s.jsx(je,{className:"h-16 w-full"}),children:s.jsx(wt,{})}):null,e[21]=_,e[22]=x):x=e[22];let b;e[23]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ye,{onAddKey:()=>l(!0)}),e[23]=b):b=e[23];let g;e[24]!==c?(g=s.jsx(_e,{open:c,onOpenChange:l}),e[24]=c,e[25]=g):g=e[25];let P;return e[26]!==h||e[27]!==x||e[28]!==g?(P=s.jsxs(s.Fragment,{children:[N,C,h,x,b,g]}),e[26]=h,e[27]=x,e[28]=g,e[29]=P):P=e[29],P}function Rt(){const e=L.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Ye,{group:"billing",errorFallback:$t,children:s.jsx(Ot,{})}),e[0]=t):t=e[0],t}function $t(e){const{error:t}=e;return s.jsx(Tt,{error:t??new Error("Failed to load AI providers")})}function Js(){const e=L.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(It,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Rt,{})}),e[0]=t):t=e[0],t}export{Js as default};