mapigate 0.5.136 → 0.5.146

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 (102) hide show
  1. package/README.md +8 -8
  2. package/dist/cli/commands/logs.js +0 -1
  3. package/dist/core/adapters/anthropic/requestOpenAiToAnthropic.js +1 -1
  4. package/dist/core/adapters/helpers/toolCallRescue.js +1 -1
  5. package/dist/core/adapters/responsesAdapter.js +11 -0
  6. package/dist/core/capabilities/index.js +5 -4
  7. package/dist/core/capabilities/modelDictionary.js +1 -0
  8. package/dist/core/scanner/modelScanner.js +2 -1
  9. package/dist/core/scanner/payloadExtractor.js +1 -1
  10. package/dist/core/scanner/urlResolver.js +16 -0
  11. package/dist/core/tokenSaver/methods/rtk/autodetect.js +1 -1
  12. package/dist/core/tokenSaver/methods/rtk/filters/gitLog.js +1 -1
  13. package/dist/core/usage/pricing.js +98 -42
  14. package/dist/core/usage/tokenExtractor.js +59 -0
  15. package/dist/mitm/handlers/antigravity/config.js +22 -0
  16. package/dist/mitm/handlers/antigravity/modelInjector.js +2 -2
  17. package/dist/providers/catalog/coarena/index.js +3 -0
  18. package/dist/providers/catalog/coarena/metadata.js +104 -0
  19. package/dist/providers/catalog/coarena/provider.js +91 -0
  20. package/dist/providers/catalog/coarena/quota.js +119 -0
  21. package/dist/providers/catalog/iflow/provider.js +1 -1
  22. package/dist/providers/catalog/iteracompute/metadata.js +154 -13
  23. package/dist/providers/catalog/iteracompute/provider.js +111 -0
  24. package/dist/providers/catalog/opencode-go/responsesPayload.js +1 -1
  25. package/dist/providers/catalog/openrouter/metadata.js +1 -0
  26. package/dist/providers/core/base/baseProvider.js +5 -3
  27. package/dist/providers/generated/chunks/chunk1.js +2 -2
  28. package/dist/providers/generated/chunks/chunk2.js +2 -2
  29. package/dist/providers/generated/chunks/chunk3.js +2 -2
  30. package/dist/providers/generated/chunks/chunk4.js +2 -0
  31. package/dist/providers/generated/runtime/chunk1.js +2 -2
  32. package/dist/providers/generated/runtime/chunk2.js +2 -2
  33. package/dist/providers/generated/runtime/chunk3.js +2 -2
  34. package/dist/providers/generated/runtime/chunk4.js +2 -0
  35. package/dist/providers/runtime/antigravity/executor.js +2 -2
  36. package/dist/providers/runtime/antigravity/metadata.js +2 -2
  37. package/dist/providers/runtime/antigravity/models.js +9 -0
  38. package/dist/providers/runtime/antigravity/provider.js +2 -2
  39. package/dist/providers/runtime/antigravity/routes.js +2 -2
  40. package/dist/providers/runtime/antigravity/schema.js +1 -1
  41. package/dist/providers/runtime/antigravity/types.js +10 -2
  42. package/dist/providers/runtime/gemini/provider.js +77 -0
  43. package/dist/providers/runtime/gemini-cli/provider.js +2 -2
  44. package/dist/providers/runtime/github/routes.js +1 -1
  45. package/dist/providers/runtime/grok/provider.js +1 -1
  46. package/dist/providers/runtime/kiro/provider.js +1 -1
  47. package/dist/providers/runtime/minimax/routes.js +0 -1
  48. package/dist/providers/runtime/opencode/tools.js +1 -1
  49. package/dist/providers/runtime/trae/index.js +1 -0
  50. package/dist/providers/runtime/trae/metadata.js +1 -0
  51. package/dist/providers/runtime/trae/provider.js +7 -0
  52. package/dist/providers/runtime/trae/quota.js +99 -0
  53. package/dist/providers/runtime/windsurf/routes.js +0 -2
  54. package/dist/providers/runtime/xkiro/quota.js +4 -1
  55. package/dist/providers/runtime/zed/metadata.js +1 -1
  56. package/dist/providers/runtime/zed/models.js +68 -8
  57. package/dist/providers/runtime/zed/provider.js +60 -15
  58. package/dist/providers/runtime/zed/quota.js +69 -12
  59. package/dist/providers/runtime/zed/routes.js +7 -0
  60. package/dist/server/proxy/executorHelpers.js +1 -1
  61. package/dist/server/proxy/index.js +1 -1
  62. package/dist/server/proxy/pipeline.js +12 -6
  63. package/dist/server/proxy/responseHandlers.js +2 -18
  64. package/dist/server/proxy/singleModelExecutor.js +1 -1
  65. package/dist/server/proxy/streaming/sseStreamer.js +3 -10
  66. package/dist/server/routes/apiMitm.js +1 -1
  67. package/dist/server/routes/apiModels.js +17 -12
  68. package/dist/server/utils/consoleLogBuffer.js +3 -3
  69. package/dist/shared/constants/index.js +2 -2
  70. package/dist/shared/constants/quotaOrder.js +5 -0
  71. package/dist/shared/logger.js +2 -2
  72. package/dist/storage/repositories/logRepo.js +3 -23
  73. package/dist/storage/repositories/requestDetailsRepo.js +1 -1
  74. package/dist/storage/repositories/usageRepo.js +136 -74
  75. package/dist/web/assets/{CliToolsTab-CkzwuwaC.js → CliToolsTab-BYO-wJ7y.js} +1 -1
  76. package/dist/web/assets/CombosTab-CujUAbYQ.js +1 -0
  77. package/dist/web/assets/{ConfirmModal-DGvcf0gB.js → ConfirmModal-BS3mAUd5.js} +1 -1
  78. package/dist/web/assets/{ConsoleLogTab-84Ens8T5.js → ConsoleLogTab-CSgZxPGW.js} +1 -1
  79. package/dist/web/assets/{EditAccountModal-D-_omvev.js → EditAccountModal-BhPOk3Ya.js} +1 -1
  80. package/dist/web/assets/{EndpointTab-7nBfEdYE.js → EndpointTab-BRVjAng2.js} +1 -1
  81. package/dist/web/assets/{MitmTab-CqS6mXHZ.js → MitmTab-ZOoWyRnb.js} +5 -5
  82. package/dist/web/assets/{ModelAutocompleteInput-B9syrV1O.js → ModelAutocompleteInput-DJkxW2yD.js} +1 -1
  83. package/dist/web/assets/{ProviderDetailPage-DGZceQ2d.js → ProviderDetailPage-CnWjM-0J.js} +2 -2
  84. package/dist/web/assets/ProvidersTab-BFdg0gXr.js +1 -0
  85. package/dist/web/assets/QuotaTab-DXg3adeS.js +1 -0
  86. package/dist/web/assets/{SettingsTab-4c0ksNJa.js → SettingsTab-DoYGKtDn.js} +1 -1
  87. package/dist/web/assets/UsageTab-O6OK0i38.js +1 -0
  88. package/dist/web/assets/index-5TzViNxR.js +2 -0
  89. package/dist/web/assets/metadataRegistry-W75_wn57.js +1 -0
  90. package/dist/web/assets/providers/coarena/icon.png +0 -0
  91. package/dist/web/assets/providers/coarena/icon.svg +3 -0
  92. package/dist/web/assets/providers/openrouter/icon.png +0 -0
  93. package/dist/web/assets/{providersData-DkVCRBsJ.js → providersData-BI_7MaUL.js} +1 -1
  94. package/dist/web/index.html +1 -1
  95. package/package.json +9 -1
  96. package/dist/web/assets/CombosTab-C5RzRwwr.js +0 -1
  97. package/dist/web/assets/ProvidersTab-CiYbqRou.js +0 -1
  98. package/dist/web/assets/QuotaTab-DFr0DWAU.js +0 -1
  99. package/dist/web/assets/UsageTab-BQcPmvtQ.js +0 -1
  100. package/dist/web/assets/index-C4NTQZ40.js +0 -2
  101. package/dist/web/assets/metadataRegistry-B91sal4r.js +0 -1
  102. package/dist/web/assets/providers/openrouter/openrouter.png +0 -0
@@ -1,14 +1,14 @@
1
- import{r as n,j as e}from"./vendor-BcOI2aZ9.js";import{u as kt,D as Ct,d as Mt,P as Ge,e as Tt}from"./index-C4NTQZ40.js";import{M as We}from"./ModelAutocompleteInput-B9syrV1O.js";import{r as Je}from"./metadataRegistry-B91sal4r.js";import{T as Bt}from"./ToolIcon-Cp4gSgFt.js";import"./lucide-Cc35htxl.js";const Ne={},Et=({toolId:r="kiro",value:u,onChange:g,onEnter:b,placeholder:N="Select or type source model ID...",className:v="",autoFocus:p=!1,disabled:w=!1})=>{const f=(r||"kiro").toLowerCase(),[j,c]=n.useState([]),[h,y]=n.useState(!1),[S,E]=n.useState(-1),[ie,D]=n.useState("bottom"),C=n.useRef(null),I=n.useRef(null);n.useEffect(()=>{if(h&&C.current){const i=C.current.getBoundingClientRect(),m=240,M=window.innerHeight-i.bottom,O=i.top;M<m&&O>M?D("top"):D("bottom")}},[h]),n.useEffect(()=>{let i=!0;if(Ne[f]){c(Ne[f]);return}return fetch(`/api/mitm/mappings/source-models/${encodeURIComponent(f)}`).then(m=>{if(!m.ok)throw new Error("Failed to load source models");return m.json()}).then(m=>{i&&Array.isArray(m)&&(Ne[f]=m,c(m))}).catch(()=>{}),()=>{i=!1}},[f]),n.useEffect(()=>{const i=m=>{C.current&&!C.current.contains(m.target)&&y(!1)};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const x=n.useMemo(()=>{const i=(u||"").trim().toLowerCase();return i?j.filter(m=>m.id.toLowerCase().includes(i)||m.name.toLowerCase().includes(i)):j},[j,u]);n.useEffect(()=>{E(x.length>0?0:-1)},[x]),n.useEffect(()=>{if(h&&S>=0&&I.current){const i=I.current.children[S];i&&i.scrollIntoView({block:"nearest"})}},[S,h]);const z=i=>{g(i),y(!1)},oe=i=>{i.key==="ArrowDown"?(i.preventDefault(),h?x.length>0&&E(m=>(m+1)%x.length):y(!0)):i.key==="ArrowUp"?(i.preventDefault(),h&&x.length>0&&E(m=>(m-1+x.length)%x.length)):i.key==="Enter"?h&&S>=0&&S<x.length?(i.preventDefault(),z(x[S].id)):b&&(i.preventDefault(),b()):i.key==="Escape"&&y(!1)};return e.jsxs("div",{ref:C,className:"relative w-full",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{type:"text",value:u,onChange:i=>{g(i.target.value),h||y(!0)},onFocus:()=>y(!0),onKeyDown:oe,placeholder:N,disabled:w,autoFocus:p,className:v||"w-full bg-[#0A0D14] border border-[#1E293B] rounded-xl px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500 placeholder:text-slate-600"}),e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>y(i=>!i),className:"absolute right-2 text-slate-500 hover:text-slate-300 p-0.5 rounded cursor-pointer",title:"Toggle model suggestions",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:h?"arrow_drop_up":"arrow_drop_down"})})]}),h&&x.length>0&&e.jsx("div",{ref:I,className:`absolute left-0 right-0 z-50 max-h-56 overflow-y-auto rounded-xl border border-[#1E293B] bg-[#0A0D14] shadow-2xl py-1 ${ie==="top"?"bottom-full mb-1":"top-full mt-1"}`,children:x.map((i,m)=>{const M=m===S,O=i.category==="native";return e.jsxs("div",{onClick:()=>z(i.id),onMouseEnter:()=>E(m),className:`px-3 py-2 flex items-center justify-between text-xs cursor-pointer transition-colors ${M?"bg-blue-600/20 text-white":"text-slate-300 hover:bg-white/5"}`,children:[e.jsxs("div",{className:"flex flex-col min-w-0 pr-2",children:[e.jsx("span",{className:"font-mono font-medium text-slate-100 truncate",children:i.id}),i.name&&i.name!==i.id&&e.jsx("span",{className:"text-[10.5px] text-slate-400 font-sans truncate",children:i.name})]}),e.jsx("div",{className:"flex-shrink-0",children:O?e.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/15 border border-cyan-500/30 text-[9.5px] font-mono text-cyan-300 uppercase tracking-wider font-semibold",children:[f," native"]}):e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-purple-500/15 border border-purple-500/30 text-[9.5px] font-mono text-purple-300 uppercase tracking-wider font-semibold",children:"Standard"})})]},`${i.category}-${i.id}`)})})]})},At={id:"antigravity",name:"Antigravity IDE",image:"/assets/providers/antigravity/icon.png",desc:"Intercept Google Antigravity IDE requests via MITM proxy",hosts:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],urlPatterns:[":generateContent",":streamGenerateContent",":fetchAvailableModels","/v1internal:fetchAvailableModels"],defaultHost:`127.0.0.1 daily-cloudcode-pa.googleapis.com
2
- 127.0.0.1 cloudcode-pa.googleapis.com`,hostRewrite:{"cloudcode-pa.googleapis.com":"daily-cloudcode-pa.googleapis.com"},matchesHost:r=>r.includes("cloudcode-pa.googleapis.com"),isModelListRequest:r=>(r.url||"").toLowerCase().includes("fetchavailablemodels"),modelSynonyms:{"gemini-default":"gemini-3.8-flash-medium","gemini-3.5-flash-high":"gemini-3.8-flash-high","gemini-3.5-flash-medium":"gemini-3.8-flash-medium","gemini-3.5-flash-low":"gemini-3.8-flash-low","gemini-3.5-flash-extra-low":"gemini-3.8-flash-low","gemini-3.8-flash":"gemini-3.8-flash-medium","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-3.7-flash-high":"gemini-3.7-flash-high","gemini-3.7-flash-medium":"gemini-3.7-flash-medium","gemini-3.7-flash-low":"gemini-3.7-flash-low","gemini-3.6-flash-high":"gemini-3.6-flash-high","gemini-3.6-flash-medium":"gemini-3.6-flash-medium","gemini-3.6-flash-low":"gemini-3.6-flash-low","gemini-3.1-pro-high":"gemini-pro-agent","gemini-3-pro-high":"gemini-pro-agent","gemini-3-pro-low":"gemini-3.1-pro-low","claude-sonnet-5-5-high":"claude-sonnet-5-5-high","claude-sonnet-5-5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5-5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5":"claude-sonnet-5-5","claude-sonnet-5.5":"claude-sonnet-5-5","claude-sonnet-5.5-high":"claude-sonnet-5-5-high","claude-sonnet-5.5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5.5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-sonnet-5.5-thinking":"claude-sonnet-5-5","claude-opus-5-5-high":"claude-opus-5-5-high","claude-opus-5-5-medium":"claude-opus-5-5-medium","claude-opus-5-5-low":"claude-opus-5-5-low","claude-opus-5-5":"claude-opus-5-5","claude-opus-5.5":"claude-opus-5-5","claude-opus-5.5-high":"claude-opus-5-5-high","claude-opus-5.5-medium":"claude-opus-5-5-medium","claude-opus-5.5-low":"claude-opus-5-5-low","claude-opus-5-5-thinking":"claude-opus-5-5","claude-opus-5.5-thinking":"claude-opus-5-5","claude-sonnet-4.6":"claude-sonnet-4-6","claude-opus-4.6":"claude-opus-4-6-thinking","claude-opus-4.6-thinking":"claude-opus-4-6-thinking","gemini-4-argon":"gemini-4-argon-medium","gemini-4-argon-high":"gemini-4-argon-high","gemini-4-argon-medium":"gemini-4-argon-medium","gemini-4-argon-low":"gemini-4-argon-low"},modelPatterns:[{match:/flash.*extra.*low|extra.*low.*flash|flash.*low|low.*flash/i,alias:"gemini-3.8-flash-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.8-flash-medium"},{match:/flash.*agent|agent.*flash|flash/i,alias:"gemini-3.8-flash-high"},{match:/pro.*low|low.*pro/i,alias:"gemini-3.1-pro-low"},{match:/gemini.*pro|pro.*gemini/i,alias:"gemini-pro-agent"},{match:/opus.*5[.-]5.*high|5[.-]5.*opus.*high/i,alias:"claude-opus-5-5-high"},{match:/opus.*5[.-]5.*medium|5[.-]5.*opus.*medium/i,alias:"claude-opus-5-5-medium"},{match:/opus.*5[.-]5.*low|5[.-]5.*opus.*low/i,alias:"claude-opus-5-5-low"},{match:/sonnet.*5[.-]5.*high|5[.-]5.*sonnet.*high/i,alias:"claude-sonnet-5-5-high"},{match:/sonnet.*5[.-]5.*medium|5[.-]5.*sonnet.*medium/i,alias:"claude-sonnet-5-5-medium"},{match:/sonnet.*5[.-]5.*low|5[.-]5.*sonnet.*low/i,alias:"claude-sonnet-5-5-low"},{match:/opus.*5[.-]5|5[.-]5.*opus/i,alias:"claude-opus-5-5"},{match:/sonnet.*5[.-]5|5[.-]5.*sonnet/i,alias:"claude-sonnet-5-5"},{match:/opus/i,alias:"claude-opus-4-6-thinking"},{match:/sonnet|claude/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"},{match:/argon.*high|gemini.*4.*high/i,alias:"gemini-4-argon-high"},{match:/argon.*low|gemini.*4.*low/i,alias:"gemini-4-argon-low"},{match:/argon|gemini.*4/i,alias:"gemini-4-argon-medium"}],modelNoMap:[/^tab[_-]/i],defaultModels:["gemini-4-argon","gemini-4-argon-high","gemini-4-argon-medium","gemini-4-argon-low","gemini-3.8-flash-high","gemini-3.8-flash-medium","gemini-3.8-flash-low","gemini-3.7-flash-high","gemini-3.7-flash-medium","gemini-3.7-flash-low","gemini-3.6-flash-high","gemini-3.6-flash-medium","gemini-3.6-flash-low","gemini-3.1-pro-high","gemini-3.1-pro-low","gemini-3.1-pro-high-legacy","claude-sonnet-5.5-thinking","claude-sonnet-5.5-high","claude-sonnet-5.5-medium","claude-sonnet-5.5-low","claude-opus-5.5-thinking","claude-opus-5.5-high","claude-opus-5.5-medium","claude-opus-5.5-low","claude-sonnet-4.6-thinking","claude-opus-4.6-thinking","gpt-oss-120b-medium"]},Dt={id:"copilot",name:"GitHub Copilot",image:"/assets/providers/github/icon.png",desc:"Intercept GitHub Copilot requests in VS Code via MITM proxy",hosts:["api.githubcopilot.com","copilot-proxy.githubusercontent.com","api.individual.githubcopilot.com","api.business.githubcopilot.com","api.enterprise.githubcopilot.com"],urlPatterns:["/chat/completions","/v1/messages","/responses","/models"],defaultHost:`127.0.0.1 api.githubcopilot.com
1
+ import{r as n,j as e}from"./vendor-BcOI2aZ9.js";import{u as kt,D as Ct,d as Mt,P as Ge,e as Tt}from"./index-5TzViNxR.js";import{M as We}from"./ModelAutocompleteInput-DJkxW2yD.js";import{r as Je}from"./metadataRegistry-W75_wn57.js";import{T as Bt}from"./ToolIcon-Cp4gSgFt.js";import"./lucide-Cc35htxl.js";const Ne={},Et=({toolId:r="kiro",value:u,onChange:g,onEnter:b,placeholder:N="Select or type source model ID...",className:w="",autoFocus:p=!1,disabled:v=!1})=>{const f=(r||"kiro").toLowerCase(),[j,c]=n.useState([]),[h,y]=n.useState(!1),[S,E]=n.useState(-1),[oe,D]=n.useState("bottom"),C=n.useRef(null),I=n.useRef(null);n.useEffect(()=>{if(h&&C.current){const o=C.current.getBoundingClientRect(),m=240,M=window.innerHeight-o.bottom,O=o.top;M<m&&O>M?D("top"):D("bottom")}},[h]),n.useEffect(()=>{let o=!0;if(Ne[f]){c(Ne[f]);return}return fetch(`/api/mitm/mappings/source-models/${encodeURIComponent(f)}`).then(m=>{if(!m.ok)throw new Error("Failed to load source models");return m.json()}).then(m=>{o&&Array.isArray(m)&&(Ne[f]=m,c(m))}).catch(()=>{}),()=>{o=!1}},[f]),n.useEffect(()=>{const o=m=>{C.current&&!C.current.contains(m.target)&&y(!1)};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[]);const x=n.useMemo(()=>{const o=(u||"").trim().toLowerCase();return o?j.filter(m=>m.id.toLowerCase().includes(o)||m.name.toLowerCase().includes(o)):j},[j,u]);n.useEffect(()=>{E(x.length>0?0:-1)},[x]),n.useEffect(()=>{if(h&&S>=0&&I.current){const o=I.current.children[S];o&&o.scrollIntoView({block:"nearest"})}},[S,h]);const z=o=>{g(o),y(!1)},le=o=>{o.key==="ArrowDown"?(o.preventDefault(),h?x.length>0&&E(m=>(m+1)%x.length):y(!0)):o.key==="ArrowUp"?(o.preventDefault(),h&&x.length>0&&E(m=>(m-1+x.length)%x.length)):o.key==="Enter"?h&&S>=0&&S<x.length?(o.preventDefault(),z(x[S].id)):b&&(o.preventDefault(),b()):o.key==="Escape"&&y(!1)};return e.jsxs("div",{ref:C,className:"relative w-full",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{type:"text",value:u,onChange:o=>{g(o.target.value),h||y(!0)},onFocus:()=>y(!0),onKeyDown:le,placeholder:N,disabled:v,autoFocus:p,className:w||"w-full bg-[#0A0D14] border border-[#1E293B] rounded-xl px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500 placeholder:text-slate-600"}),e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>y(o=>!o),className:"absolute right-2 text-slate-500 hover:text-slate-300 p-0.5 rounded cursor-pointer",title:"Toggle model suggestions",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:h?"arrow_drop_up":"arrow_drop_down"})})]}),h&&x.length>0&&e.jsx("div",{ref:I,className:`absolute left-0 right-0 z-50 max-h-56 overflow-y-auto rounded-xl border border-[#1E293B] bg-[#0A0D14] shadow-2xl py-1 ${oe==="top"?"bottom-full mb-1":"top-full mt-1"}`,children:x.map((o,m)=>{const M=m===S,O=o.category==="native";return e.jsxs("div",{onClick:()=>z(o.id),onMouseEnter:()=>E(m),className:`px-3 py-2 flex items-center justify-between text-xs cursor-pointer transition-colors ${M?"bg-blue-600/20 text-white":"text-slate-300 hover:bg-white/5"}`,children:[e.jsxs("div",{className:"flex flex-col min-w-0 pr-2",children:[e.jsx("span",{className:"font-mono font-medium text-slate-100 truncate",children:o.id}),o.name&&o.name!==o.id&&e.jsx("span",{className:"text-[10.5px] text-slate-400 font-sans truncate",children:o.name})]}),e.jsx("div",{className:"flex-shrink-0",children:O?e.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/15 border border-cyan-500/30 text-[9.5px] font-mono text-cyan-300 uppercase tracking-wider font-semibold",children:[f," native"]}):e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-purple-500/15 border border-purple-500/30 text-[9.5px] font-mono text-purple-300 uppercase tracking-wider font-semibold",children:"Standard"})})]},`${o.category}-${o.id}`)})})]})},At={id:"antigravity",name:"Antigravity IDE",image:"/assets/providers/antigravity/icon.png",desc:"Intercept Google Antigravity IDE requests via MITM proxy",hosts:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],urlPatterns:[":generateContent",":streamGenerateContent",":fetchAvailableModels","/v1internal:fetchAvailableModels"],defaultHost:`127.0.0.1 daily-cloudcode-pa.googleapis.com
2
+ 127.0.0.1 cloudcode-pa.googleapis.com`,hostRewrite:{"cloudcode-pa.googleapis.com":"daily-cloudcode-pa.googleapis.com"},matchesHost:r=>r.includes("cloudcode-pa.googleapis.com"),isModelListRequest:r=>(r.url||"").toLowerCase().includes("fetchavailablemodels"),modelSynonyms:{"gemini-default":"gemini-3.8-flash-medium","gemini-3.5-flash-high":"gemini-3.8-flash-high","gemini-3.5-flash-medium":"gemini-3.8-flash-medium","gemini-3.5-flash-low":"gemini-3.8-flash-low","gemini-3.5-flash-extra-low":"gemini-3.8-flash-low","gemini-3.8-flash":"gemini-3.8-flash-medium","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-3.7-flash-high":"gemini-3.7-flash-high","gemini-3.7-flash-medium":"gemini-3.7-flash-medium","gemini-3.7-flash-low":"gemini-3.7-flash-low","gemini-3.6-flash-high":"gemini-3.6-flash-high","gemini-3.6-flash-medium":"gemini-3.6-flash-medium","gemini-3.6-flash-low":"gemini-3.6-flash-low","gemini-3.1-pro-high":"gemini-pro-agent","gemini-3-pro-high":"gemini-pro-agent","gemini-3-pro-low":"gemini-3.1-pro-low","claude-sonnet-5-5-high":"claude-sonnet-5-5-high","claude-sonnet-5-5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5-5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5":"claude-sonnet-5-5","claude-sonnet-5.5":"claude-sonnet-5-5","claude-sonnet-5.5-high":"claude-sonnet-5-5-high","claude-sonnet-5.5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5.5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-sonnet-5.5-thinking":"claude-sonnet-5-5","claude-opus-5-5-high":"claude-opus-5-5-high","claude-opus-5-5-medium":"claude-opus-5-5-medium","claude-opus-5-5-low":"claude-opus-5-5-low","claude-opus-5-5":"claude-opus-5-5","claude-opus-5.5":"claude-opus-5-5","claude-opus-5.5-high":"claude-opus-5-5-high","claude-opus-5.5-medium":"claude-opus-5-5-medium","claude-opus-5.5-low":"claude-opus-5-5-low","claude-opus-5-5-thinking":"claude-opus-5-5","claude-opus-5.5-thinking":"claude-opus-5-5","claude-sonnet-4.6":"claude-sonnet-4-6","claude-opus-4.6":"claude-opus-4-6-thinking","claude-opus-4.6-thinking":"claude-opus-4-6-thinking","gemini-4-argon":"gemini-4-argon-medium","gemini-4-argon-high":"gemini-4-argon-high","gemini-4-argon-medium":"gemini-4-argon-medium","gemini-4-argon-low":"gemini-4-argon-low","gemini-4-carbon":"gemini-4-carbon-medium","gemini-4-carbon-high":"gemini-4-carbon-high","gemini-4-carbon-medium":"gemini-4-carbon-medium","gemini-4-carbon-low":"gemini-4-carbon-low","gemini-4-hydrogen":"gemini-4-hydrogen-medium","gemini-4-hydrogen-high":"gemini-4-hydrogen-high","gemini-4-hydrogen-medium":"gemini-4-hydrogen-medium","gemini-4-hydrogen-low":"gemini-4-hydrogen-low"},modelPatterns:[{match:/flash.*extra.*low|extra.*low.*flash|flash.*low|low.*flash/i,alias:"gemini-3.8-flash-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.8-flash-medium"},{match:/flash.*agent|agent.*flash|flash/i,alias:"gemini-3.8-flash-high"},{match:/pro.*low|low.*pro/i,alias:"gemini-3.1-pro-low"},{match:/gemini.*pro|pro.*gemini/i,alias:"gemini-pro-agent"},{match:/opus.*5[.-]5.*high|5[.-]5.*opus.*high/i,alias:"claude-opus-5-5-high"},{match:/opus.*5[.-]5.*medium|5[.-]5.*opus.*medium/i,alias:"claude-opus-5-5-medium"},{match:/opus.*5[.-]5.*low|5[.-]5.*opus.*low/i,alias:"claude-opus-5-5-low"},{match:/sonnet.*5[.-]5.*high|5[.-]5.*sonnet.*high/i,alias:"claude-sonnet-5-5-high"},{match:/sonnet.*5[.-]5.*medium|5[.-]5.*sonnet.*medium/i,alias:"claude-sonnet-5-5-medium"},{match:/sonnet.*5[.-]5.*low|5[.-]5.*sonnet.*low/i,alias:"claude-sonnet-5-5-low"},{match:/opus.*5[.-]5|5[.-]5.*opus/i,alias:"claude-opus-5-5"},{match:/sonnet.*5[.-]5|5[.-]5.*sonnet/i,alias:"claude-sonnet-5-5"},{match:/opus/i,alias:"claude-opus-4-6-thinking"},{match:/sonnet|claude/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"},{match:/carbon.*high/i,alias:"gemini-4-carbon-high"},{match:/carbon.*low/i,alias:"gemini-4-carbon-low"},{match:/carbon/i,alias:"gemini-4-carbon-medium"},{match:/hydrogen.*high/i,alias:"gemini-4-hydrogen-high"},{match:/hydrogen.*low/i,alias:"gemini-4-hydrogen-low"},{match:/hydrogen/i,alias:"gemini-4-hydrogen-medium"},{match:/argon.*high|gemini.*4.*high/i,alias:"gemini-4-argon-high"},{match:/argon.*low|gemini.*4.*low/i,alias:"gemini-4-argon-low"},{match:/argon|gemini.*4/i,alias:"gemini-4-argon-medium"}],modelNoMap:[/^tab[_-]/i],defaultModels:["gemini-4-argon","gemini-4-argon-high","gemini-4-argon-medium","gemini-4-argon-low","gemini-4-carbon","gemini-4-carbon-high","gemini-4-carbon-medium","gemini-4-carbon-low","gemini-4-hydrogen","gemini-4-hydrogen-high","gemini-4-hydrogen-medium","gemini-4-hydrogen-low","gemini-3.8-flash-high","gemini-3.8-flash-medium","gemini-3.8-flash-low","gemini-3.7-flash-high","gemini-3.7-flash-medium","gemini-3.7-flash-low","gemini-3.6-flash-high","gemini-3.6-flash-medium","gemini-3.6-flash-low","gemini-3.1-pro-high","gemini-3.1-pro-low","gemini-3.1-pro-high-legacy","claude-sonnet-5.5-thinking","claude-sonnet-5.5-high","claude-sonnet-5.5-medium","claude-sonnet-5.5-low","claude-opus-5.5-thinking","claude-opus-5.5-high","claude-opus-5.5-medium","claude-opus-5.5-low","claude-sonnet-4.6-thinking","claude-opus-4.6-thinking","gpt-oss-120b-medium"]},Dt={id:"copilot",name:"GitHub Copilot",image:"/assets/providers/github/icon.png",desc:"Intercept GitHub Copilot requests in VS Code via MITM proxy",hosts:["api.githubcopilot.com","copilot-proxy.githubusercontent.com","api.individual.githubcopilot.com","api.business.githubcopilot.com","api.enterprise.githubcopilot.com"],urlPatterns:["/chat/completions","/v1/messages","/responses","/models"],defaultHost:`127.0.0.1 api.githubcopilot.com
3
3
  127.0.0.1 copilot-proxy.githubusercontent.com
4
4
  127.0.0.1 api.individual.githubcopilot.com
5
5
  127.0.0.1 api.business.githubcopilot.com
6
6
  127.0.0.1 api.enterprise.githubcopilot.com`,matchesHost:r=>r.includes("githubcopilot.com")||r.includes("copilot-proxy.githubusercontent.com"),isModelListRequest:r=>{const u=(r.url||"").toLowerCase().split("?")[0];return u==="/models"||u==="/v1/models"||u.endsWith("/models")},defaultModels:["auto","claude-haiku-4.5","claude-haiku-5.5","claude-sonnet-4","claude-sonnet-4.6","claude-sonnet-5","claude-sonnet-5.5","claude-opus-4.8","claude-opus-5","claude-opus-5.5","gpt-5-mini","gpt-5.2","gpt-5.2-codex","gpt-5.3-codex","gpt-5.4","gpt-5.6-terra","gpt-5.6-luna","gpt-6-luna","gpt-6.1-terra","mai-code-1.1-flash","gemini-3.7-flash","gemini-3.8-flash","grok-4.5","grok-4.6","grok-4.7","kimi-k3"]},It={id:"kiro",name:"Kiro IDE",image:"/assets/providers/kiro/icon.png",desc:"Intercept Amazon Kiro IDE requests via MITM proxy",iconBg:"#9046ff",hosts:["management.us-east-1.kiro.dev","runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],urlPatterns:["/generateAssistantResponse","/responses","/List-Available-Models","/list-available-models","/ListAvailableModels","/listavailablemodels"],defaultHost:`127.0.0.1 management.us-east-1.kiro.dev
7
7
  127.0.0.1 runtime.us-east-1.kiro.dev
8
8
  127.0.0.1 q.us-east-1.amazonaws.com
9
- 127.0.0.1 codewhisperer.us-east-1.amazonaws.com`,matchesHost:r=>r.includes("kiro.dev")||r.includes("q.us-east-1.amazonaws.com")||r.includes("codewhisperer.us-east-1.amazonaws.com"),isChatRequest:r=>{var b;const u=(b=r.headers)==null?void 0:b["x-amz-target"],g=Array.isArray(u)?u[0]:String(u||"");return g.includes("GenerateAssistantResponse")||g.includes("CreateResponse")},isModelListRequest:r=>{var v;const u=(r.url||"").toLowerCase(),g=u.replace(/[-_]/g,"");if(g.includes("listavailablemodels")||g.includes("listmodels")||u.includes("list-available-models")||u.includes("listavailablemodels"))return!0;const b=(v=r.headers)==null?void 0:v["x-amz-target"],N=Array.isArray(b)?b[0]:String(b||"");return N.includes("ListAvailableModels")||N.includes("ListModels")},modelSynonyms:{"auto (kiro agent)":"auto","auto-(kiro-agent)":"auto","kiro-auto":"auto","claude-sonnet-4-5":"claude-sonnet-4.5","claude-haiku-4-5":"claude-haiku-4.5","claude-sonnet-5-5":"claude-sonnet-5","deepseek-3-2":"deepseek-3.2","minimax-m2-5":"minimax-m2.5","minimax-m2-1":"minimax-m2.1",glm5:"glm-5","qwen-3-coder-next":"qwen3-coder-next","qwen3-coder":"qwen3-coder-next"},modelPatterns:[{match:/auto.*kiro|kiro.*auto/i,alias:"auto"},{match:/claude.*sonnet.*4[.-]5/i,alias:"claude-sonnet-4.5"},{match:/claude.*haiku.*4[.-]5/i,alias:"claude-haiku-4.5"},{match:/claude.*sonnet.*4/i,alias:"claude-sonnet-4"},{match:/claude.*sonnet.*5/i,alias:"claude-sonnet-5"},{match:/deepseek.*3[.-]2/i,alias:"deepseek-3.2"},{match:/minimax.*2[.-]5/i,alias:"minimax-m2.5"},{match:/minimax.*2[.-]1/i,alias:"minimax-m2.1"},{match:/glm.*5/i,alias:"glm-5"},{match:/sol/i,alias:"gpt-5.6-sol"},{match:/terra/i,alias:"gpt-5.6-terra"},{match:/luna/i,alias:"gpt-5.6-luna"},{match:/qwen.*3.*coder/i,alias:"qwen3-coder-next"}],defaultModels:["auto","claude-opus-5.5","claude-opus-5","claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-opus-4.5","claude-sonnet-5.5","claude-sonnet-5","claude-sonnet-4.6","claude-sonnet-4.5","claude-sonnet-4","claude-haiku-5.5","claude-haiku-4.5","deepseek-3.2","minimax-m2.5","minimax-m2.1","kimi-k3","glm-5","simple-task","permission-classifier","gpt-5.6-sol","gpt-5.6-terra","gpt-5.6-luna","qwen3-coder-next"]},Ve=[At,Dt,It];function Pt(r,u="source",g="asc"){return[...r].sort((b,N)=>{if(u==="target"){const f=b.targetModel||"",j=N.targetModel||"";if(!f&&j)return 1;if(f&&!j)return-1;const c=f.localeCompare(j,void 0,{numeric:!0,sensitivity:"base"});if(c!==0)return g==="asc"?c:-c}const v=b.sourceModel.toLowerCase()==="auto",p=N.sourceModel.toLowerCase()==="auto";if(v&&!p)return g==="asc"?-1:1;if(!v&&p)return g==="asc"?1:-1;const w=b.sourceModel.localeCompare(N.sourceModel,void 0,{numeric:!0,sensitivity:"base"});return g==="asc"?w:-w})}const $t=()=>{const r=kt(t=>t.info),u=(r==null?void 0:r.port)||Ct,g=(r==null?void 0:r.host)||Mt,[b,N]=n.useState(""),v=b||`http://${g}:${u}`,[p,w]=n.useState(!0),[f,j]=n.useState(443),[c,h]=n.useState(null),[y,S]=n.useState(""),[E,ie]=n.useState(!1),[D,C]=n.useState(!1),[I,x]=n.useState(null),[z,oe]=n.useState(!0),[i,m]=n.useState(!1),[M,O]=n.useState(""),[re,Ye]=n.useState(""),[G,Qe]=n.useState({windows:'certutil -addstore -user "Root" "%USERPROFILE%\\.mapigate\\mitm\\rootCA.crt"',mac:"sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/.mapigate/mitm/rootCA.crt",linux:"sudo cp ~/.mapigate/mitm/rootCA.crt /usr/local/share/ca-certificates/mapigate-rootCA.crt && sudo update-ca-certificates"}),[P,ve]=n.useState(null),[we,Se]=n.useState(!1),[ke,Ce]=n.useState(!1),[W,T]=n.useState(null),[Me,H]=n.useState({antigravity:!1,kiro:!1,copilot:!1}),[R,J]=n.useState({antigravity:!1,kiro:!1,copilot:!1}),[Xe,Ze]=n.useState(null),et=n.useMemo(()=>[...Ve].sort((t,s)=>t.name.localeCompare(s.name)),[]),[Te,V]=n.useState({antigravity:`127.0.0.1 daily-cloudcode-pa.googleapis.com
9
+ 127.0.0.1 codewhisperer.us-east-1.amazonaws.com`,matchesHost:r=>r.includes("kiro.dev")||r.includes("q.us-east-1.amazonaws.com")||r.includes("codewhisperer.us-east-1.amazonaws.com"),isChatRequest:r=>{var b;const u=(b=r.headers)==null?void 0:b["x-amz-target"],g=Array.isArray(u)?u[0]:String(u||"");return g.includes("GenerateAssistantResponse")||g.includes("CreateResponse")},isModelListRequest:r=>{var w;const u=(r.url||"").toLowerCase(),g=u.replace(/[-_]/g,"");if(g.includes("listavailablemodels")||g.includes("listmodels")||u.includes("list-available-models")||u.includes("listavailablemodels"))return!0;const b=(w=r.headers)==null?void 0:w["x-amz-target"],N=Array.isArray(b)?b[0]:String(b||"");return N.includes("ListAvailableModels")||N.includes("ListModels")},modelSynonyms:{"auto (kiro agent)":"auto","auto-(kiro-agent)":"auto","kiro-auto":"auto","claude-sonnet-4-5":"claude-sonnet-4.5","claude-haiku-4-5":"claude-haiku-4.5","claude-sonnet-5-5":"claude-sonnet-5","deepseek-3-2":"deepseek-3.2","minimax-m2-5":"minimax-m2.5","minimax-m2-1":"minimax-m2.1",glm5:"glm-5","qwen-3-coder-next":"qwen3-coder-next","qwen3-coder":"qwen3-coder-next"},modelPatterns:[{match:/auto.*kiro|kiro.*auto/i,alias:"auto"},{match:/claude.*sonnet.*4[.-]5/i,alias:"claude-sonnet-4.5"},{match:/claude.*haiku.*4[.-]5/i,alias:"claude-haiku-4.5"},{match:/claude.*sonnet.*4/i,alias:"claude-sonnet-4"},{match:/claude.*sonnet.*5/i,alias:"claude-sonnet-5"},{match:/deepseek.*3[.-]2/i,alias:"deepseek-3.2"},{match:/minimax.*2[.-]5/i,alias:"minimax-m2.5"},{match:/minimax.*2[.-]1/i,alias:"minimax-m2.1"},{match:/glm.*5/i,alias:"glm-5"},{match:/sol/i,alias:"gpt-5.6-sol"},{match:/terra/i,alias:"gpt-5.6-terra"},{match:/luna/i,alias:"gpt-5.6-luna"},{match:/qwen.*3.*coder/i,alias:"qwen3-coder-next"}],defaultModels:["auto","claude-opus-5.5","claude-opus-5","claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-opus-4.5","claude-sonnet-5.5","claude-sonnet-5","claude-sonnet-4.6","claude-sonnet-4.5","claude-sonnet-4","claude-haiku-5.5","claude-haiku-4.5","deepseek-3.2","minimax-m2.5","minimax-m2.1","kimi-k3","glm-5","simple-task","permission-classifier","gpt-5.6-sol","gpt-5.6-terra","gpt-5.6-luna","qwen3-coder-next"]},Ve=[At,Dt,It];function Pt(r,u="source",g="asc"){return[...r].sort((b,N)=>{if(u==="target"){const f=b.targetModel||"",j=N.targetModel||"";if(!f&&j)return 1;if(f&&!j)return-1;const c=f.localeCompare(j,void 0,{numeric:!0,sensitivity:"base"});if(c!==0)return g==="asc"?c:-c}const w=b.sourceModel.toLowerCase()==="auto",p=N.sourceModel.toLowerCase()==="auto";if(w&&!p)return g==="asc"?-1:1;if(!w&&p)return g==="asc"?1:-1;const v=b.sourceModel.localeCompare(N.sourceModel,void 0,{numeric:!0,sensitivity:"base"});return g==="asc"?v:-v})}const $t=()=>{const r=kt(t=>t.info),u=(r==null?void 0:r.port)||Ct,g=(r==null?void 0:r.host)||Mt,[b,N]=n.useState(""),w=b||`http://${g}:${u}`,[p,v]=n.useState(!0),[f,j]=n.useState(443),[c,h]=n.useState(null),[y,S]=n.useState(""),[E,oe]=n.useState(!1),[D,C]=n.useState(!1),[I,x]=n.useState(null),[z,le]=n.useState(!0),[o,m]=n.useState(!1),[M,O]=n.useState(""),[re,Ye]=n.useState(""),[G,Qe]=n.useState({windows:'certutil -addstore -user "Root" "%USERPROFILE%\\.mapigate\\mitm\\rootCA.crt"',mac:"sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/.mapigate/mitm/rootCA.crt",linux:"sudo cp ~/.mapigate/mitm/rootCA.crt /usr/local/share/ca-certificates/mapigate-rootCA.crt && sudo update-ca-certificates"}),[P,we]=n.useState(null),[ve,Se]=n.useState(!1),[ke,Ce]=n.useState(!1),[W,T]=n.useState(null),[Me,H]=n.useState({antigravity:!1,kiro:!1,copilot:!1}),[R,J]=n.useState({antigravity:!1,kiro:!1,copilot:!1}),[Xe,Ze]=n.useState(null),et=n.useMemo(()=>[...Ve].sort((t,s)=>t.name.localeCompare(s.name)),[]),[Te,V]=n.useState({antigravity:`127.0.0.1 daily-cloudcode-pa.googleapis.com
10
10
  127.0.0.1 cloudcode-pa.googleapis.com`,kiro:`127.0.0.1 management.us-east-1.kiro.dev
11
11
  127.0.0.1 runtime.us-east-1.kiro.dev
12
12
  127.0.0.1 q.us-east-1.amazonaws.com
13
- 127.0.0.1 codewhisperer.us-east-1.amazonaws.com`,copilot:"127.0.0.1 api.individual.githubcopilot.com"}),[tt,ce]=n.useState({}),[Be,st]=n.useState({}),[at,Y]=n.useState({}),[nt,U]=n.useState({antigravity:[],kiro:[],copilot:[]}),[lt,it]=n.useState({}),[ot,Ee]=n.useState({}),[rt,de]=n.useState(null),[Q,me]=n.useState(null),[ue,X]=n.useState(""),[_,$]=n.useState(null),[pe,xe]=n.useState(""),[he,ge]=n.useState(""),[Ae,ct]=n.useState(new Set),[q,De]=n.useState(""),[K,Ie]=n.useState(""),[Pe,Re]=n.useState(!1),[_e,Le]=n.useState(!1),[Oe,He]=n.useState(!1),[Z,be]=n.useState(null),[ee,F]=n.useState(null),[te,dt]=n.useState([]),se=n.useMemo(()=>{const t=q.trim().toLowerCase();return t?!t.includes("127.0.0.1")&&!t.includes("localhost")&&!t.includes("0.0.0.0"):!1},[q]);n.useEffect(()=>{fetch("/api/combos").then(t=>t.ok?t.json():[]).then(t=>{const s=Array.isArray(t)?t:t.combos||[];ct(new Set(s.map(l=>(l.name||"").toLowerCase())))}).catch(()=>{})},[]);const L=(t,s)=>{navigator.clipboard.writeText(s),ve(t),setTimeout(()=>ve(null),2e3)},A=()=>{fetch("/api/mitm/status").then(t=>t.json()).then(t=>{w(!!t.running),t.port&&j(t.port),oe(!!t.certExists),m(!!t.certTrusted),t.certPath&&O(t.certPath),t.fingerprint&&Ye(t.fingerprint),t.routerBaseUrl&&N(t.routerBaseUrl),t.installCommands&&Qe(t.installCommands),t.dnsStatus&&H(s=>{var l,a,d;return{...s,antigravity:!!((l=t.dnsStatus)!=null&&l.antigravity),kiro:!!((a=t.dnsStatus)!=null&&a.kiro),copilot:!!((d=t.dnsStatus)!=null&&d.copilot)}}),t.augmentModels&&J(s=>({...s,...t.augmentModels})),Tt.getState().fetchStatus()}).catch(()=>{}),fetch("/api/mitm/router-target").then(t=>t.ok?t.json():null).then(t=>{t&&(De(t.baseUrl||""),Re(!!t.hasApiKey),t.isRemote&&t.baseUrl&&Ue())}).catch(()=>{})},Ue=()=>{fetch("/api/mitm/router-target/models").then(t=>t.ok?t.json():{models:[]}).then(t=>{const s=(t.models||[]).map(l=>({id:l.id,value:l.id,name:l.name||l.id,providerId:l.provider||"remote",providerName:l.provider||"Remote Gateway",hasConnectedAccount:!0,accountsCount:1,caps:{vision:!0,reasoning:!0,audio:!1},contextLength:128e3}));dt(s)}).catch(()=>{})},mt=async()=>{Le(!0),be(null);try{const s=await(await fetch("/api/mitm/router-target/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q.trim(),apiKey:K.trim()||void 0})})).json();be({success:!!s.success,message:s.message||(s.success?"Connection successful":"Connection failed")}),s.success&&se&&Ue()}catch(t){be({success:!1,message:(t==null?void 0:t.message)||"Test request failed"})}finally{Le(!1)}},ut=async()=>{if(!p){He(!0),F(null);try{const s=await(await fetch("/api/mitm/router-target",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q.trim(),apiKey:K!==""?K.trim():void 0})})).json();s.success?(F({success:!0,message:"Target configuration saved!"}),Re(!!s.hasApiKey),Ie(""),A()):F({success:!1,message:s.error||"Failed to save target"})}catch(t){F({success:!1,message:(t==null?void 0:t.message)||"Failed to save target"})}finally{He(!1),setTimeout(()=>F(null),3e3)}}},pt=()=>{Ve.forEach(t=>{fetch(`/api/mitm/hosts/${t.id}`).then(s=>s.json()).then(s=>{s.entries&&V(l=>({...l,[t.id]:s.entries}))}).catch(()=>{}),fetch(`/api/mitm/mappings/${t.id}`).then(s=>s.json()).then(s=>{Array.isArray(s)&&U(l=>({...l,[t.id]:s}))}).catch(()=>{})})};n.useEffect(()=>{A(),pt()},[]);const ae=async(t=!1,s)=>{x(null);let l;if(s!==void 0)l=s;else if(y.trim()){const a=Number(y.trim());if(isNaN(a)||!Number.isInteger(a)||a<1||a>65535){x("Port must be an integer between 1 and 65535.");return}l=a}if(p&&!t){w(!1);try{const d=await(await fetch("/api/mitm/toggle-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({running:!1})})).json();w(!!d.running),d.port&&j(d.port),d.dnsStatus&&H({antigravity:!!d.dnsStatus.antigravity,kiro:!!d.dnsStatus.kiro,copilot:!!d.dnsStatus.copilot}),A()}catch(a){x((a==null?void 0:a.message)||"Failed to stop server")}return}t&&C(!0);try{const a=await fetch("/api/mitm/toggle-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({running:!0,port:l,forceKill:t})});if(a.status===409){const B=await a.json();h(B.portOwner||{port:l||443,inUse:!0}),w(!1);return}if(!a.ok){const B=await a.json().catch(()=>({}));throw new Error(B.error||`Failed to start server (${a.status})`)}const d=await a.json();w(!!d.running),d.port&&j(d.port),d.dnsStatus&&H({antigravity:!!d.dnsStatus.antigravity,kiro:!!d.dnsStatus.kiro,copilot:!!d.dnsStatus.copilot}),d.warning&&x(d.warning),h(null),A()}catch(a){x((a==null?void 0:a.message)||"Failed to start server")}finally{C(!1)}},xt=async()=>{Se(!0),T(null);try{const s=await(await fetch("/api/mitm/install-cert",{method:"POST"})).json();s.success?(T({type:"success",text:s.message||"Root CA installed successfully!"}),A()):T({type:"error",text:s.message||"Installation failed"})}catch(t){T({type:"error",text:(t==null?void 0:t.message)||"Failed to install certificate"})}finally{Se(!1)}},ht=async()=>{Ce(!0),T(null);try{const s=await(await fetch("/api/mitm/uninstall-cert",{method:"POST"})).json();s.success?(T({type:"success",text:s.message||"Root CA uninstalled successfully!"}),A()):T({type:"error",text:s.message||"Uninstallation failed"})}catch(t){T({type:"error",text:(t==null?void 0:t.message)||"Failed to uninstall certificate"})}finally{Ce(!1)}},gt=async t=>{const s=!Me[t];H(l=>({...l,[t]:s}));try{const a=await(await fetch("/api/mitm/toggle-dns",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:t,active:s})})).json();a.dnsStatus&&H(d=>({...d,antigravity:!!a.dnsStatus.antigravity,kiro:!!a.dnsStatus.kiro,copilot:!!a.dnsStatus.copilot})),a.warning&&x(a.warning),A()}catch{}},bt=async t=>{const s=!R[t];J(l=>({...l,[t]:s}));try{const a=await(await fetch("/api/mitm/augment-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:t,enabled:s})})).json();a.augmentModels&&J(d=>({...d,...a.augmentModels}))}catch{J(l=>({...l,[t]:!s}))}},ft=async t=>{const s=Te[t]||"";try{(await fetch(`/api/mitm/hosts/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:s})})).ok&&(Y(a=>({...a,[t]:"Saved hosts successfully."})),ce(a=>({...a,[t]:!1})),setTimeout(()=>{Y(a=>({...a,[t]:null}))},3e3))}catch{}},yt=async t=>{try{const l=await(await fetch(`/api/mitm/hosts/${t}/reset`,{method:"POST"})).json();l.entries&&(V(a=>({...a,[t]:l.entries})),Y(a=>({...a,[t]:"Hosts reset to default."})),setTimeout(()=>{Y(a=>({...a,[t]:null}))},3e3))}catch{}},jt=async t=>{try{const l=await(await fetch("/api/mitm/mappings/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t})})).json();Array.isArray(l.mappings)&&U(a=>({...a,[t]:l.mappings}))}catch{}},Nt=async()=>{if(!_||!pe.trim()||!he.trim())return;const t=_,s={sourceModel:pe.trim(),targetModel:he.trim()};U(l=>({...l,[t]:[...l[t]||[],s]}));try{await fetch("/api/mitm/mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t,sourceModel:s.sourceModel,targetModel:s.targetModel})})}catch{}finally{xe(""),ge(""),$(null)}},$e=async t=>{if(!Q||!ue.trim())return;let s=ue.trim();Ae.has(s.toLowerCase())&&!s.startsWith("combo/")&&(s=`combo/${s}`),U(l=>({...l,[t]:(l[t]||[]).map(a=>a.sourceModel===Q?{...a,targetModel:s}:a)}));try{await fetch("/api/mitm/mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t,sourceModel:Q,targetModel:s})})}catch{}finally{me(null),de(null),X("")}},vt=(t,s)=>{U(l=>({...l,[t]:(l[t]||[]).filter(a=>a.sourceModel!==s)})),fetch(`/api/mitm/mappings/${t}?sourceModel=${encodeURIComponent(s)}`,{method:"DELETE"}).catch(()=>{})};return e.jsxs("div",{className:"space-y-6 w-full px-2 sm:px-4 pb-16 animate-rt-fade-in",children:[e.jsxs("div",{className:"flex items-start gap-2.5 px-4 py-3 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-amber-400 shrink-0",children:"warning"}),e.jsxs("p",{children:[e.jsx("strong",{children:"MITM Interceptor:"})," Intercepts HTTPS traffic of closed IDE tools (Antigravity, Kiro, GitHub Copilot) via a local Root CA to redirect requests to your chosen providers and models. DNS is controlled independently per tool."]})]}),e.jsxs("div",{className:"flex items-start gap-2.5 px-4 py-3 rounded-xl bg-blue-500/10 border border-blue-500/20 text-xs text-blue-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-blue-400 shrink-0",children:"info"}),e.jsx("p",{className:"font-mono text-[11px] sm:text-xs text-blue-200",children:"How it works: Antigravity/Kiro IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → Mapigate → response to Antigravity/Kiro"})]}),e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-9 rounded-xl bg-cyan-500/10 border border-cyan-500/20 text-cyan-400 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"alt_route"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-bold text-white",children:"MITM HTTPS Proxy Server"}),e.jsx("span",{className:`rt-badge ${p?"rt-badge--success":"rt-badge--muted"}`,children:p?`● Running (Port :${f})`:"Stopped"})]}),e.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["Intercepts inbound IDE requests via SNI certificate emulation on port ",f,"."]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("button",{onClick:()=>ae(),className:`rt-btn text-xs py-1.5 px-3.5 ${p?"rt-btn--danger":"rt-btn--primary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:p?"stop":"play_arrow"}),p?"Stop Server":"Start Server"]})})]}),I&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-xs text-rose-300 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px] text-rose-400",children:"error"}),e.jsx("span",{children:I})]}),e.jsx("button",{type:"button",onClick:()=>x(null),className:"text-rose-400 hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 pt-1 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"font-semibold text-slate-300",children:"Active Gateway Endpoint:"}),e.jsx("code",{className:"text-blue-400 font-mono bg-[#0A0D14] px-3 py-1.5 rounded-lg border border-[#1E293B]",children:v})]}),e.jsx("span",{className:"text-[11px] text-slate-400 italic",children:"Enable DNS per tool below to activate redirection"})]}),e.jsx("div",{className:"pt-3 border-t border-[#1E293B]",children:e.jsxs("div",{className:"p-3.5 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-cyan-400",children:"hub"}),e.jsx("span",{className:"text-xs font-bold text-white",children:"Target Gateway"}),se?e.jsx("span",{className:"rt-badge rt-badge--info",children:"Remote Machine"}):e.jsx("span",{className:"rt-badge rt-badge--success",children:"Local Machine"})]}),p&&e.jsxs("span",{className:"text-[11px] text-amber-400/90 flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"lock"}),"Stop server to edit target configuration"]})]}),e.jsx("p",{className:"text-[11.5px] text-slate-400 leading-relaxed",children:"Specify where intercepted prompts are forwarded. Leave URL blank to route to this machine's local Mapigate Gateway, or enter another IP/URL to delegate requests to a remote machine."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-slate-300 block mb-1",children:"Gateway Base URL"}),e.jsx("input",{type:"text",placeholder:`Leave blank for local (${v})`,value:q,disabled:p,onChange:t=>De(t.target.value),className:"w-full bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[11px] font-semibold text-slate-300 block mb-1",children:["Gateway API Key ",Pe&&!K&&"(Configured ✓)"]}),e.jsx("input",{type:"password",disabled:p,placeholder:Pe?"•••••••••••• (Leave blank to keep)":"Optional (Required if Target requires key)",value:K,onChange:t=>Ie(t.target.value),className:"w-full bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[e.jsxs("div",{className:"text-xs",children:[Z&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11.5px] ${Z.success?"text-emerald-400":"text-rose-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:Z.success?"check_circle":"cancel"}),Z.message]}),ee&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11.5px] ${ee.success?"text-emerald-400":"text-rose-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:ee.success?"check":"error"}),ee.message]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:_e,onClick:mt,className:"rt-btn rt-btn--secondary text-xs py-1 px-3 flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"network_check"}),_e?"Testing...":"Test Connection"]}),e.jsxs("button",{type:"button",disabled:Oe||p,title:p?"Stop MITM server before editing target configuration":void 0,onClick:ut,className:"rt-btn rt-btn--primary text-xs py-1 px-3.5 flex items-center gap-1 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"save"}),Oe?"Saving...":"Save Target"]})]})]})]})}),e.jsxs("div",{className:"pt-2 border-t border-[#1E293B]/60",children:[e.jsxs("button",{type:"button",onClick:()=>ie(t=>!t),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-200 transition-colors cursor-pointer",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:E?"expand_less":"tune"}),e.jsx("span",{children:"Advanced / Custom Port Configuration"})]}),E&&e.jsxs("div",{className:"mt-3 p-3.5 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-3",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-slate-300 block",children:"Custom MITM Listen Port"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Default is port 443. Custom ports are for manual developer testing only."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:"1",max:"65535",placeholder:"443",value:y,onChange:t=>S(t.target.value),disabled:p,className:"w-24 bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white text-center focus:outline-none focus:border-blue-500 disabled:opacity-50"}),!p&&y&&e.jsx("button",{type:"button",onClick:()=>S(""),className:"text-xs text-slate-400 hover:text-white px-1.5 py-1 rounded",title:"Reset to default 443",children:"Reset"})]})]}),e.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20 text-[11.5px] text-amber-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px] text-amber-400 shrink-0 mt-0.5",children:"warning"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Notice:"})," OS ",e.jsx("code",{children:"hosts"})," file redirection maps domain names to IP addresses without port numbers. AI coding tools (Antigravity, Kiro, Copilot) connect to port 443 by default. Running on custom ports will ",e.jsx("strong",{children:"not"})," intercept standard IDE traffic."]})]})]})]})]}),e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-9 rounded-xl bg-purple-500/10 border border-purple-500/20 text-purple-400 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"verified_user"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-sm font-bold text-white",children:"SSL Root CA Certificate"}),i?e.jsxs("span",{className:"rt-badge rt-badge--success",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"check"})," Trusted in System"]}):e.jsxs("span",{className:"rt-badge rt-badge--warning",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"info"})," Not Yet Trusted"]}),z&&e.jsx("span",{className:"rt-badge rt-badge--info",children:"Generated"})]}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"Required for IDEs to accept MITM proxy SSL handshakes without security warnings."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:"/api/mitm/cert",download:"mapigate-rootCA.crt",className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"download"}),"Download CA"]}),i?e.jsxs("button",{disabled:ke,onClick:ht,className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3.5 flex items-center gap-1.5 text-rose-400 hover:text-rose-300 border-rose-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"delete"}),ke?"Uninstalling...":"Uninstall from System"]}):e.jsxs("button",{disabled:we,onClick:xt,className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"add_task"}),we?"Installing...":"Install to System Store"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-xs",children:[e.jsxs("div",{className:"p-3 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"SHA1 Fingerprint:"}),re&&e.jsxs("button",{onClick:()=>L("fp",re),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="fp"?"Copied":"Copy"]})]}),e.jsx("code",{className:"text-purple-300 font-mono text-[11px] block break-all",children:re||"Generating upon first start..."})]}),e.jsxs("div",{className:"p-3 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"CA File Path:"}),M&&e.jsxs("button",{onClick:()=>L("cp",M),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="cp"?"Copied":"Copy"]})]}),e.jsx("code",{className:"text-slate-300 font-mono text-[11px] block truncate",children:M||"~/.mapigate/mitm/rootCA.crt"})]})]}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsx("span",{className:"font-semibold text-slate-300 block",children:"Manual Installation Commands:"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2.5",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-[#0A0D14] border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"Windows (PowerShell / cmd):"}),e.jsxs("button",{onClick:()=>L("winCmd",G.windows),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="winCmd"?"Copied!":"Copy"]})]}),e.jsx("code",{className:"text-emerald-400 font-mono text-[11px] block break-all bg-[#05070B] p-2 rounded-lg border border-[#1E293B]",children:G.windows})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-[#0A0D14] border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"macOS (Terminal):"}),e.jsxs("button",{onClick:()=>L("macCmd",G.mac),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="macCmd"?"Copied!":"Copy"]})]}),e.jsx("code",{className:"text-emerald-400 font-mono text-[11px] block break-all bg-[#05070B] p-2 rounded-lg border border-[#1E293B]",children:G.mac})]})]})]}),W&&e.jsxs("div",{className:`p-2.5 rounded-xl text-xs flex items-center gap-2 ${W.type==="success"?"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400":"bg-red-500/10 border border-red-500/20 text-red-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:W.type==="success"?"check_circle":"error"}),W.text]})]}),e.jsx("div",{className:"space-y-4",children:et.map(t=>{const s=Xe===t.id,l=!!Me[t.id],a=!!tt[t.id],d=Te[t.id]||t.defaultHost,B=lt[t.id]||"source",ne=ot[t.id]||"asc",qe=Pt(nt[t.id]||[],B,ne),Ke=at[t.id],Fe=o=>{B===o?Ee(k=>({...k,[t.id]:ne==="asc"?"desc":"asc"})):(it(k=>({...k,[t.id]:o})),Ee(k=>({...k,[t.id]:"asc"})))};return e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{onClick:()=>Ze(s?null:t.id),className:"flex items-center justify-between cursor-pointer select-none",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(Bt,{src:t.image,name:t.name,iconBg:t.iconBg,size:"md"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-sm font-bold text-white",children:t.name}),e.jsx("span",{className:`rt-badge ${l?"rt-badge--success":"rt-badge--muted"}`,children:l?"DNS on":"DNS off"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:t.desc})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:o=>{o.stopPropagation(),gt(t.id)},className:`rt-btn text-xs py-1.5 px-3 ${l?"rt-btn--danger":"rt-btn--primary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:l?"stop":"play_arrow"}),l?"Stop DNS":"Start DNS"]}),e.jsx("span",{className:"material-symbols-outlined text-[20px] text-slate-500",children:s?"expand_less":"expand_more"})]})]}),s&&e.jsxs("div",{className:"pt-4 border-t border-[#1E293B] space-y-5 text-xs animate-rt-fade-in",children:[e.jsxs("div",{className:"space-y-3 p-4 rounded-xl bg-[#0A0D14] border border-[#1E293B]",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("h5",{className:"font-bold text-white flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-blue-400 text-[16px]",children:"dns"}),"Hosts File Entries (",t.name,")"]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Domain mappings added to your system hosts file when DNS redirection is enabled."})]}),e.jsx("div",{className:"flex items-center gap-2",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{Be[t.id]!==void 0&&V(o=>({...o,[t.id]:Be[t.id]})),ce(o=>({...o,[t.id]:!1}))},className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"close"}),"Cancel"]}),e.jsxs("button",{onClick:()=>ft(t.id),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"save"}),"Save Hosts"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>yt(t.id),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",title:"Reset hosts entries to tool default",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),"Reset"]}),e.jsxs("button",{onClick:()=>{st(o=>({...o,[t.id]:d})),ce(o=>({...o,[t.id]:!0}))},className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"edit"}),"Edit"]})]})})]}),e.jsx("textarea",{readOnly:!a,rows:Math.max(2,d.split(`
14
- `).length+1),value:d,onChange:o=>V(k=>({...k,[t.id]:o.target.value})),className:`w-full border rounded-xl p-3 text-xs font-mono leading-relaxed transition-colors ${a?"bg-[#05070B] border-blue-500/60 text-emerald-400 cursor-text focus:outline-none focus:border-blue-500":"bg-[#07090E] border-[#1E293B] text-emerald-400/80 cursor-default focus:outline-none"}`,placeholder:"127.0.0.1 domain"}),Ke&&e.jsxs("div",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 animate-rt-scale-in",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"check_circle"}),Ke]})]}),(t.id==="kiro"||!!t.isModelListRequest)&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl bg-[#0A0D14] border border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-start sm:items-center gap-3",children:[e.jsx("div",{className:"size-8 rounded-lg bg-purple-500/10 border border-purple-500/20 text-purple-400 flex items-center justify-center shrink-0 mt-0.5 sm:mt-0",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"auto_awesome"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-white text-xs",children:"Augment Models in IDE"}),e.jsx("span",{className:`rt-badge ${R[t.id]?"rt-badge--success":"rt-badge--muted"}`,children:R[t.id]?"Enabled":"Disabled"})]}),e.jsxs("p",{className:"text-[11px] text-slate-400 mt-0.5",children:["Injects Mapigate's rich model catalog into ",t.name," so you can select from all models in the IDE regardless of your account's tier."]})]})]}),e.jsxs("button",{type:"button",onClick:()=>bt(t.id),className:`rt-btn text-xs py-1.5 px-3.5 shrink-0 flex items-center gap-1.5 cursor-pointer ${R[t.id]?"rt-btn--primary":"rt-btn--secondary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:R[t.id]?"toggle_on":"toggle_off"}),R[t.id]?"Enabled":"Enable"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-bold text-slate-200 block text-xs",children:["Model Redirection Mappings (",t.name,")"]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Map requested models to your chosen Mapigate providers and upstream model IDs (slashes / supported)."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>jt(t.id),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",title:"Reset to default mappings",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),"Reset to Default"]}),e.jsxs("button",{onClick:()=>{$(t.id),xe(""),ge("")},className:"rt-btn rt-btn--primary text-xs py-1.5 px-3",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),"Add Mapping"]})]})]}),e.jsx("div",{className:"rounded-xl border border-[#1E293B] overflow-visible bg-[#0A0D14]",children:qe.length===0?e.jsxs("div",{className:"p-4 text-xs text-slate-500 italic text-center",children:["No model mappings configured for ",t.name,". Click 'Add Mapping' or 'Reset to Default'."]}):e.jsxs("table",{className:"w-full text-left text-xs font-mono",children:[e.jsx("thead",{className:"bg-[#0D121F] text-slate-400 font-sans text-[11px] uppercase tracking-wider border-b border-[#1E293B]",children:e.jsxs("tr",{children:[e.jsx("th",{onClick:()=>Fe("source"),className:"p-3 font-semibold cursor-pointer hover:text-white select-none transition-colors",title:"Click to sort by Source Model",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Source Model (IDE)"}),e.jsx("span",{className:"material-symbols-outlined text-[14px] text-blue-400",children:B==="source"?ne==="asc"?"arrow_upward":"arrow_downward":"unfold_more"})]})}),e.jsx("th",{onClick:()=>Fe("target"),className:"p-3 font-semibold cursor-pointer hover:text-white select-none transition-colors",title:"Click to sort by Target Model",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Target Model (Mapigate)"}),e.jsx("span",{className:"material-symbols-outlined text-[14px] text-blue-400",children:B==="target"?ne==="asc"?"arrow_upward":"arrow_downward":"unfold_more"})]})}),e.jsx("th",{className:"p-3 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-[#1E293B]",children:qe.map((o,k)=>{const fe=rt===t.id&&Q===o.sourceModel,ye=Je(o.sourceModel),wt=!!(ye&&ye!==o.sourceModel),je=o.targetModel?Je(o.targetModel):"",ze=!!(o.targetModel&&(o.targetModel.startsWith("combo/")||Ae.has(o.targetModel.toLowerCase()))),le=ze&&!o.targetModel.startsWith("combo/")?`combo/${o.targetModel}`:o.targetModel,St=!!(le&&je&&je!==le);return e.jsxs("tr",{className:`transition-colors ${fe?"bg-blue-500/10":"hover:bg-white/5"}`,children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-slate-100 font-sans font-semibold text-xs leading-snug",children:ye||o.sourceModel}),wt&&e.jsx("span",{className:"text-[10.5px] font-mono text-slate-400",children:o.sourceModel})]})}),e.jsx("td",{className:"p-3 text-blue-400",children:fe?e.jsxs("div",{className:"flex items-center gap-1.5 w-full max-w-sm",children:[e.jsx("span",{className:"text-blue-400 font-mono",children:"→"}),e.jsx(We,{value:ue,onChange:X,onEnter:()=>$e(t.id),placeholder:"Search model or type ID...",fetchCustomModels:se&&te.length>0?()=>Promise.resolve(te):void 0,className:"bg-[#080B11] border border-blue-500/60 focus:border-blue-400 rounded-lg px-2.5 py-1 text-xs text-white font-mono w-full focus:outline-none",autoFocus:!0})]}):o.targetModel?e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-slate-500 font-mono",children:"→"}),ze&&e.jsx("span",{className:"px-1.5 py-0.2 rounded bg-cyan-500/20 border border-cyan-500/40 text-[9.5px] font-mono text-cyan-300 font-semibold tracking-wide",children:"COMBO"}),e.jsx("span",{className:"text-emerald-300 font-sans font-semibold text-xs leading-snug",children:je||le})]}),St&&e.jsx("span",{className:"text-[10.5px] font-mono text-slate-400 pl-4",children:le})]}):e.jsx("span",{className:"text-slate-500 italic text-xs px-2 py-0.5 rounded bg-slate-800/60 border border-slate-700/40",children:"(unmapped)"})}),e.jsx("td",{className:"p-3 text-right space-x-2 whitespace-nowrap",children:fe?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>$e(t.id),className:"px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white font-sans text-[11px] font-medium transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:()=>{me(null),de(null),X("")},className:"px-2.5 py-1 rounded bg-[#0E1320] hover:bg-slate-700 border border-[#1E293B] text-slate-400 hover:text-white font-sans text-[11px] transition-colors cursor-pointer",children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{de(t.id),me(o.sourceModel),X(o.targetModel)},className:"px-2.5 py-1 rounded bg-[#0E1320] hover:bg-blue-600 hover:text-white border border-[#1E293B] text-slate-300 transition-colors cursor-pointer font-sans text-[11px]",children:"Edit"}),e.jsx("button",{onClick:()=>vt(t.id,o.sourceModel),className:"p-1 text-slate-500 hover:text-red-400 transition-colors",title:"Delete mapping",children:e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})})]},k)})})]})})]})]})]},t.id)})}),e.jsx(Ge,{isOpen:!!_,onClose:()=>$(null),maxWidthClass:"max-w-md",children:_&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-[#1E293B]",children:[e.jsxs("h4",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-blue-400 text-[18px]",children:"add_circle"}),"Add Model Mapping (",_.toUpperCase(),")"]}),e.jsx("button",{onClick:()=>$(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-white/10",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Source Model ID (Sent by IDE)"}),e.jsx(Et,{toolId:_,value:pe,onChange:xe,placeholder:"Select or type model ID (e.g. auto, claude-sonnet-4.5)..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Target Upstream Model ID (Mapigate Provider Model)"}),e.jsx(We,{value:he,onChange:ge,placeholder:"Search model or type ID...",fetchCustomModels:se&&te.length>0?()=>Promise.resolve(te):void 0}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Supports slash / formats, e.g. provider/model-name."})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-[#1E293B]",children:[e.jsx("button",{onClick:()=>$(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsx("button",{onClick:Nt,className:"rt-btn rt-btn--primary text-xs py-1.5 px-4",children:"Add Mapping"})]})]})}),e.jsx(Ge,{isOpen:!!c,onClose:()=>h(null),maxWidthClass:"max-w-md",children:c&&(()=>{var s;const t=!!c.isTransient||c.pid===0||!!((s=c.processName)!=null&&s.toLowerCase().includes("idle"));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`material-symbols-outlined text-[20px] ${t?"text-blue-400":c.isSystemProcess?"text-rose-400":"text-amber-400"}`,children:t?"hourglass_top":c.isSystemProcess?"gpp_bad":"warning"}),e.jsxs("h4",{className:"text-sm font-bold text-white",children:["Port ",c.port," ",t?"Socket Releasing":c.isSystemProcess?"System Conflict":"Already In Use"]})]}),e.jsx("button",{onClick:()=>h(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-white/10",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),t?e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-blue-500/10 border border-blue-500/30 rounded-xl space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-blue-300 font-semibold",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"hourglass_top"}),e.jsx("span",{children:"Socket Releasing (TIME_WAIT)"})]}),e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is currently releasing from a recent restart (",e.jsx("strong",{className:"text-white",children:"TCP TIME_WAIT"}),"). The operating system will free this socket in a few seconds. Click ",e.jsx("strong",{children:"Retry"})," to start the MITM server."]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>ae(!1,c.port),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]})]})]}):c.isSystemProcess?e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-rose-500/10 border border-rose-500/30 rounded-xl space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-rose-300 font-semibold",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"admin_panel_settings"}),e.jsx("span",{children:"Windows Kernel / System Service Conflict"})]}),e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is occupied by"," ",e.jsx("strong",{children:c.processName||"System"})," (PID ",c.pid??4,"). This is a Windows system kernel service (e.g. ",e.jsx("code",{children:"HTTP.sys"}),", IIS, or Web Publishing Service) and cannot be killed directly."]})]}),e.jsxs("div",{className:"p-3 bg-[#0A0D14] border border-[#1E293B] rounded-xl space-y-2",children:[e.jsx("span",{className:"text-slate-400 text-[11px] font-semibold block",children:"Run these commands as Administrator to release the port:"}),e.jsxs("div",{className:"space-y-1.5 font-mono text-[11px]",children:[e.jsxs("div",{className:"flex items-center justify-between bg-[#141B2D] px-2.5 py-1.5 rounded-lg border border-[#1E293B]",children:[e.jsx("code",{className:"text-cyan-300",children:"iisreset /stop"}),e.jsx("button",{type:"button",onClick:()=>L("iisreset","iisreset /stop"),className:"text-slate-400 hover:text-white ml-2 shrink-0",title:"Copy command",children:e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:P==="iisreset"?"check":"content_copy"})})]}),e.jsxs("div",{className:"flex items-center justify-between bg-[#141B2D] px-2.5 py-1.5 rounded-lg border border-[#1E293B]",children:[e.jsx("code",{className:"text-cyan-300",children:"net stop w3svc"}),e.jsx("button",{type:"button",onClick:()=>L("w3svc","net stop w3svc"),className:"text-slate-400 hover:text-white ml-2 shrink-0",title:"Copy command",children:e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:P==="w3svc"?"check":"content_copy"})})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>ae(!1,c.port),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]})]})]}):e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-amber-500/10 border border-amber-500/30 rounded-xl space-y-2",children:[e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is currently used by another process:"]}),e.jsxs("div",{className:"p-2.5 bg-[#0A0D14] rounded-lg border border-[#1E293B] font-mono text-xs text-amber-200",children:[e.jsxs("div",{children:["Process: ",e.jsx("strong",{className:"text-white",children:c.processName||"Unknown"})]}),e.jsxs("div",{children:["PID: ",e.jsx("strong",{className:"text-white",children:c.pid??"Unknown"})]})]}),e.jsxs("p",{className:"text-slate-400 text-[11px]",children:["Kill this process to start MITM Proxy on port ",c.port,"?"]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",disabled:D,onClick:()=>ae(!0,c.port),className:"rt-btn rt-btn--danger text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:D?"hourglass_empty":"power_settings_new"}),D?"Terminating...":"Kill & Start"]})]})]})]})})()})]})};export{$t as MitmTab};
13
+ 127.0.0.1 codewhisperer.us-east-1.amazonaws.com`,copilot:"127.0.0.1 api.individual.githubcopilot.com"}),[tt,ce]=n.useState({}),[Be,st]=n.useState({}),[at,Y]=n.useState({}),[nt,U]=n.useState({antigravity:[],kiro:[],copilot:[]}),[it,ot]=n.useState({}),[lt,Ee]=n.useState({}),[rt,de]=n.useState(null),[Q,me]=n.useState(null),[ue,X]=n.useState(""),[_,$]=n.useState(null),[pe,xe]=n.useState(""),[he,ge]=n.useState(""),[Ae,ct]=n.useState(new Set),[q,De]=n.useState(""),[K,Ie]=n.useState(""),[Pe,Re]=n.useState(!1),[_e,Le]=n.useState(!1),[Oe,He]=n.useState(!1),[Z,be]=n.useState(null),[ee,F]=n.useState(null),[te,dt]=n.useState([]),se=n.useMemo(()=>{const t=q.trim().toLowerCase();return t?!t.includes("127.0.0.1")&&!t.includes("localhost")&&!t.includes("0.0.0.0"):!1},[q]);n.useEffect(()=>{fetch("/api/combos").then(t=>t.ok?t.json():[]).then(t=>{const s=Array.isArray(t)?t:t.combos||[];ct(new Set(s.map(i=>(i.name||"").toLowerCase())))}).catch(()=>{})},[]);const L=(t,s)=>{navigator.clipboard.writeText(s),we(t),setTimeout(()=>we(null),2e3)},A=()=>{fetch("/api/mitm/status").then(t=>t.json()).then(t=>{v(!!t.running),t.port&&j(t.port),le(!!t.certExists),m(!!t.certTrusted),t.certPath&&O(t.certPath),t.fingerprint&&Ye(t.fingerprint),t.routerBaseUrl&&N(t.routerBaseUrl),t.installCommands&&Qe(t.installCommands),t.dnsStatus&&H(s=>{var i,a,d;return{...s,antigravity:!!((i=t.dnsStatus)!=null&&i.antigravity),kiro:!!((a=t.dnsStatus)!=null&&a.kiro),copilot:!!((d=t.dnsStatus)!=null&&d.copilot)}}),t.augmentModels&&J(s=>({...s,...t.augmentModels})),Tt.getState().fetchStatus()}).catch(()=>{}),fetch("/api/mitm/router-target").then(t=>t.ok?t.json():null).then(t=>{t&&(De(t.baseUrl||""),Re(!!t.hasApiKey),t.isRemote&&t.baseUrl&&Ue())}).catch(()=>{})},Ue=()=>{fetch("/api/mitm/router-target/models").then(t=>t.ok?t.json():{models:[]}).then(t=>{const s=(t.models||[]).map(i=>({id:i.id,value:i.id,name:i.name||i.id,providerId:i.provider||"remote",providerName:i.provider||"Remote Gateway",hasConnectedAccount:!0,accountsCount:1,caps:{vision:!0,reasoning:!0,audio:!1},contextLength:128e3}));dt(s)}).catch(()=>{})},mt=async()=>{Le(!0),be(null);try{const s=await(await fetch("/api/mitm/router-target/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q.trim(),apiKey:K.trim()||void 0})})).json();be({success:!!s.success,message:s.message||(s.success?"Connection successful":"Connection failed")}),s.success&&se&&Ue()}catch(t){be({success:!1,message:(t==null?void 0:t.message)||"Test request failed"})}finally{Le(!1)}},ut=async()=>{if(!p){He(!0),F(null);try{const s=await(await fetch("/api/mitm/router-target",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q.trim(),apiKey:K!==""?K.trim():void 0})})).json();s.success?(F({success:!0,message:"Target configuration saved!"}),Re(!!s.hasApiKey),Ie(""),A()):F({success:!1,message:s.error||"Failed to save target"})}catch(t){F({success:!1,message:(t==null?void 0:t.message)||"Failed to save target"})}finally{He(!1),setTimeout(()=>F(null),3e3)}}},pt=()=>{Ve.forEach(t=>{fetch(`/api/mitm/hosts/${t.id}`).then(s=>s.json()).then(s=>{s.entries&&V(i=>({...i,[t.id]:s.entries}))}).catch(()=>{}),fetch(`/api/mitm/mappings/${t.id}`).then(s=>s.json()).then(s=>{Array.isArray(s)&&U(i=>({...i,[t.id]:s}))}).catch(()=>{})})};n.useEffect(()=>{A(),pt()},[]);const ae=async(t=!1,s)=>{x(null);let i;if(s!==void 0)i=s;else if(y.trim()){const a=Number(y.trim());if(isNaN(a)||!Number.isInteger(a)||a<1||a>65535){x("Port must be an integer between 1 and 65535.");return}i=a}if(p&&!t){v(!1);try{const d=await(await fetch("/api/mitm/toggle-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({running:!1})})).json();v(!!d.running),d.port&&j(d.port),d.dnsStatus&&H({antigravity:!!d.dnsStatus.antigravity,kiro:!!d.dnsStatus.kiro,copilot:!!d.dnsStatus.copilot}),A()}catch(a){x((a==null?void 0:a.message)||"Failed to stop server")}return}t&&C(!0);try{const a=await fetch("/api/mitm/toggle-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({running:!0,port:i,forceKill:t})});if(a.status===409){const B=await a.json();h(B.portOwner||{port:i||443,inUse:!0}),v(!1);return}if(!a.ok){const B=await a.json().catch(()=>({}));throw new Error(B.error||`Failed to start server (${a.status})`)}const d=await a.json();v(!!d.running),d.port&&j(d.port),d.dnsStatus&&H({antigravity:!!d.dnsStatus.antigravity,kiro:!!d.dnsStatus.kiro,copilot:!!d.dnsStatus.copilot}),d.warning&&x(d.warning),h(null),A()}catch(a){x((a==null?void 0:a.message)||"Failed to start server")}finally{C(!1)}},xt=async()=>{Se(!0),T(null);try{const s=await(await fetch("/api/mitm/install-cert",{method:"POST"})).json();s.success?(T({type:"success",text:s.message||"Root CA installed successfully!"}),A()):T({type:"error",text:s.message||"Installation failed"})}catch(t){T({type:"error",text:(t==null?void 0:t.message)||"Failed to install certificate"})}finally{Se(!1)}},ht=async()=>{Ce(!0),T(null);try{const s=await(await fetch("/api/mitm/uninstall-cert",{method:"POST"})).json();s.success?(T({type:"success",text:s.message||"Root CA uninstalled successfully!"}),A()):T({type:"error",text:s.message||"Uninstallation failed"})}catch(t){T({type:"error",text:(t==null?void 0:t.message)||"Failed to uninstall certificate"})}finally{Ce(!1)}},gt=async t=>{const s=!Me[t];H(i=>({...i,[t]:s}));try{const a=await(await fetch("/api/mitm/toggle-dns",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:t,active:s})})).json();a.dnsStatus&&H(d=>({...d,antigravity:!!a.dnsStatus.antigravity,kiro:!!a.dnsStatus.kiro,copilot:!!a.dnsStatus.copilot})),a.warning&&x(a.warning),A()}catch{}},bt=async t=>{const s=!R[t];J(i=>({...i,[t]:s}));try{const a=await(await fetch("/api/mitm/augment-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:t,enabled:s})})).json();a.augmentModels&&J(d=>({...d,...a.augmentModels}))}catch{J(i=>({...i,[t]:!s}))}},ft=async t=>{const s=Te[t]||"";try{(await fetch(`/api/mitm/hosts/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:s})})).ok&&(Y(a=>({...a,[t]:"Saved hosts successfully."})),ce(a=>({...a,[t]:!1})),setTimeout(()=>{Y(a=>({...a,[t]:null}))},3e3))}catch{}},yt=async t=>{try{const i=await(await fetch(`/api/mitm/hosts/${t}/reset`,{method:"POST"})).json();i.entries&&(V(a=>({...a,[t]:i.entries})),Y(a=>({...a,[t]:"Hosts reset to default."})),setTimeout(()=>{Y(a=>({...a,[t]:null}))},3e3))}catch{}},jt=async t=>{try{const i=await(await fetch("/api/mitm/mappings/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t})})).json();Array.isArray(i.mappings)&&U(a=>({...a,[t]:i.mappings}))}catch{}},Nt=async()=>{if(!_||!pe.trim()||!he.trim())return;const t=_,s={sourceModel:pe.trim(),targetModel:he.trim()};U(i=>({...i,[t]:[...i[t]||[],s]}));try{await fetch("/api/mitm/mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t,sourceModel:s.sourceModel,targetModel:s.targetModel})})}catch{}finally{xe(""),ge(""),$(null)}},$e=async t=>{if(!Q||!ue.trim())return;let s=ue.trim();Ae.has(s.toLowerCase())&&!s.startsWith("combo/")&&(s=`combo/${s}`),U(i=>({...i,[t]:(i[t]||[]).map(a=>a.sourceModel===Q?{...a,targetModel:s}:a)}));try{await fetch("/api/mitm/mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:t,sourceModel:Q,targetModel:s})})}catch{}finally{me(null),de(null),X("")}},wt=(t,s)=>{U(i=>({...i,[t]:(i[t]||[]).filter(a=>a.sourceModel!==s)})),fetch(`/api/mitm/mappings/${t}?sourceModel=${encodeURIComponent(s)}`,{method:"DELETE"}).catch(()=>{})};return e.jsxs("div",{className:"space-y-6 w-full px-2 sm:px-4 pb-16 animate-rt-fade-in",children:[e.jsxs("div",{className:"flex items-start gap-2.5 px-4 py-3 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-amber-400 shrink-0",children:"warning"}),e.jsxs("p",{children:[e.jsx("strong",{children:"MITM Interceptor:"})," Intercepts HTTPS traffic of closed IDE tools (Antigravity, Kiro, GitHub Copilot) via a local Root CA to redirect requests to your chosen providers and models. DNS is controlled independently per tool."]})]}),e.jsxs("div",{className:"flex items-start gap-2.5 px-4 py-3 rounded-xl bg-blue-500/10 border border-blue-500/20 text-xs text-blue-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-blue-400 shrink-0",children:"info"}),e.jsx("p",{className:"font-mono text-[11px] sm:text-xs text-blue-200",children:"How it works: Antigravity/Kiro IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → Mapigate → response to Antigravity/Kiro"})]}),e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-9 rounded-xl bg-cyan-500/10 border border-cyan-500/20 text-cyan-400 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"alt_route"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-bold text-white",children:"MITM HTTPS Proxy Server"}),e.jsx("span",{className:`rt-badge ${p?"rt-badge--success":"rt-badge--muted"}`,children:p?`● Running (Port :${f})`:"Stopped"})]}),e.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["Intercepts inbound IDE requests via SNI certificate emulation on port ",f,"."]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("button",{onClick:()=>ae(),className:`rt-btn text-xs py-1.5 px-3.5 ${p?"rt-btn--danger":"rt-btn--primary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:p?"stop":"play_arrow"}),p?"Stop Server":"Start Server"]})})]}),I&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-xs text-rose-300 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px] text-rose-400",children:"error"}),e.jsx("span",{children:I})]}),e.jsx("button",{type:"button",onClick:()=>x(null),className:"text-rose-400 hover:text-white",children:e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 pt-1 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"font-semibold text-slate-300",children:"Active Gateway Endpoint:"}),e.jsx("code",{className:"text-blue-400 font-mono bg-[#0A0D14] px-3 py-1.5 rounded-lg border border-[#1E293B]",children:w})]}),e.jsx("span",{className:"text-[11px] text-slate-400 italic",children:"Enable DNS per tool below to activate redirection"})]}),e.jsx("div",{className:"pt-3 border-t border-[#1E293B]",children:e.jsxs("div",{className:"p-3.5 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-[18px] text-cyan-400",children:"hub"}),e.jsx("span",{className:"text-xs font-bold text-white",children:"Target Gateway"}),se?e.jsx("span",{className:"rt-badge rt-badge--info",children:"Remote Machine"}):e.jsx("span",{className:"rt-badge rt-badge--success",children:"Local Machine"})]}),p&&e.jsxs("span",{className:"text-[11px] text-amber-400/90 flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"lock"}),"Stop server to edit target configuration"]})]}),e.jsx("p",{className:"text-[11.5px] text-slate-400 leading-relaxed",children:"Specify where intercepted prompts are forwarded. Leave URL blank to route to this machine's local Mapigate Gateway, or enter another IP/URL to delegate requests to a remote machine."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-semibold text-slate-300 block mb-1",children:"Gateway Base URL"}),e.jsx("input",{type:"text",placeholder:`Leave blank for local (${w})`,value:q,disabled:p,onChange:t=>De(t.target.value),className:"w-full bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[11px] font-semibold text-slate-300 block mb-1",children:["Gateway API Key ",Pe&&!K&&"(Configured ✓)"]}),e.jsx("input",{type:"password",disabled:p,placeholder:Pe?"•••••••••••• (Leave blank to keep)":"Optional (Required if Target requires key)",value:K,onChange:t=>Ie(t.target.value),className:"w-full bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white placeholder-slate-500 focus:outline-none focus:border-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[e.jsxs("div",{className:"text-xs",children:[Z&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11.5px] ${Z.success?"text-emerald-400":"text-rose-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:Z.success?"check_circle":"cancel"}),Z.message]}),ee&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[11.5px] ${ee.success?"text-emerald-400":"text-rose-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:ee.success?"check":"error"}),ee.message]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:_e,onClick:mt,className:"rt-btn rt-btn--secondary text-xs py-1 px-3 flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"network_check"}),_e?"Testing...":"Test Connection"]}),e.jsxs("button",{type:"button",disabled:Oe||p,title:p?"Stop MITM server before editing target configuration":void 0,onClick:ut,className:"rt-btn rt-btn--primary text-xs py-1 px-3.5 flex items-center gap-1 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"save"}),Oe?"Saving...":"Save Target"]})]})]})]})}),e.jsxs("div",{className:"pt-2 border-t border-[#1E293B]/60",children:[e.jsxs("button",{type:"button",onClick:()=>oe(t=>!t),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-200 transition-colors cursor-pointer",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:E?"expand_less":"tune"}),e.jsx("span",{children:"Advanced / Custom Port Configuration"})]}),E&&e.jsxs("div",{className:"mt-3 p-3.5 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-3",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-slate-300 block",children:"Custom MITM Listen Port"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Default is port 443. Custom ports are for manual developer testing only."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:"1",max:"65535",placeholder:"443",value:y,onChange:t=>S(t.target.value),disabled:p,className:"w-24 bg-[#141B2D] border border-[#1E293B] rounded-lg px-2.5 py-1.5 text-xs font-mono text-white text-center focus:outline-none focus:border-blue-500 disabled:opacity-50"}),!p&&y&&e.jsx("button",{type:"button",onClick:()=>S(""),className:"text-xs text-slate-400 hover:text-white px-1.5 py-1 rounded",title:"Reset to default 443",children:"Reset"})]})]}),e.jsxs("div",{className:"flex items-start gap-2 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20 text-[11.5px] text-amber-300 leading-relaxed",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px] text-amber-400 shrink-0 mt-0.5",children:"warning"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Notice:"})," OS ",e.jsx("code",{children:"hosts"})," file redirection maps domain names to IP addresses without port numbers. AI coding tools (Antigravity, Kiro, Copilot) connect to port 443 by default. Running on custom ports will ",e.jsx("strong",{children:"not"})," intercept standard IDE traffic."]})]})]})]})]}),e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-9 rounded-xl bg-purple-500/10 border border-purple-500/20 text-purple-400 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"verified_user"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-sm font-bold text-white",children:"SSL Root CA Certificate"}),o?e.jsxs("span",{className:"rt-badge rt-badge--success",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"check"})," Trusted in System"]}):e.jsxs("span",{className:"rt-badge rt-badge--warning",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"info"})," Not Yet Trusted"]}),z&&e.jsx("span",{className:"rt-badge rt-badge--info",children:"Generated"})]}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"Required for IDEs to accept MITM proxy SSL handshakes without security warnings."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:"/api/mitm/cert",download:"mapigate-rootCA.crt",className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"download"}),"Download CA"]}),o?e.jsxs("button",{disabled:ke,onClick:ht,className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3.5 flex items-center gap-1.5 text-rose-400 hover:text-rose-300 border-rose-500/20",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"delete"}),ke?"Uninstalling...":"Uninstall from System"]}):e.jsxs("button",{disabled:ve,onClick:xt,className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"add_task"}),ve?"Installing...":"Install to System Store"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-xs",children:[e.jsxs("div",{className:"p-3 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"SHA1 Fingerprint:"}),re&&e.jsxs("button",{onClick:()=>L("fp",re),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="fp"?"Copied":"Copy"]})]}),e.jsx("code",{className:"text-purple-300 font-mono text-[11px] block break-all",children:re||"Generating upon first start..."})]}),e.jsxs("div",{className:"p-3 bg-[#0A0D14] rounded-xl border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"CA File Path:"}),M&&e.jsxs("button",{onClick:()=>L("cp",M),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="cp"?"Copied":"Copy"]})]}),e.jsx("code",{className:"text-slate-300 font-mono text-[11px] block truncate",children:M||"~/.mapigate/mitm/rootCA.crt"})]})]}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsx("span",{className:"font-semibold text-slate-300 block",children:"Manual Installation Commands:"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2.5",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-[#0A0D14] border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"Windows (PowerShell / cmd):"}),e.jsxs("button",{onClick:()=>L("winCmd",G.windows),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="winCmd"?"Copied!":"Copy"]})]}),e.jsx("code",{className:"text-emerald-400 font-mono text-[11px] block break-all bg-[#05070B] p-2 rounded-lg border border-[#1E293B]",children:G.windows})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-[#0A0D14] border border-[#1E293B] space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"macOS (Terminal):"}),e.jsxs("button",{onClick:()=>L("macCmd",G.mac),className:"text-blue-400 hover:text-blue-300 font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"material-symbols-outlined text-[13px]",children:"content_copy"}),P==="macCmd"?"Copied!":"Copy"]})]}),e.jsx("code",{className:"text-emerald-400 font-mono text-[11px] block break-all bg-[#05070B] p-2 rounded-lg border border-[#1E293B]",children:G.mac})]})]})]}),W&&e.jsxs("div",{className:`p-2.5 rounded-xl text-xs flex items-center gap-2 ${W.type==="success"?"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400":"bg-red-500/10 border border-red-500/20 text-red-400"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:W.type==="success"?"check_circle":"error"}),W.text]})]}),e.jsx("div",{className:"space-y-4",children:et.map(t=>{const s=Xe===t.id,i=!!Me[t.id],a=!!tt[t.id],d=Te[t.id]||t.defaultHost,B=it[t.id]||"source",ne=lt[t.id]||"asc",qe=Pt(nt[t.id]||[],B,ne),Ke=at[t.id],Fe=l=>{B===l?Ee(k=>({...k,[t.id]:ne==="asc"?"desc":"asc"})):(ot(k=>({...k,[t.id]:l})),Ee(k=>({...k,[t.id]:"asc"})))};return e.jsxs("div",{className:"rt-card p-5 space-y-4",children:[e.jsxs("div",{onClick:()=>Ze(s?null:t.id),className:"flex items-center justify-between cursor-pointer select-none",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx(Bt,{src:t.image,name:t.name,iconBg:t.iconBg,size:"md"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-sm font-bold text-white",children:t.name}),e.jsx("span",{className:`rt-badge ${i?"rt-badge--success":"rt-badge--muted"}`,children:i?"DNS on":"DNS off"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:t.desc})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:l=>{l.stopPropagation(),gt(t.id)},className:`rt-btn text-xs py-1.5 px-3 ${i?"rt-btn--danger":"rt-btn--primary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:i?"stop":"play_arrow"}),i?"Stop DNS":"Start DNS"]}),e.jsx("span",{className:"material-symbols-outlined text-[20px] text-slate-500",children:s?"expand_less":"expand_more"})]})]}),s&&e.jsxs("div",{className:"pt-4 border-t border-[#1E293B] space-y-5 text-xs animate-rt-fade-in",children:[e.jsxs("div",{className:"space-y-3 p-4 rounded-xl bg-[#0A0D14] border border-[#1E293B]",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("h5",{className:"font-bold text-white flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-blue-400 text-[16px]",children:"dns"}),"Hosts File Entries (",t.name,")"]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Domain mappings added to your system hosts file when DNS redirection is enabled."})]}),e.jsx("div",{className:"flex items-center gap-2",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{Be[t.id]!==void 0&&V(l=>({...l,[t.id]:Be[t.id]})),ce(l=>({...l,[t.id]:!1}))},className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"close"}),"Cancel"]}),e.jsxs("button",{onClick:()=>ft(t.id),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"save"}),"Save Hosts"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>yt(t.id),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",title:"Reset hosts entries to tool default",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),"Reset"]}),e.jsxs("button",{onClick:()=>{st(l=>({...l,[t.id]:d})),ce(l=>({...l,[t.id]:!0}))},className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"edit"}),"Edit"]})]})})]}),e.jsx("textarea",{readOnly:!a,rows:Math.max(2,d.split(`
14
+ `).length+1),value:d,onChange:l=>V(k=>({...k,[t.id]:l.target.value})),className:`w-full border rounded-xl p-3 text-xs font-mono leading-relaxed transition-colors ${a?"bg-[#05070B] border-blue-500/60 text-emerald-400 cursor-text focus:outline-none focus:border-blue-500":"bg-[#07090E] border-[#1E293B] text-emerald-400/80 cursor-default focus:outline-none"}`,placeholder:"127.0.0.1 domain"}),Ke&&e.jsxs("div",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 animate-rt-scale-in",children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"check_circle"}),Ke]})]}),(t.id==="kiro"||!!t.isModelListRequest)&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl bg-[#0A0D14] border border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-start sm:items-center gap-3",children:[e.jsx("div",{className:"size-8 rounded-lg bg-purple-500/10 border border-purple-500/20 text-purple-400 flex items-center justify-center shrink-0 mt-0.5 sm:mt-0",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"auto_awesome"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-white text-xs",children:"Augment Models in IDE"}),e.jsx("span",{className:`rt-badge ${R[t.id]?"rt-badge--success":"rt-badge--muted"}`,children:R[t.id]?"Enabled":"Disabled"})]}),e.jsxs("p",{className:"text-[11px] text-slate-400 mt-0.5",children:["Injects Mapigate's rich model catalog into ",t.name," so you can select from all models in the IDE regardless of your account's tier."]})]})]}),e.jsxs("button",{type:"button",onClick:()=>bt(t.id),className:`rt-btn text-xs py-1.5 px-3.5 shrink-0 flex items-center gap-1.5 cursor-pointer ${R[t.id]?"rt-btn--primary":"rt-btn--secondary"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:R[t.id]?"toggle_on":"toggle_off"}),R[t.id]?"Enabled":"Enable"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-bold text-slate-200 block text-xs",children:["Model Redirection Mappings (",t.name,")"]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Map requested models to your chosen Mapigate providers and upstream model IDs (slashes / supported)."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>jt(t.id),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",title:"Reset to default mappings",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"}),"Reset to Default"]}),e.jsxs("button",{onClick:()=>{$(t.id),xe(""),ge("")},className:"rt-btn rt-btn--primary text-xs py-1.5 px-3",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),"Add Mapping"]})]})]}),e.jsx("div",{className:"rounded-xl border border-[#1E293B] overflow-visible bg-[#0A0D14]",children:qe.length===0?e.jsxs("div",{className:"p-4 text-xs text-slate-500 italic text-center",children:["No model mappings configured for ",t.name,". Click 'Add Mapping' or 'Reset to Default'."]}):e.jsxs("table",{className:"w-full text-left text-xs font-mono",children:[e.jsx("thead",{className:"bg-[#0D121F] text-slate-400 font-sans text-[11px] uppercase tracking-wider border-b border-[#1E293B]",children:e.jsxs("tr",{children:[e.jsx("th",{onClick:()=>Fe("source"),className:"p-3 font-semibold cursor-pointer hover:text-white select-none transition-colors",title:"Click to sort by Source Model",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Source Model (IDE)"}),e.jsx("span",{className:"material-symbols-outlined text-[14px] text-blue-400",children:B==="source"?ne==="asc"?"arrow_upward":"arrow_downward":"unfold_more"})]})}),e.jsx("th",{onClick:()=>Fe("target"),className:"p-3 font-semibold cursor-pointer hover:text-white select-none transition-colors",title:"Click to sort by Target Model",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Target Model (Mapigate)"}),e.jsx("span",{className:"material-symbols-outlined text-[14px] text-blue-400",children:B==="target"?ne==="asc"?"arrow_upward":"arrow_downward":"unfold_more"})]})}),e.jsx("th",{className:"p-3 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-[#1E293B]",children:qe.map((l,k)=>{const fe=rt===t.id&&Q===l.sourceModel,ye=Je(l.sourceModel),vt=!!(ye&&ye!==l.sourceModel),je=l.targetModel?Je(l.targetModel):"",ze=!!(l.targetModel&&(l.targetModel.startsWith("combo/")||Ae.has(l.targetModel.toLowerCase()))),ie=ze&&!l.targetModel.startsWith("combo/")?`combo/${l.targetModel}`:l.targetModel,St=!!(ie&&je&&je!==ie);return e.jsxs("tr",{className:`transition-colors ${fe?"bg-blue-500/10":"hover:bg-white/5"}`,children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-slate-100 font-sans font-semibold text-xs leading-snug",children:ye||l.sourceModel}),vt&&e.jsx("span",{className:"text-[10.5px] font-mono text-slate-400",children:l.sourceModel})]})}),e.jsx("td",{className:"p-3 text-blue-400",children:fe?e.jsxs("div",{className:"flex items-center gap-1.5 w-full max-w-sm",children:[e.jsx("span",{className:"text-blue-400 font-mono",children:"→"}),e.jsx(We,{value:ue,onChange:X,onEnter:()=>$e(t.id),placeholder:"Search model or type ID...",fetchCustomModels:se&&te.length>0?()=>Promise.resolve(te):void 0,className:"bg-[#080B11] border border-blue-500/60 focus:border-blue-400 rounded-lg px-2.5 py-1 text-xs text-white font-mono w-full focus:outline-none",autoFocus:!0})]}):l.targetModel?e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-slate-500 font-mono",children:"→"}),ze&&e.jsx("span",{className:"px-1.5 py-0.2 rounded bg-cyan-500/20 border border-cyan-500/40 text-[9.5px] font-mono text-cyan-300 font-semibold tracking-wide",children:"COMBO"}),e.jsx("span",{className:"text-emerald-300 font-sans font-semibold text-xs leading-snug",children:je||ie})]}),St&&e.jsx("span",{className:"text-[10.5px] font-mono text-slate-400 pl-4",children:ie})]}):e.jsx("span",{className:"text-slate-500 italic text-xs px-2 py-0.5 rounded bg-slate-800/60 border border-slate-700/40",children:"(unmapped)"})}),e.jsx("td",{className:"p-3 text-right space-x-2 whitespace-nowrap",children:fe?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>$e(t.id),className:"px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white font-sans text-[11px] font-medium transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:()=>{me(null),de(null),X("")},className:"px-2.5 py-1 rounded bg-[#0E1320] hover:bg-slate-700 border border-[#1E293B] text-slate-400 hover:text-white font-sans text-[11px] transition-colors cursor-pointer",children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{de(t.id),me(l.sourceModel),X(l.targetModel)},className:"px-2.5 py-1 rounded bg-[#0E1320] hover:bg-blue-600 hover:text-white border border-[#1E293B] text-slate-300 transition-colors cursor-pointer font-sans text-[11px]",children:"Edit"}),e.jsx("button",{onClick:()=>wt(t.id,l.sourceModel),className:"p-1 text-slate-500 hover:text-red-400 transition-colors",title:"Delete mapping",children:e.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})})]})})]},k)})})]})})]})]})]},t.id)})}),e.jsx(Ge,{isOpen:!!_,onClose:()=>$(null),maxWidthClass:"max-w-md",children:_&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-[#1E293B]",children:[e.jsxs("h4",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"material-symbols-outlined text-blue-400 text-[18px]",children:"add_circle"}),"Add Model Mapping (",_.toUpperCase(),")"]}),e.jsx("button",{onClick:()=>$(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-white/10",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Source Model ID (Sent by IDE)"}),e.jsx(Et,{toolId:_,value:pe,onChange:xe,placeholder:"Select or type model ID (e.g. auto, claude-sonnet-4.5)..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1",children:"Target Upstream Model ID (Mapigate Provider Model)"}),e.jsx(We,{value:he,onChange:ge,placeholder:"Search model or type ID...",fetchCustomModels:se&&te.length>0?()=>Promise.resolve(te):void 0}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"Supports slash / formats, e.g. provider/model-name."})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-[#1E293B]",children:[e.jsx("button",{onClick:()=>$(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsx("button",{onClick:Nt,className:"rt-btn rt-btn--primary text-xs py-1.5 px-4",children:"Add Mapping"})]})]})}),e.jsx(Ge,{isOpen:!!c,onClose:()=>h(null),maxWidthClass:"max-w-md",children:c&&(()=>{var s;const t=!!c.isTransient||c.pid===0||!!((s=c.processName)!=null&&s.toLowerCase().includes("idle"));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-[#1E293B]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`material-symbols-outlined text-[20px] ${t?"text-blue-400":c.isSystemProcess?"text-rose-400":"text-amber-400"}`,children:t?"hourglass_top":c.isSystemProcess?"gpp_bad":"warning"}),e.jsxs("h4",{className:"text-sm font-bold text-white",children:["Port ",c.port," ",t?"Socket Releasing":c.isSystemProcess?"System Conflict":"Already In Use"]})]}),e.jsx("button",{onClick:()=>h(null),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-white/10",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]}),t?e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-blue-500/10 border border-blue-500/30 rounded-xl space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-blue-300 font-semibold",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"hourglass_top"}),e.jsx("span",{children:"Socket Releasing (TIME_WAIT)"})]}),e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is currently releasing from a recent restart (",e.jsx("strong",{className:"text-white",children:"TCP TIME_WAIT"}),"). The operating system will free this socket in a few seconds. Click ",e.jsx("strong",{children:"Retry"})," to start the MITM server."]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>ae(!1,c.port),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]})]})]}):c.isSystemProcess?e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-rose-500/10 border border-rose-500/30 rounded-xl space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-rose-300 font-semibold",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"admin_panel_settings"}),e.jsx("span",{children:"Windows Kernel / System Service Conflict"})]}),e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is occupied by"," ",e.jsx("strong",{children:c.processName||"System"})," (PID ",c.pid??4,"). This is a Windows system kernel service (e.g. ",e.jsx("code",{children:"HTTP.sys"}),", IIS, or Web Publishing Service) and cannot be killed directly."]})]}),e.jsxs("div",{className:"p-3 bg-[#0A0D14] border border-[#1E293B] rounded-xl space-y-2",children:[e.jsx("span",{className:"text-slate-400 text-[11px] font-semibold block",children:"Run these commands as Administrator to release the port:"}),e.jsxs("div",{className:"space-y-1.5 font-mono text-[11px]",children:[e.jsxs("div",{className:"flex items-center justify-between bg-[#141B2D] px-2.5 py-1.5 rounded-lg border border-[#1E293B]",children:[e.jsx("code",{className:"text-cyan-300",children:"iisreset /stop"}),e.jsx("button",{type:"button",onClick:()=>L("iisreset","iisreset /stop"),className:"text-slate-400 hover:text-white ml-2 shrink-0",title:"Copy command",children:e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:P==="iisreset"?"check":"content_copy"})})]}),e.jsxs("div",{className:"flex items-center justify-between bg-[#141B2D] px-2.5 py-1.5 rounded-lg border border-[#1E293B]",children:[e.jsx("code",{className:"text-cyan-300",children:"net stop w3svc"}),e.jsx("button",{type:"button",onClick:()=>L("w3svc","net stop w3svc"),className:"text-slate-400 hover:text-white ml-2 shrink-0",title:"Copy command",children:e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:P==="w3svc"?"check":"content_copy"})})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>ae(!1,c.port),className:"rt-btn rt-btn--primary text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Retry"]})]})]}):e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"p-3.5 bg-amber-500/10 border border-amber-500/30 rounded-xl space-y-2",children:[e.jsxs("p",{className:"text-slate-300 text-[11.5px] leading-relaxed",children:["Port ",c.port," is currently used by another process:"]}),e.jsxs("div",{className:"p-2.5 bg-[#0A0D14] rounded-lg border border-[#1E293B] font-mono text-xs text-amber-200",children:[e.jsxs("div",{children:["Process: ",e.jsx("strong",{className:"text-white",children:c.processName||"Unknown"})]}),e.jsxs("div",{children:["PID: ",e.jsx("strong",{className:"text-white",children:c.pid??"Unknown"})]})]}),e.jsxs("p",{className:"text-slate-400 text-[11px]",children:["Kill this process to start MITM Proxy on port ",c.port,"?"]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-[#1E293B]",children:[e.jsx("button",{type:"button",onClick:()=>h(null),className:"rt-btn rt-btn--secondary text-xs py-1.5 px-3",children:"Cancel"}),e.jsxs("button",{type:"button",disabled:D,onClick:()=>ae(!0,c.port),className:"rt-btn rt-btn--danger text-xs py-1.5 px-3.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:D?"hourglass_empty":"power_settings_new"}),D?"Terminating...":"Kill & Start"]})]})]})]})})()})]})};export{$t as MitmTab};
@@ -1 +1 @@
1
- import{j as a,r as x}from"./vendor-BcOI2aZ9.js";import{g as X,a as Z}from"./metadataRegistry-B91sal4r.js";const v={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},C="[-_/:.]",ee=new RegExp([`(^|${C})(image|img)(${C}|$)`,"stable-image","gen[0-9]_image","nanobanana","imagine","t2v","i2v","flux","dall","sdxl","diffusion","embed","rerank","guard","moderation","tts","stt","whisper","voice","speech","audio"].join("|"),"i"),te=new RegExp([`(^|${C})(vision|vl|vlm|multimodal|omni|visual)(${C}|$)`,`[0-9]\\.[0-9]+v(${C}|$)`,`(^|${C})glm-[0-9]+v(${C}|$)`,"(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)"].join("|"),"i"),V={nvidia:{"minimaxai/minimax-m2.7":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072},"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"deepseek-ai/deepseek-v4-pro":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},"opencode-go":{"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072}}},S={"claude-fable-5-1":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-haiku-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-haiku-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-3-7-sonnet":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3},"claude-3.7-sonnet":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3},"claude-3-5-sonnet":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3.5-sonnet":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3-5-haiku":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3.5-haiku":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3-opus":{vision:!0,contextWindow:2e5,maxOutput:4096},"claude-3-haiku":{vision:!0,contextWindow:2e5,maxOutput:4096},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-chat":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"deepseek-reasoner":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3,maxOutput:64e3},"deepseek-r1":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3,maxOutput:64e3},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"gpt-image-1":{imageOutput:!0,tools:!1}};function y(i){if(!i)return!1;const n=String(i).toLowerCase();return ee.test(n)?!1:te.test(n)}function H(i,n){return!i||!n?!1:new RegExp("^"+i.split("*").map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(n)}const ne=[{pattern:"*claude*opus-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1}},{pattern:"*claude*opus-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1}},{pattern:"*claude*sonnet-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1}},{pattern:"*claude*sonnet-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1}},{pattern:"*claude*haiku-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4-7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*3.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*3-7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*3.5*sonnet*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3-5*sonnet*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3.5*haiku*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3-5*haiku*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3*opus*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*3*sonnet*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*3*haiku*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude-3*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-6.1-terra*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:128e3}},{pattern:"*gpt-6.1-sol*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*deepseek*v4.1*flash*free*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:33e4,maxOutput:128e3}},{pattern:"*deepseek-v4.*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k3.1*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*k3.1*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}}];function K(i){if(i){if(Array.isArray(i)){const n={};for(const u of i)typeof u=="string"&&(n[u]=!0);return n}return i}}function G(i,n){if(!n)return{...v};const u=n.includes("/")?n.split("/").pop():n,s=!i&&n.includes("/")?n.split("/")[0]:i;if(s){const t=X(s);if(t!=null&&t.models){const c=t.models.find(o=>o.id===n||o.id===u||o.upstreamModelId&&(o.upstreamModelId===n||o.upstreamModelId===u));if(c!=null&&c.capabilities){const o=K(c.capabilities);if(o){const m={...v,...o};return!m.vision&&y(n)&&(m.vision=!0),m}}}}else for(const t of Z()){if(!t.models)continue;const c=t.models.find(o=>o.id===n||o.id===u||o.upstreamModelId&&(o.upstreamModelId===n||o.upstreamModelId===u));if(c!=null&&c.capabilities){const o=K(c.capabilities);if(o){const m={...v,...o};return!m.vision&&y(n)&&(m.vision=!0),m}}}if(s&&V[s]){const t=V[s];if(t[n])return{...v,...t[n]};if(t[u])return{...v,...t[u]}}if(S[u]){const t={...v,...S[u]};return!t.vision&&y(n)&&(t.vision=!0),t}if(S[n]){const t={...v,...S[n]};return!t.vision&&y(n)&&(t.vision=!0),t}for(const{pattern:t,caps:c}of ne)if(H(t,u)||H(t,n)){const o={...v,...c};return!o.vision&&y(n)&&(o.vision=!0),o}const g={...v};return!g.vision&&y(n)&&(g.vision=!0),g}function ue(i,n,u=0){if(!i||i.length===0||u>6)return null;const s=i.map(t=>{!t.includes("/")&&(n!=null&&n[t]);const c=t.indexOf("/"),o=c===-1?null:t.slice(0,c),m=c===-1?t:t.slice(c+1);return G(o,m)}),g=s[0];return{vision:s.some(t=>t.vision),pdf:s.some(t=>t.pdf),audioInput:s.some(t=>t.audioInput),videoInput:s.some(t=>t.videoInput),imageOutput:s.some(t=>t.imageOutput),audioOutput:s.some(t=>t.audioOutput),search:s.some(t=>t.search),tools:s.every(t=>t.tools),reasoning:g.reasoning,thinkingFormat:g.thinkingFormat,thinkingCanDisable:g.thinkingCanDisable,thinkingRange:g.thinkingRange,thinkingEffortSupported:g.thinkingEffortSupported,contextWindow:Math.min(...s.map(t=>t.contextWindow)),maxOutput:Math.max(...s.map(t=>t.maxOutput))}}const $={vision:{key:"vision",label:"Vision",icon:"visibility",desc:"Supports image inputs (png, jpg, webp, base64)",colorClass:"text-cyan-400",bgClass:"bg-cyan-500/10",borderClass:"border-cyan-500/20"},pdf:{key:"pdf",label:"PDF",icon:"picture_as_pdf",desc:"Supports PDF and document parsing",colorClass:"text-orange-400",bgClass:"bg-orange-500/10",borderClass:"border-orange-500/20"},audio:{key:"audio",label:"Audio",icon:"graphic_eq",desc:"Supports raw voice and audio speech input",colorClass:"text-purple-400",bgClass:"bg-purple-500/10",borderClass:"border-purple-500/20"},thinking:{key:"thinking",label:"Thinking",icon:"psychology",desc:"Supports reasoning and thinking trace",colorClass:"text-emerald-400",bgClass:"bg-emerald-500/10",borderClass:"border-emerald-500/20"}};function ie(i){if(!i)return null;const n=i.indexOf("/"),u=n===-1?null:i.slice(0,n),s=n===-1?i:i.slice(n+1);return G(u,s)}const ae=({caps:i,model:n,className:u="",showLabels:s=!1,size:g="sm"})=>{const t=i||(n?ie(n):null);if(!t)return null;const c=!!t.vision,o=!!t.pdf,m=!!(t.audioInput||t.audio),N=!!(t.reasoning||t.thinking||t.thinkingFormat&&t.thinkingFormat!==null),h=[];if(c&&h.push($.vision),o&&h.push($.pdf),m&&h.push($.audio),N&&h.push($.thinking),h.length===0)return null;const w={xs:"text-[12px]",sm:"text-[14px]",md:"text-[16px]"},A={xs:"text-[9.5px]",sm:"text-[10.5px]",md:"text-xs"};return a.jsx("div",{className:`inline-flex items-center gap-1.5 flex-wrap ${u}`,children:h.map(d=>a.jsxs("span",{title:`${d.label}: ${d.desc}`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md border font-medium transition-all ${d.colorClass} ${d.bgClass} ${d.borderClass} ${A[g]}`,children:[a.jsx("span",{className:`material-symbols-outlined leading-none ${w[g]}`,children:d.icon}),s&&a.jsx("span",{children:d.label})]},d.key))})};let j=null,E=null;const B=new Set;function oe(i){return B.add(i),()=>{B.delete(i)}}function ce(){j=null,E=null;for(const i of B)try{i()}catch(n){console.error("Error in model cache invalidation listener:",n)}}function U(){return E?Promise.resolve(E):(j||(j=fetch("/api/models/available").then(i=>{if(!i.ok)throw new Error("Failed to load models");return i.json()}).then(i=>(E=i,i)).catch(i=>{throw j=null,i})),j)}const pe=({value:i,onChange:n,onEnter:u,placeholder:s="Search model (e.g. openai/gpt-4o)...",className:g="",autoFocus:t=!1,connectedOnly:c=!0,disabled:o=!1,excludeValues:m,allowCombos:N=!0,fetchCustomModels:h})=>{const[w,A]=x.useState([]),[d,f]=x.useState(!1),[b,k]=x.useState(-1),[W,T]=x.useState(c),[Y,R]=x.useState("bottom"),I=x.useRef(null),q=x.useRef(null);x.useEffect(()=>{if(d&&I.current){const e=I.current.getBoundingClientRect(),p=280,l=window.innerHeight-e.bottom,F=e.top;l<p&&F>l?R("top"):R("bottom")}},[d]),x.useEffect(()=>{let e=!0;const p=()=>{(h?h():U()).then(r=>{e&&A(r)}).catch(()=>{})};p();const l=oe(()=>{e&&p()});return()=>{e=!1,l()}},[h]),x.useEffect(()=>{T(c)},[c]),x.useEffect(()=>{const e=p=>{I.current&&!I.current.contains(p.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const L=x.useMemo(()=>w.some(e=>e.hasConnectedAccount),[w]),O=x.useMemo(()=>{const e=(i||"").trim().toLowerCase(),p=new Set((m||[]).map(r=>r.toLowerCase()));let l=w;if(N===!1&&(l=l.filter(r=>!r.isCombo)),p.size>0&&(l=l.filter(r=>!p.has(r.value.toLowerCase())&&!p.has(r.id.toLowerCase()))),W&&L&&(l=l.filter(r=>r.hasConnectedAccount)),!e)return l.slice(0,50);const F=l.filter(r=>!!(r.value.toLowerCase().includes(e)||r.id.toLowerCase().includes(e)||r.name.toLowerCase().includes(e)||r.providerName.toLowerCase().includes(e)||r.providerId.toLowerCase().includes(e)||r.isCombo&&(r.strategy&&r.strategy.toLowerCase().includes(e)||r.models&&r.models.some(M=>M.toLowerCase().includes(e)))));return F.sort((r,D)=>{const M=r.value.toLowerCase(),P=D.value.toLowerCase(),_=r.id.toLowerCase(),z=D.id.toLowerCase();return M===e||_===e?-1:P===e||z===e?1:M.startsWith(e)||_.startsWith(e)?-1:P.startsWith(e)||z.startsWith(e)?1:r.isCombo&&!D.isCombo?-1:!r.isCombo&&D.isCombo?1:0}),F.slice(0,50)},[w,i,W,L,m,N]);x.useEffect(()=>{if(b>=0&&q.current){const e=q.current.children[b];e&&e.scrollIntoView({block:"nearest"})}},[b]);const J=e=>{if(!o)if(e.key==="ArrowDown")e.preventDefault(),d?k(p=>p<O.length-1?p+1:0):f(!0);else if(e.key==="ArrowUp")e.preventDefault(),d?k(p=>p>0?p-1:O.length-1):f(!0);else if(e.key==="Enter")if(d&&b>=0&&O[b]){e.preventDefault();const p=O[b];n(p.value),f(!1),k(-1),u&&u()}else f(!1),u&&(e.preventDefault(),u());else e.key==="Escape"&&(e.preventDefault(),f(!1),k(-1))},Q=e=>{n(e),f(!1),k(-1)};return a.jsxs("div",{ref:I,className:"relative w-full",children:[a.jsx("input",{type:"text",value:i,onChange:e=>{n(e.target.value),d||f(!0),k(-1)},onFocus:()=>{(w.length===0||!E)&&U().then(e=>A(e)).catch(()=>{}),f(!0)},onKeyDown:J,placeholder:s,disabled:o,autoFocus:t,className:g||"w-full bg-[#0A0D14] border border-[#1E293B] rounded-xl pl-3 pr-8 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500"}),i&&!o&&a.jsx("button",{type:"button",onClick:()=>{n(""),k(-1)},className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors cursor-pointer flex items-center justify-center",title:"Clear input",children:a.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})}),d&&a.jsxs("div",{className:`absolute left-0 right-0 ${Y==="top"?"bottom-full mb-1.5":"top-full mt-1.5"} z-50 rounded-xl bg-[#0A0D14] border border-[#1E293B] shadow-2xl overflow-hidden animate-rt-scale-in min-w-[280px]`,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#1E293B] bg-[#05070B] text-[11px]",children:[a.jsxs("span",{className:"text-slate-400 font-mono text-[10.5px]",children:[O.length," models ",i.trim()?"found":"available"]}),a.jsxs("button",{type:"button",onMouseDown:e=>{e.preventDefault(),T(!W)},className:`px-2 py-0.5 rounded-md font-sans text-[10.5px] font-medium flex items-center gap-1 transition-all cursor-pointer ${W?"bg-emerald-500/15 border border-emerald-500/30 text-emerald-400":"bg-slate-800 border border-slate-700 text-slate-400 hover:text-slate-200"}`,title:W?"Showing only models from connected accounts. Click to show all catalog models.":"Showing all catalog models. Click to filter by connected accounts.",children:[a.jsx("span",{className:"material-symbols-outlined text-[12px]",children:W?"check":"filter_alt"}),"Connected only"]})]}),a.jsx("div",{ref:q,className:"max-h-56 overflow-y-auto divide-y divide-[#1E293B]/40",children:O.length===0?a.jsxs("div",{className:"p-3 text-center text-xs text-slate-500 space-y-1",children:[a.jsx("p",{children:"No matching models in catalog."}),a.jsx("p",{className:"text-[10.5px] text-slate-400",children:"Custom IDs are supported. Press Enter or click outside to use your custom model ID."}),W&&!L&&a.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),T(!1)},className:"mt-1 text-[11px] text-blue-400 hover:underline",children:"View all registry models"})]}):O.map((e,p)=>{const l=p===b,F=e.value===i;return a.jsxs("div",{onMouseDown:r=>{r.preventDefault(),Q(e.value)},onMouseEnter:()=>k(p),className:`px-3 py-2 cursor-pointer transition-colors flex items-center justify-between gap-2.5 ${l?"bg-blue-600/20 text-white":F?"bg-[#141B2D] text-slate-100":"hover:bg-white/5 text-slate-300"}`,children:[a.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.isCombo?a.jsx("span",{className:"px-1.5 py-0.2 rounded bg-cyan-500/20 border border-cyan-500/40 font-mono text-[9.5px] text-cyan-300 font-semibold tracking-wide",children:"COMBO"}):a.jsx("span",{className:"px-1.5 py-0.2 rounded bg-slate-800/80 border border-slate-700/60 font-mono text-[9.5px] text-slate-300",children:e.providerName||e.providerId}),a.jsx("span",{className:"font-medium text-xs text-slate-100 truncate",children:e.name}),e.isCombo&&e.strategy&&a.jsx("span",{className:`px-1.5 py-0.2 rounded font-sans text-[9px] font-medium border ${e.strategy==="round-robin"?"bg-cyan-950/40 text-cyan-300 border-cyan-500/30":e.strategy==="fusion"?"bg-purple-950/40 text-purple-300 border-purple-500/30":"bg-amber-950/40 text-amber-300 border-amber-500/30"}`,children:e.strategy==="round-robin"?"Round Robin":e.strategy==="fusion"?"Fusion":"Fallback"}),e.hasConnectedAccount&&a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-400 shrink-0",title:`Connected account active (${e.accountsCount})`})]}),e.isCombo&&e.models&&e.models.length>0?a.jsxs("div",{className:"font-mono text-[10.5px] text-slate-400 truncate",children:[a.jsxs("span",{className:"text-cyan-400 font-semibold",children:[e.models.length," model",e.models.length>1?"s":"",":"]})," ",a.jsxs("span",{className:"text-slate-300",children:[e.models.slice(0,3).join(", "),e.models.length>3?` +${e.models.length-3} more`:""]})]}):a.jsx("div",{className:"font-mono text-[10.5px] text-slate-400 truncate",children:e.value})]}),a.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:a.jsx(ae,{caps:e.caps,size:"xs",showLabels:!1})})]},e.value)})})]})]})};export{ae as C,pe as M,ue as a,U as b,G as g,ce as i,oe as o};
1
+ import{j as o,r as x}from"./vendor-BcOI2aZ9.js";import{g as X,a as Z}from"./metadataRegistry-W75_wn57.js";const k={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},I="[-_/:.]",ee=new RegExp([`(^|${I})(image|img)(${I}|$)`,"stable-image","gen[0-9]_image","nanobanana","imagine","t2v","i2v","flux","dall","sdxl","diffusion","embed","rerank","guard","moderation","tts","stt","whisper","voice","speech","audio"].join("|"),"i"),te=new RegExp([`(^|${I})(vision|vl|vlm|multimodal|omni|visual)(${I}|$)`,`[0-9]\\.[0-9]+v(${I}|$)`,`(^|${I})glm-[0-9]+v(${I}|$)`,"(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)"].join("|"),"i"),V={nvidia:{"minimaxai/minimax-m2.7":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072},"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"deepseek-ai/deepseek-v4-pro":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},"opencode-go":{"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072}}},A={"claude-fable-5-1":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-haiku-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-haiku-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-3-7-sonnet":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3},"claude-3.7-sonnet":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3},"claude-3-5-sonnet":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3.5-sonnet":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3-5-haiku":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3.5-haiku":{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192},"claude-3-opus":{vision:!0,contextWindow:2e5,maxOutput:4096},"claude-3-haiku":{vision:!0,contextWindow:2e5,maxOutput:4096},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-chat":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"deepseek-reasoner":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3,maxOutput:64e3},"deepseek-r1":{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3,maxOutput:64e3},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3,maxOutput:64e3},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"gpt-image-1":{imageOutput:!0,tools:!1}};function D(n){if(!n)return!1;const t=String(n).toLowerCase();return ee.test(t)?!1:te.test(t)}function H(n,t){return!n||!t?!1:new RegExp("^"+n.split("*").map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(t)}const ne=[{pattern:"*claude*opus-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1}},{pattern:"*claude*opus-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1}},{pattern:"*claude*sonnet-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1}},{pattern:"*claude*sonnet-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1}},{pattern:"*claude*haiku-5.5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-5-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4-7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-4-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*haiku-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*3.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*3-7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*3.5*sonnet*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3-5*sonnet*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3.5*haiku*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3-5*haiku*",caps:{vision:!0,search:!0,contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*3*opus*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*3*sonnet*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*3*haiku*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude-3*",caps:{vision:!0,contextWindow:2e5,maxOutput:4096}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:8192}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:2e5,maxOutput:64e3}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-6.1-terra*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:128e3}},{pattern:"*gpt-6.1-sol*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*deepseek*v4.1*flash*free*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:33e4,maxOutput:128e3}},{pattern:"*deepseek-v4.*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{vision:!1,reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k3.1*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*k3.1*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}}];function K(n){if(n){if(Array.isArray(n)){const t={};for(const u of n)typeof u=="string"&&(t[u]=!0);return t}return n}}function G(n,t){if(!t)return{...k};const u=t.includes("/")?t.split("/").pop():t,c=!n&&t.includes("/")?t.split("/")[0]:n,d=c?c.replace(/\[.*?\]$/,""):null;if(d){const a=X(d);if(a!=null&&a.models){const l=a.models.find(s=>s.id===t||s.id===u||s.upstreamModelId&&(s.upstreamModelId===t||s.upstreamModelId===u));if(l!=null&&l.capabilities){const s=K(l.capabilities);if(s){const h={...k,...s};return!h.vision&&D(t)&&(h.vision=!0),h}}}}else for(const a of Z()){if(!a.models)continue;const l=a.models.find(s=>s.id===t||s.id===u||s.upstreamModelId&&(s.upstreamModelId===t||s.upstreamModelId===u));if(l!=null&&l.capabilities){const s=K(l.capabilities);if(s){const h={...k,...s};return!h.vision&&D(t)&&(h.vision=!0),h}}}if(d&&V[d]){const a=V[d];if(a[t])return{...k,...a[t]};if(a[u])return{...k,...a[u]}}if(A[u]){const a={...k,...A[u]};return!a.vision&&D(t)&&(a.vision=!0),a}if(A[t]){const a={...k,...A[t]};return!a.vision&&D(t)&&(a.vision=!0),a}for(const{pattern:a,caps:l}of ne)if(H(a,u)||H(a,t)){const s={...k,...l};return!s.vision&&D(t)&&(s.vision=!0),s}const i={...k};return!i.vision&&D(t)&&(i.vision=!0),i}function ce(n,t,u=0){if(!n||n.length===0||u>6)return null;const c=n.map(i=>{!i.includes("/")&&(t!=null&&t[i]);const a=i.indexOf("/"),l=a===-1?null:i.slice(0,a),s=a===-1?i:i.slice(a+1);return G(l,s)}),d=c[0];return{vision:c.some(i=>i.vision),pdf:c.some(i=>i.pdf),audioInput:c.some(i=>i.audioInput),videoInput:c.some(i=>i.videoInput),imageOutput:c.some(i=>i.imageOutput),audioOutput:c.some(i=>i.audioOutput),search:c.some(i=>i.search),tools:c.every(i=>i.tools),reasoning:d.reasoning,thinkingFormat:d.thinkingFormat,thinkingCanDisable:d.thinkingCanDisable,thinkingRange:d.thinkingRange,thinkingEffortSupported:d.thinkingEffortSupported,contextWindow:Math.min(...c.map(i=>i.contextWindow)),maxOutput:Math.max(...c.map(i=>i.maxOutput))}}const M={vision:{key:"vision",label:"Vision",icon:"visibility",desc:"Supports image inputs (png, jpg, webp, base64)",colorClass:"text-cyan-400",bgClass:"bg-cyan-500/10",borderClass:"border-cyan-500/20"},pdf:{key:"pdf",label:"PDF",icon:"picture_as_pdf",desc:"Supports PDF and document parsing",colorClass:"text-orange-400",bgClass:"bg-orange-500/10",borderClass:"border-orange-500/20"},audio:{key:"audio",label:"Audio",icon:"graphic_eq",desc:"Supports raw voice and audio speech input",colorClass:"text-purple-400",bgClass:"bg-purple-500/10",borderClass:"border-purple-500/20"},thinking:{key:"thinking",label:"Thinking",icon:"psychology",desc:"Supports reasoning and thinking trace",colorClass:"text-emerald-400",bgClass:"bg-emerald-500/10",borderClass:"border-emerald-500/20"}};function ie(n){if(!n)return null;const t=n.indexOf("/"),u=t===-1?null:n.slice(0,t),c=t===-1?n:n.slice(t+1);return G(u,c)}const ae=({caps:n,model:t,className:u="",showLabels:c=!1,size:d="sm"})=>{const i=n||(t?ie(t):null);if(!i)return null;const a=!!i.vision,l=!!i.pdf,s=!!(i.audioInput||i.audio),h=!!(i.reasoning||i.thinking||i.thinkingFormat&&i.thinkingFormat!==null),f=[];if(a&&f.push(M.vision),l&&f.push(M.pdf),s&&f.push(M.audio),h&&f.push(M.thinking),f.length===0)return null;const W={xs:"text-[12px]",sm:"text-[14px]",md:"text-[16px]"},$={xs:"text-[9.5px]",sm:"text-[10.5px]",md:"text-xs"};return o.jsx("div",{className:`inline-flex items-center gap-1.5 flex-wrap ${u}`,children:f.map(g=>o.jsxs("span",{title:`${g.label}: ${g.desc}`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md border font-medium transition-all ${g.colorClass} ${g.bgClass} ${g.borderClass} ${$[d]}`,children:[o.jsx("span",{className:`material-symbols-outlined leading-none ${W[d]}`,children:g.icon}),c&&o.jsx("span",{children:g.label})]},g.key))})};function oe(n,t){if(!t.trim())return!0;const u=t.toLowerCase().trim(),c=n.toLowerCase();if(c.includes(u))return!0;const d=u.split(/\s+/).filter(Boolean);if(d.length===0)return!0;const i=c.replace(/[-_./]/g," ");return d.every(a=>c.includes(a)||i.includes(a))}let E=null,N=null;const B=new Set;function re(n){return B.add(n),()=>{B.delete(n)}}function pe(){E=null,N=null;for(const n of B)try{n()}catch(t){console.error("Error in model cache invalidation listener:",t)}}function U(){return N?Promise.resolve(N):(E||(E=fetch("/api/models/available").then(n=>{if(!n.ok)throw new Error("Failed to load models");return n.json()}).then(n=>(N=n,n)).catch(n=>{throw E=null,n})),E)}const de=({value:n,onChange:t,onEnter:u,placeholder:c="Search model (e.g. openai/gpt-4o)...",className:d="",autoFocus:i=!1,connectedOnly:a=!0,disabled:l=!1,excludeValues:s,allowCombos:h=!0,fetchCustomModels:f})=>{const[W,$]=x.useState([]),[g,v]=x.useState(!1),[O,w]=x.useState(-1),[F,S]=x.useState(a),[Q,P]=x.useState("bottom"),j=x.useRef(null),T=x.useRef(null);x.useEffect(()=>{if(g&&j.current){const e=j.current.getBoundingClientRect(),p=280,m=window.innerHeight-e.bottom,y=e.top;m<p&&y>m?P("top"):P("bottom")}},[g]),x.useEffect(()=>{let e=!0;const p=()=>{(f?f():U()).then(r=>{e&&$(r)}).catch(()=>{})};p();const m=re(()=>{e&&p()});return()=>{e=!1,m()}},[f]),x.useEffect(()=>{S(a)},[a]),x.useEffect(()=>{const e=p=>{j.current&&!j.current.contains(p.target)&&v(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const q=x.useMemo(()=>W.some(e=>e.hasConnectedAccount),[W]),C=x.useMemo(()=>{const e=(n||"").trim().toLowerCase(),p=new Set((s||[]).map(r=>r.toLowerCase()));let m=W;if(h===!1&&(m=m.filter(r=>!r.isCombo)),p.size>0&&(m=m.filter(r=>!p.has(r.value.toLowerCase())&&!(r.isCombo&&p.has(r.id.toLowerCase())))),F&&q&&(m=m.filter(r=>r.hasConnectedAccount)),!e)return m.slice(0,50);const y=m.filter(r=>{let b=`${r.name} ${r.id} ${r.value} ${r.providerName} ${r.providerId}`;return r.isCombo&&(r.strategy&&(b+=` ${r.strategy}`),r.models&&(b+=` ${r.models.join(" ")}`)),oe(b,e)});return y.sort((r,b)=>{const R=r.value.toLowerCase(),_=b.value.toLowerCase(),L=r.id.toLowerCase(),z=b.id.toLowerCase();return R===e||L===e?-1:_===e||z===e?1:R.startsWith(e)||L.startsWith(e)?-1:_.startsWith(e)||z.startsWith(e)?1:r.isCombo&&!b.isCombo?-1:!r.isCombo&&b.isCombo?1:0}),y.slice(0,50)},[W,n,F,q,s,h]);x.useEffect(()=>{if(O>=0&&T.current){const e=T.current.children[O];e&&e.scrollIntoView({block:"nearest"})}},[O]);const Y=e=>{if(!l)if(e.key==="ArrowDown")e.preventDefault(),g?w(p=>p<C.length-1?p+1:0):v(!0);else if(e.key==="ArrowUp")e.preventDefault(),g?w(p=>p>0?p-1:C.length-1):v(!0);else if(e.key==="Enter")if(g&&O>=0&&C[O]){e.preventDefault();const p=C[O];t(p.value),v(!1),w(-1),u&&u(p.value)}else v(!1),u&&(e.preventDefault(),u(n));else e.key==="Escape"&&(e.preventDefault(),v(!1),w(-1))},J=e=>{t(e),v(!1),w(-1)};return o.jsxs("div",{ref:j,className:"relative w-full",children:[o.jsx("input",{type:"text",value:n,onChange:e=>{t(e.target.value),g||v(!0),w(-1)},onFocus:()=>{(W.length===0||!N)&&U().then(e=>$(e)).catch(()=>{}),v(!0)},onKeyDown:Y,placeholder:c,disabled:l,autoFocus:i,className:d||"w-full bg-[#0A0D14] border border-[#1E293B] rounded-xl pl-3 pr-8 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500"}),n&&!l&&o.jsx("button",{type:"button",onClick:()=>{t(""),w(-1)},className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors cursor-pointer flex items-center justify-center",title:"Clear input",children:o.jsx("span",{className:"material-symbols-outlined text-[15px]",children:"close"})}),g&&o.jsxs("div",{className:`absolute left-0 right-0 ${Q==="top"?"bottom-full mb-1.5":"top-full mt-1.5"} z-50 rounded-xl bg-[#0A0D14] border border-[#1E293B] shadow-2xl overflow-hidden animate-rt-scale-in min-w-[280px]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#1E293B] bg-[#05070B] text-[11px]",children:[o.jsxs("span",{className:"text-slate-400 font-mono text-[10.5px]",children:[C.length," models ",n.trim()?"found":"available"]}),o.jsxs("button",{type:"button",onMouseDown:e=>{e.preventDefault(),S(!F)},className:`px-2 py-0.5 rounded-md font-sans text-[10.5px] font-medium flex items-center gap-1 transition-all cursor-pointer ${F?"bg-emerald-500/15 border border-emerald-500/30 text-emerald-400":"bg-slate-800 border border-slate-700 text-slate-400 hover:text-slate-200"}`,title:F?"Showing only models from connected accounts. Click to show all catalog models.":"Showing all catalog models. Click to filter by connected accounts.",children:[o.jsx("span",{className:"material-symbols-outlined text-[12px]",children:F?"check":"filter_alt"}),"Connected only"]})]}),o.jsx("div",{ref:T,className:"max-h-56 overflow-y-auto divide-y divide-[#1E293B]/40",children:C.length===0?o.jsxs("div",{className:"p-3 text-center text-xs text-slate-500 space-y-1",children:[o.jsx("p",{children:"No matching models in catalog."}),o.jsx("p",{className:"text-[10.5px] text-slate-400",children:"Custom IDs are supported. Press Enter or click outside to use your custom model ID."}),F&&!q&&o.jsx("button",{type:"button",onMouseDown:e=>{e.preventDefault(),S(!1)},className:"mt-1 text-[11px] text-blue-400 hover:underline",children:"View all registry models"})]}):C.map((e,p)=>{const m=p===O,y=e.value===n;return o.jsxs("div",{onMouseDown:r=>{r.preventDefault(),J(e.value)},onMouseEnter:()=>w(p),className:`px-3 py-2 cursor-pointer transition-colors flex items-center justify-between gap-2.5 ${m?"bg-blue-600/20 text-white":y?"bg-[#141B2D] text-slate-100":"hover:bg-white/5 text-slate-300"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.isCombo?o.jsx("span",{className:"px-1.5 py-0.2 rounded bg-cyan-500/20 border border-cyan-500/40 font-mono text-[9.5px] text-cyan-300 font-semibold tracking-wide",children:"COMBO"}):o.jsx("span",{className:"px-1.5 py-0.2 rounded bg-slate-800/80 border border-slate-700/60 font-mono text-[9.5px] text-slate-300",children:e.providerName||e.providerId}),o.jsx("span",{className:"font-medium text-xs text-slate-100 truncate",children:e.name}),e.isCombo&&e.strategy&&o.jsx("span",{className:`px-1.5 py-0.2 rounded font-sans text-[9px] font-medium border ${e.strategy==="round-robin"?"bg-cyan-950/40 text-cyan-300 border-cyan-500/30":e.strategy==="fusion"?"bg-purple-950/40 text-purple-300 border-purple-500/30":"bg-amber-950/40 text-amber-300 border-amber-500/30"}`,children:e.strategy==="round-robin"?"Round Robin":e.strategy==="fusion"?"Fusion":"Fallback"}),e.hasConnectedAccount&&o.jsx("span",{className:"size-1.5 rounded-full bg-emerald-400 shrink-0",title:`Connected account active (${e.accountsCount})`})]}),e.isCombo&&e.models&&e.models.length>0?o.jsxs("div",{className:"font-mono text-[10.5px] text-slate-400 truncate",children:[o.jsxs("span",{className:"text-cyan-400 font-semibold",children:[e.models.length," model",e.models.length>1?"s":"",":"]})," ",o.jsxs("span",{className:"text-slate-300",children:[e.models.slice(0,3).join(", "),e.models.length>3?` +${e.models.length-3} more`:""]})]}):o.jsx("div",{className:"font-mono text-[10.5px] text-slate-400 truncate",children:e.value})]}),o.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:o.jsx(ae,{caps:e.caps,size:"xs",showLabels:!1})})]},e.value)})})]})]})};export{ae as C,de as M,ce as a,U as b,G as g,pe as i,oe as m,re as o};