@nextclaw/ui 0.20.1 → 0.20.2

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/assets/{api-BBFMpRGl.js → api-DvpQWjTS.js} +3 -3
  3. package/dist/assets/{appearance-settings-page-C1Erayzl.js → appearance-settings-page-U0m0ktu3.js} +1 -1
  4. package/dist/assets/{book-open-BhTIpBKg.js → book-open-DRofSTWr.js} +1 -1
  5. package/dist/assets/channels-list-page-BURQarD0.js +8 -0
  6. package/dist/assets/{config-split-page-By7p-4X-.js → config-split-page-BrAQYTIl.js} +1 -1
  7. package/dist/assets/{confirm-dialog-xpl1Yl7r.js → confirm-dialog-DDJomLnO.js} +1 -1
  8. package/dist/assets/{createLucideIcon-B_8khHn8.js → createLucideIcon-DzkNHr5Z.js} +1 -1
  9. package/dist/assets/{desktop-update-config-CGFfa7-Z.js → desktop-update-config-BzZFhMv9.js} +1 -1
  10. package/dist/assets/{dist-CXN62DSs.js → dist-DXbLo2b1.js} +1 -1
  11. package/dist/assets/{dist-DdE-kCbi.js → dist-NskPB_yW.js} +1 -1
  12. package/dist/assets/doc-browser-DB22tQKU.js +1 -0
  13. package/dist/assets/{doc-browser-context-B8NCuMv5.js → doc-browser-context-CnKV4gJy.js} +1 -1
  14. package/dist/assets/doc-browser-sJjw9fl5.js +1 -0
  15. package/dist/assets/{extensions-CMctxyTf.js → extensions-DvlFMpAs.js} +1 -1
  16. package/dist/assets/{form-actions-BFgTdxqI.js → form-actions-UnPEZBkx.js} +1 -1
  17. package/dist/assets/index-Dc_ZMkmo.css +1 -0
  18. package/dist/assets/index-N1HnesBp.js +109 -0
  19. package/dist/assets/loader-circle-BlPXxgDB.js +1 -0
  20. package/dist/assets/mcp-marketplace-page-BIgFTbMq.js +9 -0
  21. package/dist/assets/mcp-marketplace-page-CZN4ovdK.js +1 -0
  22. package/dist/assets/model-config-page-CnSm7kfa.js +1 -0
  23. package/dist/assets/{navigation-link-BwWrm4k1.js → navigation-link-NjUdG6Vp.js} +1 -1
  24. package/dist/assets/plus-DVXol9Q5.js +1 -0
  25. package/dist/assets/privacy-settings-page-DVn2HU7W.js +1 -0
  26. package/dist/assets/providers-config-page-CzHJS3eg.js +1 -0
  27. package/dist/assets/react-DCVbGroo.js +8 -0
  28. package/dist/assets/{refresh-cw-B7NmPJ_Z.js → refresh-cw-CkeninE0.js} +1 -1
  29. package/dist/assets/remote-B2lsJF1c.js +1 -0
  30. package/dist/assets/{rotate-cw-B0ajMaHu.js → rotate-cw-DP33PuXU.js} +1 -1
  31. package/dist/assets/runtime-config-page-D69buyGp.js +1 -0
  32. package/dist/assets/{save-DWnYYpgQ.js → save-Cw2Xz-pB.js} +1 -1
  33. package/dist/assets/{search-D6pX7FC-.js → search-C2CFAVvd.js} +1 -1
  34. package/dist/assets/{search-config-page-Cx3o_675.js → search-config-page-dqNT0Swf.js} +1 -1
  35. package/dist/assets/{secrets-config-page-tyFl7Rvt.js → secrets-config-page-De6J3wVx.js} +2 -2
  36. package/dist/assets/security-config-Dcu9C4OL.js +1 -0
  37. package/dist/assets/{select-qEtFTWB5.js → select-DSuMhwVP.js} +1 -1
  38. package/dist/assets/skeleton-QoWydNLp.js +1 -0
  39. package/dist/assets/{tag-chip-vcjAYdV_.js → tag-chip-DFBLgsGf.js} +1 -1
  40. package/dist/assets/x-BXvAzpjb.js +1 -0
  41. package/dist/index.html +21 -21
  42. package/package.json +7 -7
  43. package/src/features/chat/components/layout/__tests__/chat-sidebar-read-state.test.tsx +4 -3
  44. package/src/features/chat/components/layout/__tests__/chat-sidebar-session-area.test.tsx +11 -4
  45. package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +17 -17
  46. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +17 -5
  47. package/src/features/chat/components/layout/chat-sidebar.tsx +28 -21
  48. package/src/features/chat/features/conversation/hooks/__tests__/use-session-conversation-controller.test.tsx +41 -1
  49. package/src/features/chat/features/conversation/hooks/use-session-pending-input-actions.ts +22 -4
  50. package/src/features/chat/features/message/utils/__tests__/chat-message-trigger-details.utils.test.ts +35 -0
  51. package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-agent-runtime-queue.test.tsx +50 -0
  52. package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-session-list-view.test.tsx +24 -3
  53. package/src/features/chat/features/ncp/hooks/use-ncp-session-list-view.ts +35 -19
  54. package/src/features/chat/features/session/components/__tests__/chat-sidebar-project-groups.test.tsx +26 -2
  55. package/src/features/chat/features/session/components/__tests__/chat-sidebar-session-item.test.tsx +55 -27
  56. package/src/features/chat/features/session/components/chat-sidebar-context-card.tsx +60 -0
  57. package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +95 -54
  58. package/src/features/chat/features/session/components/chat-sidebar-session-entry.tsx +9 -8
  59. package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +141 -95
  60. package/src/features/chat/features/session/components/chat-sidebar-session-list.tsx +11 -2
  61. package/src/features/chat/features/session/hooks/use-chat-sidebar-context-counts.ts +40 -0
  62. package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-file-preview.test.tsx +16 -9
  63. package/src/features/chat/features/workspace/components/__tests__/workspace-markdown-outline.test.tsx +128 -0
  64. package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumbs.tsx +3 -0
  65. package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +20 -2
  66. package/src/features/chat/features/workspace/components/workspace-markdown-outline.tsx +156 -0
  67. package/src/features/settings/pages/__tests__/privacy-settings-page.test.tsx +14 -5
  68. package/src/features/settings/pages/privacy-settings-page.tsx +38 -2
  69. package/src/shared/components/ui/actions/icon-action-button.tsx +1 -8
  70. package/src/shared/components/ui/tooltip.tsx +16 -1
  71. package/src/shared/hooks/use-config.ts +11 -0
  72. package/src/shared/lib/api/types.ts +8 -0
  73. package/src/shared/lib/api/utils/config.utils.ts +5 -0
  74. package/src/shared/lib/i18n/locales/en-US/chat.json +7 -0
  75. package/src/shared/lib/i18n/locales/en-US/core.json +17 -9
  76. package/src/shared/lib/i18n/locales/zh-CN/chat.json +7 -0
  77. package/src/shared/lib/i18n/locales/zh-CN/core.json +17 -9
  78. package/dist/assets/channels-list-page-OTCkjMOW.js +0 -8
  79. package/dist/assets/doc-browser-5xrHcQ2z.js +0 -1
  80. package/dist/assets/doc-browser-c2yO477-.js +0 -1
  81. package/dist/assets/index-DUCA8m2w.js +0 -109
  82. package/dist/assets/index-QrdUWHfm.css +0 -1
  83. package/dist/assets/loader-circle-CbdTrSp3.js +0 -1
  84. package/dist/assets/mcp-marketplace-page-DGve0muV.js +0 -9
  85. package/dist/assets/mcp-marketplace-page-_37VzG2q.js +0 -1
  86. package/dist/assets/model-config-page-DyC5H0bu.js +0 -1
  87. package/dist/assets/plus-DbeE4r-Q.js +0 -1
  88. package/dist/assets/privacy-settings-page--MOnhAZ6.js +0 -1
  89. package/dist/assets/providers-config-page-ChL3FUvK.js +0 -1
  90. package/dist/assets/react-DVMmnPWz.js +0 -8
  91. package/dist/assets/remote-DFoxj4ls.js +0 -1
  92. package/dist/assets/runtime-config-page-BQdT3nmd.js +0 -1
  93. package/dist/assets/security-config-CUTUm6JT.js +0 -1
  94. package/dist/assets/skeleton-7MYPzn8w.js +0 -1
  95. package/dist/assets/x-DThaS5ZL.js +0 -1
@@ -1 +0,0 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{B as t,H as n,L as r,a as i,s as a}from"./react-DVMmnPWz.js";import{Dn as o,cn as s,en as c,in as l,ln as u,mn as d,sn as f,zt as p}from"./api-BBFMpRGl.js";import{C as m,a as h,i as g,n as _,r as v,t as y}from"./select-qEtFTWB5.js";import{c as b,l as x,t as S}from"./confirm-dialog-xpl1Yl7r.js";import{t as C}from"./createLucideIcon-B_8khHn8.js";import{t as w}from"./search-D6pX7FC-.js";import{t as T}from"./loader-circle-CbdTrSp3.js";import{t as E}from"./plus-DbeE4r-Q.js";import{t as D}from"./refresh-cw-B7NmPJ_Z.js";import{t as O}from"./x-DThaS5ZL.js";import{t as k}from"./host-capabilities-Tk038i04.js";import{A,E as j,F as M,G as N,M as P,N as F,P as I,S as L,U as R,V as z,W as B,_ as V,b as H,bt as U,c as ee,ct as W,d as te,f as ne,ft as G,g as re,gt as ie,lt as K,m as ae,p as oe,v as q,x as se,xt as ce,y as le,yt as ue}from"./index-DUCA8m2w.js";import{t as de}from"./form-actions-BFgTdxqI.js";import{t as J}from"./config-hints-nV5HPOvq.js";import{a as fe,c as pe,i as me,l as he,n as ge,o as _e,r as ve,s as ye}from"./config-split-page-By7p-4X-.js";var be=C(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),xe=C(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y=e(n(),1),Se={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function X(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Ce(e,t){let n=X(e),r=X(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Z(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function we(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function Q(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=we(n,t))}return n.trim()}function Te(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Ee(e,t){return Z(t)}function De(e,t){return Z(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function Oe(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=I(i.thinking?.supported);if(a.length>0){let t=M(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function ke(e,t,n){return{...F(e,n),...F(t,n)}}function Ae(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!Te([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function je(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!Ce(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!Te(e.models,e.currentEditableModels)||!Ae(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Me(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=X(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),Ce(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),Te(e.models,e.currentEditableModels)||(t.models=De(e.models,e.providerName??``)),Ae(e.modelConfig,e.currentModelConfig)||(t.modelConfig=Oe(e.modelConfig,e.models)),t}function Ne(e){let t=Q(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={...Pe(e),model:t||null};return e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Pe(e){let t={apiBase:e.apiBase.trim(),extraHeaders:X(e.extraHeaders)};return e.apiKey.trim().length>0&&(t.apiKey=e.apiKey.trim()),t}function Fe(e){return i(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function Ie(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Le(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Re(e,t,n){let r=Q(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function ze(e,t,n){let r=[...e],i=new Set(e);for(let e of t){let t=Q(e,n);t&&!i.has(t)&&(i.add(t),r.push(t))}return{models:r,addedCount:r.length-e.length}}function Be(e,t,n){return ze(e,t,n).models.slice(e.length)}function Ve(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function He(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):A.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ue(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function We(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function Ge(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:Ie({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:Le({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function Ke(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:i(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:Le({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function qe(e){let{providerName:t,providersView:n,templatesView:r,schema:a,language:o}=e,s=t?n?.providers[t]:null,c=r?.providerTemplates.find(e=>e.providerType===s?.providerType),l=s??Se,u=a?.uiHints,d=!!s?.isCustom,f=t?J(`providers.${t}.apiKey`,u):void 0,p=t?J(`providers.${t}.apiBase`,u):void 0,m=t?J(`providers.${t}.extraHeaders`,u):void 0,h=t?J(`providers.${t}.wireApi`,u):void 0,g=c?.displayName||s?.displayName||t||``,_=(l.displayName||``).trim()||g,v=l.enabled!==!1,y=d||c?.supportsModelDiscovery===!0,b=Z([c?.modelPrefix||c?.providerType||``,t||``]),x=c?.defaultApiBase||``,S=l.apiBase||x,C=X(l.extraHeaders||null),w=l.wireApi||c?.defaultWireApi||`auto`,T=Ee(Z((c?.defaultModels??[]).map(e=>Q(e,b))),Z((l.models??[]).map(e=>Q(e,b)))),E=Oe(ke(c?.modelConfig,l.modelConfig,b),T),D=c?.apiBaseHelp?.[o]||c?.apiBaseHelp?.en||p?.help||i(`providerApiBaseHelp`),O=Ge({providerName:t,providerSpec:c,language:o}),k=Ke(c,d);return{apiBaseHelpText:D,apiBaseHint:p,apiKeyHint:f,currentApiBase:S,currentEditableModels:T,currentEnabled:v,currentHeaders:C,currentModelConfig:E,currentWireApi:w,defaultApiBase:x,defaultDisplayName:g,effectiveDisplayName:_,extraHeadersHint:m,...O,providerConfig:s,providerModelAliases:b,resolvedProviderConfig:l,supportsModelDiscovery:y,wireApiHint:h,...k}}function Je(e){let{providerName:t,providerAuth:n,resolvedAuthMethodId:r}=e,a=o(),s=se(),c=V(),l=re(),[u,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(``),_=(0,Y.useRef)(null),v=(0,Y.useCallback)(()=>{_.current!==null&&(window.clearTimeout(_.current),_.current=null)},[]),y=(0,Y.useCallback)((e,n)=>{v(),_.current=window.setTimeout(()=>{(async()=>{if(t)try{let r=await c.mutateAsync({provider:t,data:{sessionId:e}});if(r.status===`pending`){g(i(`providerAuthWaitingBrowser`)),y(e,r.nextPollMs??n);return}if(r.status===`authorized`){m(null),v(),g(i(`providerAuthCompleted`)),d.success(i(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}m(null),v(),g(r.message||`Authorization ${r.status}.`),d.error(r.message||`Authorization ${r.status}.`)}catch(e){m(null),v();let t=e instanceof Error?e.message:String(e);g(t),d.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,n))},[v,c,t,a]),b=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{f(t),g(``);let e=await s.mutateAsync({provider:t,data:r?{methodId:r}:{}});if(!e.sessionId||!e.verificationUri)throw Error(i(`providerAuthStartFailed`));m(e.sessionId),g(`${i(`providerAuthOpenPrompt`)}${e.userCode}${i(`providerAuthOpenPromptSuffix`)}`),await k.openExternalUrl(e.verificationUri),y(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);m(null),v(),g(t),d.error(`${i(`providerAuthStartFailed`)}: ${t}`)}},[v,n?.kind,t,r,y,s]),x=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{f(t),v(),m(null);let e=await l.mutateAsync({provider:t});g(`${i(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),d.success(i(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);g(t),d.error(`${i(`providerAuthImportFailed`)}: ${t}`)}},[v,l,n?.kind,t,a]);return(0,Y.useEffect)(()=>{v()},[v,t]),(0,Y.useEffect)(()=>()=>v(),[v]),{authSessionId:u===t?p:null,authStatusMessage:u===t?h:``,importAuthFromCli:x,importPending:l.isPending,startAuth:b,startPending:s.isPending}}function Ye(e){let{providerName:t,apiKey:n,apiKeyRequired:r,apiKeySet:a,apiBase:o,extraHeaders:s,supportsWireApi:l,wireApi:u,models:f,providerModelAliases:p}=e,m=L(),h=ae(),g=(0,Y.useMemo)(()=>JSON.stringify({providerName:t,apiKey:n,apiBase:o,extraHeaders:s}),[o,n,s,t]),[_,v]=(0,Y.useState)(null),y=(0,Y.useCallback)(async()=>{if(t)try{let e=await m.mutateAsync({provider:t,data:Ne({apiKey:n,apiBase:o,extraHeaders:s,supportsWireApi:l,wireApi:u,models:f,providerModelAliases:p})});if(e.success){d.success(`${i(`providerTestConnectionSuccess`)} (${e.latencyMs}ms)`);return}let r=[`provider=${e.provider}`,`latency=${e.latencyMs}ms`];e.model&&r.push(`model=${e.model}`),d.error(`${i(`providerTestConnectionFailed`)}: ${e.message} | ${r.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);d.error(`${i(`providerTestConnectionFailed`)}: ${t}`)}},[o,n,s,f,p,t,l,m,u]);return{discoverModels:(0,Y.useCallback)(async()=>{if(!t)return null;if(r&&!n.trim()&&!a)return d.error(i(`providerModelsApiKeyRequired`)),null;try{let e=await h.mutateAsync({provider:t,data:Pe({apiKey:n,apiBase:o,extraHeaders:s})});return v({key:g,models:e.models}),d.success(i(`providerModelsFetchSuccess`)),e.models}catch(e){if(e instanceof c&&(e.details?.upstreamStatus===401||e.details?.upstreamStatus===403))return d.error(i(`providerModelsAuthorizationFailed`)),null;let t=e instanceof Error?e.message:String(e);return d.error(`${i(`providerModelsFetchFailed`)}: ${t}`),null}},[o,n,r,a,h,g,s,t]),fetchedModels:_?.key===g?_.models:[],isDiscoveringModels:h.isPending,isTestPending:m.isPending,testConnection:y}}var $=t();function Xe({value:e,onChange:t,className:n}){let a=e?Object.entries(e):[],o=(e,n,r)=>{let i=[...a];i[e]=[n,r],t(Object.fromEntries(i))},c=()=>{t({...e,"":``})},l=e=>{let n=a.filter((t,n)=>n!==e);t(Object.fromEntries(n))};return(0,$.jsxs)(`div`,{className:r(`space-y-2`,n),children:[a.map(([e,t],n)=>(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(s,{type:`text`,value:e,onChange:e=>o(n,e.target.value,t),placeholder:i(`headerName`),className:`flex-1`}),(0,$.jsx)(s,{type:`text`,value:t,onChange:t=>o(n,e,t.target.value),placeholder:i(`headerValue`),className:`flex-1`}),(0,$.jsx)(u,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(n),children:(0,$.jsx)(K,{className:`h-4 w-4 text-red-500`})})]},n)),(0,$.jsxs)(u,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,$.jsx)(E,{className:`h-4 w-4 mr-2`}),i(`add`)]})]})}function Ze(e){let{value:t,onChange:n,options:r}=e;return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-foreground/15 bg-foreground text-background`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-muted hover:text-foreground`}`,children:e.label},e.value)})})}function Qe(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:a,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:p}=e;return(0,$.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(G,{className:`h-3.5 w-3.5`}),i(`providerAdvancedSettings`)]}),(0,$.jsx)(m,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,$.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:a}),c?(0,$.jsx)(Ze,{value:o,onChange:e=>s(e),options:l}):(0,$.jsxs)(y,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(g,{className:`rounded-xl`,children:(0,$.jsx)(h,{})}),(0,$.jsx)(_,{children:l.map(e=>(0,$.jsx)(v,{value:e.value,children:e.label},e.value))})]})]}):null,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{className:`text-sm font-medium text-foreground`,children:u}),(0,$.jsx)(Xe,{value:d,onChange:p}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerExtraHeadersHelpShort`)})]})]}):null]})}function $e({isSet:e,className:t,value:n,onChange:i,placeholder:a,...o}){let[c,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),p=typeof n==`string`&&n.length>0;return(0,$.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,$.jsx)(`div`,{onClick:()=>f(!0),className:r(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,t),children:`••••••••••••`}):(0,$.jsx)(s,{type:c?`text`:`password`,className:r(`pr-12`,t),value:n,onChange:i,onBlur:()=>{p||f(!1)},placeholder:a,autoFocus:d,...o}),(0,$.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,$.jsx)(u,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>l(!c),children:c?(0,$.jsx)(xe,{className:`h-4 w-4`}):(0,$.jsx)(ue,{className:`h-4 w-4`})})})]})}function et(e){let{apiKey:t,apiKeyRequired:n,apiKeySet:r,apiKeyPlaceholder:a,providerAuth:o,providerAuthNote:s,providerAuthMethodOptions:c,providerAuthMethodsCount:l,selectedAuthMethodHint:d,shouldUseAuthMethodPills:p,resolvedAuthMethodId:m,onAuthMethodChange:b,onStartProviderAuth:x,onImportProviderAuthFromCli:S,startPending:C,importPending:w,authSessionId:T,authStatusMessage:E,onApiKeyChange:D}=e,O=n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:i(`apiKey`)}),(0,$.jsx)($e,{id:`apiKey`,value:t,isSet:r,onChange:e=>D(e.target.value),placeholder:a,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`leaveBlankToKeepUnchanged`)})]}):null;return o?.kind===`device_code`?(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-muted/45 p-3`,children:[(0,$.jsx)(f,{className:`text-sm font-medium text-foreground`,children:o.displayName||i(`providerAuthSectionTitle`)}),s?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s}):null,l>1?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{className:`text-xs font-medium text-foreground`,children:i(`providerAuthMethodLabel`)}),p?(0,$.jsx)(Ze,{value:m,onChange:b,options:c}):(0,$.jsxs)(y,{value:m,onValueChange:b,children:[(0,$.jsx)(g,{className:`h-8 rounded-lg`,children:(0,$.jsx)(h,{placeholder:i(`providerAuthMethodPlaceholder`)})}),(0,$.jsx)(_,{children:c.map(e=>(0,$.jsx)(v,{value:e.value,children:e.label},e.value))})]}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(u,{type:`button`,variant:`outline`,size:`sm`,onClick:x,disabled:C||!!T,children:i(C?`providerAuthStarting`:T?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),o.supportsCliImport?(0,$.jsx)(u,{type:`button`,variant:`outline`,size:`sm`,onClick:S,disabled:w,children:i(w?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,T?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i(`providerAuthSessionLabel`),`: `,T.slice(0,8),`…`]}):null]}),E?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E}):null]})]}):O}function tt(e){let{providerName:t,models:n,aliases:r,fetchedModels:i=[],onModelsChange:a}=e,o=q({pollWhileRefreshing:!0,refreshOnMount:!0}),s=t?o.data?.providers[t]:void 0,c=i.length>0?`fetched`:`background`,l=(0,Y.useMemo)(()=>Be(n,c===`fetched`?i:s?.models??[],r),[r,s?.models,i,n,c]);return{addSuggestedModels:(0,Y.useCallback)(e=>{let t=ze(n,e,r);t.addedCount>0&&a(t.models)},[r,n,a]),hasSuggestionError:!!(s?.lastError&&!s.fetchedAt),isCheckingSuggestions:!!(t&&(o.isLoading||o.data?.refreshing&&!s)),suggestedModels:l,suggestionSource:c}}function nt(e){let{models:t,modelConfig:n,onModelsChange:r,onRemoveModel:a,onToggleModelThinkingLevel:o,onSetModelThinkingDefault:s,onSetModelVision:c,thinkingLevels:l,formatThinkingLevelLabel:u}=e,[d,m]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(()=>new Set),S=(0,Y.useMemo)(()=>t.filter(e=>b.has(e)),[t,b]),C=e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},w=()=>{m(!1),x(new Set)};return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`flex min-h-7 flex-wrap items-center justify-end gap-2`,children:d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:i(`providerModelsSuggestionsSelected`).replace(`{count}`,String(S.length))}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-primary hover:text-primary/80`,onClick:()=>x(S.length===t.length?new Set:new Set(t)),children:i(S.length===t.length?`providerModelsClearSelection`:`providerModelsSelectAll`)}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:w,children:i(`cancel`)}),(0,$.jsxs)(`button`,{type:`button`,disabled:S.length===0,className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{S.length!==0&&(r(t.filter(e=>!b.has(e))),w())},children:[(0,$.jsx)(K,{className:`h-3 w-3`}),i(`providerModelsRemoveSelected`)]})]}):(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,onClick:()=>m(!0),children:[(0,$.jsx)(K,{className:`h-3 w-3`}),i(`providerModelsBulkRemove`)]})}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{if(d)return(0,$.jsxs)(`label`,{className:`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5 hover:bg-muted/70`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:b.has(e),onChange:()=>C(e),"aria-label":i(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e})]},e);let t=n[e],r=t?.thinking,m=r?.supported??[],x=r?.default??null,S=t?.vision===!0;return(0,$.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,$.jsxs)(R,{children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-muted hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`providerModelThinkingTitle`),title:i(`providerModelThinkingTitle`),children:(0,$.jsx)(G,{className:`h-3 w-3`})})}),(0,$.jsxs)(B,{className:`w-80 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:i(`providerModelVisionTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelVisionHint`)})]}),(0,$.jsx)(p,{checked:S,onCheckedChange:t=>c(e,t)})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:i(`providerModelThinkingTitle`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelThinkingHint`)})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(t=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${m.includes(t)?`border-foreground/15 bg-foreground text-background`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-muted hover:text-foreground`}`,children:u(t)},t))}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(f,{className:`text-xs font-medium text-foreground`,children:i(`providerModelThinkingDefault`)}),(0,$.jsxs)(y,{value:x??`__none__`,onValueChange:t=>s(e,t===`__none__`?null:t),disabled:m.length===0,children:[(0,$.jsx)(g,{className:`h-8 rounded-lg text-xs`,children:(0,$.jsx)(h,{})}),(0,$.jsxs)(_,{children:[(0,$.jsx)(v,{value:`__none__`,children:i(`providerModelThinkingDefaultNone`)}),m.map(e=>(0,$.jsx)(v,{value:e,children:u(e)},e))]})]}),m.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-muted hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`remove`),children:(0,$.jsx)(O,{className:`h-3 w-3`})})]},e)})}),d?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelsRemoveSaveHint`)}):null]})}var rt=20,it=50,at=50;function ot(e){let{expanded:t,fetchedTotal:n,models:r,source:a,onExpandedChange:o,onAddModels:c}=e,[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(()=>new Set),p=(0,Y.useMemo)(()=>{let e=l.trim().toLowerCase();return e?r.filter(t=>t.toLowerCase().includes(e)):r},[r,l]),m=p.slice(0,at),h=(0,Y.useMemo)(()=>r.filter(e=>d.has(e)),[r,d]),g=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=e=>{e.length!==0&&(c(e),u(``),f(new Set))},v=a===`fetched`?`providerModelsFetchedSuggestionsSummary`:`providerModelsSuggestionsSummary`;return a===`fetched`&&r.length===0?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,role:`status`,children:[(0,$.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{children:i(`providerModelsFetchedAllConfigured`).replace(`{count}`,String(n))})]}):(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 p-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":t,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground`,onClick:()=>o(!t),children:[(0,$.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i(v).replace(`{count}`,String(r.length))}),(0,$.jsx)(ce,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${t?`rotate-90`:``}`})]}),r.length<=it?(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/10`,onClick:()=>_(r),children:i(`providerModelsSuggestionsAddAll`)}):null]}),t?(0,$.jsxs)(`div`,{className:`px-1 pb-1`,children:[r.length>rt?(0,$.jsxs)(`div`,{className:`relative px-2 pb-1 pt-1.5`,children:[(0,$.jsx)(w,{className:`pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(s,{value:l,onChange:e=>u(e.target.value),placeholder:i(`providerModelsSuggestionsSearchPlaceholder`),className:`h-8 rounded-lg pl-8 text-xs`})]}):null,(0,$.jsxs)(`div`,{className:`custom-scrollbar max-h-44 overflow-y-auto overscroll-contain`,children:[m.map(e=>(0,$.jsxs)(`label`,{className:`grid min-w-0 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-muted/70`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:d.has(e),onChange:()=>g(e),"aria-label":i(`providerModelsSuggestionSelect`).replace(`{model}`,e),className:`h-3.5 w-3.5 shrink-0 accent-primary`}),(0,$.jsx)(`span`,{className:`block min-w-0 truncate text-xs text-foreground`,title:e,children:e})]},e)),p.length===0?(0,$.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:i(`providerModelsSuggestionsSearchEmpty`)}):null]}),p.length>m.length?(0,$.jsx)(`p`,{className:`px-2 pt-1 text-[11px] text-muted-foreground`,children:i(`providerModelsSuggestionsShowing`).replace(`{visible}`,String(m.length)).replace(`{count}`,String(p.length))}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pt-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:i(`providerModelsSuggestionsSelected`).replace(`{count}`,String(h.length))}),(0,$.jsx)(`button`,{type:`button`,disabled:h.length===0,className:`shrink-0 rounded-md bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-primary/15 disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>_(h),children:i(`providerModelsSuggestionsAddSelected`)})]}),(0,$.jsx)(`p`,{className:`px-2 pb-1 pt-1 text-[11px] text-muted-foreground`,children:i(`providerModelsSuggestionsSaveHint`)})]}):null]})}function st({hasFetchedCatalog:e,hasSuggestionError:t,supportsModelDiscovery:n}){return!n||!t||e?null:(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,$.jsx)(x,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),i(`providerModelsSuggestionsFailed`)]})}function ct(e){let{providerName:t,providerModelAliases:n,models:r,modelConfig:a,modelDraft:o,showModelInput:c,onModelDraftChange:l,onShowModelInputChange:d,onAddModel:p,onModelsChange:m,supportsModelDiscovery:h,onDiscoverModels:g,isDiscoveringModels:_,fetchedModels:v,onRemoveModel:y,onToggleModelThinkingLevel:b,onSetModelThinkingDefault:x,onSetModelVision:S,thinkingLevels:C,formatThinkingLevelLabel:w}=e,[k,A]=(0,Y.useState)(!1),j=(0,Y.useRef)(null),{addSuggestedModels:M,hasSuggestionError:N,isCheckingSuggestions:P,suggestedModels:F,suggestionSource:I}=tt({providerName:t,models:r,aliases:n,fetchedModels:v,onModelsChange:m}),L=async()=>{await g()&&(A(!0),window.requestAnimationFrame(()=>{let e=j.current;e?.scrollIntoView?.({behavior:`smooth`,block:`center`}),e?.focus({preventScroll:!0})}))},R=v.length>0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(f,{className:`text-sm font-medium text-foreground`,children:i(`providerModelsTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h?(0,$.jsxs)(`button`,{type:`button`,onClick:L,disabled:_,className:`flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:text-primary/80 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsx)(D,{className:`h-3 w-3 ${_?`animate-spin`:``}`}),i(_?`providerModelsFetching`:`providerModelsFetch`)]}):null,c?null:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,$.jsx)(E,{className:`h-3 w-3`}),i(`providerAddModel`)]})]})]}),c?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(s,{value:o,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),p()),e.key===`Escape`&&(d(!1),l(``))},placeholder:i(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,$.jsx)(u,{type:`button`,size:`sm`,onClick:p,disabled:o.trim().length===0,children:i(`add`)}),(0,$.jsx)(u,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{d(!1),l(``)},children:(0,$.jsx)(O,{className:`h-4 w-4`})})]}):null,(0,$.jsx)(st,{hasFetchedCatalog:R,hasSuggestionError:N,supportsModelDiscovery:h}),h&&P&&!R?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/35 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`}),i(`providerModelsSuggestionsChecking`)]}):h&&(F.length>0||R)?(0,$.jsx)(`div`,{ref:j,tabIndex:-1,"aria-live":`polite`,className:`scroll-m-4 outline-none`,children:(0,$.jsx)(ot,{expanded:k,fetchedTotal:v.length,models:F,source:I,onExpandedChange:A,onAddModels:M})}):null,r.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-muted/35 px-4 py-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`providerModelsEmptyShort`)}),c?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:i(`providerAddFirstModel`)})]}):(0,$.jsx)(nt,{models:r,modelConfig:a,onModelsChange:m,onRemoveModel:y,onToggleModelThinkingLevel:b,onSetModelThinkingDefault:x,onSetModelVision:S,thinkingLevels:C,formatThinkingLevelLabel:w})]})}function lt({apiKeyRequired:e=!0,apiKeySet:t,className:n,enabled:r}){if(!r)return(0,$.jsx)(W,{status:`inactive`,label:i(`disabled`),className:n});let a=!e||t;return(0,$.jsx)(W,{status:a?`ready`:`setup`,label:i(a?`statusReady`:`statusSetup`),className:n})}function ut(e){let{context:t,language:n,providerTitle:r,providerDisplayName:a,apiKey:o,apiBase:c,extraHeaders:l,wireApi:d,models:p,modelConfig:m,modelDraft:h,showAdvanced:g,showModelInput:_,resolvedAuthMethodId:v,authSessionId:y,authStatusMessage:b,hasChanges:x,isDeletePending:S,isUpdatePending:C,connectivity:w,startPending:T,importPending:E,onProviderDisplayNameChange:D,onApiKeyChange:O,onApiBaseChange:k,onAuthMethodChange:j,onStartProviderAuth:M,onImportProviderAuthFromCli:N,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,onShowAdvancedChange:H,onWireApiChange:U,onExtraHeadersChange:ee,onDeleteProvider:W,onSubmit:te,onTestConnection:ne}=e,G=t.providerAuthMethods.find(e=>e.id===v);return(0,$.jsxs)(ge,{children:[(0,$.jsx)(pe,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:r}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:W,disabled:S,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:i(`providerDelete`),children:(0,$.jsx)(K,{className:`h-4 w-4`})}),(0,$.jsx)(lt,{enabled:t.currentEnabled,apiKeyRequired:t.resolvedProviderConfig.apiKeyRequired,apiKeySet:t.resolvedProviderConfig.apiKeySet})]})]})}),(0,$.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(_e,{className:`space-y-4 px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:i(`providerDisplayName`)}),(0,$.jsx)(s,{id:`providerDisplayName`,type:`text`,value:a,onChange:e=>D(e.target.value),placeholder:t.defaultDisplayName||i(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerDisplayNameHelpShort`)})]}),(0,$.jsx)(et,{apiKey:o,apiKeyRequired:t.resolvedProviderConfig.apiKeyRequired!==!1,apiKeySet:t.resolvedProviderConfig.apiKeySet,apiKeyPlaceholder:t.apiKeyHint?.placeholder??i(`enterApiKey`),providerAuth:t.providerAuth,providerAuthNote:t.providerAuth?.note?.[n]||t.providerAuth?.note?.en||t.providerAuth?.displayName||``,providerAuthMethodOptions:t.providerAuthMethodOptions,providerAuthMethodsCount:t.providerAuthMethods.length,selectedAuthMethodHint:G?.hint?.[n]||G?.hint?.en||``,shouldUseAuthMethodPills:t.shouldUseAuthMethodPills,resolvedAuthMethodId:v,onAuthMethodChange:j,onStartProviderAuth:M,onImportProviderAuthFromCli:N,startPending:T,importPending:E,authSessionId:y,authStatusMessage:b,onApiKeyChange:O}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(f,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:i(`apiBase`)}),(0,$.jsx)(s,{id:`apiBase`,type:`text`,value:c,onChange:e=>k(e.target.value),placeholder:t.defaultApiBase||t.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.apiBaseHelpText})]}),(0,$.jsx)(ct,{providerName:t.providerConfig?.providerId??``,providerModelAliases:t.providerModelAliases,models:p,modelConfig:m,modelDraft:h,showModelInput:_,onModelDraftChange:P,onShowModelInputChange:F,onAddModel:I,onModelsChange:L,supportsModelDiscovery:t.supportsModelDiscovery,onDiscoverModels:w.discoverModels,isDiscoveringModels:w.isDiscoveringModels,fetchedModels:w.fetchedModels,onRemoveModel:R,onToggleModelThinkingLevel:z,onSetModelThinkingDefault:B,onSetModelVision:V,thinkingLevels:A,formatThinkingLevelLabel:Fe},t.providerConfig?.providerId),(0,$.jsx)(Qe,{showAdvanced:g,onShowAdvancedChange:H,supportsWireApi:t.supportsWireApi,wireApiLabel:i(`wireApi`),wireApi:d,onWireApiChange:U,shouldUseWireApiPills:t.shouldUseWireApiPills,wireApiSelectOptions:t.wireApiSelectOptions,extraHeadersLabel:i(`extraHeaders`),extraHeaders:l,onExtraHeadersChange:ee})]}),(0,$.jsx)(ye,{children:(0,$.jsxs)(de,{align:`between`,children:[(0,$.jsxs)(u,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,disabled:w.isTestPending,children:[(0,$.jsx)(be,{className:`mr-1.5 h-3.5 w-3.5`}),w.isTestPending?i(`providerTestingConnection`):i(`providerTestConnection`)]}),(0,$.jsx)(u,{type:`submit`,size:`sm`,disabled:C||!x,children:i(C?`saving`:x?`save`:`unchanged`)})]})})]})]})}function dt({providerName:e,onProviderDeleted:t}){let{data:n}=H(),{data:r}=le(),{data:o}=te(),s=a(),c=(0,Y.useMemo)(()=>qe({providerName:e,providersView:n,templatesView:r,schema:o,language:s}),[s,e,n,o,r]);if(!e||!c.providerConfig)return(0,$.jsx)(ve,{children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:i(`providersSelectTitle`)}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:i(`providersSelectDescription`)})]})});let l=JSON.stringify({providerConfig:c.providerConfig,currentApiBase:c.currentApiBase,currentEditableModels:c.currentEditableModels,currentModelConfig:c.currentModelConfig,currentWireApi:c.currentWireApi,effectiveDisplayName:c.effectiveDisplayName,preferredAuthMethodId:c.preferredAuthMethodId});return(0,$.jsx)(ft,{providerName:e,onProviderDeleted:t,context:c,language:s},l)}function ft({providerName:e,onProviderDeleted:t,context:n,language:r}){let a=j(),o=oe(),{currentApiBase:s,currentEditableModels:c,currentHeaders:l,currentModelConfig:u,currentWireApi:d,defaultApiBase:f,effectiveDisplayName:p,providerAuth:m,providerAuthMethods:h,providerModelAliases:g,resolvedProviderConfig:_,preferredAuthMethodId:v,supportsWireApi:y}=n,[b,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(s),[w,T]=(0,Y.useState)(_.extraHeaders||null),[E,D]=(0,Y.useState)(d),[O,k]=(0,Y.useState)(c),[A,M]=(0,Y.useState)(u),[N,P]=(0,Y.useState)(``),[F,I]=(0,Y.useState)(p),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(v),U=Ye({providerName:e,apiKey:b,apiKeyRequired:_.apiKeyRequired!==!1,apiKeySet:_.apiKeySet,apiBase:S,extraHeaders:w,supportsWireApi:y,wireApi:E,models:O,providerModelAliases:g}),ee=F.trim()||p||e||i(`providersSelectPlaceholder`),W=(0,Y.useMemo)(()=>{if(!h.length)return``;let e=V.trim();return e&&h.some(t=>t.id===e)?e:v||h[0]?.id||``},[V,v,h]),{authSessionId:te,authStatusMessage:ne,importAuthFromCli:G,importPending:re,startAuth:ie,startPending:K}=Je({providerName:e,providerAuth:m,resolvedAuthMethodId:W}),ae=(0,Y.useMemo)(()=>je({providerName:e,apiKey:b,apiBase:S,currentApiBase:s,extraHeaders:w,currentHeaders:l,supportsWireApi:y,wireApi:E,currentWireApi:d,models:O,currentEditableModels:c,modelConfig:A,currentModelConfig:u,providerDisplayName:F,effectiveDisplayName:p}),[e,b,S,s,w,l,y,E,d,O,c,A,u,F,p]),q=e=>{k(e),M(t=>Oe(t,e))};return(0,$.jsx)(ut,{context:n,language:r,providerTitle:ee,providerDisplayName:F,apiKey:b,apiBase:S,extraHeaders:w,wireApi:E,models:O,modelConfig:A,modelDraft:N,showAdvanced:L,showModelInput:z,resolvedAuthMethodId:W,authSessionId:te,authStatusMessage:ne,hasChanges:ae,isDeletePending:o.isPending,isUpdatePending:a.isPending,connectivity:U,startPending:K,importPending:re,onProviderDisplayNameChange:I,onApiKeyChange:x,onApiBaseChange:C,onAuthMethodChange:H,onStartProviderAuth:ie,onImportProviderAuthFromCli:G,onModelDraftChange:P,onShowModelInputChange:B,onAddModel:()=>{let e=Re(O,N,g);q(e.models),P(e.draft)},onModelsChange:q,onRemoveModel:e=>{let t=Ve(O,A,e);k(t.models),M(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{M(n=>He(n,e,t))},onSetModelThinkingDefault:(e,t)=>{M(n=>Ue(n,e,t))},onSetModelVision:(e,t)=>{M(n=>We(n,e,t))},onShowAdvancedChange:R,onWireApiChange:D,onExtraHeadersChange:T,onDeleteProvider:async()=>{if(e&&window.confirm(i(`providerDeleteConfirm`)))try{await o.mutateAsync({provider:e}),t?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&a.mutate({provider:e,data:Me({providerName:e,apiKey:b,apiBase:S,currentApiBase:s,defaultApiBase:f,extraHeaders:w,currentHeaders:l,supportsWireApi:y,wireApi:E,currentWireApi:d,models:O,currentEditableModels:c,modelConfig:A,currentModelConfig:u,providerDisplayName:F,effectiveDisplayName:p})})},onTestConnection:U.testConnection})}function pt(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function mt(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function ht(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function gt(){let{isMobile:e}=ee(),{data:t}=H(),{data:n}=le(),a=ne(),o=oe(),c=j(),[d,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)([]),[b,x]=(0,Y.useState)(``),C=(0,Y.useMemo)(()=>mt(Object.values(t?.providers??{}),v),[t?.providers,v]),T=(0,Y.useMemo)(()=>n?.providerTemplates??[],[n?.providerTemplates]),D=(0,Y.useMemo)(()=>ht(T),[T]),O=(0,Y.useMemo)(()=>new Map(T.map(e=>[e.providerType,e])),[T]),k=(0,Y.useMemo)(()=>{let e=b.trim().toLowerCase();return C.filter(t=>{if(!e)return!0;let n=t.providerType?O.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[C,b,O]),A=(0,Y.useMemo)(()=>d&&k.some(e=>e.providerId===d)?d:e?null:k[0]?.providerId??null,[k,e,d]);return!t||!n?(0,$.jsx)(l,{title:i(`providersPageTitle`),description:i(`providersPageDescription`),layout:`split`,children:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:i(`providersLoading`)})}):(0,$.jsxs)(l,{title:i(`providersPageTitle`),description:i(`providersPageDescription`),layout:`split`,children:[(0,$.jsxs)(fe,{className:`md:min-h-0`,compactView:d?`detail`:`list`,onMobileBack:()=>f(null),mobileListLabel:i(`providersPageTitle`),children:[(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,$.jsxs)(R,{open:g,onOpenChange:_,children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsxs)(u,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:a.isPending,children:[(0,$.jsx)(E,{className:`mr-2 h-4 w-4`}),a.isPending?i(`saving`):i(`providerAdd`)]})}),(0,$.jsxs)(B,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,$.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:i(`providerTemplatePickerTitle`)}),(0,$.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-muted/45`,onClick:async()=>{try{let e=await a.mutateAsync({data:{providerType:null}});x(``),f(e.providerId),y(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),_(!1)}catch{}},children:[(0,$.jsx)(z,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:i(`providerAddCustom`)})]}),D.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-muted/40`,onClick:async()=>{try{let t=await a.mutateAsync({data:{providerType:e.providerType}});x(``),f(t.providerId),y(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),_(!1)}catch{}},children:[(0,$.jsx)(z,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,$.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,$.jsx)(s,{value:b,onChange:e=>x(e.target.value),placeholder:i(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,$.jsxs)(_e,{className:`space-y-2 p-3`,children:[k.map(e=>{let t=e.providerType?O.get(e.providerType):null,n=e.enabled!==!1,a=P(e),o=e.displayName?.trim()||t?.displayName||e.providerId,s=pt(e.apiBase||t?.defaultApiBase||``)||i(`providersDefaultDescription`);return(0,$.jsx)(`div`,{onClick:()=>f(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.providerId))},role:`button`,tabIndex:0,className:r(`group w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,A===e.providerId?`bg-background/95 text-foreground shadow-sm`:`bg-transparent text-muted-foreground hover:bg-background/65 hover:text-foreground`),children:(0,$.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,$.jsx)(z,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg bg-background/80`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,$.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:o}),(0,$.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,$.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[s,` · `,e.models?.length??0]})]})]}),(0,$.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(p,{checked:n,disabled:c.isPending,title:i(n?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{c.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(N,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-muted hover:text-foreground`,onClick:e=>e.stopPropagation(),title:i(`more`),children:(0,$.jsx)(U,{className:`h-4 w-4`})})}),(0,$.jsx)(B,{className:`w-40 p-1`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm text-red-600 hover:bg-red-50`,onClick:()=>h(e.providerId),children:[(0,$.jsx)(K,{className:`h-4 w-4`}),i(`providerDelete`)]})})]})]}),(0,$.jsx)(W,{status:n?a?`ready`:`setup`:`inactive`,label:i(n?a?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),k.length===0?(0,$.jsx)(me,{icon:ie,title:i(`providersNoMatch`)}):null]})]}),(0,$.jsx)(dt,{providerName:A??void 0,onProviderDeleted:e=>{y(t=>t.filter(t=>t!==e)),e===A&&f(null)}})]}),(0,$.jsx)(S,{open:!!m,onOpenChange:e=>{e||h(null)},title:i(`providerDelete`),description:m??void 0,confirmLabel:i(`delete`),variant:`destructive`,onCancel:()=>h(null),onConfirm:()=>{m&&o.mutateAsync({provider:m}).then(()=>{y(e=>e.filter(e=>e!==m)),m===A&&f(null),h(null)})}})]})}export{gt as ProvidersConfigPage};