@yxp934/prompt-tree 0.2.0 → 0.3.0
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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +4 -4
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/agent/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/providers/health/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/providers/models/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/providers/test/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/mcp/call-tool/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/mcp/list-tools/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/mcp/test/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/python/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/search/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +2 -2
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings.html +1 -1
- package/.next/standalone/.next/server/app/settings.rsc +3 -3
- package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +4 -4
- package/.next/standalone/.next/server/chunks/471.js +4 -4
- package/.next/standalone/.next/server/chunks/689.js +1 -1
- package/.next/standalone/.next/server/chunks/732.js +3 -3
- package/.next/standalone/.next/server/chunks/734.js +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/static/chunks/{394-1e8c9367852fd6d7.js → 394-dc41566095beafcf.js} +1 -1
- package/.next/standalone/.next/static/chunks/787-12058ee9986bdbfc.js +1 -0
- package/.next/standalone/.next/static/chunks/app/settings/page-76e3d482410f0adc.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/README.md +134 -120
- package/README.zh-CN.md +200 -0
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/787-56a48f915165efd3.js +0 -1
- package/.next/standalone/.next/static/chunks/app/settings/page-0fc8a4cbf639025c.js +0 -1
- /package/.next/standalone/.next/static/{wYfac0R-RsurEa801s_qH → i6P3teUAVQJ-hEG3Y6KV0}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{wYfac0R-RsurEa801s_qH → i6P3teUAVQJ-hEG3Y6KV0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[787],{513:(e,t,o)=>{o.d(t,{k:()=>a});var s=o(2115),r=o(4394),n=o(1766);function a(){let e=(0,r.CU)(e=>e.locale);return(0,s.useMemo)(()=>(t,o)=>(0,n.t)(e,t,o),[e])}},1379:(e,t,o)=>{o.d(t,{a:()=>a});var s=o(5155),r=o(2115),n=o(513);function a({open:e,title:t,children:o,onClose:a}){let i=(0,n.k)();return((0,r.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&a()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,a]),e)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6",children:[(0,s.jsx)("button",{className:"absolute inset-0 bg-ink/30","aria-label":i("modal.closeAria"),onClick:a}),(0,s.jsxs)("div",{className:"relative w-full max-w-[520px] rounded-2xl border border-parchment bg-cream p-6 shadow-[0_22px_60px_rgba(35,31,28,0.18)]",children:[(0,s.jsx)("div",{className:"mb-4 font-display text-[1.15rem] text-ink",children:t}),o]})]}):null}},1766:(e,t,o)=>{o.d(t,{d:()=>n,t:()=>r});let s={en:{"common.appName":"Prompt Tree","common.add":"Add","common.cancel":"Cancel","common.clear":"Clear","common.close":"Close","common.copy":"Copy","common.copied":"Copied","common.data":"Data","common.delete":"Delete","common.edit":"Edit","common.hide":"Hide","common.loading":"Loading…","common.new":"New","common.save":"Save","common.selectAll":"Select all","common.settings":"Settings","common.show":"Show","common.tools":"Tools","modal.closeAria":"Close modal","layout.closeSidebarAria":"Close sidebar","layout.closeContextPanelAria":"Close context panel","node.author.assistant":"Assistant","node.author.you":"You","node.author.system":"System","node.author.compressed":"Compressed","node.type.system":"System","node.type.user":"User","node.type.assistant":"Assistant","node.type.compressed":"Compressed","header.menu":"Menu","header.context":"Context","header.fallback.folder":"Folder","header.fallback.loading":"Loading…","header.nodes":"nodes","header.branches":"branches","header.threads":"threads","header.toggleTheme":"Toggle theme","header.theme.light":"Light","header.theme.dark":"Dark","sidebar.tagline":"Dialogue Topology","sidebar.library":"Library","sidebar.newThread":"New Thread","sidebar.newFolder":"New Folder","sidebar.deleteFolderAria":"Delete folder","sidebar.deleteThreadAria":"Delete thread","sidebar.nodeCount":"{count} nodes","sidebar.threadCount":"{count} threads","sidebar.confirmDeleteFolderTitle":"Delete folder?","sidebar.confirmDeleteThreadTitle":"Delete thread?","sidebar.confirmDeleteFolderBody":"Delete folder “{name}”. {threadNote}This action cannot be undone.","sidebar.confirmDeleteFolderThreadNote":"{count} threads will be moved to Home. ","sidebar.confirmDeleteThreadBody":"Delete thread “{title}”. This action cannot be undone.","folder.deleteFolder":"Delete folder","folder.deleteThreadAria":"Delete thread","folder.threadPreviewAria":"Thread canvas preview","folder.empty.selectFolder":"Select a folder to view its threads.","folder.empty.notFound":"Folder not found.","folder.label":"Folder","folder.namePlaceholder":"Folder name (max {count} chars)","folder.newThread":"New Thread","folder.systemPrompt.title":"Unified System Prompt","folder.systemPrompt.collapsedEmpty":"Tap to add a prompt","folder.systemPrompt.placeholder":"This will be the first (system) node of every thread in this folder.","folder.systemPrompt.note":"Applies to all threads in this folder (root system node).","folder.models.title":"Enabled Models","folder.models.allEnabled":"All enabled","folder.models.none":"None","folder.models.selectedCount":"{count} selected","folder.models.noneEnabled":"No models enabled.","folder.models.configureInSettings":"Configure in Settings","folder.models.help":"Click to edit the folder model set.","folder.models.noneSelected":"No models selected for this folder.","folder.models.picker.title":"Folder Enabled Models","folder.models.picker.description":"Pick from globally enabled models.","folder.models.picker.selected":"Selected:","folder.threads.title":"Threads ({count})","folder.threads.empty.title":"No threads yet","folder.threads.empty.description":"Create a thread in this folder. It will inherit the unified system prompt above.","folder.threads.empty.action":"Create Thread","chat.input.placeholder":"Type your message…","chat.input.attach":"Attach","chat.input.send":"Send","chat.input.modelMeta":"Model: {model}{tempPart}","chat.input.modelMetaNone":"Model: —","chat.input.tempPart":" - Temp: {temp}","chat.input.models":"Models","chat.input.enabledModels":"Enabled Models","chat.input.toolUse":"Tool Use","chat.input.tool.webSearch":"Web Search","chat.input.tool.python":"Python","chat.input.tool.pythonSubtitle":"Online code execution","chat.message.retry":"Retry","chat.message.copyResponseAria":"Copy response","chat.message.retryResponseAria":"Retry response","chat.message.toolUseEnabledTitle":"Tool use enabled for this message","chat.tool.args":"Args","chat.tool.error":"Error","chat.tool.result":"Result","chat.tool.unknownError":"Unknown error","chat.tool.status.ok":"ok","chat.tool.status.error":"error","chat.tool.status.running":"running…","chat.thinking":"Thinking…","chat.noConversationLoaded":"No conversation loaded.","chat.modelLabel.count":"{count} models","chat.contextTokens":"Context: {used} / {max}","context.title":"Context Assembly","context.subtitle":"Build your prompt","context.tokenUsage":"Token Usage","context.activeNodes":"Active Nodes","context.clearAll":"Clear all","context.toolBlocks":"Tool Blocks","context.dropzone.title":"Drag nodes here","context.dropzone.subtitle":"Drop to insert into context","context.optimize":"Optimize Context","context.preview.button":"Preview Full Context","context.preview.title":"Full Context Preview","context.preview.building":"Building context…","context.preview.failed":"Failed to build context.","context.removeFromContextAria":"Remove from context","context.card.system":"System Prompt","context.card.user":"User Message","context.card.compressed":"Compressed","context.compress.title":"Compress Nodes","context.compress.selection":"Selection ({count})","context.compress.noneSelected":"No nodes selected.","context.compress.summary":"Summary","context.compress.summaryPlaceholder":"2–3 sentences. You can generate with AI, then edit.","context.compress.language":"Language","context.compress.languagePlaceholder":"zh-CN / en","context.compress.format":"Format","context.compress.formatPlaceholder":"markdown / json","context.compress.role":"Role","context.compress.rolePlaceholder":"expert","context.compress.generate":"Generate with AI","context.compress.confirm":"Compress","context.compress.selected":"Compress Selected ({count})","context.compress.context":"Compress Context ({count})","context.compress.errors.minTwoNodes":"Select at least 2 nodes from the same path to compress.","context.compress.errors.noGaps":"Selection must be a single continuous path (no gaps).","context.compress.errors.noBranches":"Selection must be a single continuous path (no branches).","context.compress.errors.invalidSelection":"Invalid selection","tree.controls.zoomOut":"Zoom out","tree.controls.zoomIn":"Zoom in","tree.controls.fitView":"Fit view","tree.controls.autoLayout":"Auto layout","tree.menu.continueFromHere":"Continue from here","tree.menu.compressBranch":"Compress branch","tree.menu.decompressConfirm":"Decompress this node and restore the full chain?","tree.menu.decompress":"Decompress","tree.menu.addToContext":"Add to Context","tree.menu.editNode":"Edit node","tree.menu.deleteSubtree":"Delete subtree","tree.editor.title":"Edit Node","tree.node.emptySummary":"(empty summary)","tree.node.emptyContent":"(empty)","tree.node.dragToContextAria":"Drag node to context","tree.node.expandCompressedAria":"Expand compressed node","tree.node.collapseCompressedAria":"Collapse compressed node","branches.title":"Branches","branches.activeCount":"{count} active","branches.default.compressed":"Compressed branch","branches.default.type":"{type} branch","settings.nav.configuration":"Configuration","settings.nav.providers":"Model Service","settings.nav.defaultModel":"Default Model","settings.nav.tools":"Tools","settings.nav.general":"Participation","settings.nav.display":"Display","settings.nav.data":"Data","settings.nav.about":"About","settings.backToHome":"Back to Home","providers.title":"Service Providers","providers.deleteAria":"Delete provider","providers.empty.title":"No providers yet","providers.empty.description":"Click below to add one.","providers.add":"Add provider","providers.dialog.title":"Add provider","providers.dialog.nameLabel":"Provider Name","providers.dialog.namePlaceholder":"OpenAI, Anthropic, DeepSeek…","providerConfig.empty.title":"Select or add a provider","providerConfig.empty.description":"Choose a provider from the middle list to configure.","providerConfig.check.running":"Checking…","providerConfig.check.button":"Test connection","providerConfig.apiKeys.title":"API Key","providerConfig.apiKeys.namePlaceholder":"Key name","providerConfig.apiKeys.primary":"Primary","providerConfig.apiKeys.setPrimary":"Set as primary","providerConfig.apiKeys.add":"Add key","providerConfig.baseUrl.title":"Base URL","providerConfig.baseUrl.preview":"Preview: {url}","providerConfig.models.title":"Models","providerConfig.models.select":"Select models","providerConfig.models.enabled":"Enabled ({count})","providerConfig.models.disabled":"Disabled ({count})","providerConfig.models.streaming":"Streaming","providerConfig.models.empty.title":"No models","providerConfig.models.empty.description":"Click “Select models” to add.","providerConfig.addKey.title":"Add API Key","providerConfig.addKey.nameLabel":"Name","providerConfig.addKey.namePlaceholder":"Primary / backup","providerConfig.addKey.valueLabel":"API Key","errors.connectionFailed":"Connection failed","errors.requestFailedWithStatus":"Request failed ({status})","errors.invalidRequestBody":"Invalid request body","errors.missingApiKey":"Missing API key","errors.invalidBaseUrl":"Invalid Base URL","errors.invalidApiKey":"Invalid API key","errors.requestTimeout":"Request timeout","errors.unknownError":"Unknown error","errors.failedToFetchModels":"Failed to fetch models","errors.missingOpenAIApiKey":"Missing OpenAI API key. Add it in Settings.","errors.noActiveConversationTree":"No active conversation tree loaded.","errors.failedToSendMessage":"Failed to send message","errors.failedToRetryMessage":"Failed to retry message","errors.failedToCompressNodes":"Failed to compress nodes","errors.failedToDecompressNode":"Failed to decompress node","errors.failedToGenerateSuggestion":"Failed to generate suggestion","settings.display.title":"Display","settings.display.description":"Manage theme and language.","settings.display.theme":"Theme","settings.display.theme.light":"Light","settings.display.theme.lightDesc":"Best for daylight environments.","settings.display.theme.dark":"Dark","settings.display.theme.darkDesc":"Best for low-light environments.","settings.display.language":"Language","settings.display.language.en":"English","settings.display.language.enDesc":"Use English UI copy.","settings.display.language.zhCN":"中文","settings.display.language.zhCNDesc":"使用中文界面(保留常用英文术语)。","settings.defaultModel.title":"Model Settings","settings.defaultModel.description":"Select branch models and configure compression + title generation.","settings.defaultModel.enabledModels.title":"Enabled models","settings.defaultModel.enabledModels.description":"When multiple models are selected, sending a message generates parallel branches.","settings.defaultModel.enabledModels.emptyTitle":"No enabled models","settings.defaultModel.enabledModels.emptyDescription":"Enable models first in Model Service.","settings.defaultModel.compressionModel.title":"Compression model","settings.defaultModel.compressionModel.placeholder":"Select a compression model","settings.defaultModel.compressionModel.description":"Used to generate compressed summaries and meta-instruction suggestions.","settings.defaultModel.summaryModel.title":"Title model","settings.defaultModel.summaryModel.placeholder":"Select a title model","settings.defaultModel.summaryModel.description":"Used to generate the conversation title after the first message.","settings.defaultModel.test.title":"Model test","settings.defaultModel.test.latency":"Latency {ms}ms","settings.defaultModel.test.running":"Testing…","settings.defaultModel.test.button":"Test model","settings.defaultModel.test.selectModelFirst":"Select a model first.","settings.defaultModel.test.providerMissing":"Provider not found.","settings.defaultModel.test.success":"Connected","settings.defaultModel.test.failed":"Test failed","settings.general.title":"Participation","settings.general.description":"Manage generation parameters.","settings.general.api.title":"API","settings.general.api.apiKeyLabel":"API Key","settings.general.api.baseUrlLabel":"Base URL","settings.general.generation.title":"Parameters","settings.general.generation.temperature":"Temperature","settings.general.generation.maxTokens":"Max Tokens","settings.general.saveHint":"Changes are saved locally in your browser.","settings.general.saveButton":"Save settings","settings.general.saved":"Saved","settings.data.title":"Data","settings.data.description":"Manage locally stored conversation data and settings.","settings.data.clear.title":"Clear conversations","settings.data.clear.description":"Deletes all conversations stored in IndexedDB.","settings.data.clear.button":"Clear data","settings.data.clear.running":"Clearing…","settings.data.clear.confirm":"Confirm","settings.data.clear.success":"Conversation data cleared. Reloading…","settings.data.clear.failed":"Clear failed","settings.data.reset.title":"Reset settings","settings.data.reset.description":"Clears providers, API keys, and theme settings.","settings.data.reset.button":"Reset settings","settings.data.reset.running":"Resetting…","settings.data.reset.confirm":"Confirm","settings.data.reset.success":"Settings reset. Reloading…","settings.data.reset.failed":"Reset failed","settings.about.title":"About","settings.about.description":"Learn about Prompt Tree version and stack.","settings.about.version.label":"Version","settings.about.version.value":"Prompt Tree v0.3.0","settings.about.framework.label":"Framework","settings.about.framework.value":"Next.js 14 + React 18","settings.about.storage.label":"Storage","settings.about.storage.value":"IndexedDB + LocalStorage","settings.about.contact.email":"Email","settings.about.contact.wechat":"WeChat","settings.tools.title":"Tools","settings.tools.description":"Configure Web Search (Exa/Tavily), MCP servers, and Python execution.","settings.tools.search.title":"Web Search","settings.tools.search.defaultProvider":"Default Provider","settings.tools.search.searchDepth":"Search Depth","settings.tools.search.maxResults":"Max Results","settings.tools.search.depth.basic":"basic","settings.tools.search.depth.advanced":"advanced","settings.tools.search.missingApiKey":"Set {provider} API Key first.","settings.tools.search.test.title":"Connection test","settings.tools.search.test.latency":"Latency {ms}ms","settings.tools.search.test.running":"Testing…","settings.tools.search.test.button":"Test connection","settings.tools.search.test.success":"Connected","settings.tools.search.test.successWithTitle":"Connected \xb7 {title}","settings.tools.search.test.failed":"Connection test failed","settings.tools.mcp.add":"Add MCP","settings.tools.mcp.description":"Configure MCP via JSON (Streamable HTTP / Legacy SSE / stdio) and set a token per server.","settings.tools.mcp.empty.title":"No MCP Servers","settings.tools.mcp.empty.description":"Click “New” above and paste your MCP config JSON.","settings.tools.mcp.logs":"Logs","settings.tools.mcp.tools":"Tools","settings.tools.mcp.expand":"Expand","settings.tools.mcp.collapse":"Collapse","settings.tools.mcp.noTools":"No tools returned (tools = 0)","settings.tools.mcp.serverNotFound":"MCP server does not exist or was removed.","settings.tools.mcp.invalidTestResponse":"Invalid MCP test response (expected SSE).","settings.tools.mcp.test.button":"Test connection","settings.tools.mcp.test.running":"Testing…","settings.tools.mcp.test.success":"Connected \xb7 {count} tools","settings.tools.mcp.test.failed":"Connection test failed","settings.tools.mcp.test.noResult":"MCP test finished without result.","settings.tools.mcp.newServerName":"New MCP Server","settings.tools.mcp.modal.title":"MCP Server","settings.tools.mcp.modal.titleWithName":"MCP Server \xb7 {name}","settings.tools.mcp.editor.serverId":"Server ID","settings.tools.mcp.editor.name":"Name","settings.tools.mcp.editor.transport":"Transport","settings.tools.mcp.editor.token":"Token","settings.tools.mcp.editor.tokenPlaceholder":"Bearer token (optional)","settings.tools.mcp.editor.configJson":"Config JSON","settings.tools.mcp.editor.configNote":"This JSON is not validated; it is parsed at runtime.","settings.tools.mcp.editor.idRequired":"Server ID is required.","settings.tools.mcp.editor.nameRequired":"Server name is required.","settings.tools.python.title":"Python Execution","settings.tools.python.timeoutSeconds":"Timeout (seconds)","settings.tools.python.maxOutputChars":"Max Output (chars)","settings.tools.python.command":"Python Command","settings.tools.python.note":"For local runs, keep this as python3.","modelSelector.providerFallback":"Provider","modelSelector.models":"Models","modelSelector.searchPlaceholder":"Search model ID or name","modelSelector.fetching":"Fetching models…","modelSelector.fetchFailed":"Failed to fetch models","modelSelector.noMatches":"No matching models","modelSelector.noModels":"No available models","modelSelector.tryOtherQuery":"Try another search query.","modelSelector.configureApiKey":"Configure API Key and refresh.","modelSelector.selectedCount":"Selected {count} models","modelSelector.addSelected":"Add selected","modelSelector.addCount":"Add {count}","modelCategory.all":"All","modelCategory.chat":"Chat","modelCategory.reasoning":"Reasoning","modelCategory.vision":"Vision","modelCategory.embedding":"Embedding","modelCategory.tool":"Tool","modelCategory.other":"Other"},"zh-CN":{"common.appName":"Prompt Tree","common.add":"添加","common.cancel":"取消","common.clear":"清空","common.close":"关闭","common.copy":"复制","common.copied":"已复制","common.data":"数据","common.delete":"删除","common.edit":"编辑","common.hide":"隐藏","common.loading":"加载中…","common.new":"新建","common.save":"保存","common.selectAll":"全选","common.settings":"设置","common.show":"显示","common.tools":"Tools","modal.closeAria":"关闭弹窗","layout.closeSidebarAria":"关闭侧边栏","layout.closeContextPanelAria":"关闭 Context 面板","node.author.assistant":"Assistant","node.author.you":"你","node.author.system":"System","node.author.compressed":"Compressed","node.type.system":"System","node.type.user":"User","node.type.assistant":"Assistant","node.type.compressed":"Compressed","header.menu":"菜单","header.context":"Context","header.fallback.folder":"文件夹","header.fallback.loading":"加载中…","header.nodes":"个节点","header.branches":"条分支","header.threads":"个线程","header.toggleTheme":"切换主题","header.theme.light":"Light","header.theme.dark":"Dark","sidebar.tagline":"Dialogue Topology","sidebar.library":"Library","sidebar.newThread":"New Thread","sidebar.newFolder":"New Folder","sidebar.deleteFolderAria":"删除文件夹","sidebar.deleteThreadAria":"删除线程","sidebar.nodeCount":"{count} 个节点","sidebar.threadCount":"{count} 个线程","sidebar.confirmDeleteFolderTitle":"确认删除文件夹?","sidebar.confirmDeleteThreadTitle":"确认删除线程?","sidebar.confirmDeleteFolderBody":"删除文件夹“{name}”。{threadNote}此操作不可撤销。","sidebar.confirmDeleteFolderThreadNote":"其中的 {count} 个线程将移动到主页。 ","sidebar.confirmDeleteThreadBody":"删除线程“{title}”。此操作不可撤销。","folder.deleteFolder":"删除文件夹","folder.deleteThreadAria":"删除线程","folder.threadPreviewAria":"线程画布预览","folder.empty.selectFolder":"请选择一个文件夹来查看线程。","folder.empty.notFound":"未找到该文件夹。","folder.label":"文件夹","folder.namePlaceholder":"文件夹名称(最多 {count} 个字符)","folder.newThread":"新建线程","folder.systemPrompt.title":"统一 System Prompt","folder.systemPrompt.collapsedEmpty":"点击添加 prompt","folder.systemPrompt.placeholder":"这将作为该文件夹内每个线程的首个(system)node。","folder.systemPrompt.note":"应用于此文件夹内的所有线程(root system node)。","folder.models.title":"启用的 Models","folder.models.allEnabled":"全部启用","folder.models.none":"无","folder.models.selectedCount":"已选择 {count} 个","folder.models.noneEnabled":"暂无启用模型。","folder.models.configureInSettings":"前往设置配置","folder.models.help":"点击编辑文件夹可用模型集合。","folder.models.noneSelected":"此文件夹未选择模型。","folder.models.picker.title":"文件夹启用模型","folder.models.picker.description":"从全局已启用模型中选择。","folder.models.picker.selected":"已选择:","folder.threads.title":"线程({count})","folder.threads.empty.title":"暂无线程","folder.threads.empty.description":"在此文件夹创建一个线程,它会继承上方统一的 system prompt。","folder.threads.empty.action":"创建线程","chat.input.placeholder":"输入消息…","chat.input.attach":"附件","chat.input.send":"发送","chat.input.modelMeta":"Model: {model}{tempPart}","chat.input.modelMetaNone":"Model: —","chat.input.tempPart":" - Temp: {temp}","chat.input.models":"Models","chat.input.enabledModels":"Enabled Models","chat.input.toolUse":"Tool Use","chat.input.tool.webSearch":"Web Search","chat.input.tool.python":"Python","chat.input.tool.pythonSubtitle":"联网 code execution","chat.message.retry":"重试","chat.message.copyResponseAria":"复制回复","chat.message.retryResponseAria":"重试回复","chat.message.toolUseEnabledTitle":"此消息已启用 tool use","chat.tool.args":"Args","chat.tool.error":"错误","chat.tool.result":"结果","chat.tool.unknownError":"未知错误","chat.tool.status.ok":"ok","chat.tool.status.error":"error","chat.tool.status.running":"运行中…","chat.thinking":"思考中…","chat.noConversationLoaded":"未加载对话。","chat.modelLabel.count":"{count} 个模型","chat.contextTokens":"Context: {used} / {max}","context.title":"Context 组装","context.subtitle":"构建你的 prompt","context.tokenUsage":"Token 用量","context.activeNodes":"已选节点","context.clearAll":"全部清除","context.toolBlocks":"Tool Blocks","context.dropzone.title":"将节点拖到这里","context.dropzone.subtitle":"松开以加入 Context","context.optimize":"优化 Context","context.preview.button":"预览完整 Context","context.preview.title":"完整 Context 预览","context.preview.building":"正在构建 Context…","context.preview.failed":"构建 Context 失败。","context.removeFromContextAria":"从 Context 移除","context.card.system":"System Prompt","context.card.user":"User Message","context.card.compressed":"Compressed","context.compress.title":"压缩节点","context.compress.selection":"选择({count})","context.compress.noneSelected":"未选择节点。","context.compress.summary":"摘要","context.compress.summaryPlaceholder":"2–3 句。可先用 AI 生成再编辑。","context.compress.language":"Language","context.compress.languagePlaceholder":"zh-CN / en","context.compress.format":"Format","context.compress.formatPlaceholder":"markdown / json","context.compress.role":"Role","context.compress.rolePlaceholder":"expert","context.compress.generate":"用 AI 生成","context.compress.confirm":"压缩","context.compress.selected":"压缩选中({count})","context.compress.context":"压缩 Context({count})","context.compress.errors.minTwoNodes":"请从同一路径选择至少 2 个节点进行压缩。","context.compress.errors.noGaps":"所选节点必须在同一条连续路径上(不能有断档)。","context.compress.errors.noBranches":"所选节点必须在同一条连续路径上(不能跨分支)。","context.compress.errors.invalidSelection":"无效选择","tree.controls.zoomOut":"缩小","tree.controls.zoomIn":"放大","tree.controls.fitView":"适配视图","tree.controls.autoLayout":"自动布局","tree.menu.continueFromHere":"从此处继续","tree.menu.compressBranch":"压缩分支","tree.menu.decompressConfirm":"解压此节点并恢复完整链路?","tree.menu.decompress":"解压","tree.menu.addToContext":"加入 Context","tree.menu.editNode":"编辑节点","tree.menu.deleteSubtree":"删除子树","tree.editor.title":"编辑节点","tree.node.emptySummary":"(空摘要)","tree.node.emptyContent":"(空)","tree.node.dragToContextAria":"拖动节点到 Context","tree.node.expandCompressedAria":"展开压缩节点","tree.node.collapseCompressedAria":"收起压缩节点","branches.title":"分支","branches.activeCount":"{count} 个","branches.default.compressed":"Compressed 分支","branches.default.type":"{type} 分支","settings.nav.configuration":"Configuration","settings.nav.providers":"模型服务","settings.nav.defaultModel":"默认 Model","settings.nav.tools":"Tools","settings.nav.general":"参与","settings.nav.display":"显示","settings.nav.data":"数据","settings.nav.about":"关于","settings.backToHome":"返回主页","providers.title":"服务提供商","providers.deleteAria":"删除提供商","providers.empty.title":"暂无提供商","providers.empty.description":"点击下方按钮添加。","providers.add":"添加提供商","providers.dialog.title":"添加提供商","providers.dialog.nameLabel":"Provider Name","providers.dialog.namePlaceholder":"OpenAI, Anthropic, DeepSeek…","providerConfig.empty.title":"请选择或添加一个提供商","providerConfig.empty.description":"从中间列表选择一个提供商来配置。","providerConfig.check.running":"检测中…","providerConfig.check.button":"检测连接","providerConfig.apiKeys.title":"API Key","providerConfig.apiKeys.namePlaceholder":"密钥名称","providerConfig.apiKeys.primary":"主密钥","providerConfig.apiKeys.setPrimary":"设为主密钥","providerConfig.apiKeys.add":"添加密钥","providerConfig.baseUrl.title":"Base URL","providerConfig.baseUrl.preview":"预览: {url}","providerConfig.models.title":"Models","providerConfig.models.select":"选择模型","providerConfig.models.enabled":"已启用 ({count})","providerConfig.models.disabled":"未启用 ({count})","providerConfig.models.streaming":"流式","providerConfig.models.empty.title":"暂无模型","providerConfig.models.empty.description":"点击「选择模型」添加。","providerConfig.addKey.title":"添加 API Key","providerConfig.addKey.nameLabel":"名称","providerConfig.addKey.namePlaceholder":"主密钥 / 备用密钥","providerConfig.addKey.valueLabel":"API Key","errors.connectionFailed":"连接失败","errors.requestFailedWithStatus":"请求失败({status})","errors.invalidRequestBody":"无效的请求体","errors.missingApiKey":"缺少 API Key","errors.invalidBaseUrl":"Base URL 无效","errors.invalidApiKey":"API Key 无效","errors.requestTimeout":"请求超时","errors.unknownError":"未知错误","errors.failedToFetchModels":"获取模型列表失败","errors.missingOpenAIApiKey":"缺少 OpenAI API Key,请在设置中添加。","errors.noActiveConversationTree":"未加载对话树。","errors.failedToSendMessage":"发送消息失败","errors.failedToRetryMessage":"重试失败","errors.failedToCompressNodes":"压缩节点失败","errors.failedToDecompressNode":"解压节点失败","errors.failedToGenerateSuggestion":"生成建议失败","settings.display.title":"显示","settings.display.description":"管理主题与语言。","settings.display.theme":"主题","settings.display.theme.light":"浅色","settings.display.theme.lightDesc":"适合白天或自然光环境。","settings.display.theme.dark":"深色","settings.display.theme.darkDesc":"适合夜间或弱光环境。","settings.display.language":"语言","settings.display.language.en":"English","settings.display.language.enDesc":"使用英文界面。","settings.display.language.zhCN":"中文","settings.display.language.zhCNDesc":"使用中文界面(保留常用英文术语)。","settings.defaultModel.title":"模型设置","settings.defaultModel.description":"选择分支模型,并配置压缩与标题生成模型。","settings.defaultModel.enabledModels.title":"已启用模型","settings.defaultModel.enabledModels.description":"选择多个模型后,发送消息将并行生成多个分支回复。","settings.defaultModel.enabledModels.emptyTitle":"暂无启用模型","settings.defaultModel.enabledModels.emptyDescription":"请先在模型服务中启用模型。","settings.defaultModel.compressionModel.title":"压缩模型","settings.defaultModel.compressionModel.placeholder":"请选择压缩模型","settings.defaultModel.compressionModel.description":"用于生成压缩节点的摘要与元指令建议。","settings.defaultModel.summaryModel.title":"标题模型","settings.defaultModel.summaryModel.placeholder":"请选择标题模型","settings.defaultModel.summaryModel.description":"用于在首条消息后生成对话标题。","settings.defaultModel.test.title":"模型测试","settings.defaultModel.test.latency":"响应时间 {ms}ms","settings.defaultModel.test.running":"测试中…","settings.defaultModel.test.button":"测试模型","settings.defaultModel.test.selectModelFirst":"请先选择模型","settings.defaultModel.test.providerMissing":"模型服务商不存在","settings.defaultModel.test.success":"连接成功","settings.defaultModel.test.failed":"测试失败","settings.general.title":"参与","settings.general.description":"管理生成参数。","settings.general.api.title":"API 连接","settings.general.api.apiKeyLabel":"API Key","settings.general.api.baseUrlLabel":"Base URL","settings.general.generation.title":"生成参数","settings.general.generation.temperature":"Temperature","settings.general.generation.maxTokens":"Max Tokens","settings.general.saveHint":"修改将保存到本地浏览器","settings.general.saveButton":"保存设置","settings.general.saved":"设置已保存","settings.data.title":"数据","settings.data.description":"管理本地存储的对话数据与设置。","settings.data.clear.title":"清除对话数据","settings.data.clear.description":"删除 IndexedDB 中保存的全部对话记录。","settings.data.clear.button":"清除数据","settings.data.clear.running":"清除中…","settings.data.clear.confirm":"确认清除","settings.data.clear.success":"对话数据已清除,正在刷新…","settings.data.clear.failed":"清除失败","settings.data.reset.title":"重置设置","settings.data.reset.description":"清空提供商配置、API Key 与主题设置。","settings.data.reset.button":"重置设置","settings.data.reset.running":"重置中…","settings.data.reset.confirm":"确认重置","settings.data.reset.success":"设置已重置,正在刷新…","settings.data.reset.failed":"重置失败","settings.about.title":"关于","settings.about.description":"了解 Prompt Tree 的版本与技术栈。","settings.about.version.label":"版本","settings.about.version.value":"Prompt Tree v0.3.0","settings.about.framework.label":"框架","settings.about.framework.value":"Next.js 14 + React 18","settings.about.storage.label":"数据存储","settings.about.storage.value":"IndexedDB + LocalStorage","settings.about.contact.email":"Email","settings.about.contact.wechat":"WeChat","settings.tools.title":"工具","settings.tools.description":"配置 Web Search(Exa/Tavily)、MCP servers 与 Python 执行参数。","settings.tools.search.title":"Web Search","settings.tools.search.defaultProvider":"默认 Provider","settings.tools.search.searchDepth":"Search Depth","settings.tools.search.maxResults":"Max Results","settings.tools.search.depth.basic":"basic","settings.tools.search.depth.advanced":"advanced","settings.tools.search.missingApiKey":"请先配置 {provider} API Key。","settings.tools.search.test.title":"连接测试","settings.tools.search.test.latency":"响应时间 {ms}ms","settings.tools.search.test.running":"测试中…","settings.tools.search.test.button":"测试连接","settings.tools.search.test.success":"连接成功","settings.tools.search.test.successWithTitle":"连接成功 \xb7 {title}","settings.tools.search.test.failed":"连接测试失败","settings.tools.mcp.add":"添加 MCP","settings.tools.mcp.description":"使用 JSON 配置 MCP(Streamable HTTP / Legacy SSE / stdio),并为每个 server 设置 token。","settings.tools.mcp.empty.title":"暂无 MCP Servers","settings.tools.mcp.empty.description":"点击上方「新建」,粘贴你的 MCP 配置 JSON。","settings.tools.mcp.logs":"日志","settings.tools.mcp.tools":"可用工具","settings.tools.mcp.expand":"展开","settings.tools.mcp.collapse":"收起","settings.tools.mcp.noTools":"未返回工具列表(tools = 0)","settings.tools.mcp.serverNotFound":"MCP Server 不存在或已删除。","settings.tools.mcp.invalidTestResponse":"MCP 测试响应无效(需要 SSE)。","settings.tools.mcp.test.button":"测试连接","settings.tools.mcp.test.running":"测试中…","settings.tools.mcp.test.success":"连接成功 \xb7 {count} tools","settings.tools.mcp.test.failed":"测试连接失败","settings.tools.mcp.test.noResult":"MCP 测试结束但未返回结果。","settings.tools.mcp.newServerName":"New MCP Server","settings.tools.mcp.modal.title":"MCP Server","settings.tools.mcp.modal.titleWithName":"MCP Server \xb7 {name}","settings.tools.mcp.editor.serverId":"Server ID","settings.tools.mcp.editor.name":"Name","settings.tools.mcp.editor.transport":"Transport","settings.tools.mcp.editor.token":"Token","settings.tools.mcp.editor.tokenPlaceholder":"Bearer token(可选)","settings.tools.mcp.editor.configJson":"Config JSON","settings.tools.mcp.editor.configNote":"该 JSON 不做校验,运行时直接解析。","settings.tools.mcp.editor.idRequired":"Server ID 不能为空。","settings.tools.mcp.editor.nameRequired":"Server name 不能为空。","settings.tools.python.title":"Python 执行","settings.tools.python.timeoutSeconds":"超时(秒)","settings.tools.python.maxOutputChars":"最大输出(字符)","settings.tools.python.command":"Python 命令","settings.tools.python.note":"本地运行建议保持为 python3。","modelSelector.providerFallback":"提供商","modelSelector.models":"模型","modelSelector.searchPlaceholder":"搜索 model ID 或名称","modelSelector.fetching":"正在获取模型列表…","modelSelector.fetchFailed":"获取模型列表失败","modelSelector.noMatches":"未找到匹配的模型","modelSelector.noModels":"暂无可用模型","modelSelector.tryOtherQuery":"尝试其他搜索关键词。","modelSelector.configureApiKey":"请先配置 API Key 并刷新。","modelSelector.selectedCount":"已选择 {count} 个模型","modelSelector.addSelected":"添加选中","modelSelector.addCount":"添加 {count}","modelCategory.all":"全部","modelCategory.chat":"对话","modelCategory.reasoning":"推理","modelCategory.vision":"视觉","modelCategory.embedding":"嵌入","modelCategory.tool":"工具","modelCategory.other":"其他"}};function r(e,t,o){var r;return r=(s[e]??s.en)[t]??s.en[t],o?r.replaceAll(/\{(\w+)\}/g,(e,t)=>{let s=o[t];return null==s?"":String(s)}):r}function n(e){return Object.prototype.hasOwnProperty.call(s.en,e)}},8353:(e,t,o)=>{function s(e){return`${e.providerId}:${e.modelId}`}function r(e){let t=[];for(let o of e)for(let e of o.models.filter(e=>e.enabled)){let s=o.name?`${o.name} \xb7 ${e.id}`:e.id;t.push({providerId:o.id,providerName:o.name,modelId:e.id,label:s})}return t.sort((e,t)=>{let o=e.providerName.localeCompare(t.providerName);return 0!==o?o:e.modelId.localeCompare(t.modelId)}),t}o.d(t,{R:()=>s,n:()=>r})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{92:(e,t,s)=>{"use strict";s.d(t,{ConnectedModelSelector:()=>x});var r=s(5155),n=s(2115),o=s(4394),a=s(513),l=s(1766),i=s(6222);function d({category:e,models:t,selectedIds:s,onToggle:o,onAddSelected:l}){let d=(0,a.k)(),[c,x]=(0,n.useState)(!0);if(0===t.length)return null;let h=t.filter(e=>s.has(e.id)),m=d("chat"===e?"modelCategory.chat":"reasoning"===e?"modelCategory.reasoning":"vision"===e?"modelCategory.vision":"embedding"===e?"modelCategory.embedding":"tool"===e?"modelCategory.tool":"modelCategory.other");return(0,r.jsxs)("div",{className:"mb-3 rounded-xl border border-parchment bg-cream overflow-hidden",children:[(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-paper/50",onClick:()=>x(!c),children:[(0,r.jsx)("span",{className:`transition-transform duration-200 ${c?"rotate-0":"-rotate-90"}`,children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})}),(0,r.jsx)("span",{className:"flex-1 font-body text-[0.9rem] font-medium text-ink",children:m}),(0,r.jsx)("span",{className:"rounded-full bg-parchment px-2 py-0.5 font-mono text-[0.7rem] text-clay",children:t.length}),h.length>0&&(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-copper px-2.5 py-1 font-body text-[0.8rem] text-white transition-colors hover:bg-copper/90",onClick:e=>{e.stopPropagation(),l()},children:d("modelSelector.addCount",{count:h.length})})]}),c&&(0,r.jsx)("div",{className:"border-t border-parchment px-4 pb-3",children:(0,r.jsx)("div",{className:"space-y-1 pt-2",children:t.map(e=>{let t=s.has(e.id);return(0,r.jsxs)("div",{className:`group flex items-center gap-3 rounded-lg px-3 py-2.5 transition-all ${t?"bg-copper/10":"hover:bg-paper/50"}`,children:[(0,r.jsx)("button",{type:"button",className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded border transition-all ${t?"border-copper bg-copper text-white":"border-parchment bg-transparent hover:border-sand"}`,onClick:()=>o(e.id),children:t&&(0,r.jsx)(i.Sr,{})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-mono text-[0.85rem] text-ink truncate",children:e.id}),e.name!==e.id&&(0,r.jsx)("div",{className:"font-body text-[0.75rem] text-sand truncate",children:e.name})]})]},e.id)})})})]})}function c({open:e,onClose:t}){let s=(0,a.k)(),c=(0,o.CU)(e=>e.providers),x=(0,o.CU)(e=>e.modelSelector);(0,o.CU)(e=>e.closeModelSelector);let h=(0,o.CU)(e=>e.setModelSelectorSearch),m=(0,o.CU)(e=>e.setModelSelectorTab),p=(0,o.CU)(e=>e.fetchModelsForSelector),g=(0,o.CU)(e=>e.addFetchedModels),[u,b]=(0,n.useState)(new Set),f=c.find(e=>e.id===x.providerId),y=new Set(f?.models.map(e=>e.id)||[]),j=x.fetchedModels.filter(e=>!y.has(e.id)).filter(e=>{let t=!x.searchQuery||e.id.toLowerCase().includes(x.searchQuery.toLowerCase())||e.name.toLowerCase().includes(x.searchQuery.toLowerCase()),s="all"===x.activeTab||e.category===x.activeTab;return t&&s}),v={};for(let e of j){let t=e.category||"chat";v[t]||(v[t]=[]),v[t].push(e)}let N=e=>{b(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};return((0,n.useEffect)(()=>{e&&f&&0===x.fetchedModels.length&&p(f.id)},[e]),(0,n.useEffect)(()=>{e||b(new Set)},[e]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-ink/20 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative mx-auto my-8 flex h-full w-full max-w-xl flex-col rounded-2xl bg-paper shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-parchment px-6 py-4",children:[(0,r.jsxs)("h3",{className:"font-display text-xl text-ink",children:[f?.name||s("modelSelector.providerFallback")," - ",s("modelSelector.models")]}),(0,r.jsx)("button",{type:"button",className:"rounded-lg p-2 text-clay transition-colors hover:text-ink",onClick:t,children:(0,r.jsx)(i.US,{})})]}),(0,r.jsx)("div",{className:"border-b border-parchment px-6 py-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"flex-1 relative",children:[(0,r.jsx)(i.WI,{}),(0,r.jsx)("input",{type:"text",value:x.searchQuery,onChange:e=>h(e.target.value),placeholder:s("modelSelector.searchPlaceholder"),className:"w-full rounded-xl border border-parchment bg-cream pl-10 pr-4 py-2.5 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]"})]}),(0,r.jsx)("button",{type:"button",className:`flex-shrink-0 rounded-xl border border-parchment p-2.5 text-clay transition-all hover:border-copper hover:text-copper ${x.isLoading?"animate-spin":""}`,onClick:()=>{f&&p(f.id)},disabled:x.isLoading,children:(0,r.jsx)(i.fN,{})})]})}),(0,r.jsx)("div",{className:"flex items-center gap-1 border-b border-parchment px-6 py-3 overflow-x-auto",children:["all","chat","reasoning","vision","embedding","tool"].map(e=>(0,r.jsx)("button",{type:"button",className:`whitespace-nowrap rounded-lg px-3 py-1.5 font-body text-[0.8rem] transition-all ${x.activeTab===e?"bg-copper text-white":"text-clay hover:bg-cream hover:text-ink"}`,onClick:()=>m(e),children:(e=>{switch(e){case"all":return s("modelCategory.all");case"chat":return s("modelCategory.chat");case"reasoning":return s("modelCategory.reasoning");case"vision":return s("modelCategory.vision");case"embedding":return s("modelCategory.embedding");case"tool":return s("modelCategory.tool");default:return s("modelCategory.other")}})(e)},e))}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:x.isLoading?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,r.jsx)("div",{className:"mb-4 h-8 w-8 animate-spin rounded-full border-2 border-copper border-t-transparent"}),(0,r.jsx)("p",{className:"font-body text-[0.9rem] text-sand",children:s("modelSelector.fetching")})]}):x.error?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,r.jsx)("div",{className:"mb-4 text-red-400",children:(0,r.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"m15 9-6 6m0-6 6 6"})]})}),(0,r.jsx)("p",{className:"mb-1 font-body text-[0.9rem] text-clay",children:s("modelSelector.fetchFailed")}),(0,r.jsx)("p",{className:"font-body text-[0.8rem] text-sand",children:(0,l.d)(x.error)?s(x.error):x.error})]}):0===j.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,r.jsx)("div",{className:"mb-4 text-sand",children:(0,r.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("path",{d:"M9 9h6v6H9z"})]})}),(0,r.jsx)("p",{className:"mb-1 font-body text-[0.9rem] text-clay",children:x.searchQuery?s("modelSelector.noMatches"):s("modelSelector.noModels")}),(0,r.jsx)("p",{className:"font-body text-[0.8rem] text-sand",children:x.searchQuery?s("modelSelector.tryOtherQuery"):s("modelSelector.configureApiKey")})]}):(0,r.jsx)("div",{children:Object.entries(v).map(([e,t])=>(0,r.jsx)(d,{category:e,models:t,selectedIds:u,onToggle:N,onAddSelected:()=>{let e=t.filter(e=>u.has(e.id)).map(e=>e.id);e.length>0&&(g(e),e.forEach(e=>u.delete(e)),b(new Set(u)))}},e))})}),u.size>0&&(0,r.jsxs)("div",{className:"flex items-center justify-between border-t border-parchment px-6 py-4",children:[(0,r.jsx)("span",{className:"font-body text-[0.85rem] text-sand",children:s("modelSelector.selectedCount",{count:u.size})}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-2 rounded-lg bg-copper px-4 py-2.5 font-body text-[0.9rem] text-white transition-colors hover:bg-copper/90",onClick:()=>{u.size>0&&(g(Array.from(u)),b(new Set))},children:[(0,r.jsx)(i.c1,{}),s("modelSelector.addSelected")]})]})]})]}):null}function x(){let e=(0,o.CU)(e=>e.modelSelector),t=(0,o.CU)(e=>e.closeModelSelector);return(0,r.jsx)(c,{open:e.open,onClose:t})}},3409:(e,t,s)=>{Promise.resolve().then(s.bind(s,92)),Promise.resolve().then(s.bind(s,9362)),Promise.resolve().then(s.bind(s,6531)),Promise.resolve().then(s.bind(s,4333)),Promise.resolve().then(s.bind(s,7977))},4333:(e,t,s)=>{"use strict";s.d(t,{SettingsPage:()=>T});var r=s(5155),n=s(8500),o=s.n(n),a=s(2115),l=s(4394),i=s(513),d=s(6531),c=s(9362),x=s(7977),h=s(92),m=s(1379),p=s(3653),g=s(6290),u=s(4752),b=s(9113),f=s(8353),y=s(5746),j=s(5989),v=s(5432),N=s(6222);function w(e){return"object"==typeof e&&null!==e}function k({title:e,description:t,action:s,children:n}){return(0,r.jsxs)("div",{className:"flex h-full flex-1 flex-col bg-shoji-white",children:[(0,r.jsx)("div",{className:"border-b border-parchment/10 px-8 py-8",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"font-zen-display text-2xl font-light text-ink-black tracking-wide",children:e}),t&&(0,r.jsx)("p",{className:"mt-2 max-w-xl font-zen-body text-sm text-stone-gray font-light",children:t})]}),s]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,r.jsx)("div",{className:"max-w-3xl px-8 py-8",children:n})})]})}function C({title:e,description:t}){return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border-1.5 border-dashed border-parchment/20 bg-washi-cream/50 p-10 text-center",children:[(0,r.jsx)("div",{className:"mb-4 rounded-xl bg-shoji-white p-4 text-stone-gray",children:(0,r.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]})}),(0,r.jsx)("p",{className:"mb-2 font-zen-body text-sm text-stone-gray font-light",children:e}),(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray/70 font-light",children:t})]})}function M(){let e=(0,i.k)(),t=(0,l.CU)(e=>e.providers),s=(0,l.CU)(e=>e.compressionModel),n=(0,l.CU)(e=>e.summaryModel),o=(0,l.CU)(e=>e.setLLMSettings),d=(0,l.CU)(e=>e.selectedModels),c=(0,l.CU)(e=>e.setSelectedModels),[x,h]=(0,a.useState)("idle"),[m,p]=(0,a.useState)(null),[g,u]=(0,a.useState)(null),b=(0,a.useMemo)(()=>(0,f.n)(t),[t]),j=(0,a.useMemo)(()=>new Set(d.map(f.R)),[d]),w=(0,a.useMemo)(()=>{let e=new Map;for(let t of b)e.has(t.providerId)||e.set(t.providerId,{providerId:t.providerId,providerName:t.providerName,models:[]}),e.get(t.providerId).models.push(t);return Array.from(e.values()).sort((e,t)=>e.providerName.localeCompare(t.providerName))},[b]);(0,a.useEffect)(()=>{let e=new Set(b.map(f.R)),t=d.filter(t=>e.has((0,f.R)(t)));t.length!==d.length&&c(t)},[b,d,c]),(0,a.useEffect)(()=>{let e=new Set(b.map(f.R)),t=s?(0,f.R)(s):null;t&&!e.has(t)&&o({compressionModel:null});let r=n?(0,f.R)(n):null;r&&!e.has(r)&&o({summaryModel:null})},[s,b,o,n]);let M=e=>({providerId:e.providerId,modelId:e.modelId}),S=async()=>{let s=d[0];if(!s){h("error"),p(e("settings.defaultModel.test.selectModelFirst"));return}let r=t.find(e=>e.id===s.providerId)??null;if(!r){h("error"),p(e("settings.defaultModel.test.providerMissing"));return}let n=(0,v.aA)(r);if(!n){h("error"),p(e("errors.missingApiKey"));return}h("running"),p(null),u(null);let o=await (0,y.DT)(n.value,r.baseUrl,s.modelId,{headers:r.headers,timeout:r.timeout,prompt:"ping"});if(u(o.responseTime??null),"healthy"===o.status){h("success"),p(o.content||e("settings.defaultModel.test.success"));return}h("error"),p(o.error||e("settings.defaultModel.test.failed"))},z=s?(0,f.R)(s):"",L=n?(0,f.R)(n):"";return(0,r.jsx)(k,{title:e("settings.defaultModel.title"),description:e("settings.defaultModel.description"),children:(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.defaultModel.enabledModels.title")}),(0,r.jsx)("p",{className:"mt-2 font-zen-body text-sm text-stone-gray font-light",children:e("settings.defaultModel.enabledModels.description")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/20 bg-shoji-white px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>{c(b.map(e=>M(e)))},disabled:0===b.length,children:e("common.selectAll")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/20 bg-shoji-white px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>{c([])},disabled:0===d.length,children:e("common.clear")})]})]}),0===b.length?(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(C,{title:e("settings.defaultModel.enabledModels.emptyTitle"),description:e("settings.defaultModel.enabledModels.emptyDescription")})}):(0,r.jsx)("div",{className:"mt-6 space-y-6",children:w.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-3 font-zen-body text-xs text-stone-gray font-light",children:e.providerName}),(0,r.jsx)("div",{className:"space-y-2",children:e.models.map(e=>{let t=j.has((0,f.R)(e));return(0,r.jsxs)("button",{type:"button",className:`flex w-full items-center gap-3 rounded-xl border px-4 py-3 text-left transition-all duration-200 ${t?"border-matcha-green/40 bg-matcha-green/10":"border-parchment/20 bg-shoji-white hover:border-matcha-green/30"}`,onClick:()=>{let t;return t=(0,f.R)(e),void c(j.has(t)?d.filter(e=>(0,f.R)(e)!==t):[...d,M(e)])},children:[(0,r.jsx)("span",{className:`flex h-5 w-5 items-center justify-center rounded border text-[0.7rem] ${t?"border-matcha-green bg-matcha-green text-shoji-white":"border-parchment bg-transparent text-transparent"}`,children:"✓"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"font-mono text-sm text-ink-black",children:e.modelId}),(0,r.jsx)("div",{className:"text-xs text-stone-gray font-light",children:e.label})]})]},e.modelId)})})]},e.providerId))})]}),(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsx)("div",{className:"mb-3 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.defaultModel.compressionModel.title")}),(0,r.jsxs)("select",{value:z,onChange:e=>{var t;let s;return t=e.target.value,void o({compressionModel:(s=b.find(e=>(0,f.R)(e)===t))?M(s):null,...s?{model:s.modelId}:{}})},disabled:0===b.length,className:"w-full rounded-xl border border-parchment/20 bg-shoji-white px-5 py-4 font-mono text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50 disabled:opacity-60",children:[(0,r.jsx)("option",{value:"",children:e("settings.defaultModel.compressionModel.placeholder")}),b.map(e=>(0,r.jsx)("option",{value:(0,f.R)(e),children:e.label},`${e.providerId}-${e.modelId}`))]}),(0,r.jsx)("p",{className:"mt-3 font-zen-body text-xs text-stone-gray font-light",children:e("settings.defaultModel.compressionModel.description")})]}),(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsx)("div",{className:"mb-3 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.defaultModel.summaryModel.title")}),(0,r.jsxs)("select",{value:L,onChange:e=>{var t;let s;return t=e.target.value,void o({summaryModel:(s=b.find(e=>(0,f.R)(e)===t))?M(s):null})},disabled:0===b.length,className:"w-full rounded-xl border border-parchment/20 bg-shoji-white px-5 py-4 font-mono text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50 disabled:opacity-60",children:[(0,r.jsx)("option",{value:"",children:e("settings.defaultModel.summaryModel.placeholder")}),b.map(e=>(0,r.jsx)("option",{value:(0,f.R)(e),children:e.label},`${e.providerId}-${e.modelId}`))]}),(0,r.jsx)("p",{className:"mt-3 font-zen-body text-xs text-stone-gray font-light",children:e("settings.defaultModel.summaryModel.description")})]}),(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.defaultModel.test.title")}),null!==g&&(0,r.jsx)("div",{className:"mt-2 font-mono text-xs text-stone-gray",children:e("settings.defaultModel.test.latency",{ms:g})})]}),(0,r.jsx)("button",{type:"button",className:`flex items-center gap-2 rounded-lg px-4 py-2.5 font-zen-body text-sm transition-all duration-300 ${"running"===x?"bg-washi-cream text-stone-gray cursor-wait":"bg-matcha-green/10 text-matcha-green hover:bg-matcha-green/20 font-light"}`,onClick:S,disabled:"running"===x||0===d.length,children:"running"===x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.fN,{}),e("settings.defaultModel.test.running")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Sr,{}),e("settings.defaultModel.test.button")]})})]}),m&&(0,r.jsx)("p",{className:`mt-3 font-zen-body text-xs font-light ${{idle:"text-stone-gray",running:"text-kintsugi-gold",success:"text-matcha-green",error:"text-red-500"}[x]}`,children:m})]})]})})}function S(){let e=(0,i.k)(),t=(0,l.CU)(e=>e.temperature),s=(0,l.CU)(e=>e.maxTokens),n=(0,l.CU)(e=>e.setLLMSettings),[o,d]=(0,a.useState)(t.toString()),[c,x]=(0,a.useState)(s.toString()),[h,m]=(0,a.useState)(null);return(0,a.useEffect)(()=>{d(t.toString())},[t]),(0,a.useEffect)(()=>{x(s.toString())},[s]),(0,r.jsx)(k,{title:e("settings.general.title"),description:e("settings.general.description"),children:(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsx)("div",{className:"mb-4 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.general.generation.title")}),(0,r.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block font-zen-body text-xs text-stone-gray font-light",children:e("settings.general.generation.temperature")}),(0,r.jsx)("input",{type:"number",min:"0",max:"2",step:"0.1",value:o,onChange:e=>d(e.target.value),className:"w-full rounded-xl border border-parchment/20 bg-shoji-white px-5 py-4 font-zen-body text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block font-zen-body text-xs text-stone-gray font-light",children:e("settings.general.generation.maxTokens")}),(0,r.jsx)("input",{type:"number",min:"1",value:c,onChange:e=>x(e.target.value),className:"w-full rounded-xl border border-parchment/20 bg-shoji-white px-5 py-4 font-zen-body text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50"})]})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:h??e("settings.general.saveHint")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-matcha-green px-6 py-3 font-zen-body text-sm text-shoji-white transition-all duration-200 hover:bg-bamboo-light",onClick:()=>{let r=Number.parseFloat(o),a=Number.parseInt(c,10);n({temperature:Number.isFinite(r)?r:t,maxTokens:Number.isFinite(a)?a:s}),m(e("settings.general.saved")),setTimeout(()=>m(null),2e3)},children:e("settings.general.saveButton")})]})]})})}function z(){let e=(0,i.k)(),t=(0,l.CU)(e=>e.theme),s=(0,l.CU)(e=>e.setTheme),n=(0,l.CU)(e=>e.locale),o=(0,l.CU)(e=>e.setLocale),a=[{id:"light",label:e("settings.display.theme.light"),description:e("settings.display.theme.lightDesc")},{id:"dark",label:e("settings.display.theme.dark"),description:e("settings.display.theme.darkDesc")}],d=[{id:"en",label:e("settings.display.language.en"),description:e("settings.display.language.enDesc")},{id:"zh-CN",label:e("settings.display.language.zhCN"),description:e("settings.display.language.zhCNDesc")}];return(0,r.jsx)(k,{title:e("settings.display.title"),description:e("settings.display.description"),children:(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsxs)("section",{children:[(0,r.jsx)("div",{className:"mb-4 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.display.theme")}),(0,r.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:a.map(e=>(0,r.jsxs)("button",{type:"button",className:`rounded-2xl border px-6 py-5 text-left transition-all duration-300 ${t===e.id?"border-matcha-green/40 bg-matcha-green/10":"border-parchment/20 bg-washi-cream/50 hover:border-matcha-green/40"}`,onClick:()=>s(e.id),children:[(0,r.jsx)("div",{className:"font-zen-display text-lg font-light text-ink-black",children:e.label}),(0,r.jsx)("div",{className:"mt-2 font-zen-body text-xs text-stone-gray font-light",children:e.description})]},e.id))})]}),(0,r.jsxs)("section",{children:[(0,r.jsx)("div",{className:"mb-4 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.display.language")}),(0,r.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:d.map(e=>(0,r.jsxs)("button",{type:"button",className:`rounded-2xl border px-6 py-5 text-left transition-all duration-300 ${n===e.id?"border-matcha-green/40 bg-matcha-green/10":"border-parchment/20 bg-washi-cream/50 hover:border-matcha-green/40"}`,onClick:()=>o(e.id),children:[(0,r.jsx)("div",{className:"font-zen-display text-lg font-light text-ink-black",children:e.label}),(0,r.jsx)("div",{className:"mt-2 font-zen-body text-xs text-stone-gray font-light",children:e.description})]},e.id))})]})]})})}function L(){let e=(0,i.k)(),t=(0,l.CU)(e=>e.setLLMSettings),s=(0,l.CU)(e=>e.setTheme),[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[x,h]=(0,a.useState)(!1),[m,f]=(0,a.useState)(!1),[y,v]=(0,a.useState)(null),N=async()=>{o(!0),v(null);try{await (0,p.MR)(),v(e("settings.data.clear.success")),setTimeout(()=>window.location.reload(),800)}catch(t){v(t instanceof Error?t.message:e("settings.data.clear.failed")),o(!1)}},w=async()=>{c(!0),v(null);try{(0,g.YA)(""),(0,u.$t)(""),(0,j.Ny)(),(0,j.k8)(),t(b.ES),s("light"),v(e("settings.data.reset.success")),setTimeout(()=>window.location.reload(),800)}catch(t){v(t instanceof Error?t.message:e("settings.data.reset.failed")),c(!1)}};return(0,r.jsx)(k,{title:e("settings.data.title"),description:e("settings.data.description"),children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-display text-lg font-light text-ink-black",children:e("settings.data.clear.title")}),(0,r.jsx)("p",{className:"mt-2 font-zen-body text-xs text-stone-gray font-light",children:e("settings.data.clear.description")})]}),x?(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-red-500 px-4 py-2 text-sm text-white",onClick:N,disabled:n,children:n?e("settings.data.clear.running"):e("settings.data.clear.confirm")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/30 px-4 py-2 text-sm text-stone-gray",onClick:()=>h(!1),children:e("common.cancel")})]}):(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-red-200 bg-red-50 px-5 py-2.5 font-zen-body text-sm text-red-600 transition-all duration-200 hover:bg-red-100",onClick:()=>h(!0),children:e("settings.data.clear.button")})]})}),(0,r.jsx)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-display text-lg font-light text-ink-black",children:e("settings.data.reset.title")}),(0,r.jsx)("p",{className:"mt-2 font-zen-body text-xs text-stone-gray font-light",children:e("settings.data.reset.description")})]}),m?(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-matcha-green px-4 py-2 text-sm text-shoji-white",onClick:w,disabled:d,children:d?e("settings.data.reset.running"):e("settings.data.reset.confirm")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/30 px-4 py-2 text-sm text-stone-gray",onClick:()=>f(!1),children:e("common.cancel")})]}):(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/30 bg-shoji-white px-5 py-2.5 font-zen-body text-sm text-stone-gray transition-all duration-200 hover:border-matcha-green/50 hover:text-matcha-green",onClick:()=>f(!0),children:e("settings.data.reset.button")})]})}),y&&(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray font-light",children:y})]})})}function _(){let e=(0,i.k)(),t=[{label:e("settings.about.version.label"),value:e("settings.about.version.value")},{label:e("settings.about.framework.label"),value:e("settings.about.framework.value")},{label:e("settings.about.storage.label"),value:e("settings.about.storage.value")},{label:e("settings.about.contact.email"),value:"yxp934@outlook.com"},{label:e("settings.about.contact.wechat"),value:"WanguA8"}];return(0,r.jsx)(k,{title:e("settings.about.title"),description:e("settings.about.description"),children:(0,r.jsx)("div",{className:"space-y-4",children:t.map(e=>(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-parchment/20 bg-washi-cream/50 px-6 py-4",children:[(0,r.jsx)("span",{className:"font-zen-body text-sm text-stone-gray font-light",children:e.label}),(0,r.jsx)("span",{className:"font-zen-display text-lg font-light text-ink-black",children:e.value})]},e.label))})})}function U(){let e=(0,i.k)(),t=(0,l.CU)(e=>e.toolSettings),s=(0,l.CU)(e=>e.setToolSettings),n=(0,l.CU)(e=>e.upsertMcpServer),o=(0,l.CU)(e=>e.deleteMcpServer),[d,c]=(0,a.useState)(!1),[x,h]=(0,a.useState)(!1),[p,g]=(0,a.useState)({status:"idle"}),u=async()=>{let s=t.search.provider,r="exa"===s?t.search.exaApiKey:t.search.tavilyApiKey;if(!r.trim())return void g({status:"error",message:e("settings.tools.search.missingApiKey",{provider:"exa"===s?"Exa":"Tavily"})});g({status:"running",message:void 0,latencyMs:void 0});let n=Date.now();try{let o=await fetch("/api/tools/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,apiKey:r,query:"OpenAI",maxResults:1,searchDepth:t.search.searchDepth})}),a=Math.max(0,Date.now()-n),l=await o.json().catch(()=>null);if(!o.ok){let t=w(l)&&"error"in l?String(l.error??""):"";throw Error(t||e("errors.requestFailedWithStatus",{status:o.status}))}let i=w(l)&&Array.isArray(l.results)&&l.results[0]&&w(l.results[0])&&"string"==typeof l.results[0].title?l.results[0].title:"";g({status:"success",latencyMs:a,message:i?e("settings.tools.search.test.successWithTitle",{title:i}):e("settings.tools.search.test.success")})}catch(t){g({status:"error",message:t instanceof Error?t.message:e("settings.tools.search.test.failed")})}},b={idle:"text-stone-gray",running:"text-kintsugi-gold",success:"text-matcha-green",error:"text-red-500"}[p.status],[f,y]=(0,a.useState)({}),[j,v]=(0,a.useState)({}),[M,S]=(0,a.useState)({}),z=(e,t)=>{let s=t.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\r/g,"").split("\n").map(e=>e.trimEnd()).filter(Boolean);0!==s.length&&y(t=>{let r=t[e],n=[...r?.logs??[],...s],o=n.slice(Math.max(0,n.length-200));return{...t,[e]:{...r??{status:"running"},logs:o}}})},L=async s=>{let r=t.mcp.servers.find(e=>e.id===s)??null;if(!r)return void y(t=>({...t,[s]:{status:"error",message:e("settings.tools.mcp.serverNotFound")}}));y(e=>({...e,[s]:{status:"running",message:void 0,tools:void 0,logs:[]}})),S(e=>({...e,[s]:!0}));let n=Date.now();try{let t=await fetch("/api/tools/mcp/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r})});if(!t.ok){let s=await t.json().catch(()=>null),r="object"==typeof s&&null!==s&&"error"in s?String(s.error??""):"";throw Error(r||e("errors.requestFailedWithStatus",{status:t.status}))}let o=t.headers.get("content-type")??"";if(!t.body||!o.includes("text/event-stream"))throw Error(e("settings.tools.mcp.invalidTestResponse"));let a=t.body.getReader(),l=new TextDecoder("utf-8"),i="",d=!1,c=!1;for(;!d;){let t=await a.read();if(t.done)break;let r=(i+=l.decode(t.value,{stream:!0})).split(/\r?\n\r?\n/);for(let t of(i=r.pop()??"",r)){for(let r of t.split(/\r?\n/)){if(!r.startsWith("data:"))continue;let t=r.replace(/^data:\s*/,"");if(t){if("[DONE]"===t){d=!0;break}try{let r=JSON.parse(t);if("log"===r.type)z(s,r.text);else if("status"===r.type)y(e=>({...e,[s]:{...e[s]??{status:"running"},message:r.phase}}));else if("result"===r.type)c=!0,y(t=>({...t,[s]:{...t[s]??{status:"success"},status:"success",message:e("settings.tools.mcp.test.success",{count:r.tools.length}),latencyMs:r.latencyMs??Math.max(0,Date.now()-n),tools:r.tools,testedAt:Date.now()}})),v(e=>({...e,[s]:!0}));else if("error"===r.type)throw Error(r.message)}catch(r){let t=r instanceof Error?r.message:e("settings.tools.mcp.test.failed");z(s,t)}}}if(d)break}}if(!c)throw Error(e("settings.tools.mcp.test.noResult"))}catch(o){let t=Math.max(0,Date.now()-n),r=o instanceof Error?o.message:e("settings.tools.mcp.test.failed");y(e=>({...e,[s]:{...e[s]??{status:"error"},status:"error",message:r,latencyMs:t,tools:e[s]?.tools??[],testedAt:Date.now()}}))}},[_,U]=(0,a.useState)(!1),[P,T]=(0,a.useState)(null),[W,E]=(0,a.useState)(null),A=()=>{E(null),T({id:`mcp_${Date.now().toString(36)}`,name:e("settings.tools.mcp.newServerName"),transport:"http",token:"",configJson:JSON.stringify({url:"http://localhost:3000/mcp",protocolVersion:"2024-11-05"},null,2)}),U(!0)};return(0,r.jsxs)(k,{title:e("settings.tools.title"),description:e("settings.tools.description"),action:(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-matcha-green px-4 py-2 text-sm text-shoji-white transition-all duration-200 hover:bg-matcha-green/90",onClick:A,children:e("settings.tools.mcp.add")}),children:[(0,r.jsxs)("div",{className:"space-y-10",children:[(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsx)("div",{className:"mb-5 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.tools.search.title")}),(0,r.jsxs)("div",{className:"grid gap-5 md:grid-cols-2",children:[(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.search.defaultProvider")}),(0,r.jsxs)("select",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.search.provider,onChange:e=>s({...t,search:{...t.search,provider:"exa"===e.target.value?"exa":"tavily"}}),children:[(0,r.jsx)("option",{value:"tavily",children:"Tavily"}),(0,r.jsx)("option",{value:"exa",children:"Exa"})]})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.search.searchDepth")}),(0,r.jsxs)("select",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.search.searchDepth,onChange:e=>s({...t,search:{...t.search,searchDepth:"advanced"===e.target.value?"advanced":"basic"}}),children:[(0,r.jsx)("option",{value:"basic",children:e("settings.tools.search.depth.basic")}),(0,r.jsx)("option",{value:"advanced",children:e("settings.tools.search.depth.advanced")})]})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.search.maxResults")}),(0,r.jsx)("input",{type:"number",min:1,max:20,className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.search.maxResults,onChange:e=>s({...t,search:{...t.search,maxResults:Math.max(1,Math.min(20,Number(e.target.value||0)))}})})]})]}),(0,r.jsxs)("div",{className:"mt-6 grid gap-5 md:grid-cols-2",children:[(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:"Tavily API Key"}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-2 rounded-lg border border-parchment/20 bg-shoji-white px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>c(e=>!e),children:[d?(0,r.jsx)(N.aR,{}):(0,r.jsx)(N.bM,{}),d?e("common.hide"):e("common.show")]})]}),(0,r.jsx)("input",{type:d?"text":"password",className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.search.tavilyApiKey,onChange:e=>s({...t,search:{...t.search,tavilyApiKey:e.target.value}}),placeholder:"tvly-..."})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:"Exa API Key"}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-2 rounded-lg border border-parchment/20 bg-shoji-white px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>h(e=>!e),children:[x?(0,r.jsx)(N.aR,{}):(0,r.jsx)(N.bM,{}),x?e("common.hide"):e("common.show")]})]}),(0,r.jsx)("input",{type:x?"text":"password",className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.search.exaApiKey,onChange:e=>s({...t,search:{...t.search,exaApiKey:e.target.value}}),placeholder:"exa_..."})]})]}),(0,r.jsxs)("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.tools.search.test.title")}),void 0!==p.latencyMs?(0,r.jsx)("div",{className:"mt-2 font-mono text-xs text-stone-gray",children:e("settings.tools.search.test.latency",{ms:p.latencyMs})}):null]}),(0,r.jsx)("button",{type:"button",className:`flex items-center gap-2 rounded-lg px-4 py-2.5 font-zen-body text-sm transition-all duration-300 ${"running"===p.status?"bg-washi-cream text-stone-gray cursor-wait":"bg-matcha-green/10 text-matcha-green hover:bg-matcha-green/20 font-light"}`,onClick:()=>void u(),disabled:"running"===p.status,children:"running"===p.status?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.fN,{}),e("settings.tools.search.test.running")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Sr,{}),e("settings.tools.search.test.button")]})})]}),p.message?(0,r.jsx)("p",{className:`mt-3 font-zen-body text-xs font-light ${b}`,children:p.message}):null]}),(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsxs)("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:"MCP Servers"}),(0,r.jsx)("p",{className:"mt-2 font-zen-body text-sm text-stone-gray font-light",children:e("settings.tools.mcp.description")})]}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/30 bg-shoji-white px-4 py-2 text-sm text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:A,children:e("common.new")})]}),0===t.mcp.servers.length?(0,r.jsx)(C,{title:e("settings.tools.mcp.empty.title"),description:e("settings.tools.mcp.empty.description")}):(0,r.jsx)("div",{className:"space-y-3",children:t.mcp.servers.map(s=>{let n,a,l,i;return(0,r.jsx)("div",{className:"rounded-2xl border border-parchment/20 bg-shoji-white px-6 py-4",children:(n=f[s.id]??{status:"idle"},a=j[s.id]??!1,l=M[s.id]??!1,i="success"===n.status?"text-matcha-green":"error"===n.status?"text-red-500":"running"===n.status?"text-kintsugi-gold":"text-stone-gray",(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-zen-display text-lg font-light text-ink-black",children:s.name}),(0,r.jsxs)("div",{className:"mt-1 font-mono text-[0.7rem] text-stone-gray",children:[s.id," \xb7 ",s.transport.toUpperCase()]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/20 bg-washi-cream px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green disabled:opacity-60",onClick:()=>void L(s.id),disabled:"running"===n.status,children:"running"===n.status?e("settings.tools.mcp.test.running"):e("settings.tools.mcp.test.button")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/20 bg-washi-cream px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>{var e;let r;return e=s.id,void((r=t.mcp.servers.find(t=>t.id===e))&&(E(null),T({id:r.id,name:r.name,transport:r.transport,token:r.token,configJson:r.configJson}),U(!0)))},children:e("common.edit")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/20 bg-washi-cream px-3 py-2 text-xs text-stone-gray transition-all duration-200 hover:border-red-300 hover:text-red-500",onClick:()=>o(s.id),children:e("common.delete")})]})]}),"idle"!==n.status?(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsxs)("div",{className:`font-mono text-[0.75rem] ${i}`,children:[n.message??("running"===n.status?e("settings.tools.mcp.test.running"):""),"number"==typeof n.latencyMs?(0,r.jsxs)("span",{className:"ml-2 text-stone-gray",children:[n.latencyMs,"ms"]}):null]}),n.logs&&n.logs.length>0?(0,r.jsxs)("div",{className:"mt-2 rounded-xl border border-parchment/20 bg-washi-cream/60 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"font-mono text-[0.65rem] uppercase tracking-[0.12em] text-stone-gray",children:e("settings.tools.mcp.logs")}),(0,r.jsxs)("button",{type:"button",className:"rounded-lg border border-parchment/30 bg-shoji-white px-3 py-1.5 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>S(e=>({...e,[s.id]:!l})),children:[l?e("settings.tools.mcp.collapse"):e("settings.tools.mcp.expand")," (",n.logs.length,")"]})]}),l?(0,r.jsx)("pre",{className:"mt-3 max-h-[260px] overflow-auto rounded-lg bg-shoji-white px-3 py-2 font-mono text-[0.7rem] text-ink-black",children:n.logs.join("\n")}):null]}):null,"success"===n.status&&n.tools&&(0,r.jsxs)("div",{className:"mt-2 rounded-xl border border-parchment/20 bg-washi-cream/60 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"font-mono text-[0.65rem] uppercase tracking-[0.12em] text-stone-gray",children:e("settings.tools.mcp.tools")}),(0,r.jsxs)("button",{type:"button",className:"rounded-lg border border-parchment/30 bg-shoji-white px-3 py-1.5 text-xs text-stone-gray transition-all duration-200 hover:border-matcha-green/40 hover:text-matcha-green",onClick:()=>v(e=>({...e,[s.id]:!a})),children:[a?e("settings.tools.mcp.collapse"):e("settings.tools.mcp.expand")," (",n.tools.length,")"]})]}),a?(0,r.jsx)("div",{className:"mt-3 max-h-[260px] space-y-2 overflow-auto pr-1",children:0===n.tools.length?(0,r.jsx)("div",{className:"rounded-lg bg-shoji-white px-3 py-2 text-xs text-stone-gray",children:e("settings.tools.mcp.noTools")}):n.tools.map(e=>(0,r.jsxs)("div",{className:"rounded-lg bg-shoji-white px-3 py-2",children:[(0,r.jsx)("div",{className:"font-mono text-[0.75rem] text-ink-black",children:e.name}),e.description?(0,r.jsx)("div",{className:"mt-1 text-xs text-stone-gray",children:e.description}):null]},e.name))}):null]})]}):null]}))},s.id)})})]}),(0,r.jsxs)("section",{className:"rounded-2xl border border-parchment/20 bg-washi-cream/50 p-6",children:[(0,r.jsx)("div",{className:"mb-5 font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:e("settings.tools.python.title")}),(0,r.jsxs)("div",{className:"grid gap-5 md:grid-cols-2",children:[(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.python.timeoutSeconds")}),(0,r.jsx)("input",{type:"number",min:1,max:120,className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:Math.round(t.python.timeoutMs/1e3),onChange:e=>{let r=Math.max(1,Math.min(120,Number(e.target.value||0)));s({...t,python:{...t.python,timeoutMs:1e3*r}})}})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.python.maxOutputChars")}),(0,r.jsx)("input",{type:"number",min:1e3,max:2e5,className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.python.maxOutputChars,onChange:e=>{let r=Math.max(1e3,Math.min(2e5,Number(e.target.value||0)));s({...t,python:{...t.python,maxOutputChars:r}})}})]}),(0,r.jsxs)("label",{className:"space-y-2 md:col-span-2",children:[(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray font-light",children:e("settings.tools.python.command")}),(0,r.jsx)("input",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:t.python.pythonCommand,onChange:e=>s({...t,python:{...t.python,pythonCommand:e.target.value}}),placeholder:"python3"}),(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray/70 font-light",children:e("settings.tools.python.note")})]})]})]})]}),(0,r.jsx)(m.a,{open:_,title:P?e("settings.tools.mcp.modal.titleWithName",{name:P.name}):e("settings.tools.mcp.modal.title"),onClose:()=>U(!1),children:P?(0,r.jsxs)("div",{className:"space-y-4",children:[W?(0,r.jsx)("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:W}):null,(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-xs text-sand",children:e("settings.tools.mcp.editor.serverId")}),(0,r.jsx)("input",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-mono text-[0.85rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:P.id,onChange:e=>T({...P,id:e.target.value})})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-xs text-sand",children:e("settings.tools.mcp.editor.name")}),(0,r.jsx)("input",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:P.name,onChange:e=>T({...P,name:e.target.value})})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-xs text-sand",children:e("settings.tools.mcp.editor.transport")}),(0,r.jsxs)("select",{className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-body text-[0.9rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:P.transport,onChange:e=>{let t="stdio"===e.target.value?"stdio":"sse"===e.target.value?"sse":"http",s="http"===t?JSON.stringify({url:"http://localhost:3000/mcp",protocolVersion:"2024-11-05"},null,2):"sse"===t?JSON.stringify({sseUrl:"http://localhost:3000/mcp",messagesUrl:"http://localhost:3000/messages",protocolVersion:"2024-11-05"},null,2):JSON.stringify({command:"node",args:["server.js"],protocolVersion:"2024-11-05",stdioFraming:"content-length"},null,2);T({...P,transport:t,configJson:P.configJson.trim()?P.configJson:s})},children:[(0,r.jsx)("option",{value:"http",children:"streamable http"}),(0,r.jsx)("option",{value:"sse",children:"legacy sse"}),(0,r.jsx)("option",{value:"stdio",children:"stdio"})]})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-xs text-sand",children:e("settings.tools.mcp.editor.token")}),(0,r.jsx)("input",{type:"password",className:"w-full rounded-xl border border-parchment bg-paper px-4 py-3 font-mono text-[0.85rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:P.token,onChange:e=>T({...P,token:e.target.value}),placeholder:e("settings.tools.mcp.editor.tokenPlaceholder")})]}),(0,r.jsxs)("label",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-xs text-sand",children:e("settings.tools.mcp.editor.configJson")}),(0,r.jsx)("textarea",{className:"h-[220px] w-full resize-none rounded-xl border border-parchment bg-paper px-4 py-3 font-mono text-[0.8rem] text-ink outline-none transition-all duration-200 focus:border-copper focus:shadow-[0_0_0_3px_var(--copper-glow)]",value:P.configJson,onChange:e=>T({...P,configJson:e.target.value}),spellCheck:!1}),(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray/70 font-light",children:e("settings.tools.mcp.editor.configNote")})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-parchment/30 bg-shoji-white px-4 py-2 text-sm text-stone-gray",onClick:()=>U(!1),children:e("common.cancel")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-matcha-green px-4 py-2 text-sm text-shoji-white",onClick:()=>{if(!P)return;let t=P.id.trim(),s=P.name.trim();t?s?(n({id:t,name:s,transport:P.transport,token:P.token,configJson:P.configJson}),U(!1)):E(e("settings.tools.mcp.editor.nameRequired")):E(e("settings.tools.mcp.editor.idRequired"))},children:e("common.save")})]})]}):null})]})}function P(){let e=(0,i.k)();return(0,r.jsxs)(o(),{href:"/",className:"fixed bottom-8 left-8 z-50 flex items-center gap-3 rounded-2xl border border-parchment/30 bg-shoji-white/95 backdrop-blur-sm px-5 py-3 font-zen-body text-sm text-stone-gray shadow-lg transition-all duration-200 hover:border-matcha-green/50 hover:text-matcha-green hover:shadow-xl",children:[(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),e("settings.backToHome")]})}function T(){let e=(0,l.CU)(e=>e.providers),t=(0,l.CU)(e=>e.selectedProviderId),s=(0,l.CU)(e=>e.loadProviders),n=(0,a.useRef)(null),[o,i]=(0,a.useState)("providers");(0,a.useEffect)(()=>{s()},[s]),(0,a.useEffect)(()=>{!t&&e.length>0&&l.jL.getState().selectProvider(e[0].id)},[t,e]);let m=()=>"providers"===o?(0,r.jsx)(c.ProviderConfig,{}):"models"===o?(0,r.jsx)(M,{}):"general"===o?(0,r.jsx)(S,{}):"display"===o?(0,r.jsx)(z,{}):"tools"===o?(0,r.jsx)(U,{}):"data"===o?(0,r.jsx)(L,{}):"about"===o?(0,r.jsx)(_,{}):(0,r.jsx)(c.ProviderConfig,{}),p="providers"===o||"models"===o;return(0,r.jsxs)("div",{ref:n,className:"fixed inset-0 z-[100] flex bg-shoji-white",style:{height:"100vh",maxHeight:"100vh"},children:[(0,r.jsx)(x.SettingsSidebar,{activeId:o,onSelect:i}),p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.ProviderList,{}),m(),(0,r.jsx)(h.ConnectedModelSelector,{})]}):m(),(0,r.jsx)(P,{})]})}},6222:(e,t,s)=>{"use strict";s.d(t,{GQ:()=>o,PX:()=>c,RY:()=>b,Sr:()=>g,Td:()=>f,US:()=>u,WI:()=>m,aR:()=>v,bM:()=>j,bN:()=>i,c1:()=>x,fN:()=>p,hp:()=>n,mo:()=>d,qY:()=>y,uc:()=>h,v1:()=>a,yo:()=>l});var r=s(5155);function n(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M17.5 19c0-1.7-1.3-3-3-3h-11c-1.7 0-3 1.3-3 3s1.3 3 3 3h11c1.7 0 3-1.3 3-3z"}),(0,r.jsx)("path",{d:"M19 16c2.8 0 5-2.2 5-5s-2.2-5-5-5c-.5 0-1 .1-1.4.2"}),(0,r.jsx)("path",{d:"M6.5 6C8.4 3.7 11.5 2.5 14.5 3c2.3.4 4.3 1.9 5.5 4"})]})}function o(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("path",{d:"M9 9h6v6H9z"}),(0,r.jsx)("path",{d:"M9 1v3"}),(0,r.jsx)("path",{d:"M15 1v3"}),(0,r.jsx)("path",{d:"M9 20v3"}),(0,r.jsx)("path",{d:"M15 20v3"}),(0,r.jsx)("path",{d:"M20 9h3"}),(0,r.jsx)("path",{d:"M20 15h3"}),(0,r.jsx)("path",{d:"M1 9h3"}),(0,r.jsx)("path",{d:"M1 15h3"})]})}function a(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"13.5",cy:"6.5",r:"0.5",fill:"currentColor"}),(0,r.jsx)("circle",{cx:"17.5",cy:"10.5",r:"0.5",fill:"currentColor"}),(0,r.jsx)("circle",{cx:"8.5",cy:"7.5",r:"0.5",fill:"currentColor"}),(0,r.jsx)("circle",{cx:"6.5",cy:"12.5",r:"0.5",fill:"currentColor"}),(0,r.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"})]})}function l(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),(0,r.jsx)("path",{d:"M8 21h8"}),(0,r.jsx)("path",{d:"M12 17v4"})]})}function i(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),(0,r.jsx)("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),(0,r.jsx)("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}function d(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 16v-4"}),(0,r.jsx)("path",{d:"M12 8h.01"})]})}function c(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M14.7 6.3a4 4 0 0 1-5.65 5.65L3 18v3h3l6.05-6.05a4 4 0 0 1 5.65-5.65l-2.1 2.1 1.4 1.4 2.1-2.1Z"})})}function x(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M12 5v14M5 12h14"})})}function h(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})})}function m(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("path",{d:"m21 21-4.35-4.35"})]})}function p(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,r.jsx)("path",{d:"M3 3v5h5"}),(0,r.jsx)("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),(0,r.jsx)("path",{d:"M16 16h5v5"})]})}function g(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function u(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})}function b(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}function f(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function y(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,r.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function j(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}function v(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),(0,r.jsx)("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),(0,r.jsx)("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),(0,r.jsx)("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]})}},6531:(e,t,s)=>{"use strict";s.d(t,{ProviderList:()=>h});var r=s(5155),n=s(2115),o=s(4394),a=s(513),l=s(6222);function i({name:e}){let t=e.trim().charAt(0).toUpperCase(),s=["bg-matcha-green","bg-kintsugi-gold","bg-stone-gray"],n=e.charCodeAt(0)%s.length,o=s[n];return(0,r.jsx)("div",{className:`flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg ${o} text-shoji-white text-lg font-medium shadow-sm`,children:t})}function d({enabled:e,onToggle:t}){return(0,r.jsx)("button",{type:"button",className:`relative flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-all duration-300 ${e?"bg-matcha-green":"bg-stone-gray/30"}`,onClick:e=>{e.stopPropagation(),t()},"aria-pressed":e,children:(0,r.jsx)("span",{className:`block h-4.5 w-4.5 transform rounded-full bg-white shadow-sm transition-all duration-300 ${e?"translate-x-6":"translate-x-0.5"}`})})}function c({provider:e,isActive:t,onSelect:s,onToggle:n,onDelete:o}){let c=(0,a.k)();return(0,r.jsx)("div",{className:`group relative mb-2 cursor-pointer rounded-xl p-4 transition-all duration-300 ${t?"bg-washi-cream/70 border border-matcha-green/20 shadow-sm":"hover:bg-washi-cream/30 border border-transparent"}`,onClick:s,role:"button",tabIndex:0,onKeyDown:e=>"Enter"===e.key&&s(),children:(0,r.jsxs)("div",{className:"flex w-full items-center gap-4 text-left",children:[(0,r.jsx)(i,{name:e.name}),(0,r.jsx)("span",{className:"flex-1 truncate font-zen-body text-sm font-normal text-ink-black",children:e.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d,{enabled:e.enabled,onToggle:n}),(0,r.jsx)("button",{type:"button",className:"flex-shrink-0 rounded-lg p-2 text-stone-gray opacity-0 transition-all duration-200 hover:bg-sakura-pink/30 hover:text-red-500 group-hover:opacity-100 group-hover:pointer-events-auto pointer-events-none",onClick:e=>{e.stopPropagation(),o()},"aria-label":c("providers.deleteAria"),children:(0,r.jsx)(l.uc,{})})]})]})})}function x({open:e,onClose:t,onAdd:s}){let o=(0,a.k)(),[l,i]=(0,n.useState)("");return e?(0,r.jsx)("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-ink-black/20 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"w-full max-w-md rounded-2xl bg-shoji-white p-8 shadow-lg border border-parchment/10",children:[(0,r.jsx)("h3",{className:"mb-6 font-zen-display text-2xl font-light text-ink-black tracking-wide",children:o("providers.dialog.title")}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault();let r=l.trim();r&&(s(r),i(""),t())},children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("label",{className:"mb-3 block font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:o("providers.dialog.nameLabel")}),(0,r.jsx)("input",{type:"text",value:l,onChange:e=>i(e.target.value),placeholder:o("providers.dialog.namePlaceholder"),className:"w-full rounded-xl border border-parchment/20 bg-washi-cream px-5 py-4 font-zen-body text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50 focus:shadow-sm",autoFocus:!0})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,r.jsx)("button",{type:"button",className:"rounded-xl border border-parchment/20 px-6 py-3 font-zen-body text-sm text-stone-gray transition-all duration-200 hover:border-stone-gray/30 hover:text-ink-black",onClick:t,children:o("common.cancel")}),(0,r.jsx)("button",{type:"submit",className:"rounded-xl bg-matcha-green px-6 py-3 font-zen-body text-sm text-shoji-white transition-all duration-200 hover:bg-bamboo-light",children:o("common.add")})]})]})]})}):null}function h(){let e=(0,a.k)(),t=(0,o.CU)(e=>e.providers),s=(0,o.CU)(e=>e.selectedProviderId),i=(0,o.CU)(e=>e.selectProvider),d=(0,o.CU)(e=>e.toggleProviderEnabled),h=(0,o.CU)(e=>e.deleteProvider),m=(0,o.CU)(e=>e.addProvider),[p,g]=(0,n.useState)(!1),[u,b]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{b(!0)},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex h-full w-[320px] flex-shrink-0 flex-col border-r border-parchment/10 bg-washi-cream/50",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-parchment/10 px-6 py-6",children:[(0,r.jsx)("div",{className:"font-zen-display text-xl font-normal text-ink-black tracking-wide",children:e("providers.title")}),(0,r.jsx)("div",{className:"flex h-7 min-h-7 w-7 min-w-7 items-center justify-center rounded-full bg-washi-cream font-zen-body text-xs text-stone-gray font-light",children:u?t.length:"-"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-6",children:0===t.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,r.jsx)("div",{className:"mb-4 rounded-2xl bg-washi-cream/50 p-6 text-stone-gray",children:(0,r.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",className:"mx-auto",children:[(0,r.jsx)("path",{d:"M17.5 19c0-1.7-1.3-3-3-3h-11c-1.7 0-3 1.3-3 3s1.3 3 3 3h11c1.7 0 3-1.3 3-3z"}),(0,r.jsx)("path",{d:"M19 16c2.8 0 5-2.2 5-5s-2.2-5-5-5c-.5 0-1 .1-1.4.2"}),(0,r.jsx)("path",{d:"M6.5 6C8.4 3.7 11.5 2.5 14.5 3c2.3.4 4.3 1.9 5.5 4"})]})}),(0,r.jsx)("p",{className:"mb-2 font-zen-body text-sm text-stone-gray font-light",children:e("providers.empty.title")}),(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray/70 font-light",children:e("providers.empty.description")})]}):t.map((e,t)=>(0,r.jsx)("div",{style:{animation:`slideInUp 0.5s ease-out ${.05*t}s backwards`},children:(0,r.jsx)(c,{provider:e,isActive:s===e.id,onSelect:()=>i(e.id),onToggle:()=>d(e.id),onDelete:()=>h(e.id)})},e.id))}),(0,r.jsx)("div",{className:"border-t border-parchment/10 p-5",children:(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center justify-center gap-2 rounded-xl border-1.5 border-dashed border-parchment/30 px-5 py-4 font-zen-body text-sm text-stone-gray font-light transition-all duration-300 hover:border-matcha-green/50 hover:bg-matcha-green/5 hover:text-matcha-green",onClick:()=>g(!0),children:[(0,r.jsx)(l.c1,{}),e("providers.add")]})})]}),(0,r.jsx)(x,{open:p,onClose:()=>g(!1),onAdd:e=>m(e)})]})}},7977:(e,t,s)=>{"use strict";s.d(t,{SettingsSidebar:()=>i});var r=s(5155),n=s(513),o=s(6222);let a=[{id:"providers",labelKey:"settings.nav.providers",icon:(0,r.jsx)(o.hp,{})},{id:"models",labelKey:"settings.nav.defaultModel",icon:(0,r.jsx)(o.GQ,{})},{id:"tools",labelKey:"settings.nav.tools",icon:(0,r.jsx)(o.PX,{})},{id:"general",labelKey:"settings.nav.general",icon:(0,r.jsx)(o.yo,{})},{id:"display",labelKey:"settings.nav.display",icon:(0,r.jsx)(o.v1,{})}],l=[{id:"data",labelKey:"settings.nav.data",icon:(0,r.jsx)(o.bN,{})},{id:"about",labelKey:"settings.nav.about",icon:(0,r.jsx)(o.mo,{})}];function i({activeId:e,onSelect:t}){let s=(0,n.k)(),o=[{label:s("settings.nav.configuration"),items:a},{label:s("settings.nav.data"),items:l}];return(0,r.jsxs)("nav",{className:"flex h-full w-[240px] flex-shrink-0 flex-col border-r border-parchment/10 bg-shoji-white",children:[(0,r.jsxs)("div",{className:"border-b border-parchment/10 px-8 py-12",children:[(0,r.jsx)("div",{className:"font-zen-display text-2xl font-light tracking-[0.15em] text-ink-black",children:s("common.settings")}),(0,r.jsx)("div",{className:"mt-1 font-zen-body text-[0.6rem] tracking-[0.2em] text-stone-gray font-light uppercase",children:s("common.appName")})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-8",children:o.map((n,o)=>(0,r.jsxs)("div",{className:0===o?"mb-8":"",children:[(0,r.jsx)("div",{className:"mb-5 px-3 font-zen-body text-[0.65rem] tracking-[0.25em] text-stone-gray uppercase font-light",children:n.label}),(0,r.jsx)("div",{className:"space-y-1",children:n.items.map((n,o)=>(0,r.jsxs)("button",{className:`group relative flex w-full items-center gap-3 rounded-lg px-5 py-3 font-zen-body text-sm font-light transition-all duration-300 ${e===n.id?"bg-washi-cream text-matcha-green border border-matcha-green/15 shadow-sm":"text-stone-gray hover:bg-washi-cream/50 hover:text-ink-black"}`,style:{animation:`fadeIn 0.8s ease-out ${.05*o}s backwards`},onClick:()=>t(n.id),children:[(0,r.jsx)("div",{className:`absolute left-0 top-0 h-full w-0.5 bg-matcha-green transition-transform duration-300 ${e===n.id?"scale-y-100":"scale-y-0"}`}),(0,r.jsx)("span",{className:"flex-shrink-0 text-base opacity-70 group-hover:opacity-100 transition-opacity",children:n.icon}),(0,r.jsx)("span",{className:"font-light tracking-wide",children:s(n.labelKey)})]},n.id))})]},n.label))}),(0,r.jsx)("div",{className:"border-t border-parchment/10 px-8 py-7",children:(0,r.jsxs)("div",{className:"font-zen-display text-sm text-stone-gray font-light tracking-[0.1em]",children:[s("common.appName")," v0.3.0"]})})]})}},9362:(e,t,s)=>{"use strict";s.d(t,{ProviderConfig:()=>m});var r=s(5155),n=s(2115),o=s(4394),a=s(513),l=s(5746),i=s(6222);function d({apiKey:e,onUpdate:t,onDelete:s,onSetPrimary:o,isPrimary:l}){let d=(0,a.k)(),[c,x]=(0,n.useState)(!1),h=async()=>{try{await navigator.clipboard.writeText(e.value)}catch{}},m={healthy:"text-matcha-green",error:"text-red-500",checking:"text-kintsugi-gold",unknown:"text-stone-gray"}[e.healthStatus||"unknown"];return(0,r.jsxs)("div",{className:"group relative rounded-xl border border-parchment/10 bg-washi-cream p-5 transition-all duration-300 hover:border-matcha-green/20 hover:shadow-sm",children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",value:e.name||"",onChange:e=>t({name:e.target.value}),placeholder:d("providerConfig.apiKeys.namePlaceholder"),className:"w-32 bg-transparent font-zen-body text-sm font-normal text-ink-black outline-none placeholder:text-stone-gray/50"}),l&&(0,r.jsx)("span",{className:"rounded-lg bg-kintsugi-gold/10 px-2 py-1 font-zen-body text-xs text-kintsugi-gold font-light",children:d("providerConfig.apiKeys.primary")})]}),(0,r.jsx)("div",{className:"flex items-center gap-1",children:(0,r.jsx)("span",{className:`flex-shrink-0 ${m}`,children:"healthy"===e.healthStatus?(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"})}):"error"===e.healthStatus?(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"m15 9-6 6m0-6 6 6"})]}):(0,r.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("path",{d:"M12 6v6l4 2"})]})})})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:c?"text":"password",value:e.value,onChange:e=>t({value:e.target.value}),placeholder:"sk-...",className:"w-full rounded-lg border border-parchment/20 bg-shoji-white px-4 py-3 pr-10 font-mono text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50"}),(0,r.jsx)("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-stone-gray transition-colors hover:text-ink-black",onClick:()=>x(!c),children:c?(0,r.jsx)(i.aR,{}):(0,r.jsx)(i.bM,{})})]})}),(0,r.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",children:!l&&(0,r.jsx)("button",{type:"button",className:"rounded-lg px-3 py-1.5 font-zen-body text-xs text-stone-gray font-light transition-colors hover:text-matcha-green",onClick:o,children:d("providerConfig.apiKeys.setPrimary")})}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("button",{type:"button",className:"rounded-lg p-2 text-stone-gray transition-colors hover:text-ink-black",onClick:h,title:d("common.copy"),children:(0,r.jsx)(i.Td,{})}),(0,r.jsx)("button",{type:"button",className:"rounded-lg p-2 text-stone-gray transition-colors hover:text-red-500",onClick:s,title:d("common.delete"),children:(0,r.jsx)(i.uc,{})})]})]})]})}function c({model:e,onRemove:t,onToggleEnabled:s,onToggleStreaming:n}){let o=(0,a.k)(),l=e.supportsStreaming??!1;return(0,r.jsxs)("div",{className:"group flex items-center gap-3 rounded-lg border border-parchment/10 bg-washi-cream px-4 py-3 transition-all duration-300 hover:border-matcha-green/20",children:[(0,r.jsx)("button",{type:"button",className:`flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-lg border transition-all duration-300 ${e.enabled?"border-matcha-green bg-matcha-green text-shoji-white":"border-stone-gray/30 bg-transparent text-transparent hover:border-stone-gray/50"}`,onClick:s,children:(0,r.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:(0,r.jsx)("path",{d:"M5 12l6 6 8-8"})})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-mono text-sm text-ink-black truncate font-light",children:e.id}),e.name!==e.id&&(0,r.jsx)("div",{className:"font-zen-body text-xs text-stone-gray truncate font-light",children:e.name})]}),(0,r.jsxs)("button",{type:"button",className:`flex items-center gap-1.5 rounded-full border px-3 py-1 text-[0.65rem] transition-all ${l?"border-copper/50 bg-copper/10 text-copper":"border-parchment/40 text-sand hover:border-copper/40 hover:text-ink"}`,onClick:n,children:[(0,r.jsx)("span",{className:`h-2 w-2 rounded-full border ${l?"border-copper bg-copper":"border-parchment/60 bg-transparent"}`}),o("providerConfig.models.streaming")]}),(0,r.jsx)("button",{type:"button",className:"flex-shrink-0 rounded-lg p-2 text-stone-gray opacity-0 transition-all hover:text-red-500 group-hover:opacity-100",onClick:t,children:(0,r.jsx)(i.uc,{})})]})}function x({icon:e,title:t,description:s}){return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border-1.5 border-dashed border-parchment/20 bg-washi-cream/50 p-10 text-center",children:[(0,r.jsx)("div",{className:"mb-4 rounded-xl bg-shoji-white p-4 text-stone-gray",children:(0,r.jsx)(e,{className:"h-8 w-8"})}),(0,r.jsx)("p",{className:"mb-2 font-zen-body text-sm text-stone-gray font-light",children:t}),(0,r.jsx)("p",{className:"font-zen-body text-xs text-stone-gray/70 font-light",children:s})]})}function h({open:e,onClose:t,onAdd:s}){let o=(0,a.k)(),[l,i]=(0,n.useState)(""),[d,c]=(0,n.useState)("");return((0,n.useEffect)(()=>{e||(i(""),c(""))},[e]),e)?(0,r.jsx)("div",{className:"fixed inset-0 z-[220] flex items-center justify-center bg-ink-black/20 backdrop-blur-sm",children:(0,r.jsxs)("div",{className:"w-full max-w-md rounded-2xl bg-shoji-white p-8 shadow-lg border border-parchment/10",children:[(0,r.jsx)("h3",{className:"mb-6 font-zen-display text-2xl font-light text-ink-black tracking-wide",children:o("providerConfig.addKey.title")}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault();let r=d.trim(),n=l.trim();r&&(s(r,n||void 0),t())},children:[(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsx)("label",{className:"mb-2 block font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:o("providerConfig.addKey.nameLabel")}),(0,r.jsx)("input",{type:"text",value:l,onChange:e=>i(e.target.value),placeholder:o("providerConfig.addKey.namePlaceholder"),className:"w-full rounded-xl border border-parchment/20 bg-washi-cream px-5 py-4 font-zen-body text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50"})]}),(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("label",{className:"mb-2 block font-zen-body text-[0.7rem] uppercase tracking-[0.15em] text-stone-gray font-light",children:o("providerConfig.addKey.valueLabel")}),(0,r.jsx)("input",{type:"password",value:d,onChange:e=>c(e.target.value),placeholder:"sk-...",className:"w-full rounded-xl border border-parchment/20 bg-washi-cream px-5 py-4 font-mono text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50",autoFocus:!0})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,r.jsx)("button",{type:"button",className:"rounded-xl border border-parchment/20 px-6 py-3 font-zen-body text-sm text-stone-gray transition-all duration-200 hover:border-stone-gray/30 hover:text-ink-black",onClick:t,children:o("common.cancel")}),(0,r.jsx)("button",{type:"submit",className:"rounded-xl bg-matcha-green px-6 py-3 font-zen-body text-sm text-shoji-white transition-all duration-200 hover:bg-bamboo-light",children:o("common.add")})]})]})]})}):null}function m(){let e=(0,a.k)(),t=(0,o.CU)(e=>e.providers),s=(0,o.CU)(e=>e.selectedProviderId),m=(0,o.CU)(e=>e.updateProvider),p=(0,o.CU)(e=>e.updateModel),g=(0,o.CU)(e=>e.addApiKey),u=(0,o.CU)(e=>e.updateApiKey),b=(0,o.CU)(e=>e.deleteApiKey),f=(0,o.CU)(e=>e.setPrimaryApiKey),y=(0,o.CU)(e=>e.removeModel),j=(0,o.CU)(e=>e.toggleModelEnabled),v=(0,o.CU)(e=>e.checkProviderHealth),N=(0,o.CU)(e=>e.openModelSelector),[w,k]=(0,n.useState)(""),[C,M]=(0,n.useState)(""),[S,z]=(0,n.useState)(!1),[L,_]=(0,n.useState)(!1),[U,P]=(0,n.useState)(null),T=t.find(e=>e.id===s)||null;(0,n.useEffect)(()=>{T?(k(T.name),M(T.baseUrl)):(k(""),M("")),P(null)},[s]);let W=async()=>{if(T){z(!0),P(null);try{await v(T.id)}catch(t){P(t instanceof Error?t.message:e("errors.connectionFailed"))}finally{z(!1)}}},E=T?.models.filter(e=>e.enabled)??[],A=T?.models.filter(e=>!e.enabled)??[];return T?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex h-full flex-1 flex-col bg-shoji-white",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-parchment/10 px-8 py-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-matcha-green text-xl font-medium text-shoji-white shadow-sm",children:T.name.charAt(0).toUpperCase()}),(0,r.jsx)("input",{type:"text",value:w,onChange:e=>{var t;k(t=e.target.value),T&&m(T.id,{name:t})},className:"bg-transparent font-zen-display text-2xl font-light text-ink-black outline-none tracking-wide"})]}),(0,r.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,r.jsx)("button",{type:"button",className:`flex items-center gap-2.5 rounded-lg px-5 py-3 font-zen-body text-sm transition-all duration-300 ${S?"bg-washi-cream text-stone-gray cursor-wait":"bg-matcha-green/10 text-matcha-green hover:bg-matcha-green/20 font-light"}`,onClick:W,disabled:S,children:S?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.fN,{}),e("providerConfig.check.running")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.fN,{}),e("providerConfig.check.button")]})}),U&&(0,r.jsx)("p",{className:"font-zen-body text-xs text-red-500 font-light",children:U})]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,r.jsxs)("div",{className:"max-w-3xl px-8 py-8",children:[(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"rounded-lg bg-washi-cream p-2.5 text-stone-gray",children:(0,r.jsx)(i.RY,{})}),(0,r.jsx)("h3",{className:"font-zen-display text-xl font-light text-ink-black tracking-wide",children:e("providerConfig.apiKeys.title")})]}),(0,r.jsx)("div",{className:"space-y-3",children:T.apiKeys.map(e=>(0,r.jsx)(d,{apiKey:e,onUpdate:t=>u(T.id,e.id,t),onDelete:()=>b(T.id,e.id),onSetPrimary:()=>f(T.id,e.id),isPrimary:e.isPrimary||1===T.apiKeys.length},e.id))}),(0,r.jsxs)("button",{type:"button",className:"mt-4 flex w-full items-center justify-center gap-2.5 rounded-xl border-1.5 border-dashed border-parchment/30 bg-washi-cream/50 px-5 py-4 font-zen-body text-sm text-stone-gray transition-all duration-300 hover:border-matcha-green/50 hover:bg-matcha-green/5 hover:text-matcha-green font-light",onClick:()=>{T&&_(!0)},children:[(0,r.jsx)(i.c1,{}),e("providerConfig.apiKeys.add")]})]}),(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"rounded-lg bg-washi-cream p-2.5 text-stone-gray",children:(0,r.jsx)(i.qY,{})}),(0,r.jsx)("h3",{className:"font-zen-display text-xl font-light text-ink-black tracking-wide",children:e("providerConfig.baseUrl.title")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("input",{type:"text",value:C,onChange:e=>{var t;M(t=e.target.value),T&&m(T.id,{baseUrl:(0,l.qT)(t)})},placeholder:"https://api.openai.com/v1",className:"w-full rounded-xl border border-parchment/20 bg-washi-cream px-5 py-4 font-mono text-sm text-ink-black outline-none transition-all duration-300 focus:border-matcha-green/50"}),(0,r.jsx)("p",{className:"mt-3 font-zen-body text-xs text-stone-gray font-light",children:e("providerConfig.baseUrl.preview",{url:`${(0,l.qT)(C)}/chat/completions`})})]})]}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"mb-5 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"rounded-lg bg-washi-cream p-2.5 text-stone-gray",children:(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("path",{d:"M9 9h6v6H9z"})]})}),(0,r.jsx)("h3",{className:"font-zen-display text-xl font-light text-ink-black tracking-wide",children:e("providerConfig.models.title")}),(0,r.jsx)("span",{className:"rounded-full bg-washi-cream px-3 py-1 font-mono text-xs text-stone-gray font-light",children:T.models.length})]}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-2 rounded-lg border border-parchment/20 bg-washi-cream px-4 py-2.5 font-zen-body text-sm text-stone-gray transition-all duration-300 hover:border-matcha-green/50 hover:text-matcha-green font-light",onClick:()=>N(T.id),children:[(0,r.jsx)(i.WI,{}),e("providerConfig.models.select")]})]}),0===T.models.length?(0,r.jsx)(x,{icon:e=>(0,r.jsxs)("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),(0,r.jsx)("path",{d:"M9 9h6v6H9z"})]}),title:e("providerConfig.models.empty.title"),description:e("providerConfig.models.empty.description")}):(0,r.jsxs)("div",{className:"space-y-6",children:[E.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-3 font-mono text-xs text-stone-gray font-light",children:e("providerConfig.models.enabled",{count:E.length})}),(0,r.jsx)("div",{className:"space-y-2",children:E.map(e=>(0,r.jsx)(c,{model:e,onRemove:()=>y(T.id,e.id),onToggleEnabled:()=>j(T.id,e.id),onToggleStreaming:()=>p(T.id,e.id,{supportsStreaming:!e.supportsStreaming})},e.id))})]}),A.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-3 font-mono text-xs text-stone-gray font-light",children:e("providerConfig.models.disabled",{count:A.length})}),(0,r.jsx)("div",{className:"space-y-2",children:A.map(e=>(0,r.jsx)(c,{model:e,onRemove:()=>y(T.id,e.id),onToggleEnabled:()=>j(T.id,e.id),onToggleStreaming:()=>p(T.id,e.id,{supportsStreaming:!e.supportsStreaming})},e.id))})]})]})]})]})})]}),(0,r.jsx)(h,{open:L,onClose:()=>_(!1),onAdd:(e,t)=>{T&&g(T.id,e,t)}})]}):(0,r.jsx)("div",{className:"flex h-full flex-1 items-center justify-center bg-shoji-white",children:(0,r.jsx)(x,{icon:e=>(0,r.jsxs)("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[(0,r.jsx)("path",{d:"M17.5 19c0-1.7-1.3-3-3-3h-11c-1.7 0-3 1.3-3 3s1.3 3 3 3h11c1.7 0 3-1.3 3-3z"}),(0,r.jsx)("path",{d:"M19 16c2.8 0 5-2.2 5-5s-2.2-5-5-5c-.5 0-1 .1-1.4.2"}),(0,r.jsx)("path",{d:"M6.5 6C8.4 3.7 11.5 2.5 14.5 3c2.3.4 4.3 1.9 5.5 4"})]}),title:e("providerConfig.empty.title"),description:e("providerConfig.empty.description")})})}}},e=>{e.O(0,[307,394,787,441,794,358],()=>e(e.s=3409)),_N_E=e.O()}]);
|