@tombcato/ai-selector-vue 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,897 +1,189 @@
1
- import { ref as E, computed as T, onMounted as ce, watch as j, defineComponent as W, onUnmounted as ue, createElementBlock as b, openBlock as y, normalizeClass as P, Fragment as H, renderList as ae, normalizeStyle as J, toDisplayString as x, unref as g, createCommentVNode as Q, createVNode as V, createElementVNode as d, withDirectives as ye, vModelText as ke, createTextVNode as z } from "vue";
2
- const Z = {
3
- zh: {
4
- save: "保存配置",
5
- saved: "保存成功",
6
- providerLabel: "Provider",
7
- modelLabel: "Model",
8
- selectProvider: "选择 Provider...",
9
- customBaseUrl: "自定义 Base URL",
10
- apiKeyLabel: "API Key",
11
- apiKeyPlaceholder: "输入 API Key...",
12
- testConnection: "测试模型连接",
13
- testing: "测试中...",
14
- testSuccess: "连接成功",
15
- testFailed: "测试连通性失败",
16
- selectModel: "选择 Model...",
17
- searchModel: "搜索或自定义模型...",
18
- useCustom: "使用自定义",
19
- noModels: "暂无模型数据",
20
- apiKeyTip: "输入 API Key 后可获取完整模型列表",
21
- fetchModelsFailed: "拉取模型列表失败,已使用离线模型列表",
22
- refreshingModels: "列表刷新中...",
23
- modelListUpdated: "模型列表已刷新",
24
- preview: "配置预览",
25
- unselected: "(未选择)"
26
- },
27
- en: {
28
- save: "Save Config",
29
- saved: "Saved",
30
- providerLabel: "Provider",
31
- modelLabel: "Model",
32
- selectProvider: "Select Provider...",
33
- customBaseUrl: "Custom Base URL",
34
- apiKeyLabel: "API Key",
35
- apiKeyPlaceholder: "Enter API Key...",
36
- testConnection: "Test Model Connection",
37
- testing: "Testing...",
38
- testSuccess: "Connection Successful",
39
- testFailed: "Connection Failed",
40
- selectModel: "Select Model...",
41
- searchModel: "Search or custom models...",
42
- useCustom: "Use custom",
43
- noModels: "No models found",
44
- apiKeyTip: "Enter API Key to fetch full model list",
45
- fetchModelsFailed: "Failed to fetch model list, using offline models",
46
- refreshingModels: "Refreshing models...",
47
- modelListUpdated: "Model list updated",
48
- preview: "Config Preview",
49
- unselected: "(Unselected)"
50
- }
51
- }, O = "https://registry.npmmirror.com/@lobehub/icons-static-svg/1.77.0/files/icons", o = {
52
- OPENAI: "openai",
53
- ANTHROPIC: "anthropic",
54
- GEMINI: "gemini",
55
- DEEPSEEK: "deepseek",
56
- OPENROUTER: "openrouter",
57
- GROQ: "groq",
58
- MISTRAL: "mistral",
59
- MOONSHOT: "moonshot",
60
- QWEN: "qwen",
61
- ZHIPU: "zhipu",
62
- SILICONFLOW: "siliconflow",
63
- XAI: "xai",
64
- TOGETHER: "together",
65
- FIREWORKS: "fireworks",
66
- DEEPINFRA: "deepinfra",
67
- PERPLEXITY: "perplexity",
68
- COHERE: "cohere",
69
- OLLAMA: "ollama",
70
- DOUBAO: "doubao",
71
- MINIMAX: "minimax"
72
- }, pe = {
73
- [o.OPENAI]: {
74
- id: o.OPENAI,
75
- name: "OpenAI",
76
- baseUrl: "https://api.openai.com/v1",
77
- needsApiKey: !0,
78
- apiFormat: "openai",
79
- supportsModelsApi: !0,
80
- icon: `${O}/openai.svg`
81
- },
82
- [o.ANTHROPIC]: {
83
- id: o.ANTHROPIC,
84
- name: "Anthropic (Claude)",
85
- baseUrl: "https://api.anthropic.com/v1",
86
- needsApiKey: !0,
87
- apiFormat: "anthropic",
88
- supportsModelsApi: !1,
89
- icon: `${O}/anthropic.svg`
90
- },
91
- [o.GEMINI]: {
92
- id: o.GEMINI,
93
- name: "Google Gemini",
94
- baseUrl: "https://generativelanguage.googleapis.com/v1beta",
95
- needsApiKey: !0,
96
- apiFormat: "gemini",
97
- supportsModelsApi: !0,
98
- icon: `${O}/gemini.svg`
99
- },
100
- [o.OPENROUTER]: {
101
- id: o.OPENROUTER,
102
- name: "OpenRouter",
103
- baseUrl: "https://openrouter.ai/api/v1",
104
- needsApiKey: !0,
105
- apiFormat: "openai",
106
- supportsModelsApi: !0,
107
- icon: `${O}/openrouter.svg`
108
- },
109
- [o.DEEPSEEK]: {
110
- id: o.DEEPSEEK,
111
- name: "DeepSeek",
112
- baseUrl: "https://api.deepseek.com",
113
- needsApiKey: !0,
114
- apiFormat: "openai",
115
- supportsModelsApi: !0,
116
- icon: `${O}/deepseek.svg`
117
- },
118
- [o.MOONSHOT]: {
119
- id: o.MOONSHOT,
120
- name: "Moonshot (Kimi)",
121
- baseUrl: "https://api.moonshot.cn/v1",
122
- needsApiKey: !0,
123
- apiFormat: "openai",
124
- supportsModelsApi: !0,
125
- icon: `${O}/moonshot.svg`
126
- },
127
- [o.QWEN]: {
128
- id: o.QWEN,
129
- name: "通义千问 (Qwen)",
130
- baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
131
- needsApiKey: !0,
132
- apiFormat: "openai",
133
- supportsModelsApi: !0,
134
- icon: `${O}/qwen.svg`
135
- },
136
- [o.ZHIPU]: {
137
- id: o.ZHIPU,
138
- name: "智谱 AI (GLM)",
139
- baseUrl: "https://open.bigmodel.cn/api/paas/v4",
140
- needsApiKey: !0,
141
- apiFormat: "openai",
142
- supportsModelsApi: !0,
143
- icon: `${O}/zhipu.svg`
144
- },
145
- [o.SILICONFLOW]: {
146
- id: o.SILICONFLOW,
147
- name: "硅基流动 (siliconflow)",
148
- baseUrl: "https://api.siliconflow.cn/v1",
149
- needsApiKey: !0,
150
- apiFormat: "openai",
151
- supportsModelsApi: !0,
152
- icon: `${O}/siliconcloud.svg`
153
- },
154
- [o.DOUBAO]: {
155
- id: o.DOUBAO,
156
- name: "火山方舟 (Doubao)",
157
- baseUrl: "https://ark.cn-beijing.volces.com/api/v3",
158
- needsApiKey: !0,
159
- apiFormat: "openai",
160
- supportsModelsApi: !0,
161
- icon: `${O}/doubao.svg`
162
- },
163
- [o.MINIMAX]: {
164
- id: o.MINIMAX,
165
- name: "MiniMax",
166
- baseUrl: "https://api.minimax.io/v1",
167
- needsApiKey: !0,
168
- apiFormat: "openai",
169
- supportsModelsApi: !1,
170
- icon: `${O}/minimax.svg`
171
- },
172
- [o.XAI]: {
173
- id: o.XAI,
174
- name: "xAI (Grok)",
175
- baseUrl: "https://api.x.ai/v1",
176
- needsApiKey: !0,
177
- apiFormat: "openai",
178
- supportsModelsApi: !0,
179
- icon: `${O}/grok.svg`
180
- },
181
- [o.GROQ]: {
182
- id: o.GROQ,
183
- name: "Groq",
184
- baseUrl: "https://api.groq.com/openai/v1",
185
- needsApiKey: !0,
186
- apiFormat: "openai",
187
- supportsModelsApi: !0,
188
- icon: `${O}/groq.svg`
189
- },
190
- [o.MISTRAL]: {
191
- id: o.MISTRAL,
192
- name: "Mistral AI",
193
- baseUrl: "https://api.mistral.ai/v1",
194
- needsApiKey: !0,
195
- apiFormat: "openai",
196
- supportsModelsApi: !0,
197
- icon: `${O}/mistral.svg`
198
- },
199
- [o.TOGETHER]: {
200
- id: o.TOGETHER,
201
- name: "Together AI",
202
- baseUrl: "https://api.together.xyz/v1",
203
- needsApiKey: !0,
204
- apiFormat: "openai",
205
- supportsModelsApi: !0,
206
- icon: `${O}/together.svg`
207
- },
208
- [o.FIREWORKS]: {
209
- id: o.FIREWORKS,
210
- name: "Fireworks AI",
211
- baseUrl: "https://api.fireworks.ai/inference/v1",
212
- needsApiKey: !0,
213
- apiFormat: "openai",
214
- supportsModelsApi: !0,
215
- icon: `${O}/fireworks.svg`
216
- },
217
- [o.DEEPINFRA]: {
218
- id: o.DEEPINFRA,
219
- name: "DeepInfra",
220
- baseUrl: "https://api.deepinfra.com/v1/openai",
221
- needsApiKey: !0,
222
- apiFormat: "openai",
223
- supportsModelsApi: !0,
224
- icon: `${O}/deepinfra.svg`
225
- },
226
- [o.PERPLEXITY]: {
227
- id: o.PERPLEXITY,
228
- name: "Perplexity",
229
- baseUrl: "https://api.perplexity.ai",
230
- needsApiKey: !0,
231
- apiFormat: "openai",
232
- supportsModelsApi: !1,
233
- icon: `${O}/perplexity.svg`
234
- },
235
- [o.COHERE]: {
236
- id: o.COHERE,
237
- name: "Cohere",
238
- baseUrl: "https://api.cohere.com/v2",
239
- needsApiKey: !0,
240
- apiFormat: "cohere",
241
- supportsModelsApi: !0,
242
- icon: `${O}/cohere.svg`
243
- },
244
- [o.OLLAMA]: {
245
- id: o.OLLAMA,
246
- name: "Ollama (Local)",
247
- baseUrl: "http://localhost:11434/v1",
248
- needsApiKey: !1,
249
- apiFormat: "openai",
250
- supportsModelsApi: !0,
251
- icon: `${O}/ollama.svg`
252
- }
253
- }, Me = {
254
- [o.OPENAI]: [
255
- { id: "gpt-5.2-pro", name: "GPT-5.2 Pro" },
256
- { id: "gpt-5.2", name: "GPT-5.2" },
257
- { id: "gpt-5", name: "GPT-5" },
258
- { id: "gpt-5-mini", name: "GPT-5 Mini" },
259
- { id: "gpt-5-nano", name: "GPT-5 Nano" },
260
- { id: "gpt-4.1", name: "GPT-4.1" }
261
- ],
262
- [o.ANTHROPIC]: [
263
- { id: "claude-opus-4.5-20251101", name: "Claude Opus 4.5" },
264
- { id: "claude-opus-4.5-20251101-thinking", name: "Claude Opus 4.5 Thinking" },
265
- { id: "claude-sonnet-4.5-20250929", name: "Claude Sonnet 4.5" },
266
- { id: "claude-sonnet-4.5-20250929-thinking", name: "Claude Sonnet 4.5 Thinking" },
267
- { id: "claude-haiku-4.5-20251001", name: "Claude Haiku 4.5" },
268
- { id: "claude-haiku-4.5-20251001-thinking", name: "Claude Haiku 4.5 Thinking" },
269
- { id: "claude-opus-4.1-20250805", name: "Claude Opus 4.1" },
270
- { id: "claude-opus-4.1-20250805-thinking", name: "Claude Opus 4.1 Thinking" }
271
- ],
272
- [o.GEMINI]: [
273
- { id: "gemini-3-flash-preview", name: "Gemini 3 Flash Preview" },
274
- { id: "gemini-3-pro-preview", name: "Gemini 3 Pro Preview" },
275
- { id: "gemini-2.5-pro", name: "Gemini 2.5 Pro" },
276
- { id: "gemini-2.5-flash", name: "Gemini 2.5 Flash" },
277
- { id: "gemini-2.5-flash-lite", name: "Gemini 2.5 Flash-Lite" }
278
- ],
279
- [o.DEEPSEEK]: [
280
- { id: "deepseek-chat", name: "Deepseek Chat" },
281
- { id: "deepseek-reasoner", name: "Deepseek Reasoner" }
282
- ],
283
- [o.MISTRAL]: [
284
- { id: "mistral-large-latest", name: "Mistral Large" },
285
- { id: "mistral-medium-latest", name: "Mistral Medium" },
286
- { id: "mistral-small-latest", name: "Mistral Small" },
287
- { id: "codestral-latest", name: "Codestral" },
288
- { id: "devstral-latest", name: "Devstral" },
289
- { id: "magistral-medium-latest", name: "Magistral Medium" },
290
- { id: "pixtral-large-latest", name: "Pixtral Large" },
291
- { id: "pixtral-12b-latest", name: "Pixtral 12B" },
292
- { id: "ministral-8b-latest", name: "Ministral 8B" },
293
- { id: "ministral-3b-latest", name: "Ministral 3B" }
294
- ],
295
- [o.GROQ]: [
296
- { id: "canopylabs/orpheus-v1-english", name: "Orpheus V1 English" },
297
- { id: "canopylabs/orpheus-arabic-saudi", name: "Orpheus Arabic Saudi" },
298
- { id: "moonshotai/kimi-k2-instruct", name: "Kimi K2 Instruct" },
299
- { id: "groq/compound-mini", name: "Compound Mini" },
300
- { id: "llama-3.3-70b-versatile", name: "Llama 3.3 70B Versatile" },
301
- { id: "openai/gpt-oss-120b", name: "Gpt Oss 120B" },
302
- { id: "qwen/qwen3-32b", name: "Qwen3 32B" },
303
- { id: "groq/compound", name: "Compound" },
304
- { id: "meta-llama/llama-4-maverick-17b-128e-instruct", name: "Llama 4 Maverick 17B 128E Instruct" }
305
- ],
306
- [o.XAI]: [
307
- { id: "grok-4", name: "Grok 4" },
308
- { id: "grok-4-fast", name: "Grok 4 Fast" },
309
- { id: "grok-3-latest", name: "Grok 3" },
310
- { id: "grok-3-fast", name: "Grok 3 Fast" },
311
- { id: "grok-3-mini-latest", name: "Grok 3 Mini" },
312
- { id: "grok-3-mini-fast", name: "Grok 3 Mini Fast" },
313
- { id: "grok-vision-beta", name: "Grok Vision (Beta)" }
314
- ],
315
- [o.TOGETHER]: [
316
- { id: "Qwen/Qwen2.5-72B-Instruct-Turbo", name: "Qwen2.5 72B Instruct Turbo" },
317
- { id: "Qwen/Qwen3-235B-A22B-Thinking-2507", name: "Qwen3 235B A22B Thinking 2507" },
318
- { id: "deepseek-ai/DeepSeek-R1", name: "Deepseek R1" },
319
- { id: "deepseek-ai/DeepSeek-V3.1", name: "Deepseek V3.1" },
320
- { id: "meta-llama/Llama-3.2-3B-Instruct-Turbo", name: "Llama 3.2 3B Instruct Turbo" },
321
- { id: "meta-llama/Llama-3.3-70B-Instruct-Turbo", name: "Llama 3.3 70B Instruct Turbo" },
322
- { id: "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free", name: "Llama 3.3 70B Instruct Turbo Free" }
323
- ],
324
- [o.FIREWORKS]: [
325
- { id: "accounts/fireworks/models/llama4-scout-instruct-basic", name: "Llama4 Scout Instruct Basic" },
326
- { id: "accounts/fireworks/models/qwen3-vl-235b-a22b-thinking", name: "Qwen3 Vl 235B A22B Thinking" },
327
- { id: "accounts/fireworks/models/deepseek-v3p2", name: "Deepseek V3P2" },
328
- { id: "accounts/fireworks/models/qwen3-vl-30b-a3b-thinking", name: "Qwen3 Vl 30B A3B Thinking" },
329
- { id: "accounts/fireworks/models/qwen3-8b", name: "Qwen3 8B" },
330
- { id: "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct", name: "Qwen3 Vl 30B A3B Instruct" },
331
- { id: "accounts/fireworks/models/qwen2p5-vl-32b-instruct", name: "Qwen2P5 Vl 32B Instruct" },
332
- { id: "accounts/fireworks/models/llama4-maverick-instruct-basic", name: "Llama4 Maverick Instruct Basic" },
333
- { id: "accounts/fireworks/models/qwen3-235b-a22b-thinking-2507", name: "Qwen3 235B A22B Thinking 2507" },
334
- { id: "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct", name: "Qwen3 Coder 480B A35B Instruct" }
335
- ],
336
- [o.DEEPINFRA]: [
337
- { id: "meta-llama/Llama-3.2-11B-Vision-Instruct", name: "Llama 3.2 11B Vision Instruct" },
338
- { id: "Qwen/Qwen3-32B", name: "Qwen3 32B" },
339
- { id: "NousResearch/Hermes-3-Llama-3.1-70B", name: "Hermes 3 Llama 3.1 70B" },
340
- { id: "Qwen/Qwen2.5-72B-Instruct", name: "Qwen2.5 72B Instruct" },
341
- { id: "deepseek-ai/DeepSeek-V3-0324", name: "Deepseek V3 0324" },
342
- { id: "Qwen/Qwen3-VL-235B-A22B-Instruct", name: "Qwen3 Vl 235B A22B Instruct" },
343
- { id: "meta-llama/Llama-3.2-3B-Instruct", name: "Llama 3.2 3B Instruct" },
344
- { id: "Qwen/Qwen2.5-VL-32B-Instruct", name: "Qwen2.5 Vl 32B Instruct" },
345
- { id: "meta-llama/Meta-Llama-3.1-8B-Instruct", name: "Meta Llama 3.1 8B Instruct" },
346
- { id: "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo", name: "Qwen3 Coder 480B A35B Instruct Turbo" }
347
- ],
348
- [o.OPENROUTER]: [
349
- { id: "google/gemini-3-flash-preview", name: "Gemini 3 Flash Preview" },
350
- { id: "mistralai/mistral-small-creative", name: "Mistral Small Creative" },
351
- { id: "openai/gpt-5.2-chat", name: "Gpt 5.2 Chat" },
352
- { id: "openai/gpt-5.2-pro", name: "Gpt 5.2 Pro" },
353
- { id: "openai/gpt-5.2", name: "Gpt 5.2" },
354
- { id: "mistralai/devstral-2512", name: "Devstral 2512" },
355
- { id: "openai/gpt-5.1-codex-max", name: "Gpt 5.1 Codex Max" },
356
- { id: "mistralai/ministral-14b-2512", name: "Ministral 14B 2512" },
357
- { id: "mistralai/ministral-8b-2512", name: "Ministral 8B 2512" },
358
- { id: "mistralai/ministral-3b-2512", name: "Ministral 3B 2512" },
359
- { id: "mistralai/mistral-large-2512", name: "Mistral Large 2512" },
360
- { id: "deepseek/deepseek-v3.2-speciale", name: "Deepseek V3.2 Speciale" }
361
- ],
362
- [o.PERPLEXITY]: [
363
- { id: "codellama-34b-instruct", name: "Codellama 34B Instruct" },
364
- { id: "codellama-70b-instruct", name: "Codellama 70B Instruct" },
365
- { id: "llama-2-70b-chat", name: "Llama 2 70B Chat" },
366
- { id: "llama-3.1-70b-instruct", name: "Llama 3.1 70B Instruct" },
367
- { id: "llama-3.1-8b-instruct", name: "Llama 3.1 8B Instruct" },
368
- { id: "llama-3.1-sonar-huge-128k-online", name: "Llama 3.1 Sonar Huge 128K Online" },
369
- { id: "llama-3.1-sonar-large-128k-chat", name: "Llama 3.1 Sonar Large 128K Chat" },
370
- { id: "llama-3.1-sonar-large-128k-online", name: "Llama 3.1 Sonar Large 128K Online" },
371
- { id: "llama-3.1-sonar-small-128k-chat", name: "Llama 3.1 Sonar Small 128K Chat" }
372
- ],
373
- [o.COHERE]: [
374
- { id: "command-a-vision-07-2025", name: "Command A Vision 07 2025" },
375
- { id: "command-a-reasoning-08-2025", name: "Command A Reasoning 08 2025" },
376
- { id: "command-r-08-2024", name: "Command R 08 2024" },
377
- { id: "command-r7b-arabic-02-2025", name: "Command R7B Arabic 02 2025" },
378
- { id: "command-r7b-12-2024", name: "Command R7B 12 2024" }
379
- ],
380
- [o.MOONSHOT]: [
381
- { id: "moonshot-v1-128k", name: "Moonshot 128K" },
382
- { id: "moonshot-v1-32k", name: "Moonshot 32K" },
383
- { id: "moonshot-v1-8k", name: "Moonshot 8K" },
384
- { id: "kimi-k2-0711-chat", name: "Kimi K2 Chat" },
385
- { id: "moonshot-v1-auto", name: "Moonshot Auto" }
386
- ],
387
- [o.QWEN]: [
388
- { id: "qwen-flash", name: "Qwen Flash" },
389
- { id: "qwen3-vl-plus-2025-12-19", name: "Qwen3 Vl Plus 2025 12 19" },
390
- { id: "qwen3-tts-vd-realtime-2025-12-16", name: "Qwen3 Tts Vd Realtime 2025 12 16" },
391
- { id: "qwen-image-edit-plus-2025-12-15", name: "Qwen Image Edit Plus 2025 12 15" },
392
- { id: "qwen3-omni-flash-2025-12-01", name: "Qwen3 Omni Flash 2025 12 01" },
393
- { id: "qwen3-omni-flash-realtime-2025-12-01", name: "Qwen3 Omni Flash Realtime 2025 12 01" },
394
- { id: "qwen3-livetranslate-flash-2025-12-01", name: "Qwen3 Livetranslate Flash 2025 12 01" },
395
- { id: "qwen3-livetranslate-flash", name: "Qwen3 Livetranslate Flash" },
396
- { id: "qwen-plus-2025-12-01", name: "Qwen Plus 2025 12 01" },
397
- { id: "qwen3-tts-vc-realtime-2025-11-27", name: "Qwen3 Tts Vc Realtime 2025 11 27" }
398
- ],
399
- [o.ZHIPU]: [
400
- { id: "glm-4.5", name: "Glm 4.5" },
401
- { id: "glm-4.5-air", name: "Glm 4.5 Air" },
402
- { id: "glm-4.6", name: "Glm 4.6" },
403
- { id: "glm-4.7", name: "Glm 4.7" }
404
- ],
405
- [o.SILICONFLOW]: [
406
- { id: "deepseek-ai/DeepSeek-V3.2", name: "Deepseek V3.2" },
407
- { id: "deepseek-ai/DeepSeek-V3.1-Terminus", name: "Deepseek V3.1 Terminus" },
408
- { id: "deepseek-ai/DeepSeek-R1", name: "Deepseek R1" },
409
- { id: "deepseek-ai/DeepSeek-V3", name: "Deepseek V3" },
410
- { id: "zai-org/GLM-4.6V", name: "Glm 4.6V" },
411
- { id: "zai-org/GLM-4.6", name: "Glm 4.6" },
412
- { id: "Pro/zai-org/GLM-4.7", name: "Glm 4.7" },
413
- { id: "Qwen/Qwen3-VL-32B-Instruct", name: "Qwen3 Vl 32B Instruct" }
414
- ],
415
- [o.OLLAMA]: [
416
- { id: "llama3.3", name: "Llama 3.3" },
417
- { id: "llama3.2", name: "Llama 3.2" },
418
- { id: "qwq", name: "QwQ (推理)" },
419
- { id: "qwen3:32b", name: "Qwen3 32B" },
420
- { id: "deepseek-r1:32b", name: "DeepSeek R1 32B" },
421
- { id: "deepseek-coder-v2", name: "DeepSeek Coder V2" },
422
- { id: "gemma3:27b", name: "Gemma 3 27B" },
423
- { id: "mistral:7b", name: "Mistral 7B" },
424
- { id: "phi4", name: "Phi 4" },
425
- { id: "codellama", name: "Code Llama" }
426
- ],
427
- [o.DOUBAO]: [
428
- { id: "doubao-seed-1-8-251215", name: "Doubao 1.8" },
429
- { id: "doubao-seed-1-6-251015", name: "Doubao 1.6" },
430
- { id: "doubao-seed-1-6-lite-251015", name: "Doubao 1.6 Lite" },
431
- { id: "doubao-seed-1-6-flash-250828", name: "Doubao 1.6 Flash" },
432
- { id: "doubao-seed-1-6-thinking-250615", name: "Doubao 1.6 Thinking" }
433
- ],
434
- [o.MINIMAX]: [
435
- { id: "MiniMax-M2.1", name: "MiniMax M2.1" },
436
- { id: "MiniMax-M2.1-lightning", name: "MiniMax M2.1 Lightning" },
437
- { id: "MiniMax-M2", name: "MiniMax M2" }
438
- ]
439
- };
440
- function de(e) {
441
- return Me[e] || [];
442
- }
443
- const we = (e) => Array.isArray(e == null ? void 0 : e.data) ? e.data.filter((a) => a.id).map((a) => {
444
- const s = a.name || (a.id.split("/").pop() ?? "").replace(/[-_]/g, " ").replace(/\b\w/g, (i) => i.toUpperCase());
445
- return {
446
- id: a.id,
447
- name: s,
448
- created: a.created || 0
449
- };
450
- }).sort((a, s) => (s.created || 0) - (a.created || 0)) : [], he = {
451
- format: "openai",
452
- getModelsEndpoint: (e) => `${e}/models`,
453
- getChatEndpoint: (e) => `${e}/chat/completions`,
454
- buildHeaders: (e) => ({
455
- "Content-Type": "application/json",
456
- Authorization: `Bearer ${e}`
457
- }),
458
- buildChatPayload: (e, a, s) => ({
459
- model: e,
460
- messages: a,
461
- max_tokens: s
462
- }),
463
- parseChatResponse: (e) => {
464
- var a, s, i;
465
- return ((i = (s = (a = e.choices) == null ? void 0 : a[0]) == null ? void 0 : s.message) == null ? void 0 : i.content) || "";
466
- }
467
- }, Ce = {
468
- format: "anthropic",
469
- getChatEndpoint: (e) => `${e}/messages`,
470
- buildHeaders: (e) => ({
471
- "Content-Type": "application/json",
472
- "x-api-key": e,
473
- "anthropic-version": "2023-06-01"
474
- }),
475
- buildChatPayload: (e, a, s) => ({
476
- model: e,
477
- messages: a,
478
- max_tokens: s
479
- }),
480
- parseChatResponse: (e) => {
481
- var a, s;
482
- return ((s = (a = e.content) == null ? void 0 : a[0]) == null ? void 0 : s.text) || "";
483
- }
484
- }, Ie = {
485
- format: "gemini",
486
- getModelsEndpoint: (e, a) => `${e}/models?key=${a}`,
487
- getChatEndpoint: (e, a, s) => `${e}/models/${s}:generateContent?key=${a}`,
488
- buildHeaders: () => ({
489
- "Content-Type": "application/json"
490
- }),
491
- buildChatPayload: (e, a, s) => ({
492
- contents: a.map((t) => ({
493
- role: t.role === "assistant" ? "model" : "user",
494
- parts: [{ text: t.content }]
495
- })),
496
- generationConfig: { maxOutputTokens: s }
497
- }),
498
- parseChatResponse: (e) => {
499
- var a, s, i, t, n;
500
- return ((n = (t = (i = (s = (a = e.candidates) == null ? void 0 : a[0]) == null ? void 0 : s.content) == null ? void 0 : i.parts) == null ? void 0 : t[0]) == null ? void 0 : n.text) || "";
501
- },
502
- // Gemini 返回格式: { models: [{ name: "models/gemini-pro", ... }] }
503
- parseModelsResponse: (e) => Array.isArray(e.models) ? e.models.filter((a) => {
504
- var s;
505
- return (s = a.supportedGenerationMethods) == null ? void 0 : s.includes("generateContent");
506
- }).map((a) => ({
507
- id: a.name.replace("models/", ""),
508
- // "models/gemini-pro" -> "gemini-pro"
509
- name: a.displayName || a.name.replace("models/", ""),
510
- created: a.created || 0
511
- })).sort((a, s) => (s.created || 0) - (a.created || 0)) : []
512
- }, xe = {
513
- format: "cohere",
514
- getModelsEndpoint: (e) => `${e}/models`,
515
- getChatEndpoint: (e) => `${e}/chat`,
516
- buildHeaders: (e) => ({
517
- "Content-Type": "application/json",
518
- Authorization: `Bearer ${e}`
519
- }),
520
- buildChatPayload: (e, a, s) => {
521
- const i = a[a.length - 1], t = a.slice(0, -1).map((n) => ({
522
- role: n.role === "assistant" ? "CHATBOT" : "USER",
523
- message: n.content
524
- }));
525
- return {
526
- model: e,
527
- message: i.content,
528
- chat_history: t,
529
- max_tokens: s
530
- };
531
- },
532
- parseChatResponse: (e) => e.text || ""
533
- }, Ae = {
534
- openai: he,
535
- anthropic: Ce,
536
- gemini: Ie,
537
- cohere: xe
538
- };
539
- function fe(e) {
540
- return Ae[e] || he;
541
- }
542
- async function Ee(e) {
543
- const { provider: a, apiKey: s, model: i, baseUrl: t, proxyUrl: n } = e, v = t || a.baseUrl, l = Date.now();
544
- try {
545
- if (n) {
546
- const k = await (await fetch(`${n}/test`, {
547
- method: "POST",
548
- headers: { "Content-Type": "application/json" },
549
- body: JSON.stringify({
550
- provider_id: a.id,
551
- api_key: s,
552
- model: i || "",
553
- base_url: t || a.baseUrl,
554
- api_format: a.apiFormat
555
- })
556
- })).json();
557
- return {
558
- success: k.success,
559
- latencyMs: k.latency_ms || Date.now() - l,
560
- message: k.message
561
- };
562
- }
563
- const r = fe(a.apiFormat), u = i || "";
564
- if (!u)
565
- return {
566
- success: !1,
567
- latencyMs: 0,
568
- message: "请先选择模型 (Please select a model)"
569
- };
570
- const c = r.buildHeaders(s), f = r.buildChatPayload(u, [{ role: "user", content: "Hi" }], 5), p = r.getChatEndpoint(v, s, u), h = await fetch(p, {
571
- method: "POST",
572
- headers: c,
573
- body: JSON.stringify(f)
574
- }), I = Date.now() - l;
575
- if (h.ok)
576
- return { success: !0, latencyMs: I, message: "连接成功" };
577
- {
578
- const A = await h.text();
579
- return {
580
- success: !1,
581
- latencyMs: I,
582
- message: `HTTP ${h.status}: ${A.slice(0, 200)}`
583
- };
584
- }
585
- } catch (r) {
586
- return {
587
- success: !1,
588
- latencyMs: Date.now() - l,
589
- message: r instanceof Error ? r.message : String(r)
590
- };
591
- }
592
- }
593
- async function Le(e) {
594
- var v;
595
- const { provider: a, apiKey: s, baseUrl: i, proxyUrl: t, fallbackToStatic: n = !0 } = e;
596
- if (t)
597
- try {
598
- const r = await (await fetch(`${t}/models`, {
599
- method: "POST",
600
- headers: { "Content-Type": "application/json" },
601
- body: JSON.stringify({
602
- provider_id: a.id,
603
- api_key: s || void 0,
604
- base_url: i || a.baseUrl
605
- })
606
- })).json();
607
- if (r.success && ((v = r.models) == null ? void 0 : v.length) > 0)
608
- return r.models;
609
- } catch (l) {
610
- if (console.warn("Failed to fetch models via proxy:", l), !n)
611
- throw l;
612
- }
613
- if (!t && a.supportsModelsApi)
614
- try {
615
- const l = fe(a.apiFormat);
616
- if (l.getModelsEndpoint) {
617
- const r = l.getModelsEndpoint(i || a.baseUrl, s || ""), u = l.buildHeaders(s || ""), c = await fetch(r, {
618
- method: "GET",
619
- headers: u
620
- });
621
- if (c.ok) {
622
- const f = await c.json();
623
- return (l.parseModelsResponse || we)(f);
624
- } else if (!n)
625
- throw new Error(`HTTP ${c.status}`);
626
- }
627
- } catch (l) {
628
- if (console.warn("Failed to fetch models directly:", l), !n)
629
- throw l;
630
- }
631
- if (!n && a.supportsModelsApi)
632
- throw new Error("Failed to fetch models");
633
- return de(a.id);
634
- }
635
- const se = "ai_provider_config", Oe = {
636
- get: (e) => typeof window > "u" ? null : localStorage.getItem(e),
637
- set: (e, a) => {
638
- typeof window > "u" || localStorage.setItem(e, a);
639
- },
640
- remove: (e) => {
641
- typeof window > "u" || localStorage.removeItem(e);
642
- }
643
- };
644
- function Se(e = Oe, a = {}) {
645
- const s = a.serialize || JSON.stringify, i = a.deserialize || JSON.parse;
646
- return {
647
- /**
648
- * Save AI config
649
- */
650
- save(t) {
651
- try {
652
- const n = s(t);
653
- e.set(se, n);
654
- } catch (n) {
655
- console.error("Failed to save config:", n);
656
- }
657
- },
658
- /**
659
- * Load AI config
660
- */
661
- load() {
662
- const t = e.get(se);
663
- if (!t)
664
- return null;
665
- try {
666
- return i(t);
667
- } catch (n) {
668
- return console.error("Failed to load config:", n), null;
669
- }
670
- },
671
- /**
672
- * Clear AI config
673
- */
674
- clear() {
675
- e.remove(se);
676
- }
677
- };
678
- }
679
- function Te(e) {
680
- if (!e)
681
- return {
682
- providers: Object.values(pe),
683
- getModels: (r) => de(r)
684
- };
685
- const { mode: a, include: s, exclude: i, custom: t } = e;
686
- let n = [];
687
- if (a === "default") {
688
- let r = Object.values(pe);
689
- s && s.length > 0 && (r = r.filter((u) => s.includes(u.id))), i && i.length > 0 && (r = r.filter((u) => !i.includes(u.id))), n = [...r];
690
- }
691
- const v = {};
692
- if (t)
693
- for (const [r, u] of Object.entries(t)) {
694
- const c = {
695
- id: r,
696
- name: u.name,
697
- baseUrl: u.baseUrl,
698
- needsApiKey: u.needsApiKey,
699
- apiFormat: u.apiFormat,
700
- supportsModelsApi: u.supportsModelsApi ?? !1,
701
- icon: u.icon
702
- }, f = n.findIndex((p) => p.id === r);
703
- f >= 0 ? n[f] = {
704
- ...n[f],
705
- ...c,
706
- icon: c.icon || n[f].icon
707
- } : n.push(c), u.models && u.models.length > 0 && (v[r] = u.models);
708
- }
709
- return { providers: n, getModels: (r) => v[r] ? v[r] : de(r) };
710
- }
711
- function Be(e = {}) {
712
- var F, D, X, q, G;
713
- const a = E(((F = e.initialConfig) == null ? void 0 : F.providerId) || ""), s = E(((D = e.initialConfig) == null ? void 0 : D.apiKey) || ""), i = E(((X = e.initialConfig) == null ? void 0 : X.model) || ""), t = E(((q = e.initialConfig) == null ? void 0 : q.modelName) || ""), n = E(((G = e.initialConfig) == null ? void 0 : G.baseUrl) || ""), v = E([]), l = E("idle"), r = E(null), u = E(!1), c = E(null), f = T(() => Te(e.providerConfig)), p = T(() => f.value.providers), h = T(
714
- () => p.value.find((m) => m.id === a.value) || null
715
- ), I = Se(void 0, {
1
+ import { ref as $, computed as A, onMounted as ne, watch as q, defineComponent as V, onUnmounted as ie, createElementBlock as p, openBlock as m, normalizeClass as z, Fragment as R, renderList as ee, normalizeStyle as G, toDisplayString as w, unref as v, createCommentVNode as W, createVNode as j, createElementVNode as n, withDirectives as ve, vModelText as he, createTextVNode as D } from "vue";
2
+ import { resolveProviderConfig as fe, createConfigStorage as pe, fetchModels as me, testConnection as ge, I18N as Q } from "@tombcato/ai-selector-core";
3
+ function ye(e = {}) {
4
+ var N, E, H, Y, O;
5
+ const r = $(((N = e.initialConfig) == null ? void 0 : N.providerId) || ""), l = $(((E = e.initialConfig) == null ? void 0 : E.apiKey) || ""), a = $(((H = e.initialConfig) == null ? void 0 : H.model) || ""), t = $(((Y = e.initialConfig) == null ? void 0 : Y.modelName) || ""), s = $(((O = e.initialConfig) == null ? void 0 : O.baseUrl) || ""), f = $([]), u = $("idle"), i = $(null), y = $(!1), c = $(null), g = A(() => fe(e.providerConfig)), d = A(() => g.value.providers), h = A(
6
+ () => d.value.find((o) => o.id === r.value) || null
7
+ ), M = pe(void 0, {
716
8
  serialize: e.onSerialize,
717
9
  deserialize: e.onDeserialize
718
- }), A = E(!1);
719
- ce(() => {
720
- const m = I.load();
721
- m && m.providerId && p.value.some((M) => M.id === m.providerId) && (a.value = m.providerId, m.apiKey && (s.value = m.apiKey), m.model && (i.value = m.model), m.modelName && (t.value = m.modelName), m.baseUrl && (n.value = m.baseUrl)), setTimeout(() => {
722
- A.value = !0;
10
+ }), I = $(!1);
11
+ ne(() => {
12
+ const o = M.load();
13
+ o && o.providerId && d.value.some((b) => b.id === o.providerId) && (r.value = o.providerId, o.apiKey && (l.value = o.apiKey), o.model && (a.value = o.model), o.modelName && (t.value = o.modelName), o.baseUrl && (s.value = o.baseUrl)), setTimeout(() => {
14
+ I.value = !0;
723
15
  }, 0);
724
- }), j(a, () => {
725
- A.value && (s.value = "", i.value = "", t.value = "", n.value = "", l.value = "idle", r.value = null);
16
+ }), q(r, () => {
17
+ I.value && (l.value = "", a.value = "", t.value = "", s.value = "", u.value = "idle", i.value = null);
726
18
  });
727
- let k = null;
728
- const L = /* @__PURE__ */ new Map();
729
- j([a, s, n], () => {
730
- if (k && clearTimeout(k), !a.value || !h.value) {
731
- v.value = [], c.value = null, u.value = !1;
19
+ let x = null;
20
+ const U = /* @__PURE__ */ new Map();
21
+ q([r, l, s], () => {
22
+ if (x && clearTimeout(x), !r.value || !h.value) {
23
+ f.value = [], c.value = null, y.value = !1;
732
24
  return;
733
25
  }
734
- const m = h.value.supportsModelsApi && (!h.value.needsApiKey || !!s.value), M = n.value || h.value.baseUrl, $ = `${a.value}|${M}|${s.value}`, _ = L.get($);
735
- if (_) {
736
- v.value = _, c.value = null, u.value = !1;
26
+ const o = h.value.supportsModelsApi && (!h.value.needsApiKey || !!l.value), b = s.value || h.value.baseUrl, F = `${r.value}|${b}|${l.value}`, P = U.get(F);
27
+ if (P) {
28
+ f.value = P, c.value = null, y.value = !1;
737
29
  return;
738
30
  }
739
- if (!m) {
740
- const K = f.value.getModels(a.value);
741
- v.value = K, L.set($, K), c.value = null, u.value = !1;
31
+ if (!o) {
32
+ const _ = g.value.getModels(r.value);
33
+ f.value = _, U.set(F, _), c.value = null, y.value = !1;
742
34
  return;
743
35
  }
744
- u.value = !0, c.value = null, v.value.length === 0 && (v.value = f.value.getModels(a.value)), k = setTimeout(async () => {
36
+ y.value = !0, c.value = null, f.value.length === 0 && (f.value = g.value.getModels(r.value)), x = setTimeout(async () => {
745
37
  try {
746
- let K;
747
- e.modelFetcher ? K = await e.modelFetcher({
38
+ let _;
39
+ e.modelFetcher ? _ = await e.modelFetcher({
748
40
  type: "fetchModels",
749
41
  providerId: h.value.id,
750
- baseUrl: M,
751
- apiKey: s.value
752
- }) : K = await Le({
42
+ baseUrl: b,
43
+ apiKey: l.value
44
+ }) : _ = await me({
753
45
  provider: h.value,
754
- apiKey: s.value,
755
- baseUrl: M,
46
+ apiKey: l.value,
47
+ baseUrl: b,
756
48
  proxyUrl: e.proxyUrl,
757
49
  fallbackToStatic: !1
758
- }), v.value = K, L.set($, K);
759
- } catch (K) {
760
- console.warn("Model fetch failed:", K), c.value = "fetchModelsFailed", v.value = f.value.getModels(a.value);
50
+ }), f.value = _, U.set(F, _);
51
+ } catch (_) {
52
+ console.warn("Model fetch failed:", _), c.value = "fetchModelsFailed", f.value = g.value.getModels(r.value);
761
53
  } finally {
762
- u.value = !1;
54
+ y.value = !1;
763
55
  }
764
56
  }, 500);
765
- }, { immediate: !0 }), j([s, n], () => {
766
- (l.value === "error" || l.value === "success") && (l.value = "idle", r.value = null);
57
+ }, { immediate: !0 }), q([l, s], () => {
58
+ (u.value === "error" || u.value === "success") && (u.value = "idle", i.value = null);
767
59
  });
768
- async function w() {
769
- if (!h.value || h.value.needsApiKey && !s.value) return;
770
- l.value = "testing", r.value = null;
771
- let m;
60
+ async function k() {
61
+ if (!h.value || h.value.needsApiKey && !l.value) return;
62
+ u.value = "testing", i.value = null;
63
+ let o;
772
64
  if (e.modelFetcher)
773
65
  try {
774
- const M = await e.modelFetcher({
66
+ const b = await e.modelFetcher({
775
67
  type: "checkConnection",
776
68
  providerId: h.value.id,
777
- baseUrl: n.value || h.value.baseUrl,
778
- apiKey: s.value,
779
- modelId: i.value
69
+ baseUrl: s.value || h.value.baseUrl,
70
+ apiKey: l.value,
71
+ modelId: a.value
780
72
  });
781
- m = {
782
- success: M.success,
783
- latencyMs: M.latency || M.latencyMs,
784
- message: M.message
73
+ o = {
74
+ success: b.success,
75
+ latencyMs: b.latency || b.latencyMs,
76
+ message: b.message
785
77
  };
786
- } catch (M) {
787
- m = { success: !1, message: M.message || "Unknown error" };
78
+ } catch (b) {
79
+ o = { success: !1, message: b.message || "Unknown error" };
788
80
  }
789
81
  else
790
- m = await Ee({
82
+ o = await ge({
791
83
  provider: h.value,
792
- apiKey: s.value,
793
- baseUrl: n.value,
794
- model: i.value,
84
+ apiKey: l.value,
85
+ baseUrl: s.value,
86
+ model: a.value,
795
87
  proxyUrl: e.proxyUrl
796
88
  });
797
- return r.value = m, l.value = m.success ? "success" : "error", setTimeout(() => {
798
- l.value = "idle";
799
- }, 2e3), m;
89
+ return i.value = o, u.value = o.success ? "success" : "error", setTimeout(() => {
90
+ u.value = "idle";
91
+ }, 2e3), o;
800
92
  }
801
93
  function S() {
802
- const m = v.value.find(($) => $.id === i.value), M = (m == null ? void 0 : m.name) || t.value || i.value;
803
- m != null && m.name && m.name !== t.value && (t.value = m.name), I.save({
804
- providerId: a.value,
805
- apiKey: s.value,
806
- model: i.value,
807
- modelName: M,
808
- baseUrl: n.value
94
+ const o = f.value.find((F) => F.id === a.value), b = (o == null ? void 0 : o.name) || t.value || a.value;
95
+ o != null && o.name && o.name !== t.value && (t.value = o.name), M.save({
96
+ providerId: r.value,
97
+ apiKey: l.value,
98
+ model: a.value,
99
+ modelName: b,
100
+ baseUrl: s.value
809
101
  });
810
102
  }
811
- function U() {
812
- I.clear(), a.value = "", s.value = "", i.value = "", t.value = "", n.value = "";
103
+ function K() {
104
+ M.clear(), r.value = "", l.value = "", a.value = "", t.value = "", s.value = "";
813
105
  }
814
- function B(m, M) {
815
- if (i.value = m, M)
816
- t.value = M;
106
+ function L(o, b) {
107
+ if (a.value = o, b)
108
+ t.value = b;
817
109
  else {
818
- const $ = v.value.find((_) => _.id === m);
819
- t.value = ($ == null ? void 0 : $.name) || m;
110
+ const F = f.value.find((P) => P.id === o);
111
+ t.value = (F == null ? void 0 : F.name) || o;
820
112
  }
821
113
  }
822
- const R = T(() => {
823
- var m;
824
- return !(!a.value || !i.value || (m = h.value) != null && m.needsApiKey && !s.value);
825
- }), C = T(() => {
826
- var m;
114
+ const T = A(() => {
115
+ var o;
116
+ return !(!r.value || !a.value || (o = h.value) != null && o.needsApiKey && !l.value);
117
+ }), C = A(() => {
118
+ var o;
827
119
  return {
828
- providerId: a.value,
829
- apiKey: s.value,
830
- model: i.value,
120
+ providerId: r.value,
121
+ apiKey: l.value,
122
+ model: a.value,
831
123
  modelName: t.value,
832
- baseUrl: n.value || ((m = h.value) == null ? void 0 : m.baseUrl) || ""
124
+ baseUrl: s.value || ((o = h.value) == null ? void 0 : o.baseUrl) || ""
833
125
  };
834
126
  });
835
127
  return {
836
128
  // State (Refs)
837
- providerId: a,
838
- apiKey: s,
839
- model: i,
129
+ providerId: r,
130
+ apiKey: l,
131
+ model: a,
840
132
  modelName: t,
841
- baseUrl: n,
842
- models: v,
843
- testStatus: l,
844
- testResult: r,
845
- isFetchingModels: u,
133
+ baseUrl: s,
134
+ models: f,
135
+ testStatus: u,
136
+ testResult: i,
137
+ isFetchingModels: y,
846
138
  fetchModelError: c,
847
139
  // Computed
848
140
  provider: h,
849
- providers: p,
850
- isValid: R,
141
+ providers: d,
142
+ isValid: T,
851
143
  config: C,
852
144
  // Actions
853
- runTest: w,
145
+ runTest: k,
854
146
  save: S,
855
- clear: U,
856
- selectModel: B
147
+ clear: K,
148
+ selectModel: L
857
149
  };
858
150
  }
859
- var Pe = Object.defineProperty, Ue = (e, a, s) => a in e ? Pe(e, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[a] = s, ne = (e, a, s) => Ue(e, typeof a != "symbol" ? a + "" : a, s);
860
- const N = "\0";
861
- class Fe {
862
- constructor(a) {
863
- ne(this, "numOriginalCharacters"), ne(this, "characterList"), ne(this, "characterIndicesMap");
864
- const s = [...a], i = s.length;
865
- this.numOriginalCharacters = i, this.characterIndicesMap = /* @__PURE__ */ new Map();
866
- for (let t = 0; t < i; t++)
867
- this.characterIndicesMap.set(s[t], t);
868
- this.characterList = new Array(i * 2 + 1), this.characterList[0] = N;
869
- for (let t = 0; t < i; t++)
870
- this.characterList[1 + t] = s[t], this.characterList[1 + i + t] = s[t];
151
+ var be = Object.defineProperty, xe = (e, r, l) => r in e ? be(e, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[r] = l, te = (e, r, l) => xe(e, typeof r != "symbol" ? r + "" : r, l);
152
+ const B = "\0";
153
+ class ke {
154
+ constructor(r) {
155
+ te(this, "numOriginalCharacters"), te(this, "characterList"), te(this, "characterIndicesMap");
156
+ const l = [...r], a = l.length;
157
+ this.numOriginalCharacters = a, this.characterIndicesMap = /* @__PURE__ */ new Map();
158
+ for (let t = 0; t < a; t++)
159
+ this.characterIndicesMap.set(l[t], t);
160
+ this.characterList = new Array(a * 2 + 1), this.characterList[0] = B;
161
+ for (let t = 0; t < a; t++)
162
+ this.characterList[1 + t] = l[t], this.characterList[1 + a + t] = l[t];
871
163
  }
872
- getCharacterIndices(a, s, i) {
873
- let t = this.getIndexOfChar(a), n = this.getIndexOfChar(s);
874
- if (t < 0 || n < 0) return null;
875
- switch (i) {
164
+ getCharacterIndices(r, l, a) {
165
+ let t = this.getIndexOfChar(r), s = this.getIndexOfChar(l);
166
+ if (t < 0 || s < 0) return null;
167
+ switch (a) {
876
168
  case "DOWN":
877
- s === N ? n = this.characterList.length : n < t && (n += this.numOriginalCharacters);
169
+ l === B ? s = this.characterList.length : s < t && (s += this.numOriginalCharacters);
878
170
  break;
879
171
  case "UP":
880
- t < n && (t += this.numOriginalCharacters);
172
+ t < s && (t += this.numOriginalCharacters);
881
173
  break;
882
174
  case "ANY":
883
- if (a !== N && s !== N) {
884
- if (n < t) {
885
- const v = t - n;
886
- this.numOriginalCharacters - t + n < v && (n += this.numOriginalCharacters);
887
- } else if (t < n) {
888
- const v = n - t;
889
- this.numOriginalCharacters - n + t < v && (t += this.numOriginalCharacters);
175
+ if (r !== B && l !== B) {
176
+ if (s < t) {
177
+ const f = t - s;
178
+ this.numOriginalCharacters - t + s < f && (s += this.numOriginalCharacters);
179
+ } else if (t < s) {
180
+ const f = s - t;
181
+ this.numOriginalCharacters - s + t < f && (t += this.numOriginalCharacters);
890
182
  }
891
183
  }
892
184
  break;
893
185
  }
894
- return { startIndex: t, endIndex: n };
186
+ return { startIndex: t, endIndex: s };
895
187
  }
896
188
  getSupportedCharacters() {
897
189
  return new Set(this.characterIndicesMap.keys());
@@ -899,64 +191,64 @@ class Fe {
899
191
  getCharacterList() {
900
192
  return this.characterList;
901
193
  }
902
- getIndexOfChar(a) {
903
- return a === N ? 0 : this.characterIndicesMap.has(a) ? this.characterIndicesMap.get(a) + 1 : -1;
194
+ getIndexOfChar(r) {
195
+ return r === B ? 0 : this.characterIndicesMap.has(r) ? this.characterIndicesMap.get(r) + 1 : -1;
904
196
  }
905
197
  }
906
- const te = 0, Y = 1, ee = 2;
907
- function $e(e, a, s) {
908
- let i = 0, t = 0;
909
- const n = [];
198
+ const Z = 0, J = 1, X = 2;
199
+ function Ce(e, r, l) {
200
+ let a = 0, t = 0;
201
+ const s = [];
910
202
  for (; ; ) {
911
- const v = i === e.length, l = t === a.length;
912
- if (v && l) break;
913
- if (v) {
914
- for (; t < a.length; t++) n.push(Y);
203
+ const f = a === e.length, u = t === r.length;
204
+ if (f && u) break;
205
+ if (f) {
206
+ for (; t < r.length; t++) s.push(J);
915
207
  break;
916
208
  }
917
- if (l) {
918
- for (; i < e.length; i++) n.push(ee);
209
+ if (u) {
210
+ for (; a < e.length; a++) s.push(X);
919
211
  break;
920
212
  }
921
- const r = s.has(e[i]), u = s.has(a[t]);
922
- if (r && u) {
923
- let c = i + 1, f = t + 1;
924
- for (; c < e.length && s.has(e[c]); ) c++;
925
- for (; f < a.length && s.has(a[f]); ) f++;
926
- const p = c - i, h = f - t;
927
- if (p === h)
928
- for (let I = 0; I < p; I++) n.push(te);
213
+ const i = l.has(e[a]), y = l.has(r[t]);
214
+ if (i && y) {
215
+ let c = a + 1, g = t + 1;
216
+ for (; c < e.length && l.has(e[c]); ) c++;
217
+ for (; g < r.length && l.has(r[g]); ) g++;
218
+ const d = c - a, h = g - t;
219
+ if (d === h)
220
+ for (let M = 0; M < d; M++) s.push(Z);
929
221
  else {
930
- const I = Array(p + 1).fill(null).map(() => Array(h + 1).fill(0));
931
- for (let w = 0; w <= p; w++) I[w][0] = w;
932
- for (let w = 0; w <= h; w++) I[0][w] = w;
933
- for (let w = 1; w <= p; w++)
222
+ const M = Array(d + 1).fill(null).map(() => Array(h + 1).fill(0));
223
+ for (let k = 0; k <= d; k++) M[k][0] = k;
224
+ for (let k = 0; k <= h; k++) M[0][k] = k;
225
+ for (let k = 1; k <= d; k++)
934
226
  for (let S = 1; S <= h; S++) {
935
- const U = e[i + w - 1] === a[t + S - 1] ? 0 : 1;
936
- I[w][S] = Math.min(I[w - 1][S] + 1, I[w][S - 1] + 1, I[w - 1][S - 1] + U);
227
+ const K = e[a + k - 1] === r[t + S - 1] ? 0 : 1;
228
+ M[k][S] = Math.min(M[k - 1][S] + 1, M[k][S - 1] + 1, M[k - 1][S - 1] + K);
937
229
  }
938
- const A = [];
939
- let k = p, L = h;
940
- for (; k > 0 || L > 0; )
941
- if (k === 0)
942
- A.push(Y), L--;
943
- else if (L === 0)
944
- A.push(ee), k--;
230
+ const I = [];
231
+ let x = d, U = h;
232
+ for (; x > 0 || U > 0; )
233
+ if (x === 0)
234
+ I.push(J), U--;
235
+ else if (U === 0)
236
+ I.push(X), x--;
945
237
  else {
946
- const w = I[k][L - 1], S = I[k - 1][L], U = I[k - 1][L - 1];
947
- w < S && w < U ? (A.push(Y), L--) : S < U ? (A.push(ee), k--) : (A.push(te), k--, L--);
238
+ const k = M[x][U - 1], S = M[x - 1][U], K = M[x - 1][U - 1];
239
+ k < S && k < K ? (I.push(J), U--) : S < K ? (I.push(X), x--) : (I.push(Z), x--, U--);
948
240
  }
949
- for (let w = A.length - 1; w >= 0; w--) n.push(A[w]);
241
+ for (let k = I.length - 1; k >= 0; k--) s.push(I[k]);
950
242
  }
951
- i = c, t = f;
952
- } else r ? (n.push(Y), t++) : u ? (n.push(ee), i++) : (n.push(te), i++, t++);
243
+ a = c, t = g;
244
+ } else i ? (s.push(J), t++) : y ? (s.push(X), a++) : (s.push(Z), a++, t++);
953
245
  }
954
- return n;
246
+ return s;
955
247
  }
956
- function ie() {
248
+ function ae() {
957
249
  return {
958
- currentChar: N,
959
- targetChar: N,
250
+ currentChar: B,
251
+ targetChar: B,
960
252
  charList: null,
961
253
  startIndex: 0,
962
254
  endIndex: 0,
@@ -968,30 +260,30 @@ function ie() {
968
260
  currDelta: 0
969
261
  };
970
262
  }
971
- function re(e, a, s, i) {
263
+ function se(e, r, l, a) {
972
264
  const t = { ...e };
973
- t.targetChar = a, t.sourceWidth = t.currentWidth, t.targetWidth = a === N ? 0 : 1;
974
- let n = !1;
975
- for (const v of s) {
976
- const l = v.getCharacterIndices(t.currentChar, a, i);
977
- if (l) {
978
- t.charList = v.getCharacterList(), t.startIndex = l.startIndex, t.endIndex = l.endIndex, n = !0;
265
+ t.targetChar = r, t.sourceWidth = t.currentWidth, t.targetWidth = r === B ? 0 : 1;
266
+ let s = !1;
267
+ for (const f of l) {
268
+ const u = f.getCharacterIndices(t.currentChar, r, a);
269
+ if (u) {
270
+ t.charList = f.getCharacterList(), t.startIndex = u.startIndex, t.endIndex = u.endIndex, s = !0;
979
271
  break;
980
272
  }
981
273
  }
982
- return n || (t.charList = t.currentChar === a ? [t.currentChar] : [t.currentChar, a], t.startIndex = 0, t.endIndex = t.currentChar === a ? 0 : 1), t.directionAdj = t.endIndex >= t.startIndex ? 1 : -1, t.prevDelta = t.currDelta, t.currDelta = 0, t;
274
+ return s || (t.charList = t.currentChar === r ? [t.currentChar] : [t.currentChar, r], t.startIndex = 0, t.endIndex = t.currentChar === r ? 0 : 1), t.directionAdj = t.endIndex >= t.startIndex ? 1 : -1, t.prevDelta = t.currDelta, t.currDelta = 0, t;
983
275
  }
984
- function le(e, a, s = !1) {
985
- const i = { ...e }, t = Math.abs(i.endIndex - i.startIndex), n = a * t, v = n - Math.floor(n), l = i.prevDelta * (1 - a), r = v * i.directionAdj + l, u = i.startIndex + Math.floor(n) * i.directionAdj;
986
- return a >= 1 ? (i.currentChar = i.targetChar, i.currDelta = 0, i.prevDelta = 0) : s && i.charList && u >= 0 && u < i.charList.length && (i.currentChar = i.charList[u], i.currDelta = r), i.currentWidth = i.sourceWidth + (i.targetWidth - i.sourceWidth) * a, { col: i, charIdx: u, delta: r };
276
+ function le(e, r, l = !1) {
277
+ const a = { ...e }, t = Math.abs(a.endIndex - a.startIndex), s = r * t, f = s - Math.floor(s), u = a.prevDelta * (1 - r), i = f * a.directionAdj + u, y = a.startIndex + Math.floor(s) * a.directionAdj;
278
+ return r >= 1 ? (a.currentChar = a.targetChar, a.currDelta = 0, a.prevDelta = 0) : l && a.charList && y >= 0 && y < a.charList.length && (a.currentChar = a.charList[y], a.currDelta = i), a.currentWidth = a.sourceWidth + (a.targetWidth - a.sourceWidth) * r, { col: a, charIdx: y, delta: i };
987
279
  }
988
- const ve = {
280
+ const de = {
989
281
  linear: (e) => e,
990
282
  easeIn: (e) => e * e,
991
283
  easeOut: (e) => 1 - (1 - e) * (1 - e),
992
284
  easeInOut: (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2,
993
285
  bounce: (e) => e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375
994
- }, oe = 1.2, Ke = /* @__PURE__ */ W({
286
+ }, re = 1.2, we = /* @__PURE__ */ V({
995
287
  __name: "Ticker",
996
288
  props: {
997
289
  value: { type: String, required: !0 },
@@ -1003,82 +295,82 @@ const ve = {
1003
295
  charWidth: { type: Number, default: 1 }
1004
296
  },
1005
297
  setup(e) {
1006
- const a = e, s = E([]), i = E(1);
298
+ const r = e, l = $([]), a = $(1);
1007
299
  let t;
1008
- const n = T(() => a.characterLists.map((r) => new Fe(r))), v = T(() => {
1009
- const r = /* @__PURE__ */ new Set();
1010
- return n.value.forEach((u) => u.getSupportedCharacters().forEach((c) => r.add(c))), r;
300
+ const s = A(() => r.characterLists.map((i) => new ke(i))), f = A(() => {
301
+ const i = /* @__PURE__ */ new Set();
302
+ return s.value.forEach((y) => y.getSupportedCharacters().forEach((c) => i.add(c))), i;
1011
303
  });
1012
- j(() => a.value, (r, u) => {
1013
- if (r === u) return;
304
+ q(() => r.value, (i, y) => {
305
+ if (i === y) return;
1014
306
  t && (cancelAnimationFrame(t), t = void 0);
1015
- let c = s.value;
1016
- i.value < 1 && i.value > 0 && (c = c.map((C) => le(C, i.value, !0).col));
1017
- const f = [...r], p = c.map((C) => C.currentChar), h = $e(p, f, v.value);
1018
- let I = 0, A = 0;
1019
- const k = [], L = c.filter((C) => C.currentWidth > 0);
307
+ let c = l.value;
308
+ a.value < 1 && a.value > 0 && (c = c.map((C) => le(C, a.value, !0).col));
309
+ const g = [...i], d = c.map((C) => C.currentChar), h = Ce(d, g, f.value);
310
+ let M = 0, I = 0;
311
+ const x = [], U = c.filter((C) => C.currentWidth > 0);
1020
312
  for (const C of h)
1021
- if (C === Y)
1022
- k.push(re(ie(), f[A++], n.value, a.direction));
1023
- else if (C === te) {
1024
- const F = L[I++] || ie();
1025
- k.push(re(F, f[A++], n.value, a.direction));
313
+ if (C === J)
314
+ x.push(se(ae(), g[I++], s.value, r.direction));
315
+ else if (C === Z) {
316
+ const N = U[M++] || ae();
317
+ x.push(se(N, g[I++], s.value, r.direction));
1026
318
  } else {
1027
- const F = L[I++] || ie();
1028
- k.push(re(F, N, n.value, a.direction));
319
+ const N = U[M++] || ae();
320
+ x.push(se(N, B, s.value, r.direction));
1029
321
  }
1030
- s.value = k, i.value = 0;
1031
- const w = performance.now(), S = a.duration, U = ve[a.easing] || ve.linear;
1032
- let B = 0;
1033
- const R = (C) => {
1034
- const F = Math.min((C - w) / S, 1), D = U(F);
1035
- if ((C - B >= 16 || F >= 1) && (B = C, i.value = D), F < 1)
1036
- t = requestAnimationFrame(R);
322
+ l.value = x, a.value = 0;
323
+ const k = performance.now(), S = r.duration, K = de[r.easing] || de.linear;
324
+ let L = 0;
325
+ const T = (C) => {
326
+ const N = Math.min((C - k) / S, 1), E = K(N);
327
+ if ((C - L >= 16 || N >= 1) && (L = C, a.value = E), N < 1)
328
+ t = requestAnimationFrame(T);
1037
329
  else {
1038
- const q = s.value.map((G) => le(G, 1).col).filter((G) => G.currentWidth > 0);
1039
- s.value = q, i.value = 1, t = void 0;
330
+ const Y = l.value.map((O) => le(O, 1).col).filter((O) => O.currentWidth > 0);
331
+ l.value = Y, a.value = 1, t = void 0;
1040
332
  }
1041
333
  };
1042
- t = requestAnimationFrame(R);
1043
- }, { immediate: !0 }), ue(() => {
334
+ t = requestAnimationFrame(T);
335
+ }, { immediate: !0 }), ie(() => {
1044
336
  t && cancelAnimationFrame(t);
1045
337
  });
1046
- const l = T(() => s.value.map((r) => {
1047
- const { charIdx: u, delta: c } = le(r, i.value), f = r.sourceWidth + (r.targetWidth - r.sourceWidth) * i.value;
1048
- if (f <= 0) return { width: f, chars: [] };
1049
- const p = [], h = r.charList || [], I = c * oe, A = (C, F, D) => {
1050
- C >= 0 && C < h.length && p.push({
1051
- key: `${D}-${C}`,
338
+ const u = A(() => l.value.map((i) => {
339
+ const { charIdx: y, delta: c } = le(i, a.value), g = i.sourceWidth + (i.targetWidth - i.sourceWidth) * a.value;
340
+ if (g <= 0) return { width: g, chars: [] };
341
+ const d = [], h = i.charList || [], M = c * re, I = (C, N, E) => {
342
+ C >= 0 && C < h.length && d.push({
343
+ key: `${E}-${C}`,
1052
344
  char: h[C],
1053
- offset: I + F
345
+ offset: M + N
1054
346
  });
1055
347
  };
1056
- A(u, 0, "c"), A(u + 1, -oe, "n"), A(u - 1, oe, "p");
1057
- const k = (C) => C && C.length > 0 && C.charCodeAt(0) > 255, L = (C) => k(C) ? 1.25 : 0.8, w = h[r.startIndex] || "", S = h[r.endIndex] || "", U = L(w), B = L(S), R = U + (B - U) * i.value;
1058
- return { width: f, chars: p, baseW: R };
1059
- }).filter((r) => r.width > 0));
1060
- return (r, u) => (y(), b("div", {
1061
- class: P(["ticker", e.className])
348
+ I(y, 0, "c"), I(y + 1, -re, "n"), I(y - 1, re, "p");
349
+ const x = (C) => C && C.length > 0 && C.charCodeAt(0) > 255, U = (C) => x(C) ? 1.25 : 0.8, k = h[i.startIndex] || "", S = h[i.endIndex] || "", K = U(k), L = U(S), T = K + (L - K) * a.value;
350
+ return { width: g, chars: d, baseW: T };
351
+ }).filter((i) => i.width > 0));
352
+ return (i, y) => (m(), p("div", {
353
+ class: z(["ticker", e.className])
1062
354
  }, [
1063
- (y(!0), b(H, null, ae(l.value, (c, f) => (y(), b("div", {
1064
- key: f,
355
+ (m(!0), p(R, null, ee(u.value, (c, g) => (m(), p("div", {
356
+ key: g,
1065
357
  class: "ticker-column",
1066
- style: J({ width: `${c.width * (c.baseW || 0.8) * e.charWidth}em` })
358
+ style: G({ width: `${c.width * (c.baseW || 0.8) * e.charWidth}em` })
1067
359
  }, [
1068
- (y(!0), b(H, null, ae(c.chars, (p) => (y(), b("div", {
1069
- key: p.key,
360
+ (m(!0), p(R, null, ee(c.chars, (d) => (m(), p("div", {
361
+ key: d.key,
1070
362
  class: "ticker-char",
1071
- style: J({ transform: `translateY(${p.offset}em)` })
1072
- }, x(p.char === g(N) ? " " : p.char), 5))), 128))
363
+ style: G({ transform: `translateY(${d.offset}em)` })
364
+ }, w(d.char === v(B) ? " " : d.char), 5))), 128))
1073
365
  ], 4))), 128))
1074
366
  ], 2));
1075
367
  }
1076
- }), Re = (e, a) => {
1077
- const s = e.__vccOpts || e;
1078
- for (const [i, t] of a)
1079
- s[i] = t;
1080
- return s;
1081
- }, Ne = /* @__PURE__ */ Re(Ke, [["__scopeId", "data-v-7e47ac69"]]), ge = /* @__PURE__ */ W({
368
+ }), Me = (e, r) => {
369
+ const l = e.__vccOpts || e;
370
+ for (const [a, t] of r)
371
+ l[a] = t;
372
+ return l;
373
+ }, Ie = /* @__PURE__ */ Me(we, [["__scopeId", "data-v-7e47ac69"]]), ue = /* @__PURE__ */ V({
1082
374
  __name: "SmartText",
1083
375
  props: {
1084
376
  text: {},
@@ -1086,27 +378,27 @@ const ve = {
1086
378
  placeholder: {}
1087
379
  },
1088
380
  setup(e) {
1089
- return (a, s) => !e.text && e.placeholder ? (y(), b("span", {
381
+ return (r, l) => !e.text && e.placeholder ? (m(), p("span", {
1090
382
  key: 0,
1091
- class: P(["apmsu-placeholder", e.className])
1092
- }, x(e.placeholder), 3)) : e.text ? (y(), b("span", {
383
+ class: z(["apmsu-placeholder", e.className])
384
+ }, w(e.placeholder), 3)) : e.text ? (m(), p("span", {
1093
385
  key: 1,
1094
- class: P(["inline-flex min-w-0", e.className])
386
+ class: z(["inline-flex min-w-0", e.className])
1095
387
  }, [
1096
- V(g(Ne), {
388
+ j(v(Ie), {
1097
389
  value: e.text,
1098
390
  "char-width": 0.8,
1099
391
  duration: 300
1100
392
  }, null, 8, ["value"])
1101
- ], 2)) : Q("", !0);
393
+ ], 2)) : W("", !0);
1102
394
  }
1103
- }), De = { class: "apmsu-label" }, Ge = { class: "relative" }, Qe = ["disabled"], _e = {
395
+ }), $e = { class: "apmsu-label" }, Ue = { class: "relative" }, Se = ["disabled"], Ae = {
1104
396
  key: 0,
1105
397
  class: "flex items-center gap-2 min-w-0"
1106
- }, ze = ["src", "alt"], Ve = {
398
+ }, Le = ["src", "alt"], ze = {
1107
399
  key: 1,
1108
400
  class: "apmsu-placeholder"
1109
- }, He = ["onClick"], We = { class: "flex items-center gap-2 flex-shrink-0" }, qe = ["src", "alt"], je = { class: "font-medium whitespace-nowrap" }, Xe = { class: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0" }, Ye = /* @__PURE__ */ W({
401
+ }, Ke = ["onClick"], Ne = { class: "flex items-center gap-2 flex-shrink-0" }, Fe = ["src", "alt"], _e = { class: "font-medium whitespace-nowrap" }, Te = { class: "apmsu-hint-text ml-auto text-right truncate flex-1 min-w-0" }, Be = /* @__PURE__ */ V({
1110
402
  __name: "ProviderSelect",
1111
403
  props: {
1112
404
  providers: {},
@@ -1115,95 +407,95 @@ const ve = {
1115
407
  language: { default: "zh" }
1116
408
  },
1117
409
  emits: ["select"],
1118
- setup(e, { emit: a }) {
1119
- const s = e, i = a, t = E(!1), n = E(null), v = T(() => Z[s.language]), l = T(() => s.providers.find((c) => c.id === s.selectedProviderId));
1120
- function r(c) {
1121
- n.value && !n.value.contains(c.target) && (t.value = !1);
410
+ setup(e, { emit: r }) {
411
+ const l = e, a = r, t = $(!1), s = $(null), f = A(() => Q[l.language]), u = A(() => l.providers.find((c) => c.id === l.selectedProviderId));
412
+ function i(c) {
413
+ s.value && !s.value.contains(c.target) && (t.value = !1);
1122
414
  }
1123
- ce(() => {
1124
- document.addEventListener("mousedown", r);
1125
- }), ue(() => {
1126
- document.removeEventListener("mousedown", r);
415
+ ne(() => {
416
+ document.addEventListener("mousedown", i);
417
+ }), ie(() => {
418
+ document.removeEventListener("mousedown", i);
1127
419
  });
1128
- function u(c) {
1129
- i("select", c), t.value = !1;
420
+ function y(c) {
421
+ a("select", c), t.value = !1;
1130
422
  }
1131
- return (c, f) => (y(), b("div", {
423
+ return (c, g) => (m(), p("div", {
1132
424
  class: "apmsu-field",
1133
425
  ref_key: "triggerRef",
1134
- ref: n
426
+ ref: s
1135
427
  }, [
1136
- d("label", De, x(v.value.providerLabel), 1),
1137
- d("div", Ge, [
1138
- d("button", {
428
+ n("label", $e, w(f.value.providerLabel), 1),
429
+ n("div", Ue, [
430
+ n("button", {
1139
431
  type: "button",
1140
- onClick: f[0] || (f[0] = (p) => !e.disabled && (t.value = !t.value)),
432
+ onClick: g[0] || (g[0] = (d) => !e.disabled && (t.value = !t.value)),
1141
433
  disabled: e.disabled,
1142
434
  class: "apmsu-select-trigger"
1143
435
  }, [
1144
- l.value ? (y(), b("div", _e, [
1145
- d("img", {
1146
- src: l.value.icon,
1147
- alt: l.value.name,
436
+ u.value ? (m(), p("div", Ae, [
437
+ n("img", {
438
+ src: u.value.icon,
439
+ alt: u.value.name,
1148
440
  class: "apmsu-provider-icon"
1149
- }, null, 8, ze),
1150
- V(ge, {
1151
- text: l.value.name
441
+ }, null, 8, Le),
442
+ j(ue, {
443
+ text: u.value.name
1152
444
  }, null, 8, ["text"])
1153
- ])) : (y(), b("span", Ve, x(v.value.selectProvider), 1)),
1154
- (y(), b("svg", {
1155
- class: P(["apmsu-chevron", t.value ? "rotate-180" : ""]),
445
+ ])) : (m(), p("span", ze, w(f.value.selectProvider), 1)),
446
+ (m(), p("svg", {
447
+ class: z(["apmsu-chevron", t.value ? "rotate-180" : ""]),
1156
448
  fill: "none",
1157
449
  stroke: "currentColor",
1158
450
  viewBox: "0 0 24 24"
1159
- }, [...f[1] || (f[1] = [
1160
- d("path", {
451
+ }, [...g[1] || (g[1] = [
452
+ n("path", {
1161
453
  "stroke-linecap": "round",
1162
454
  "stroke-linejoin": "round",
1163
455
  "stroke-width": "2",
1164
456
  d: "M19 9l-7 7-7-7"
1165
457
  }, null, -1)
1166
458
  ])], 2))
1167
- ], 8, Qe),
1168
- d("div", {
1169
- class: P(["apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top", t.value ? "apmsu-dropdown-open" : ""])
459
+ ], 8, Se),
460
+ n("div", {
461
+ class: z(["apmsu-dropdown max-h-[300px] overflow-auto p-1 origin-top", t.value ? "apmsu-dropdown-open" : ""])
1170
462
  }, [
1171
- (y(!0), b(H, null, ae(e.providers, (p) => (y(), b("button", {
1172
- key: p.id,
463
+ (m(!0), p(R, null, ee(e.providers, (d) => (m(), p("button", {
464
+ key: d.id,
1173
465
  type: "button",
1174
- onClick: (h) => u(p.id),
1175
- class: P(["apmsu-dropdown-item rounded-sm", e.selectedProviderId === p.id && "apmsu-dropdown-item-active"])
466
+ onClick: (h) => y(d.id),
467
+ class: z(["apmsu-dropdown-item rounded-sm", e.selectedProviderId === d.id && "apmsu-dropdown-item-active"])
1176
468
  }, [
1177
- d("div", We, [
1178
- d("img", {
1179
- src: p.icon,
1180
- alt: p.name,
469
+ n("div", Ne, [
470
+ n("img", {
471
+ src: d.icon,
472
+ alt: d.name,
1181
473
  class: "apmsu-provider-icon"
1182
- }, null, 8, qe),
1183
- d("span", je, x(p.name), 1)
474
+ }, null, 8, Fe),
475
+ n("span", _e, w(d.name), 1)
1184
476
  ]),
1185
- d("span", Xe, x(p.baseUrl.replace("https://", "")), 1)
1186
- ], 10, He))), 128))
477
+ n("span", Te, w(d.baseUrl.replace("https://", "")), 1)
478
+ ], 10, Ke))), 128))
1187
479
  ], 2)
1188
480
  ])
1189
481
  ], 512));
1190
482
  }
1191
- }), Je = {
483
+ }), Ee = {
1192
484
  key: 0,
1193
485
  class: "apmsu-field"
1194
- }, Ze = { class: "apmsu-label" }, et = { class: "relative" }, tt = ["type", "value", "placeholder", "disabled"], at = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center" }, st = {
486
+ }, Oe = { class: "apmsu-label" }, We = { class: "relative" }, Pe = ["type", "value", "placeholder", "disabled"], De = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center" }, je = {
1195
487
  key: 0,
1196
488
  class: "w-4 h-4 text-gray-400",
1197
489
  fill: "none",
1198
490
  stroke: "currentColor",
1199
491
  viewBox: "0 0 24 24"
1200
- }, nt = {
492
+ }, Re = {
1201
493
  key: 1,
1202
494
  class: "w-4 h-4 text-gray-400",
1203
495
  fill: "none",
1204
496
  stroke: "currentColor",
1205
497
  viewBox: "0 0 24 24"
1206
- }, it = /* @__PURE__ */ W({
498
+ }, Ve = /* @__PURE__ */ V({
1207
499
  __name: "AuthInput",
1208
500
  props: {
1209
501
  provider: {},
@@ -1213,37 +505,37 @@ const ve = {
1213
505
  language: { default: "zh" }
1214
506
  },
1215
507
  emits: ["update:apiKey"],
1216
- setup(e, { emit: a }) {
1217
- const s = e, i = a, t = E(!1), n = T(() => Z[s.language]), v = T(() => s.testStatus === "success" ? "apmsu-input apmsu-input-success" : "apmsu-input apmsu-input-default");
1218
- return (l, r) => e.provider && e.provider.needsApiKey ? (y(), b("div", Je, [
1219
- d("label", Ze, x(n.value.apiKeyLabel), 1),
1220
- d("div", et, [
1221
- d("input", {
508
+ setup(e, { emit: r }) {
509
+ const l = e, a = r, t = $(!1), s = A(() => Q[l.language]), f = A(() => l.testStatus === "success" ? "apmsu-input apmsu-input-success" : "apmsu-input apmsu-input-default");
510
+ return (u, i) => e.provider && e.provider.needsApiKey ? (m(), p("div", Ee, [
511
+ n("label", Oe, w(s.value.apiKeyLabel), 1),
512
+ n("div", We, [
513
+ n("input", {
1222
514
  type: t.value ? "text" : "password",
1223
515
  value: e.apiKey,
1224
- onInput: r[0] || (r[0] = (u) => i("update:apiKey", u.target.value)),
1225
- onFocus: r[1] || (r[1] = (u) => t.value = !0),
1226
- onBlur: r[2] || (r[2] = (u) => t.value = !1),
1227
- placeholder: n.value.apiKeyPlaceholder,
516
+ onInput: i[0] || (i[0] = (y) => a("update:apiKey", y.target.value)),
517
+ onFocus: i[1] || (i[1] = (y) => t.value = !0),
518
+ onBlur: i[2] || (i[2] = (y) => t.value = !1),
519
+ placeholder: s.value.apiKeyPlaceholder,
1228
520
  disabled: e.disabled,
1229
- class: P([v.value, "pr-10"])
1230
- }, null, 42, tt),
1231
- d("span", at, [
1232
- t.value ? (y(), b("svg", st, [...r[3] || (r[3] = [
1233
- d("path", {
521
+ class: z([f.value, "pr-10"])
522
+ }, null, 42, Pe),
523
+ n("span", De, [
524
+ t.value ? (m(), p("svg", je, [...i[3] || (i[3] = [
525
+ n("path", {
1234
526
  "stroke-linecap": "round",
1235
527
  "stroke-linejoin": "round",
1236
528
  "stroke-width": "2",
1237
529
  d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
1238
530
  }, null, -1),
1239
- d("path", {
531
+ n("path", {
1240
532
  "stroke-linecap": "round",
1241
533
  "stroke-linejoin": "round",
1242
534
  "stroke-width": "2",
1243
535
  d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
1244
536
  }, null, -1)
1245
- ])])) : (y(), b("svg", nt, [...r[4] || (r[4] = [
1246
- d("path", {
537
+ ])])) : (m(), p("svg", Re, [...i[4] || (i[4] = [
538
+ n("path", {
1247
539
  "stroke-linecap": "round",
1248
540
  "stroke-linejoin": "round",
1249
541
  "stroke-width": "2",
@@ -1252,27 +544,27 @@ const ve = {
1252
544
  ])]))
1253
545
  ])
1254
546
  ])
1255
- ])) : Q("", !0);
547
+ ])) : W("", !0);
1256
548
  }
1257
- }), rt = { class: "apmsu-label flex items-center justify-between" }, lt = { class: "relative" }, ot = ["disabled"], dt = { class: "p-1.5 border-b border-gray-100 dark:border-zinc-800" }, ct = ["placeholder", "autofocus"], ut = { class: "max-h-60 overflow-auto" }, mt = { class: "text-blue-500" }, pt = ["onClick"], vt = {
549
+ }), Ye = { class: "apmsu-label flex items-center justify-between" }, qe = { class: "relative" }, He = ["disabled"], Je = { class: "p-1.5 border-b border-gray-100 dark:border-zinc-800" }, Ge = ["placeholder", "autofocus"], Qe = { class: "max-h-60 overflow-auto" }, Xe = { class: "text-blue-500" }, Ze = ["onClick"], et = {
1258
550
  key: 1,
1259
551
  class: "p-4 text-center apmsu-hint-text"
1260
- }, ht = {
552
+ }, tt = {
1261
553
  key: 0,
1262
554
  class: "min-h-[20px] flex items-center"
1263
- }, ft = {
555
+ }, at = {
1264
556
  key: 0,
1265
557
  class: "apmsu-hint-text animate-pulse"
1266
- }, gt = {
558
+ }, st = {
1267
559
  key: 1,
1268
560
  class: "apmsu-hint-text dark:text-zinc-500"
1269
- }, bt = {
561
+ }, lt = {
1270
562
  key: 2,
1271
563
  class: "apmsu-hint-text"
1272
- }, yt = {
564
+ }, rt = {
1273
565
  key: 3,
1274
566
  class: "apmsu-hint-text"
1275
- }, kt = /* @__PURE__ */ W({
567
+ }, nt = /* @__PURE__ */ V({
1276
568
  __name: "ModelSelect",
1277
569
  props: {
1278
570
  provider: {},
@@ -1286,105 +578,105 @@ const ve = {
1286
578
  selectedModelName: {}
1287
579
  },
1288
580
  emits: ["select"],
1289
- setup(e, { emit: a }) {
1290
- const s = e, i = a, t = E(!1), n = E(""), v = E(null), l = T(() => Z[s.language]), r = T(
1291
- () => s.models.filter(
1292
- (p) => p.name.toLowerCase().includes(n.value.toLowerCase()) || p.id.toLowerCase().includes(n.value.toLowerCase())
581
+ setup(e, { emit: r }) {
582
+ const l = e, a = r, t = $(!1), s = $(""), f = $(null), u = A(() => Q[l.language]), i = A(
583
+ () => l.models.filter(
584
+ (d) => d.name.toLowerCase().includes(s.value.toLowerCase()) || d.id.toLowerCase().includes(s.value.toLowerCase())
1293
585
  )
1294
- ), u = T(
586
+ ), y = A(
1295
587
  () => {
1296
- var p;
1297
- return ((p = s.models.find((h) => h.id === s.selectedModelId)) == null ? void 0 : p.name) || s.selectedModelName || s.selectedModelId;
588
+ var d;
589
+ return ((d = l.models.find((h) => h.id === l.selectedModelId)) == null ? void 0 : d.name) || l.selectedModelName || l.selectedModelId;
1298
590
  }
1299
591
  );
1300
- function c(p) {
1301
- v.value && !v.value.contains(p.target) && (t.value = !1, n.value = "");
592
+ function c(d) {
593
+ f.value && !f.value.contains(d.target) && (t.value = !1, s.value = "");
1302
594
  }
1303
- ce(() => {
595
+ ne(() => {
1304
596
  document.addEventListener("mousedown", c);
1305
- }), ue(() => {
597
+ }), ie(() => {
1306
598
  document.removeEventListener("mousedown", c);
1307
599
  });
1308
- function f(p, h) {
1309
- i("select", p, h), t.value = !1, n.value = "";
600
+ function g(d, h) {
601
+ a("select", d, h), t.value = !1, s.value = "";
1310
602
  }
1311
- return (p, h) => {
1312
- var I, A;
1313
- return y(), b("div", {
603
+ return (d, h) => {
604
+ var M, I;
605
+ return m(), p("div", {
1314
606
  class: "apmsu-field",
1315
607
  ref_key: "triggerRef",
1316
- ref: v
608
+ ref: f
1317
609
  }, [
1318
- d("label", rt, [
1319
- d("span", null, x(l.value.modelLabel), 1)
610
+ n("label", Ye, [
611
+ n("span", null, w(u.value.modelLabel), 1)
1320
612
  ]),
1321
- d("div", lt, [
1322
- d("button", {
613
+ n("div", qe, [
614
+ n("button", {
1323
615
  type: "button",
1324
- onClick: h[0] || (h[0] = (k) => !e.disabled && e.provider && (t.value = !t.value)),
616
+ onClick: h[0] || (h[0] = (x) => !e.disabled && e.provider && (t.value = !t.value)),
1325
617
  disabled: e.disabled || !e.provider,
1326
618
  class: "apmsu-select-trigger"
1327
619
  }, [
1328
- V(ge, {
1329
- text: u.value ? u.value : "",
1330
- placeholder: l.value.selectModel
620
+ j(ue, {
621
+ text: y.value ? y.value : "",
622
+ placeholder: u.value.selectModel
1331
623
  }, null, 8, ["text", "placeholder"]),
1332
- (y(), b("svg", {
1333
- class: P(["apmsu-chevron", t.value ? "rotate-180" : ""]),
624
+ (m(), p("svg", {
625
+ class: z(["apmsu-chevron", t.value ? "rotate-180" : ""]),
1334
626
  fill: "none",
1335
627
  stroke: "currentColor",
1336
628
  viewBox: "0 0 24 24"
1337
629
  }, [...h[3] || (h[3] = [
1338
- d("path", {
630
+ n("path", {
1339
631
  "stroke-linecap": "round",
1340
632
  "stroke-linejoin": "round",
1341
633
  "stroke-width": "2",
1342
634
  d: "M19 9l-7 7-7-7"
1343
635
  }, null, -1)
1344
636
  ])], 2))
1345
- ], 8, ot),
1346
- d("div", {
1347
- class: P(["apmsu-dropdown origin-top", t.value ? "apmsu-dropdown-open" : ""])
637
+ ], 8, He),
638
+ n("div", {
639
+ class: z(["apmsu-dropdown origin-top", t.value ? "apmsu-dropdown-open" : ""])
1348
640
  }, [
1349
- d("div", dt, [
1350
- ye(d("input", {
641
+ n("div", Je, [
642
+ ve(n("input", {
1351
643
  type: "text",
1352
- "onUpdate:modelValue": h[1] || (h[1] = (k) => n.value = k),
1353
- placeholder: l.value.searchModel,
644
+ "onUpdate:modelValue": h[1] || (h[1] = (x) => s.value = x),
645
+ placeholder: u.value.searchModel,
1354
646
  class: "apmsu-select-trigger",
1355
647
  autofocus: t.value
1356
- }, null, 8, ct), [
1357
- [ke, n.value]
648
+ }, null, 8, Ge), [
649
+ [he, s.value]
1358
650
  ])
1359
651
  ]),
1360
- d("div", ut, [
1361
- n.value && !r.value.some((k) => k.id === n.value) ? (y(), b("button", {
652
+ n("div", Qe, [
653
+ s.value && !i.value.some((x) => x.id === s.value) ? (m(), p("button", {
1362
654
  key: 0,
1363
655
  type: "button",
1364
- onClick: h[2] || (h[2] = (k) => f(n.value)),
656
+ onClick: h[2] || (h[2] = (x) => g(s.value)),
1365
657
  class: "apmsu-dropdown-item bg-blue-50 dark:bg-blue-900/20 border-b"
1366
658
  }, [
1367
- d("span", mt, x(l.value.useCustom) + ": " + x(n.value), 1)
1368
- ])) : Q("", !0),
1369
- (y(!0), b(H, null, ae(r.value, (k) => (y(), b("button", {
1370
- key: k.id,
659
+ n("span", Xe, w(u.value.useCustom) + ": " + w(s.value), 1)
660
+ ])) : W("", !0),
661
+ (m(!0), p(R, null, ee(i.value, (x) => (m(), p("button", {
662
+ key: x.id,
1371
663
  type: "button",
1372
- onClick: (L) => f(k.id, k.name),
1373
- class: P(["apmsu-dropdown-item", e.selectedModelId === k.id && "apmsu-dropdown-item-active"])
664
+ onClick: (U) => g(x.id, x.name),
665
+ class: z(["apmsu-dropdown-item", e.selectedModelId === x.id && "apmsu-dropdown-item-active"])
1374
666
  }, [
1375
- d("span", null, x(k.name), 1)
1376
- ], 10, pt))), 128)),
1377
- r.value.length === 0 && !n.value ? (y(), b("div", vt, x(l.value.noModels), 1)) : Q("", !0)
667
+ n("span", null, w(x.name), 1)
668
+ ], 10, Ze))), 128)),
669
+ i.value.length === 0 && !s.value ? (m(), p("div", et, w(u.value.noModels), 1)) : W("", !0)
1378
670
  ])
1379
671
  ], 2)
1380
672
  ]),
1381
- (I = e.provider) != null && I.supportsModelsApi ? (y(), b("div", ht, [
1382
- e.isFetchingModels ? (y(), b("p", ft, x(l.value.refreshingModels), 1)) : e.fetchModelError ? (y(), b("p", gt, x(l.value[e.fetchModelError] || e.fetchModelError), 1)) : (A = e.provider) != null && A.needsApiKey && !e.hasApiKey ? (y(), b("p", bt, x(l.value.apiKeyTip), 1)) : (y(), b("p", yt, x(l.value.modelListUpdated), 1))
1383
- ])) : Q("", !0)
673
+ (M = e.provider) != null && M.supportsModelsApi ? (m(), p("div", tt, [
674
+ e.isFetchingModels ? (m(), p("p", at, w(u.value.refreshingModels), 1)) : e.fetchModelError ? (m(), p("p", st, w(u.value[e.fetchModelError] || e.fetchModelError), 1)) : (I = e.provider) != null && I.needsApiKey && !e.hasApiKey ? (m(), p("p", lt, w(u.value.apiKeyTip), 1)) : (m(), p("p", rt, w(u.value.modelListUpdated), 1))
675
+ ])) : W("", !0)
1384
676
  ], 512);
1385
677
  };
1386
678
  }
1387
- }), Mt = { class: "overflow-hidden" }, wt = ["value", "placeholder", "disabled"], Ct = /* @__PURE__ */ W({
679
+ }), it = { class: "overflow-hidden" }, ot = ["value", "placeholder", "disabled"], dt = /* @__PURE__ */ V({
1388
680
  __name: "BaseUrlInput",
1389
681
  props: {
1390
682
  provider: {},
@@ -1393,65 +685,65 @@ const ve = {
1393
685
  language: { default: "zh" }
1394
686
  },
1395
687
  emits: ["update:baseUrl"],
1396
- setup(e, { emit: a }) {
1397
- const s = e, i = a, t = E(!1), n = T(() => Z[s.language]);
1398
- return (v, l) => e.provider ? (y(), b(H, { key: 0 }, [
1399
- d("button", {
688
+ setup(e, { emit: r }) {
689
+ const l = e, a = r, t = $(!1), s = A(() => Q[l.language]);
690
+ return (f, u) => e.provider ? (m(), p(R, { key: 0 }, [
691
+ n("button", {
1400
692
  type: "button",
1401
- onClick: l[0] || (l[0] = (r) => t.value = !t.value),
693
+ onClick: u[0] || (u[0] = (i) => t.value = !t.value),
1402
694
  class: "text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1 transition-colors"
1403
695
  }, [
1404
- (y(), b("svg", {
1405
- class: P(["w-3 h-3 transition-transform", t.value && "rotate-90"]),
696
+ (m(), p("svg", {
697
+ class: z(["w-3 h-3 transition-transform", t.value && "rotate-90"]),
1406
698
  fill: "none",
1407
699
  stroke: "currentColor",
1408
700
  viewBox: "0 0 24 24"
1409
- }, [...l[2] || (l[2] = [
1410
- d("path", {
701
+ }, [...u[2] || (u[2] = [
702
+ n("path", {
1411
703
  "stroke-linecap": "round",
1412
704
  "stroke-linejoin": "round",
1413
705
  "stroke-width": "2",
1414
706
  d: "M9 5l7 7-7 7"
1415
707
  }, null, -1)
1416
708
  ])], 2)),
1417
- z(" " + x(n.value.customBaseUrl), 1)
709
+ D(" " + w(s.value.customBaseUrl), 1)
1418
710
  ]),
1419
- d("div", {
711
+ n("div", {
1420
712
  class: "grid transition-all duration-200 ease-out",
1421
- style: J({ gridTemplateRows: t.value ? "1fr" : "0fr" })
713
+ style: G({ gridTemplateRows: t.value ? "1fr" : "0fr" })
1422
714
  }, [
1423
- d("div", Mt, [
1424
- d("input", {
715
+ n("div", it, [
716
+ n("input", {
1425
717
  type: "text",
1426
718
  value: e.baseUrl,
1427
- onInput: l[1] || (l[1] = (r) => i("update:baseUrl", r.target.value)),
719
+ onInput: u[1] || (u[1] = (i) => a("update:baseUrl", i.target.value)),
1428
720
  placeholder: e.provider.baseUrl,
1429
721
  disabled: e.disabled,
1430
722
  class: "apmsu-input apmsu-input-default"
1431
- }, null, 40, wt)
723
+ }, null, 40, ot)
1432
724
  ])
1433
725
  ], 4)
1434
- ], 64)) : Q("", !0);
726
+ ], 64)) : W("", !0);
1435
727
  }
1436
- }), It = { class: "apmsu-card" }, xt = {
728
+ }), ut = { class: "apmsu-card" }, ct = {
1437
729
  key: 0,
1438
730
  class: "text-lg font-semibold mb-4"
1439
- }, At = { class: "space-y-3" }, Et = { class: "space-y-4" }, Lt = { class: "pt-2 space-y-2" }, Ot = { class: "flex gap-2" }, St = ["disabled"], Tt = {
731
+ }, vt = { class: "space-y-3" }, ht = { class: "space-y-4" }, ft = { class: "pt-2 space-y-2" }, pt = { class: "flex gap-2" }, mt = ["disabled"], gt = {
1440
732
  key: 0,
1441
733
  class: "flex items-center justify-center gap-2"
1442
- }, Bt = {
734
+ }, yt = {
1443
735
  key: 1,
1444
736
  class: "flex items-center justify-center gap-2"
1445
- }, Pt = {
737
+ }, bt = {
1446
738
  key: 2,
1447
739
  class: "flex items-center justify-center gap-2"
1448
- }, Ut = ["disabled"], Ft = {
740
+ }, xt = ["disabled"], kt = {
1449
741
  key: 0,
1450
742
  class: "flex items-center justify-center gap-2"
1451
- }, $t = { class: "overflow-hidden" }, Kt = { class: "p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800" }, Rt = { class: "text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left" }, Nt = {
743
+ }, Ct = { class: "overflow-hidden" }, wt = { class: "p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800" }, Mt = { class: "text-xs text-red-600 dark:text-red-400 line-clamp-3 text-left" }, It = {
1452
744
  key: 1,
1453
745
  class: "mt-6 border border-gray-200/50 dark:border-zinc-800 rounded-lg overflow-hidden"
1454
- }, Dt = { class: "text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider" }, Gt = { class: "overflow-hidden" }, Qt = { class: "text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50" }, zt = /* @__PURE__ */ W({
746
+ }, $t = { class: "text-xs font-medium text-gray-500 dark:text-zinc-500 uppercase tracking-wider" }, Ut = { class: "overflow-hidden" }, St = { class: "text-xs text-gray-600 dark:text-zinc-400 font-mono overflow-x-auto leading-relaxed p-4 bg-zinc-50 dark:bg-zinc-900/50" }, zt = /* @__PURE__ */ V({
1455
747
  __name: "AIConfigForm",
1456
748
  props: {
1457
749
  proxyUrl: {},
@@ -1467,125 +759,125 @@ const ve = {
1467
759
  modelFetcher: {}
1468
760
  },
1469
761
  emits: ["save", "testResult", "change"],
1470
- setup(e, { emit: a }) {
1471
- const s = e, i = a, {
762
+ setup(e, { emit: r }) {
763
+ const l = e, a = r, {
1472
764
  providerId: t,
1473
- apiKey: n,
1474
- model: v,
1475
- modelName: l,
1476
- baseUrl: r,
1477
- models: u,
765
+ apiKey: s,
766
+ model: f,
767
+ modelName: u,
768
+ baseUrl: i,
769
+ models: y,
1478
770
  testStatus: c,
1479
- testResult: f,
1480
- provider: p,
771
+ testResult: g,
772
+ provider: d,
1481
773
  providers: h,
1482
- isValid: I,
1483
- config: A,
1484
- runTest: k,
1485
- save: L,
1486
- selectModel: w,
774
+ isValid: M,
775
+ config: I,
776
+ runTest: x,
777
+ save: U,
778
+ selectModel: k,
1487
779
  isFetchingModels: S,
1488
- fetchModelError: U
1489
- } = Be({
1490
- proxyUrl: s.proxyUrl,
1491
- providerConfig: s.config,
1492
- initialConfig: s.initialConfig,
1493
- onSerialize: s.onSerialize,
1494
- onDeserialize: s.onDeserialize,
1495
- modelFetcher: s.modelFetcher
1496
- }), B = T(() => Z[s.language]), R = E("idle"), C = E(!1);
1497
- j([t, n, v, r], () => {
1498
- i("change", {
780
+ fetchModelError: K
781
+ } = ye({
782
+ proxyUrl: l.proxyUrl,
783
+ providerConfig: l.config,
784
+ initialConfig: l.initialConfig,
785
+ onSerialize: l.onSerialize,
786
+ onDeserialize: l.onDeserialize,
787
+ modelFetcher: l.modelFetcher
788
+ }), L = A(() => Q[l.language]), T = $("idle"), C = $(!1);
789
+ q([t, s, f, i], () => {
790
+ a("change", {
1499
791
  providerId: t.value,
1500
- apiKey: n.value,
1501
- model: v.value,
1502
- baseUrl: r.value
792
+ apiKey: s.value,
793
+ model: f.value,
794
+ baseUrl: i.value
1503
795
  });
1504
- }), j(f, (m) => {
1505
- m && i("testResult", m);
796
+ }), q(g, (o) => {
797
+ o && a("testResult", o);
1506
798
  });
1507
- function F() {
1508
- L(), R.value = "saved", i("save", A.value), setTimeout(() => {
1509
- R.value = "idle";
799
+ function N() {
800
+ U(), T.value = "saved", a("save", I.value), setTimeout(() => {
801
+ T.value = "idle";
1510
802
  }, 2e3);
1511
803
  }
1512
- function D(m) {
1513
- t.value = m;
804
+ function E(o) {
805
+ t.value = o;
1514
806
  }
1515
- function X(m) {
1516
- n.value = m;
807
+ function H(o) {
808
+ s.value = o;
1517
809
  }
1518
- function q(m, M) {
1519
- w(m, M);
810
+ function Y(o, b) {
811
+ k(o, b);
1520
812
  }
1521
- function G(m) {
1522
- r.value = m;
813
+ function O(o) {
814
+ i.value = o;
1523
815
  }
1524
- return (m, M) => {
1525
- var $, _, K, me;
1526
- return y(), b("div", It, [
1527
- e.title ? (y(), b("h2", xt, x(e.title), 1)) : Q("", !0),
1528
- d("div", At, [
1529
- V(Ye, {
1530
- providers: g(h),
1531
- selectedProviderId: g(t),
1532
- onSelect: D,
816
+ return (o, b) => {
817
+ var F, P, _, oe;
818
+ return m(), p("div", ut, [
819
+ e.title ? (m(), p("h2", ct, w(e.title), 1)) : W("", !0),
820
+ n("div", vt, [
821
+ j(Be, {
822
+ providers: v(h),
823
+ selectedProviderId: v(t),
824
+ onSelect: E,
1533
825
  disabled: e.disabled,
1534
826
  language: e.language
1535
827
  }, null, 8, ["providers", "selectedProviderId", "disabled", "language"]),
1536
- V(Ct, {
1537
- provider: g(p),
1538
- baseUrl: g(r),
1539
- "onUpdate:baseUrl": G,
828
+ j(dt, {
829
+ provider: v(d),
830
+ baseUrl: v(i),
831
+ "onUpdate:baseUrl": O,
1540
832
  disabled: e.disabled,
1541
833
  language: e.language
1542
834
  }, null, 8, ["provider", "baseUrl", "disabled", "language"]),
1543
- d("div", {
1544
- class: P(["transition-all duration-500 ease-in-out", g(t) ? "max-h-[1000px] opacity-100 overflow-visible" : "max-h-0 opacity-0 overflow-hidden"])
835
+ n("div", {
836
+ class: z(["transition-all duration-500 ease-in-out", v(t) ? "max-h-[1000px] opacity-100 overflow-visible" : "max-h-0 opacity-0 overflow-hidden"])
1545
837
  }, [
1546
- d("div", Et, [
1547
- V(it, {
1548
- provider: g(p),
1549
- apiKey: g(n),
1550
- "onUpdate:apiKey": X,
1551
- testStatus: g(c),
838
+ n("div", ht, [
839
+ j(Ve, {
840
+ provider: v(d),
841
+ apiKey: v(s),
842
+ "onUpdate:apiKey": H,
843
+ testStatus: v(c),
1552
844
  disabled: e.disabled,
1553
845
  language: e.language,
1554
- isFetchingModels: g(S),
1555
- fetchModelError: g(U)
846
+ isFetchingModels: v(S),
847
+ fetchModelError: v(K)
1556
848
  }, null, 8, ["provider", "apiKey", "testStatus", "disabled", "language", "isFetchingModels", "fetchModelError"]),
1557
- V(kt, {
1558
- provider: g(p),
1559
- models: g(u),
1560
- selectedModelId: g(v),
1561
- onSelect: q,
1562
- hasApiKey: !!g(n),
849
+ j(nt, {
850
+ provider: v(d),
851
+ models: v(y),
852
+ selectedModelId: v(f),
853
+ onSelect: Y,
854
+ hasApiKey: !!v(s),
1563
855
  disabled: e.disabled,
1564
856
  language: e.language,
1565
- isFetchingModels: g(S),
1566
- fetchModelError: g(U),
1567
- selectedModelName: g(l)
857
+ isFetchingModels: v(S),
858
+ fetchModelError: v(K),
859
+ selectedModelName: v(u)
1568
860
  }, null, 8, ["provider", "models", "selectedModelId", "hasApiKey", "disabled", "language", "isFetchingModels", "fetchModelError", "selectedModelName"])
1569
861
  ])
1570
862
  ], 2),
1571
- d("div", Lt, [
1572
- d("div", Ot, [
1573
- d("button", {
863
+ n("div", ft, [
864
+ n("div", pt, [
865
+ n("button", {
1574
866
  type: "button",
1575
- onClick: M[0] || (M[0] = (be) => g(k)()),
1576
- disabled: !g(t) || !g(n) || !g(v) || e.disabled || g(c) === "testing",
1577
- class: P([
867
+ onClick: b[0] || (b[0] = (ce) => v(x)()),
868
+ disabled: !v(t) || !v(s) || !v(f) || e.disabled || v(c) === "testing",
869
+ class: z([
1578
870
  "apmsu-btn flex-1",
1579
- g(c) === "success" ? "apmsu-btn-success" : g(c) === "error" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40" : "apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"
871
+ v(c) === "success" ? "apmsu-btn-success" : v(c) === "error" ? "bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-900/40" : "apmsu-btn-ghost border border-gray-200 dark:border-zinc-700"
1580
872
  ])
1581
873
  }, [
1582
- g(c) === "testing" ? (y(), b("span", Tt, [
1583
- M[2] || (M[2] = d("svg", {
874
+ v(c) === "testing" ? (m(), p("span", gt, [
875
+ b[2] || (b[2] = n("svg", {
1584
876
  class: "apmsu-icon-spin",
1585
877
  viewBox: "0 0 24 24",
1586
878
  fill: "none"
1587
879
  }, [
1588
- d("circle", {
880
+ n("circle", {
1589
881
  class: "opacity-25",
1590
882
  cx: "12",
1591
883
  cy: "12",
@@ -1593,86 +885,86 @@ const ve = {
1593
885
  stroke: "currentColor",
1594
886
  "stroke-width": "4"
1595
887
  }),
1596
- d("path", {
888
+ n("path", {
1597
889
  class: "opacity-75",
1598
890
  fill: "currentColor",
1599
891
  d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
1600
892
  })
1601
893
  ], -1)),
1602
- z(" " + x(B.value.testing), 1)
1603
- ])) : g(c) === "success" ? (y(), b("span", Bt, [
1604
- M[3] || (M[3] = d("svg", {
894
+ D(" " + w(L.value.testing), 1)
895
+ ])) : v(c) === "success" ? (m(), p("span", yt, [
896
+ b[3] || (b[3] = n("svg", {
1605
897
  class: "apmsu-icon-success",
1606
898
  fill: "currentColor",
1607
899
  viewBox: "0 0 24 24"
1608
900
  }, [
1609
- d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
901
+ n("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
1610
902
  ], -1)),
1611
- z(" " + x(B.value.testSuccess) + " " + x(($ = g(f)) != null && $.latencyMs ? `${g(f).latencyMs}ms` : ""), 1)
1612
- ])) : g(c) === "error" ? (y(), b("span", Pt, [
1613
- M[4] || (M[4] = d("svg", {
903
+ D(" " + w(L.value.testSuccess) + " " + w((F = v(g)) != null && F.latencyMs ? `${v(g).latencyMs}ms` : ""), 1)
904
+ ])) : v(c) === "error" ? (m(), p("span", bt, [
905
+ b[4] || (b[4] = n("svg", {
1614
906
  class: "apmsu-icon-error",
1615
907
  fill: "currentColor",
1616
908
  viewBox: "0 0 24 24"
1617
909
  }, [
1618
- d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
910
+ n("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
1619
911
  ], -1)),
1620
- z(" " + x(B.value.testFailed), 1)
1621
- ])) : (y(), b(H, { key: 3 }, [
1622
- z(x(B.value.testConnection), 1)
912
+ D(" " + w(L.value.testFailed), 1)
913
+ ])) : (m(), p(R, { key: 3 }, [
914
+ D(w(L.value.testConnection), 1)
1623
915
  ], 64))
1624
- ], 10, St),
1625
- d("button", {
1626
- onClick: F,
1627
- disabled: !g(I) || e.disabled,
1628
- class: P(["apmsu-btn flex-1", R.value === "saved" ? "apmsu-btn-success" : "apmsu-btn-primary"])
916
+ ], 10, mt),
917
+ n("button", {
918
+ onClick: N,
919
+ disabled: !v(M) || e.disabled,
920
+ class: z(["apmsu-btn flex-1", T.value === "saved" ? "apmsu-btn-success" : "apmsu-btn-primary"])
1629
921
  }, [
1630
- R.value === "saved" ? (y(), b("span", Ft, [
1631
- M[5] || (M[5] = d("svg", {
922
+ T.value === "saved" ? (m(), p("span", kt, [
923
+ b[5] || (b[5] = n("svg", {
1632
924
  class: "w-4 h-4",
1633
925
  fill: "none",
1634
926
  stroke: "currentColor",
1635
927
  viewBox: "0 0 24 24"
1636
928
  }, [
1637
- d("path", {
929
+ n("path", {
1638
930
  "stroke-linecap": "round",
1639
931
  "stroke-linejoin": "round",
1640
932
  "stroke-width": "2.5",
1641
933
  d: "M5 13l4 4L19 7"
1642
934
  })
1643
935
  ], -1)),
1644
- z(" " + x(B.value.saved), 1)
1645
- ])) : (y(), b(H, { key: 1 }, [
1646
- z(x(e.saveButtonText || B.value.save), 1)
936
+ D(" " + w(L.value.saved), 1)
937
+ ])) : (m(), p(R, { key: 1 }, [
938
+ D(w(e.saveButtonText || L.value.save), 1)
1647
939
  ], 64))
1648
- ], 10, Ut)
940
+ ], 10, xt)
1649
941
  ]),
1650
- d("div", {
942
+ n("div", {
1651
943
  class: "grid transition-all duration-200 ease-out",
1652
- style: J({ gridTemplateRows: !((_ = g(f)) != null && _.success) && ((K = g(f)) != null && K.message) && g(c) !== "testing" && g(c) !== "success" ? "1fr" : "0fr" })
944
+ style: G({ gridTemplateRows: !((P = v(g)) != null && P.success) && ((_ = v(g)) != null && _.message) && v(c) !== "testing" && v(c) !== "success" ? "1fr" : "0fr" })
1653
945
  }, [
1654
- d("div", $t, [
1655
- d("div", Kt, [
1656
- d("p", Rt, x((me = g(f)) == null ? void 0 : me.message), 1)
946
+ n("div", Ct, [
947
+ n("div", wt, [
948
+ n("p", Mt, w((oe = v(g)) == null ? void 0 : oe.message), 1)
1657
949
  ])
1658
950
  ])
1659
951
  ], 4)
1660
952
  ])
1661
953
  ]),
1662
- e.showPreview && g(p) ? (y(), b("div", Nt, [
1663
- d("button", {
954
+ e.showPreview && v(d) ? (m(), p("div", It, [
955
+ n("button", {
1664
956
  type: "button",
1665
- onClick: M[1] || (M[1] = (be) => C.value = !C.value),
957
+ onClick: b[1] || (b[1] = (ce) => C.value = !C.value),
1666
958
  class: "w-full flex items-center justify-between px-4 py-3 bg-zinc-50 dark:bg-zinc-900/50 hover:bg-zinc-100 dark:hover:bg-zinc-800/50 transition-colors"
1667
959
  }, [
1668
- d("h3", Dt, x(B.value.preview), 1),
1669
- (y(), b("svg", {
1670
- class: P(["w-4 h-4 text-gray-400 transition-transform duration-200", C.value ? "rotate-180" : ""]),
960
+ n("h3", $t, w(L.value.preview), 1),
961
+ (m(), p("svg", {
962
+ class: z(["w-4 h-4 text-gray-400 transition-transform duration-200", C.value ? "rotate-180" : ""]),
1671
963
  fill: "none",
1672
964
  stroke: "currentColor",
1673
965
  viewBox: "0 0 24 24"
1674
- }, [...M[6] || (M[6] = [
1675
- d("path", {
966
+ }, [...b[6] || (b[6] = [
967
+ n("path", {
1676
968
  "stroke-linecap": "round",
1677
969
  "stroke-linejoin": "round",
1678
970
  "stroke-width": "2",
@@ -1680,28 +972,28 @@ const ve = {
1680
972
  }, null, -1)
1681
973
  ])], 2))
1682
974
  ]),
1683
- d("div", {
975
+ n("div", {
1684
976
  class: "grid transition-all duration-200 ease-out",
1685
- style: J({ gridTemplateRows: C.value ? "1fr" : "0fr" })
977
+ style: G({ gridTemplateRows: C.value ? "1fr" : "0fr" })
1686
978
  }, [
1687
- d("div", Gt, [
1688
- d("pre", Qt, "" + x(JSON.stringify({
1689
- provider: g(p).name,
1690
- apiFormat: g(p).apiFormat,
1691
- baseUrl: g(r) || g(p).baseUrl,
1692
- model: g(v) || B.value.unselected,
1693
- hasApiKey: !!g(n)
979
+ n("div", Ut, [
980
+ n("pre", St, "" + w(JSON.stringify({
981
+ provider: v(d).name,
982
+ apiFormat: v(d).apiFormat,
983
+ baseUrl: v(i) || v(d).baseUrl,
984
+ model: v(f) || L.value.unselected,
985
+ hasApiKey: !!v(s)
1694
986
  }, null, 2)) + `
1695
987
  `, 1)
1696
988
  ])
1697
989
  ], 4)
1698
- ])) : Q("", !0)
990
+ ])) : W("", !0)
1699
991
  ]);
1700
992
  };
1701
993
  }
1702
994
  });
1703
995
  export {
1704
996
  zt as AIConfigForm,
1705
- Be as useAIConfig
997
+ ye as useAIConfig
1706
998
  };
1707
999
  //# sourceMappingURL=index.js.map