ekarouter 1.0.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/README.md +36 -0
- package/bin/cli.js +192 -0
- package/binaries/ekarouter-linux-amd64 +0 -0
- package/binaries/ekarouter-windows-amd64.exe +0 -0
- package/package.json +36 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/LoginView-CSzx0ltN.js +1 -0
- package/public/assets/OrangeSwitch-Dc_G3ztN.js +1 -0
- package/public/assets/QueryClientProvider-BjElddVn.js +1 -0
- package/public/assets/_id-BC10EHRw.js +4 -0
- package/public/assets/_id-CnBJVbQB.js +2 -0
- package/public/assets/api-lXjeGSiV.js +2 -0
- package/public/assets/bot-mZlhzHVu.js +1 -0
- package/public/assets/boxes-DXduN63I.js +1 -0
- package/public/assets/callback-D2O49UZw.js +2 -0
- package/public/assets/callback-pJodpDyd.js +1 -0
- package/public/assets/check-36OnHiEM.js +1 -0
- package/public/assets/chevron-down-DxUrtHFo.js +1 -0
- package/public/assets/chevron-right-CHJcvRU6.js +1 -0
- package/public/assets/circle-alert-CcGnUa7l.js +1 -0
- package/public/assets/cli-tools-DCOrwuor.js +21 -0
- package/public/assets/cloud-upload-D41DfGnv.js +1 -0
- package/public/assets/code-xml-BsvsUoDv.js +1 -0
- package/public/assets/combos-Df1jA7_R.js +1 -0
- package/public/assets/console-log-Bl-Kc0eo.js +2 -0
- package/public/assets/copy-B1k2VT2A.js +1 -0
- package/public/assets/createLucideIcon-CLdWFMku.js +1 -0
- package/public/assets/dialog-B56WVEML.js +41 -0
- package/public/assets/dist-yiyhte89.js +1 -0
- package/public/assets/endpoint-C-3fXtUc.js +36 -0
- package/public/assets/external-link-BYVStqz6.js +1 -0
- package/public/assets/eye-Cbs9C6DS.js +1 -0
- package/public/assets/eye-off-DIe2-cve.js +1 -0
- package/public/assets/file-text-BRzD_S8I.js +1 -0
- package/public/assets/flask-conical-CoRklKsr.js +1 -0
- package/public/assets/globe-hcLYcRzz.js +1 -0
- package/public/assets/hard-drive-Dakvr_if.js +1 -0
- package/public/assets/headerSearch-C758FsaX.js +1 -0
- package/public/assets/image-B10s4838.js +1 -0
- package/public/assets/jsx-runtime-B-hcVAMW.js +1 -0
- package/public/assets/key-BXUPFSjV.js +1 -0
- package/public/assets/kit-DGWILC5k.js +1 -0
- package/public/assets/laptop-D_8f9_v7.js +1 -0
- package/public/assets/layers-C_9oEa0w.js +1 -0
- package/public/assets/loader-circle-NEOay2w5.js +1 -0
- package/public/assets/lock-Chb45-Rn.js +1 -0
- package/public/assets/log-out-wyRkCSAT.js +1 -0
- package/public/assets/login-BuQTIKrL.js +1 -0
- package/public/assets/media-providers-C_wofVbG.js +1 -0
- package/public/assets/mic-D6DQAnIR.js +1 -0
- package/public/assets/network-D0tNT-6h.js +1 -0
- package/public/assets/pencil-CFgylVBP.js +1 -0
- package/public/assets/play-CPV0a6Tn.js +1 -0
- package/public/assets/playground-BIwkZcr_.js +67 -0
- package/public/assets/plus-qKI-KwZh.js +1 -0
- package/public/assets/preload-helper-CzRBhNKp.js +1 -0
- package/public/assets/providers-D8WoK8lA.js +1 -0
- package/public/assets/providersData-lrEpUDQM.js +1 -0
- package/public/assets/proxy-pools-BusHbtGD.js +5 -0
- package/public/assets/react-dom-8HkkFvw6.js +1 -0
- package/public/assets/refresh-cw-CHzni4H4.js +1 -0
- package/public/assets/routes-r_aF-Xnw.js +1 -0
- package/public/assets/search-BtJsgOj6.js +1 -0
- package/public/assets/server-CAbKLNFx.js +1 -0
- package/public/assets/settings-Tk-iCnFy.js +1 -0
- package/public/assets/shield-CMYlc0qf.js +1 -0
- package/public/assets/skills-D0d-ShKH.js +1 -0
- package/public/assets/spa-Bs7oEq98.js +10 -0
- package/public/assets/sparkles-DZ5Pl1vD.js +1 -0
- package/public/assets/styles-BSGa23zc.css +2 -0
- package/public/assets/terminal-BkaGpO2M.js +1 -0
- package/public/assets/theme-o081sJEj.js +1 -0
- package/public/assets/token-saver-DgfF_Mvq.js +1 -0
- package/public/assets/trash-2-D9HI9O7Q.js +1 -0
- package/public/assets/triangle-alert-DUFscLic.js +1 -0
- package/public/assets/upload--8EEkrQJ.js +1 -0
- package/public/assets/usage-D2lS5DQa.js +56 -0
- package/public/assets/useNavigate-D06Ztr27.js +1 -0
- package/public/assets/useQuery-BrM5_EQu.js +1 -0
- package/public/assets/utils-B6KiDbIe.js +1 -0
- package/public/assets/volume-2-DoDae9nb.js +1 -0
- package/public/assets/wifi-Bsq09YFd.js +1 -0
- package/public/assets/x-CGuQtexA.js +1 -0
- package/public/assets/zap-BS7lyU9U.js +1 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +3 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon.png +0 -0
- package/public/icons.svg +24 -0
- package/public/index.html +55 -0
- package/public/logo-icon-dark.svg +28 -0
- package/public/logo.png +0 -0
- package/public/providers/agentrouter.png +0 -0
- package/public/providers/alicode-intl.png +0 -0
- package/public/providers/alicode.png +0 -0
- package/public/providers/alims-intl.png +0 -0
- package/public/providers/alitp-intl.png +0 -0
- package/public/providers/amp.png +0 -0
- package/public/providers/anthropic-m.png +0 -0
- package/public/providers/anthropic.png +0 -0
- package/public/providers/antigravity.png +0 -0
- package/public/providers/api-airforce.png +0 -0
- package/public/providers/assemblyai.png +0 -0
- package/public/providers/aws-polly.png +0 -0
- package/public/providers/azure.png +0 -0
- package/public/providers/baidu.png +0 -0
- package/public/providers/bazaarlink.png +0 -0
- package/public/providers/black-forest-labs.png +0 -0
- package/public/providers/blackbox.png +0 -0
- package/public/providers/bluesminds.png +0 -0
- package/public/providers/brave-search.png +0 -0
- package/public/providers/bynara.svg +28 -0
- package/public/providers/byteplus.png +0 -0
- package/public/providers/cartesia.png +0 -0
- package/public/providers/cerebras.png +0 -0
- package/public/providers/chutes.png +0 -0
- package/public/providers/claude.png +0 -0
- package/public/providers/cline.png +0 -0
- package/public/providers/clinepass.png +0 -0
- package/public/providers/cloudflare-ai.png +0 -0
- package/public/providers/codebuddy-cn.png +0 -0
- package/public/providers/codebuddy-intl.png +0 -0
- package/public/providers/codex.png +0 -0
- package/public/providers/cohere.png +0 -0
- package/public/providers/comfyui.png +0 -0
- package/public/providers/commandcode.png +0 -0
- package/public/providers/continue.png +0 -0
- package/public/providers/copilot.png +0 -0
- package/public/providers/coqui.png +0 -0
- package/public/providers/cursor.png +0 -0
- package/public/providers/deepgram.png +0 -0
- package/public/providers/deepseek-tui.png +0 -0
- package/public/providers/deepseek.png +0 -0
- package/public/providers/devin-cli.png +0 -0
- package/public/providers/droid.png +0 -0
- package/public/providers/edge-tts.png +0 -0
- package/public/providers/elevenlabs.png +0 -0
- package/public/providers/exa.png +0 -0
- package/public/providers/fal-ai.png +0 -0
- package/public/providers/featherless.png +0 -0
- package/public/providers/firecrawl.png +0 -0
- package/public/providers/fireworks.png +0 -0
- package/public/providers/fish-audio.png +0 -0
- package/public/providers/gemini-cli.png +0 -0
- package/public/providers/gemini.png +0 -0
- package/public/providers/github.png +0 -0
- package/public/providers/gitlab.png +0 -0
- package/public/providers/glm-cn.png +0 -0
- package/public/providers/glm.png +0 -0
- package/public/providers/google-pse.png +0 -0
- package/public/providers/google-tts.png +0 -0
- package/public/providers/grok-cli.png +0 -0
- package/public/providers/grok-web.png +0 -0
- package/public/providers/groq.png +0 -0
- package/public/providers/hermes.png +0 -0
- package/public/providers/huggingface.png +0 -0
- package/public/providers/hyperbolic.png +0 -0
- package/public/providers/iflow.png +0 -0
- package/public/providers/inworld.png +0 -0
- package/public/providers/jcode.png +0 -0
- package/public/providers/jina-ai.png +0 -0
- package/public/providers/jina-reader.png +0 -0
- package/public/providers/kilo-gateway.png +0 -0
- package/public/providers/kilocode.png +0 -0
- package/public/providers/kimchi.png +0 -0
- package/public/providers/kimchi.svg +4 -0
- package/public/providers/kimi-coding.png +0 -0
- package/public/providers/kimi.png +0 -0
- package/public/providers/kiro.png +0 -0
- package/public/providers/linkup.png +0 -0
- package/public/providers/llm7.png +0 -0
- package/public/providers/local-device.png +0 -0
- package/public/providers/longcat.png +0 -0
- package/public/providers/mimo-free.png +0 -0
- package/public/providers/minimax-cn.png +0 -0
- package/public/providers/minimax.png +0 -0
- package/public/providers/mistral.png +0 -0
- package/public/providers/mmf.png +0 -0
- package/public/providers/morph.png +0 -0
- package/public/providers/nanobanana.png +0 -0
- package/public/providers/nara.svg +28 -0
- package/public/providers/nebius.png +0 -0
- package/public/providers/novita.png +0 -0
- package/public/providers/nvidia.png +0 -0
- package/public/providers/oai-cc.png +0 -0
- package/public/providers/oai-r.png +0 -0
- package/public/providers/ollama-local.png +0 -0
- package/public/providers/ollama.png +0 -0
- package/public/providers/openai.png +0 -0
- package/public/providers/openclaw.png +0 -0
- package/public/providers/opencode-go.png +0 -0
- package/public/providers/opencode.png +0 -0
- package/public/providers/opendesign.png +0 -0
- package/public/providers/openrouter.png +0 -0
- package/public/providers/perplexity-agent.png +0 -0
- package/public/providers/perplexity-web.png +0 -0
- package/public/providers/perplexity.png +0 -0
- package/public/providers/playht.png +0 -0
- package/public/providers/poolside.png +0 -0
- package/public/providers/qoder.png +0 -0
- package/public/providers/qwen.png +0 -0
- package/public/providers/recraft.png +0 -0
- package/public/providers/reka.png +0 -0
- package/public/providers/roo.png +0 -0
- package/public/providers/runwayml.png +0 -0
- package/public/providers/sambanova.png +0 -0
- package/public/providers/sdwebui.png +0 -0
- package/public/providers/searchapi.png +0 -0
- package/public/providers/searxng.png +0 -0
- package/public/providers/selfhosted-embedding.png +0 -0
- package/public/providers/selfhosted-stt.png +0 -0
- package/public/providers/selfhosted-tts.png +0 -0
- package/public/providers/serper.png +0 -0
- package/public/providers/siliconflow.png +0 -0
- package/public/providers/stability-ai.png +0 -0
- package/public/providers/tavily.png +0 -0
- package/public/providers/tencent.png +0 -0
- package/public/providers/together.png +0 -0
- package/public/providers/tokenrouter.png +0 -0
- package/public/providers/topaz.png +0 -0
- package/public/providers/tortoise.png +0 -0
- package/public/providers/trae.png +0 -0
- package/public/providers/venice.png +0 -0
- package/public/providers/vercel-ai-gateway.png +0 -0
- package/public/providers/vercel.png +0 -0
- package/public/providers/vertex-partner.png +0 -0
- package/public/providers/vertex.png +0 -0
- package/public/providers/volcengine-ark.png +0 -0
- package/public/providers/voyage-ai.png +0 -0
- package/public/providers/windsurf.png +0 -0
- package/public/providers/workbuddy.png +0 -0
- package/public/providers/xai.png +0 -0
- package/public/providers/xiaomi-mimo.png +0 -0
- package/public/providers/xiaomi-tokenplan.png +0 -0
- package/public/providers/xquik.png +0 -0
- package/public/providers/youcom.png +0 -0
- package/public/providers/zed.png +0 -0
- package/public/robots.txt +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# EkaRouter
|
|
2
|
+
|
|
3
|
+
> Universal AI Gateway & Reverse-Proxy Engine with Web Dashboard.
|
|
4
|
+
|
|
5
|
+
Cross-platform distribution wrapper for EkaRouter.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
You can run EkaRouter instantly without installing Go:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx ekarouter
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or install globally:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g ekarouter
|
|
19
|
+
ekarouter
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The gateway will start on `http://127.0.0.1:20128`. Open your browser to access the dashboard.
|
|
23
|
+
|
|
24
|
+
## Environment Variables
|
|
25
|
+
|
|
26
|
+
| Variable | Default | Description |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `PORT` | `20128` | HTTP listen port |
|
|
29
|
+
| `HOST` | `0.0.0.0` | HTTP listen address |
|
|
30
|
+
| `DATA_DIR` | `./data` | Directory for SQLite DB and secrets |
|
|
31
|
+
| `INITIAL_PASSWORD` | *(auto-generated)* | Initial admin login password |
|
|
32
|
+
| `TRUST_PROXY` | `false` | Enable if running behind Nginx / Cloudflare |
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import https from "node:https";
|
|
8
|
+
import http from "node:http";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
14
|
+
const version = pkg.version || "1.0.0";
|
|
15
|
+
|
|
16
|
+
const platform = process.platform;
|
|
17
|
+
const arch = process.arch;
|
|
18
|
+
|
|
19
|
+
const platformMap = {
|
|
20
|
+
win32: "windows",
|
|
21
|
+
linux: "linux",
|
|
22
|
+
darwin: "darwin"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const archMap = {
|
|
26
|
+
x64: "amd64",
|
|
27
|
+
arm64: "arm64"
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const osName = platformMap[platform];
|
|
31
|
+
const archName = archMap[arch];
|
|
32
|
+
|
|
33
|
+
if (!osName || !archName) {
|
|
34
|
+
console.error(`Unsupported system architecture: ${platform} ${arch}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const exeExt = platform === "win32" ? ".exe" : "";
|
|
39
|
+
const binaryFileName = `ekarouter-${osName}-${archName}${exeExt}`;
|
|
40
|
+
|
|
41
|
+
function findExistingBinary() {
|
|
42
|
+
const localCandidates = [
|
|
43
|
+
path.join(__dirname, "..", "binaries", binaryFileName),
|
|
44
|
+
path.join(__dirname, "..", binaryFileName),
|
|
45
|
+
path.join(__dirname, "..", "..", platform === "win32" ? "ekarouter.exe" : "ekarouter-linux"),
|
|
46
|
+
path.join(process.cwd(), platform === "win32" ? "ekarouter.exe" : "ekarouter-linux"),
|
|
47
|
+
path.join(os.homedir(), ".ekarouter", "bin", `${binaryFileName}-${version}`)
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
for (const candidate of localCandidates) {
|
|
51
|
+
if (fs.existsSync(candidate)) {
|
|
52
|
+
return candidate;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ensurePublicDir() {
|
|
59
|
+
if (process.env.PUBLIC_DIR && fs.existsSync(process.env.PUBLIC_DIR)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const publicCandidates = [
|
|
64
|
+
path.join(process.cwd(), "public"),
|
|
65
|
+
path.join(__dirname, "..", "public"),
|
|
66
|
+
path.join(__dirname, "..", "..", "public")
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
for (const cand of publicCandidates) {
|
|
70
|
+
if (fs.existsSync(cand) && fs.existsSync(path.join(cand, "index.html"))) {
|
|
71
|
+
process.env.PUBLIC_DIR = cand;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function downloadBinary(url, destination) {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
const protocol = url.startsWith("https") ? https : http;
|
|
80
|
+
protocol.get(url, (response) => {
|
|
81
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
82
|
+
return downloadBinary(response.headers.location, destination)
|
|
83
|
+
.then(resolve)
|
|
84
|
+
.catch(reject);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (response.statusCode !== 200) {
|
|
88
|
+
return reject(new Error(`Download failed with HTTP status ${response.statusCode}`));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const totalBytes = parseInt(response.headers["content-length"] || "0", 10);
|
|
92
|
+
let downloadedBytes = 0;
|
|
93
|
+
const fileStream = fs.createWriteStream(destination);
|
|
94
|
+
|
|
95
|
+
response.on("data", (chunk) => {
|
|
96
|
+
downloadedBytes += chunk.length;
|
|
97
|
+
if (totalBytes > 0) {
|
|
98
|
+
const percent = ((downloadedBytes / totalBytes) * 100).toFixed(1);
|
|
99
|
+
process.stdout.write(`\rDownloading EkaRouter binary: ${percent}% (${(downloadedBytes / (1024 * 1024)).toFixed(1)} MB)`);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
response.pipe(fileStream);
|
|
104
|
+
|
|
105
|
+
fileStream.on("finish", () => {
|
|
106
|
+
fileStream.close(() => {
|
|
107
|
+
process.stdout.write("\n");
|
|
108
|
+
resolve();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
fileStream.on("error", (err) => {
|
|
113
|
+
fs.unlink(destination, () => {});
|
|
114
|
+
reject(err);
|
|
115
|
+
});
|
|
116
|
+
}).on("error", reject);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function resolveBinary() {
|
|
121
|
+
const existing = findExistingBinary();
|
|
122
|
+
if (existing) {
|
|
123
|
+
return existing;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const binDir = path.join(os.homedir(), ".ekarouter", "bin");
|
|
127
|
+
if (!fs.existsSync(binDir)) {
|
|
128
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const targetPath = path.join(binDir, `${binaryFileName}-${version}`);
|
|
132
|
+
const tempPath = `${targetPath}.tmp`;
|
|
133
|
+
|
|
134
|
+
const downloadUrl = process.env.EKAROUTER_BINARY_URL ||
|
|
135
|
+
`https://github.com/dresar/ekarouterv1/releases/download/v${version}/${binaryFileName}`;
|
|
136
|
+
|
|
137
|
+
console.log(`EkaRouter binary not found locally.`);
|
|
138
|
+
console.log(`Fetching precompiled binary from: ${downloadUrl}`);
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
await downloadBinary(downloadUrl, tempPath);
|
|
142
|
+
fs.renameSync(tempPath, targetPath);
|
|
143
|
+
if (platform !== "win32") {
|
|
144
|
+
fs.chmodSync(targetPath, 0o755);
|
|
145
|
+
}
|
|
146
|
+
return targetPath;
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (fs.existsSync(tempPath)) {
|
|
149
|
+
fs.unlinkSync(tempPath);
|
|
150
|
+
}
|
|
151
|
+
console.error(`Failed to download EkaRouter binary: ${error.message}`);
|
|
152
|
+
console.error(`Please compile from source or check release availability at https://github.com/dresar/ekarouterv1/releases`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async function main() {
|
|
158
|
+
ensurePublicDir();
|
|
159
|
+
const binaryPath = await resolveBinary();
|
|
160
|
+
|
|
161
|
+
if (platform !== "win32") {
|
|
162
|
+
try {
|
|
163
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
164
|
+
} catch {}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
168
|
+
stdio: "inherit",
|
|
169
|
+
env: process.env
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
child.on("exit", (code, signal) => {
|
|
173
|
+
if (signal) {
|
|
174
|
+
process.kill(process.pid, signal);
|
|
175
|
+
} else {
|
|
176
|
+
process.exit(code ?? 0);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
process.on("SIGINT", () => {
|
|
181
|
+
child.kill("SIGINT");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
process.on("SIGTERM", () => {
|
|
185
|
+
child.kill("SIGTERM");
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
main().catch((err) => {
|
|
190
|
+
console.error(err);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
});
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ekarouter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Universal AI Gateway & Reverse-Proxy Engine with Web Dashboard",
|
|
5
|
+
"main": "bin/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ekarouter": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"binaries",
|
|
13
|
+
"public",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18.0.0"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"ai",
|
|
21
|
+
"gateway",
|
|
22
|
+
"llm",
|
|
23
|
+
"router",
|
|
24
|
+
"proxy",
|
|
25
|
+
"claude-code",
|
|
26
|
+
"openai",
|
|
27
|
+
"gemini",
|
|
28
|
+
"deepseek"
|
|
29
|
+
],
|
|
30
|
+
"author": "Eka Syarif Maulana",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/dresar/ekarouterv1.git"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{n as r}from"./QueryClientProvider-BjElddVn.js";import{n as i,r as a}from"./api-lXjeGSiV.js";import{t as o}from"./eye-off-DIe2-cve.js";import{t as s}from"./eye-Cbs9C6DS.js";import{t as c}from"./loader-circle-NEOay2w5.js";import{a as l,i as u,r as d}from"./theme-o081sJEj.js";var f=e(t(),1),p=n();function m({className:e}){let{resolvedTheme:t,toggleTheme:n}=d();return(0,p.jsx)(`button`,{type:`button`,onClick:n,"data-testid":`theme-toggle`,className:e||`focus-ring inline-flex h-8 w-8 items-center justify-center rounded-lg border border-border/80 bg-card text-muted-foreground transition-colors hover:bg-hover hover:text-foreground cursor-pointer shadow-xs`,title:t===`dark`?`Ganti ke mode terang`:`Ganti ke mode gelap`,"aria-label":`Toggle theme`,children:t===`dark`?(0,p.jsx)(u,{className:`h-4 w-4 text-amber-400`}):(0,p.jsx)(l,{className:`h-4 w-4 text-primary`})})}function h(){let e=r(),[t,n]=(0,f.useState)(``),[l,u]=(0,f.useState)(!1),[d,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null);return(0,p.jsxs)(`div`,{className:`relative flex min-h-screen items-center justify-center bg-background px-4 dot-grid-bg transition-colors`,children:[(0,p.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,p.jsx)(m,{})}),(0,p.jsxs)(`div`,{className:`w-full max-w-[380px] overflow-hidden rounded-2xl border border-border bg-card shadow-[0_16px_64px_-12px_rgba(0,0,0,0.4)] transition-colors`,children:[(0,p.jsx)(`div`,{className:`border-b border-border bg-muted/30 px-8 py-7 transition-colors`,children:(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-center`,children:[(0,p.jsx)(`img`,{src:`/logo.png`,alt:`EkaRouter`,className:`h-16 w-16 object-contain filter drop-shadow-[0_4px_14px_rgba(14,165,233,0.55)]`}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-lg font-bold tracking-tight text-foreground`,children:`EkaRouter`}),(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Universal AI Gateway`})]})]})}),(0,p.jsxs)(`form`,{onSubmit:async n=>{if(n?.preventDefault(),!(!t.trim()||d)){h(!0),_(null);try{let n=await i.login(t.trim());if(!n.success)throw Error(n.error||`Login gagal`);e.setQueryData([`auth-status`],{authenticated:!0,requireLogin:!0,hasPassword:!0,authMode:`password`,user:n.user||{username:`admin`,role:`admin`}}),await e.invalidateQueries({queryKey:[`auth-status`]})}catch(e){_(a(e)),h(!1)}}},className:`space-y-3.5 px-8 py-7`,children:[(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(`label`,{htmlFor:`login-password`,className:`text-xs font-medium text-foreground`,children:`Password`}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(`input`,{id:`login-password`,type:l?`text`:`password`,value:t,onChange:e=>n(e.target.value),autoFocus:!0,autoComplete:`current-password`,placeholder:`Masukkan password`,className:`h-10 w-full rounded-xl border border-border bg-background px-3.5 pr-10 text-sm text-foreground placeholder:text-dim transition-colors focus:border-primary focus:outline-none`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>u(!l),"aria-label":l?`Sembunyikan password`:`Tampilkan password`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-dim transition-colors hover:text-foreground`,children:l?(0,p.jsx)(o,{className:`h-4 w-4`}):(0,p.jsx)(s,{className:`h-4 w-4`})})]})]}),g&&(0,p.jsx)(`div`,{className:`rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-2.5 text-xs font-medium text-danger`,children:g}),(0,p.jsxs)(`button`,{type:`submit`,disabled:!t.trim()||d,className:`flex h-10 w-full items-center justify-center gap-2 rounded-xl bg-primary text-sm font-semibold text-primary-foreground shadow-[0_4px_16px_rgba(240,100,59,0.25)] transition-all hover:bg-primary-light active:scale-[0.99] disabled:pointer-events-none disabled:opacity-50`,children:[d&&(0,p.jsx)(c,{className:`h-4 w-4 animate-spin`}),(0,p.jsx)(`span`,{children:d?`Memeriksa...`:`Masuk`})]})]}),(0,p.jsx)(`div`,{className:`border-t border-border bg-muted/30 px-8 py-4 transition-colors`,children:(0,p.jsxs)(`p`,{className:`text-center text-[11px] leading-relaxed text-muted-foreground`,children:[`Password default: `,(0,p.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:`eka1234`})]})})]})]})}export{m as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-B-hcVAMW.js";import{t}from"./utils-B6KiDbIe.js";var n=e();function r({className:e=`h-5 w-5 text-[#f0643b]`}){return(0,n.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,n.jsx)(`path`,{d:`M12 2.5L15 5.5L12 8.5L9 5.5Z`}),(0,n.jsx)(`path`,{d:`M21.5 12L18.5 15L15.5 12L18.5 9Z`}),(0,n.jsx)(`path`,{d:`M12 21.5L9 18.5L12 15.5L15 18.5Z`}),(0,n.jsx)(`path`,{d:`M2.5 12L5.5 9L8.5 12L5.5 15Z`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.2`})]})}function i({checked:e,onCheckedChange:r,disabled:i}){return(0,n.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:i,onClick:()=>r(!e),className:t(`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full p-0.5 transition-colors duration-200 focus:outline-none`,e?`bg-[#f0643b]`:`bg-zinc-300 dark:bg-[#282d3b]`,i&&`opacity-50 cursor-not-allowed`),children:(0,n.jsx)(`span`,{className:t(`pointer-events-none block h-4 w-4 rounded-full bg-white shadow transition-transform duration-200`,e?`translate-x-4`:`translate-x-0`)})})}export{r as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t}));export{o as n,s as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{n as r}from"./useNavigate-D06Ztr27.js";import{a as i}from"./preload-helper-CzRBhNKp.js";import{t as a}from"./useQuery-BrM5_EQu.js";import{n as o}from"./QueryClientProvider-BjElddVn.js";import{n as s,r as c}from"./api-lXjeGSiV.js";import{t as l}from"./createLucideIcon-CLdWFMku.js";import{t as ee}from"./bot-mZlhzHVu.js";import{t as u}from"./check-36OnHiEM.js";import{t as te}from"./chevron-down-DxUrtHFo.js";import{n as ne,t as d}from"./triangle-alert-DUFscLic.js";import{t as re}from"./cloud-upload-D41DfGnv.js";import{t as ie}from"./copy-B1k2VT2A.js";import{n as ae,t as oe}from"./lock-Chb45-Rn.js";import{t as f}from"./external-link-BYVStqz6.js";import{t as se}from"./eye-off-DIe2-cve.js";import{t as ce}from"./eye-Cbs9C6DS.js";import{t as le}from"./file-text-BRzD_S8I.js";import{t as ue}from"./flask-conical-CoRklKsr.js";import{t as de}from"./globe-hcLYcRzz.js";import{t as fe}from"./image-B10s4838.js";import{u as pe}from"./kit-DGWILC5k.js";import{t as me}from"./key-BXUPFSjV.js";import{t as p}from"./network-D0tNT-6h.js";import{t as he}from"./pencil-CFgylVBP.js";import{t as m}from"./plus-qKI-KwZh.js";import{t as h}from"./refresh-cw-CHzni4H4.js";import{t as ge}from"./search-BtJsgOj6.js";import{t as _e}from"./sparkles-DZ5Pl1vD.js";import{t as ve}from"./terminal-BkaGpO2M.js";import{t as ye}from"./trash-2-D9HI9O7Q.js";import{t as be}from"./x-CGuQtexA.js";import{t as xe}from"./zap-BS7lyU9U.js";import{t as g}from"./utils-B6KiDbIe.js";import{n as _}from"./dist-yiyhte89.js";import{t as v}from"./_id-CnBJVbQB.js";import{t as Se}from"./providersData-lrEpUDQM.js";import{t as Ce}from"./OrangeSwitch-Dc_G3ztN.js";var we=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Te=l(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Ee=l(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),De=l(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),y=e(t(),1),b=n();function Oe(e,t,n){let r=`${e} ${t}`.toLowerCase(),i=r.includes(`coder`)||r.includes(`code`)||r.includes(`codestral`)||r.includes(`coding`)||r.includes(`program`)||r.includes(`qoder`)||r.includes(`cline`)||r.includes(`copilot`)||r.includes(`sonnet`)||r.includes(`gemini-3.7`)||r.includes(`gemini-3.8`)||r.includes(`gemini-3.6`)||r.includes(`gpt-4o`)||r.includes(`gpt-5`)||r.includes(`gpt-6`),a=!!n?.vision||r.includes(`vision`)||r.includes(`vl`)||r.includes(`flash`)||r.includes(`pro`)||r.includes(`4o`)||r.includes(`sonnet`)||r.includes(`gemini`)||r.includes(`claude`),o=!!n?.reasoning||r.includes(`reasoning`)||r.includes(`reasoner`)||r.includes(`r1`)||r.includes(`thinking`)||r.includes(`thought`)||r.includes(`o1`)||r.includes(`o3`)||r.includes(`qwq`);return{isCode:i,isVision:a,isReasoning:o,isTextOnly:!i&&!a&&!o}}function ke({className:e=`h-5 w-5`}){return(0,b.jsxs)(`svg`,{viewBox:`0 0 48 48`,className:e,fill:`none`,children:[(0,b.jsx)(`path`,{fill:`#F38020`,d:`M36.6 22.8c-.8-5.3-5.3-9.3-10.8-9.3-4.8 0-8.9 3.1-10.4 7.5-3.8.4-6.8 3.7-6.8 7.6 0 4.2 3.4 7.6 7.6 7.6h19.8c3.9 0 7-3.1 7-7 0-3.4-2.4-6.2-5.7-6.8l-.7-.6z`}),(0,b.jsx)(`path`,{fill:`#FAAE40`,d:`M33.7 28.5c-.3-.2-.7-.3-1-.3h-8.8c-.3 0-.6.1-.8.4l-1.3 2.1c-.2.3-.2.7 0 1 .2.3.5.4.8.4h8.8c.3 0 .6-.1.8-.4l1.3-2.1c-.3-.3-.3-.8.2-1.1z`})]})}function Ae({className:e=`h-5 w-5`}){return(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,children:(0,b.jsx)(`path`,{d:`M12 2L24 22H0L12 2Z`})})}function je({className:e=`h-5 w-5`}){return(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,children:[(0,b.jsx)(`rect`,{width:`24`,height:`24`,rx:`12`,fill:`#0c111c`,stroke:`#2a3346`,strokeWidth:`1`}),(0,b.jsx)(`circle`,{cx:`12`,cy:`12`,r:`7`,fill:`#2dd4bf`,fillOpacity:`0.2`}),(0,b.jsx)(`path`,{d:`M8.5 7.5c0-.55.45-1 1-1h5c.55 0 1 .45 1 1v2.5h-1.5V8.5h-4v7h4v-1.5H14V12.5h1.5v3c0 .55-.45 1-1 1h-5c-.55 0-1-.45-1-1v-8z`,fill:`#2dd4bf`}),(0,b.jsx)(`circle`,{cx:`10`,cy:`10`,r:`0.8`,fill:`#ffffff`})]})}function Me({providerId:e}){let t=o(),n=r(),l=(0,y.useMemo)(()=>Se(e),[e]),v=(0,y.useMemo)(()=>e.toLowerCase().trim(),[e]),Me=a({queryKey:[`provider-definitions`],queryFn:s.providerDefinitions,retry:!1,staleTime:6e4}),Ne=a({queryKey:[`provider-nodes`],queryFn:s.providerNodes,retry:!1}),x=(0,y.useMemo)(()=>{let e=(Me.data??[]).find(e=>{let t=(e.id||``).toLowerCase().trim(),n=(e.alias||``).toLowerCase().trim();return t===v||n===v});if(e)return e;let t=(Ne.data??[]).find(e=>{let t=(e.id||``).toLowerCase().trim();return t===v||t===`node_${v}`||v===`node_${t}`});return t?{...t,...t.data??{}}:null},[Me.data,Ne.data,v]),Pe=(0,y.useMemo)(()=>{if(l.website)return l.website;if(x?.website)return x.website;let e=x?.baseUrl||``;if(e.startsWith(`http`))try{return new URL(e).origin}catch{return e}return``},[l.website,x]),S=(0,y.useMemo)(()=>l.signupUrl?l.signupUrl:x?.signupUrl?x.signupUrl:x?.quotaUrl?x.quotaUrl:Pe,[l.signupUrl,x,Pe]),[Fe,Ie]=(0,y.useState)(null),[Le,Re]=(0,y.useState)(`auto`),[ze,Be]=(0,y.useState)(!1),[Ve,He]=(0,y.useState)(1),[C,Ue]=(0,y.useState)(new Set),[w,We]=(0,y.useState)(!1),[Ge,Ke]=(0,y.useState)({}),[T,qe]=(0,y.useState)(null),[Je,Ye]=(0,y.useState)({}),Xe=(0,y.useRef)(!1),[Ze,Qe]=(0,y.useState)(``),[$e,E]=(0,y.useState)(``),[et,tt]=(0,y.useState)(null),nt=Ze||l.icon,[D,rt]=(0,y.useState)(new Set),[it,at]=(0,y.useState)(!1),[ot,st]=(0,y.useState)(!1),ct=async()=>{st(!0);try{let r=await s.deleteProvider(e);r&&r.success!==!1?(_.success(`Provider ${l.name} berhasil dihapus`),t.invalidateQueries({queryKey:[`provider-definitions`]}),t.invalidateQueries({queryKey:[`provider-nodes`]}),t.invalidateQueries({queryKey:[`connections`]}),t.invalidateQueries({queryKey:[`providers`]}),n({to:`/providers`})):_.error(`Gagal menghapus provider ${l.name}`)}catch(e){_.error(e?.message||`Gagal menghapus provider ${l.name}`)}finally{st(!1)}};(0,y.useEffect)(()=>{try{let e=localStorage.getItem(`ekarouter.custom_icon.`+v);e&&Qe(e)}catch{}try{let e=localStorage.getItem(`ekarouter.disabled_models.`+v);e&&rt(new Set(JSON.parse(e)))}catch{}try{let e=localStorage.getItem(`ekarouter.custom_models.`+v);e&<(JSON.parse(e))}catch{}},[v]);let[O,lt]=(0,y.useState)([]),[ut,dt]=(0,y.useState)({}),[ft,pt]=(0,y.useState)(null),[mt,ht]=(0,y.useState)(!1),[gt,_t]=(0,y.useState)(null),k=a({queryKey:[`settings`],queryFn:s.settings,retry:!1}).data?.providerStrategies?.[v];(0,y.useEffect)(()=>{k&&(Be(k.roundRobin===!0||k.strategy===`round-robin`),typeof k.stickyLimit==`number`&&k.stickyLimit>=1&&He(k.stickyLimit))},[k]);let A=e=>{if(rt(e),typeof window<`u`)try{localStorage.setItem(`ekarouter.disabled_models.`+v,JSON.stringify([...e]))}catch{}},vt=e=>{let t=new Set(D);t.has(e)?t.delete(e):t.add(e),A(t)},yt=()=>{A(new Set)},bt=()=>{let e=new Set([...l.models.map(e=>e.id),...O.map(e=>e.id)]);A(e)},xt=e=>{let t=e.trim();if(t){if(Qe(t),typeof window<`u`)try{localStorage.setItem(`ekarouter.custom_icon.`+v,t)}catch{}tt(`Saved`),setTimeout(()=>tt(null),2500)}},St=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{let n=e.target?.result;n&&(xt(n),E(`https://cdn.jsdelivr.net/gh/user/repo@main/icons/${t.name}`))},n.readAsDataURL(t)},Ct=()=>{if(Qe(``),E(``),typeof window<`u`)try{localStorage.removeItem(`ekarouter.custom_icon.`+v)}catch{}tt(`Reset`),setTimeout(()=>tt(null),2500)},[wt,j]=(0,y.useState)(!1),[Tt,Et]=(0,y.useState)(!1),[Dt,Ot]=(0,y.useState)(!1),[kt,At]=(0,y.useState)(null),[jt,M]=(0,y.useState)(null),[Mt,Nt]=(0,y.useState)(``),[Pt,Ft]=(0,y.useState)(``),[N,It]=(0,y.useState)(`__none__`),[Lt,Rt]=(0,y.useState)(``),[zt,Bt]=(0,y.useState)(!1),[Vt,Ht]=(0,y.useState)(!0),[Ut,Wt]=(0,y.useState)(``),[P,Gt]=(0,y.useState)(``),[Kt,qt]=(0,y.useState)(``),[F,Jt]=(0,y.useState)(`direct`),[I,Yt]=(0,y.useState)(``),[Xt,Zt]=(0,y.useState)(!1),[Qt,$t]=(0,y.useState)(`single`),[en,tn]=(0,y.useState)(``),[nn,rn]=(0,y.useState)(1),[L,R]=(0,y.useState)({checking:!1}),[z,an]=(0,y.useState)(``),[on,sn]=(0,y.useState)(!1),[cn,ln]=(0,y.useState)(!1),[B,V]=(0,y.useState)({testing:!1}),[un,dn]=(0,y.useState)(!1),[fn,pn]=(0,y.useState)(``),[H,mn]=(0,y.useState)(!1),[hn,U]=(0,y.useState)(null),[W,gn]=(0,y.useState)([]),[_n,vn]=(0,y.useState)(``),[yn,bn]=(0,y.useState)({}),[xn,Sn]=(0,y.useState)(null),[G,Cn]=(0,y.useState)(``),[wn,Tn]=(0,y.useState)(!1),[En,Dn]=(0,y.useState)(!1),[On,kn]=(0,y.useState)(!1),[K,An]=(0,y.useState)(null),[jn,Mn]=(0,y.useState)({}),[Nn,Pn]=(0,y.useState)(null),[Fn,In]=(0,y.useState)(!1),Ln=a({queryKey:[`connections`,`provider-detail`,e],queryFn:()=>s.connections({provider:e,pageSize:500}),retry:!1}),Rn=a({queryKey:[`proxy-pools`],queryFn:s.proxyPools,retry:!1}),q=(0,y.useMemo)(()=>{let e=[{id:`__none__`,name:`Direct`,type:`direct`}];return(Rn.data??[]).forEach(t=>{let n=t.name.toLowerCase(),r=(t.type||``).toLowerCase(),i=t.proxyUrl||t.proxies&&t.proxies[0]||``,a=`custom`;r===`cloudflare`||n.includes(`cloudflare`)||i.includes(`workers.dev`)?a=`cloudflare`:r===`vercel`||n.includes(`vercel`)||i.includes(`vercel.app`)?a=`vercel`:(r===`deno`||n.includes(`deno`)||i.includes(`deno.net`)||i.includes(`deno.dev`))&&(a=`deno`),e.push({id:t.id,name:t.name,type:a,url:i})}),e},[Rn.data]),zn=async(e,t)=>{Pn(e);let n=performance.now();try{if(t&&t!==`__none__`){let r=await s.testProxyPool(t),i=r?.latencyMs??Math.round(performance.now()-n),a=r.ok!==!1&&r.status!==`error`&&r.success!==!1&&!r.error;Mn(t=>({...t,[e]:{latency:i,status:a?`online`:`offline`,error:a?void 0:r.error||`Gagal`}}))}else await new Promise(e=>setTimeout(e,60)),Mn(t=>({...t,[e]:{latency:4,status:`online`}}))}catch(t){let r=Math.round(performance.now()-n);Mn(n=>({...n,[e]:{latency:r,status:`offline`,error:t?.message||`Koneksi gagal`}}))}finally{Pn(null)}},Bn=async()=>{if(!Fn){In(!0);for(let e of q)await zn(e.name,e.id);In(!1)}},Vn=(Ln.data?.connections??[]).filter(t=>{let n=(t.provider||``).toLowerCase(),r=e.toLowerCase(),i=l.alias?l.alias.toLowerCase():``;return n===r||i&&n===i}),[Hn,J]=(0,y.useState)(l.sampleConnections),Y=(0,y.useMemo)(()=>Vn.length>0?Vn.map(e=>{let t=e.providerSpecificData?.proxyPoolId,n=e.providerSpecificData?.connectionProxyUrl,r=t?q.find(e=>e.id===t||e.name===t):null,i=Je[e.id],a=e.lastError||void 0,o=e.testStatus;return i&&(i.state===`success`?(a=void 0,o=`active`):i.state===`failed`&&(a=i.error||e.lastError||`Gagal`,o=`error`)),{id:e.id,name:e.name||e.displayName||`Key`,displayName:e.displayName,authType:`apikey`,isActive:e.isActive??!0,testStatus:o,lastError:a,priority:e.priority||1,poolName:r?r.name:t||void 0,poolUrl:n||r?.url||void 0}}):Hn,[Vn,Hn,q,Je]),Un=e=>{M(e),Nt(e.name||``),Ft(e.displayName||``);let t=e.poolName||e.providerSpecificData?.proxyPoolId,n=t?q.find(e=>e.id===t||e.name===t):null;n?(It(n.id),Rt(e.poolUrl||e.providerSpecificData?.connectionProxyUrl||``)):e.poolUrl||e.providerSpecificData?.connectionProxyUrl?(It(`__custom__`),Rt(e.poolUrl||e.providerSpecificData?.connectionProxyUrl||``)):(It(`__none__`),Rt(``))},Wn=async e=>{if(e.preventDefault(),jt){Bt(!0);try{let e=null,n=``;if(N===`__custom__`)n=Lt.trim();else if(N!==`__none__`&&N!==``){let t=q.find(e=>e.id===N||e.name===N);t&&(e=t.id,n=t.url||``)}await s.updateProvider(jt.id,{name:Mt.trim(),displayName:Pt.trim(),proxyPoolId:e,connectionProxyUrl:n,providerSpecificData:{proxyPoolId:e,connectionProxyUrl:n}}),J(t=>t.map(t=>t.id===jt.id?{...t,name:Mt.trim(),displayName:Pt.trim()||void 0,poolName:e?q.find(t=>t.id===e)?.name||e:void 0,poolUrl:n||void 0}:t)),t.invalidateQueries({queryKey:[`connections`]}),M(null)}catch(e){_.error(`Gagal menyimpan perubahan: ${c(e)}`)}finally{Bt(!1)}}},Gn=Y.length>0&&Y.every(e=>C.has(e.id)),Kn=()=>{Ue(Gn?new Set:new Set(Y.map(e=>e.id)))},qn=e=>{Ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Jn=(e,t)=>{navigator.clipboard.writeText(e),Ie(t),setTimeout(()=>Ie(null),1500)},Yn=async e=>{let n=!e.isActive;J(t=>t.map(t=>t.id===e.id?{...t,isActive:n}:t));try{await s.updateProvider(e.id,{isActive:n}),t.invalidateQueries({queryKey:[`connections`]})}catch(t){J(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),_.error(`Gagal mengubah status: ${c(t)}`)}},Xn=(e,t)=>{let n=t===`up`?e-1:e+1;if(n<0||n>=Y.length)return;let r=[...Y],i=r[e],a=r[n];!i||!a||(r[e]=a,r[n]=i,r.forEach((e,t)=>{e.priority=t+1}),J(r))},Zn=async e=>{J(t=>t.filter(t=>t.id!==e));try{await s.deleteProvider(e),t.invalidateQueries({queryKey:[`connections`]})}catch(e){_.error(`Gagal menghapus koneksi: ${c(e)}`),t.invalidateQueries({queryKey:[`connections`]})}},Qn=async()=>{if(C.size===0)return;let e=Array.from(C);J(e=>e.filter(e=>!C.has(e.id))),Ue(new Set);let n=0;for(let t of e)try{await s.deleteProvider(t)}catch{n++}n>0&&_.error(`Gagal menghapus ${n} koneksi`),t.invalidateQueries({queryKey:[`connections`]})},$n=()=>{$t(`single`),tn(``),rn(Y.length+1),R({checking:!1}),Wt(``),Gt(``),qt(``),Jt(`direct`),Yt(``),j(!0)},er=async()=>{if(w||Y.length===0)return;Xe.current=!1,We(!0);let e={};Y.forEach(t=>{e[t.id]={state:`queued`}}),Ye(e),qe({total:Y.length,completed:0,passed:0,failed:0});let n=0,r=0;try{for(let e=0;e<Y.length;e++){if(Xe.current){qe({total:Y.length,completed:e,passed:n,failed:r,stopped:!0});break}let t=Y[e];if(t){Ye(e=>({...e,[t.id]:{state:`testing`}}));try{let e=await s.testProvider(t.id).catch(()=>null),i=!!(e&&(e.ok===!0||e.success===!0));if(i)n++,J(e=>e.map(e=>e.id===t.id?{...e,lastError:void 0,testStatus:`active`}:e));else{r++;let n=e?.error||e?.message||`Gagal`;J(e=>e.map(e=>e.id===t.id?{...e,lastError:n,testStatus:`error`}:e))}Ye(n=>({...n,[t.id]:{state:i?`success`:`failed`,error:i?void 0:e?.error||e?.message||`Gagal`}})),Ke(n=>({...n,[t.id]:{ok:i,msg:i?`${e?.latencyMs||120}ms`:e?.error||`Error`}}))}catch{r++,J(e=>e.map(e=>e.id===t.id?{...e,lastError:`Gagal`,testStatus:`error`}:e)),Ye(e=>({...e,[t.id]:{state:`failed`,error:`Gagal`}})),Ke(e=>({...e,[t.id]:{ok:!1,msg:`Error`}}))}qe({total:Y.length,completed:e+1,passed:n,failed:r,stopped:!1}),e<Y.length-1&&await new Promise(e=>setTimeout(e,600))}}}finally{We(!1),Xe.current=!1,t.invalidateQueries({queryKey:[`connections`]})}},tr=()=>{w&&(Xe.current=!0)},nr=async()=>{if(!z.trim()||B.testing)return;let t=Y.filter(e=>e.isActive),n=t.length>0?t:Y;if(n.length===0){_.error(`Tambahkan koneksi provider terlebih dahulu`);return}let r=z.trim().replace(/^([a-zA-Z0-9_-]+)\//,``);V({testing:!0});let i=performance.now();try{let t=e||n[0]?.id,a=await s.testProvider(t,r).catch(e=>({ok:!1,error:c(e)||`Koneksi gagal`,latencyMs:Math.round(performance.now()-i)})),o=Math.round(performance.now()-i),l=a&&(a.ok===!0||a.success===!0);V({testing:!1,result:{ok:!!l,latencyMs:a.latencyMs||o,error:l?void 0:a.error||a.message||(a.status?`HTTP ${a.status}`:`Model tidak merespons`)}})}catch(e){V({testing:!1,result:{ok:!1,latencyMs:Math.round(performance.now()-i),error:c(e)||`Koneksi gagal`}})}},rr=e=>{if(e.preventDefault(),!z.trim())return;let t=z.trim().replace(/^([a-zA-Z0-9_-]+)\//,``),n=t.toLowerCase(),r={id:n,name:t.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||t,caps:{vision:on,reasoning:cn}};lt(e=>{let t=[...e.filter(e=>e.id!==n),r];try{localStorage.setItem(`ekarouter.custom_models.`+v,JSON.stringify(t))}catch{}return t}),an(``),sn(!1),ln(!1),V({testing:!1}),Et(!1),_.success(`Model ${n} berhasil ditambahkan`)},ir=async n=>{if(n.preventDefault(),!P.trim()){_.error(`API Key wajib diisi`);return}Zt(!0);let r=Ut.trim()||`Key ${Y.length+1}`,i=`conn-${e}-${Date.now()}`,a=F===`direct`?void 0:F,o=F===`custom`?I.trim():a?`https://${a}.workers.dev`:void 0,l={id:i,name:r,authType:`apikey`,isActive:!0,testStatus:`active`,priority:parseInt(String(nn))||Y.length+1,poolName:a,poolUrl:o};J(e=>[...e,l]);try{await s.createProvider({provider:e,name:r,apiKey:P.trim(),token:P.trim(),projectId:Kt.trim()||void 0,proxyPoolId:a,connectionProxyUrl:o,authType:`apikey`,isActive:!0,priority:parseInt(String(nn))||Y.length+1}),t.invalidateQueries({queryKey:[`connections`]})}catch(e){J(e=>e.filter(e=>e.id!==l.id)),_t(`Gagal menambah koneksi: ${c(e)}`)}finally{Zt(!1),j(!1),Wt(``),Gt(``),qt(``),Yt(``),R({checking:!1})}},ar=async()=>{if(!P.trim()||L.checking)return;R({checking:!0});let t=F===`direct`?void 0:F,n=F===`custom`?I.trim():t?`https://${t}.workers.dev`:void 0;try{let t=await s.validateProvider({provider:e,providerId:e,apiKey:P.trim(),token:P.trim(),connectionProxyUrl:n});if(t&&t.valid)R({checking:!1,ok:!0,latencyMs:t.latencyMs||120}),_.success(`API Key valid & aktif!`);else{let e=t?.message||`Key tidak valid`;R({checking:!1,ok:!1,error:e}),_.error(e)}}catch(e){let t=c(e)||`Gagal verifikasi key`;R({checking:!1,ok:!1,error:t}),_.error(t)}},or=async n=>{if(n.preventDefault(),!en.trim())return;Zt(!0);let r=en.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(Boolean);if(r.length===0){Zt(!1);return}let i=F===`direct`?void 0:F,a=F===`custom`?I.trim():i?`https://${i}.workers.dev`:void 0,o=0,c=0,l=parseInt(String(nn))||Y.length+1;for(let t=0;t<r.length;t++){let n=r[t],ee=`Key ${Y.length+t+1}`,u=n;if(n.includes(`:`)&&!n.startsWith(`http`)){let e=n.split(`:`);e.length>=2&&(ee=e[0].trim(),u=e.slice(1).join(`:`).trim())}else if(n.includes(`,`)&&!n.startsWith(`http`)){let e=n.split(`,`);e.length>=2&&(ee=e[0].trim(),u=e.slice(1).join(`,`).trim())}if(u)try{await s.createProvider({provider:e,name:ee,apiKey:u,token:u,proxyPoolId:i,connectionProxyUrl:a,authType:`apikey`,isActive:!0,priority:l+t}),o++}catch{c++}}t.invalidateQueries({queryKey:[`connections`]}),Zt(!1),j(!1),tn(``),o>0&&_.success(`Berhasil menambahkan ${o} key`),c>0&&_.error(`Gagal menambahkan ${c} key`)},X=()=>{Ot(!1),At(null),M(null)},Z=async e=>{let n=kt?[kt]:C.size>0?Y.filter(e=>C.has(e.id)):Y;if(n.length===0){X();return}if(e===`__rotate__`){let e=q.filter(e=>e.id!==`__none__`&&e.type!==`direct`),t=e.length>0?e:q.filter(e=>e.id!==`__none__`);if(t.length===0){X();return}let r=[...t].sort(()=>Math.random()-.5),i=0;for(let e=0;e<n.length;e++){let t=n[e];if(!t)continue;let a=n.length===1?r[Math.floor(Math.random()*r.length)]:r[e%r.length];if(!a){i++;continue}let o=a.id,c=a.url||`https://${a.name}.workers.dev`;try{await s.updateProvider(t.id,{proxyPoolId:o,connectionProxyUrl:c,providerSpecificData:{proxyPoolId:o,connectionProxyUrl:c}})}catch{i++}}i>0&&_.error(`Gagal menerapkan proxy pada ${i} koneksi`)}else if(e===`__none__`||e===`__unbind__`){let e=0;for(let t of n)try{await s.updateProvider(t.id,{proxyPoolId:null,connectionProxyUrl:``,providerSpecificData:{proxyPoolId:null,connectionProxyUrl:``}})}catch{e++}e>0&&_.error(`Gagal melepas proxy pada ${e} koneksi`)}else{let t=q.find(t=>t.name===e||t.id===e),r=t?t.id===`__none__`?null:t.id:null,i=t?.url||(r?`https://${e}.workers.dev`:``),a=0;for(let e of n)try{await s.updateProvider(e.id,{proxyPoolId:r,connectionProxyUrl:i,providerSpecificData:{proxyPoolId:r,connectionProxyUrl:i}})}catch{a++}a>0&&_.error(`Gagal menerapkan proxy pada ${a} koneksi`)}t.invalidateQueries({queryKey:[`connections`]}),X()},Q=(0,y.useMemo)(()=>[...l.models,...O],[l.models,O]),sr=(0,y.useMemo)(()=>Q.filter(e=>!D.has(e.id)),[Q,D]),cr=(0,y.useMemo)(()=>Q.filter(e=>D.has(e.id)),[Q,D]),lr=async e=>{let t=Y.filter(e=>e.isActive),n=t.length>0?t:Y;if(n.length===0){dt({}),_t(`Belum ada akun. Tambahkan koneksi terlebih dahulu.`),$n();return}pt(e);let r=v===`poolside`?e.trim():e.trim().replace(/^([a-zA-Z0-9_-]+)\//,``),i=performance.now();try{let t=[...n].sort((e,t)=>!!e.lastError?.includes(`not licensed`)-+!!t.lastError?.includes(`not licensed`)),a=null,o=!1,l=0;for(let e of t){let t=performance.now();if(a=await s.testProvider(e.id,r).catch(e=>({ok:!1,error:c(e)||`Koneksi gagal`,latencyMs:Math.round(performance.now()-t)})),l=Math.round(performance.now()-i),o=!!(a&&(a.ok===!0||a.success===!0)),o)break}dt(o?t=>({...t,[e]:{status:`success`,latency:a?.latencyMs||l||80,msg:`Model aktif & terverifikasi`}}):t=>({...t,[e]:{status:`error`,latency:a?.latencyMs||l,msg:a?.error||a?.message||(a?.status?`HTTP ${a.status}`:`Model tidak merespons`)}}))}catch(t){dt(n=>({...n,[e]:{status:`error`,latency:Math.round(performance.now()-i),msg:c(t)||`Koneksi gagal`}}))}pt(null)},ur=async()=>{let e=Y.filter(e=>e.isActive);if((e.length>0?e:Y).length===0){dt({}),_t(`Belum ada akun. Tambahkan koneksi terlebih dahulu.`),$n();return}if(!mt){ht(!0);for(let e of sr)await lr(e.id);ht(!1)}},$=async t=>{mn(!0),U(null),dn(!0);let n=(t===void 0?fn:t).trim();try{let t=await s.discoverProviderModels(e,{customModelsUrl:n||void 0});t&&t.success&&Array.isArray(t.models)?(gn(t.models),t.models.length>0?_.success(`Ditemukan ${t.models.length} model aktif dari upstream`):U(`Endpoint merespons sukses tetapi tidak ada model yang ditemukan dalam daftar.`)):U(`Format respon endpoint tidak dikenali sebagai daftar model OpenAI/Gemini.`)}catch(e){let t=c(e);U(t),_.error(`Gagal mengambil model: ${t}`)}finally{mn(!1)}},dr=async()=>{if(!G.trim()||On)return;kn(!0),An(null);let t=G.trim().replace(/^([a-zA-Z0-9_-]+)\//,``),n=performance.now();try{let r=await s.testProvider(e,t).catch(e=>({ok:!1,error:c(e)||`Koneksi gagal`,latencyMs:Math.round(performance.now()-n)})),i=Math.round(performance.now()-n),a=r&&(r.ok===!0||r.success===!0);An({ok:!!a,latencyMs:r.latencyMs||i,error:a?void 0:r?.error||r?.message||(r?.status?`HTTP ${r.status}`:`Gagal merespons`)})}catch(e){An({ok:!1,latencyMs:Math.round(performance.now()-n),error:c(e)||`Koneksi gagal`})}finally{kn(!1)}},fr=()=>{let e=G.trim();if(!e)return;let t=e.replace(/^([a-zA-Z0-9_-]+)\//,``);if(!Q.some(e=>e.id.toLowerCase()===t.toLowerCase())){let e={id:t,name:t,caps:{vision:wn,reasoning:En}},n=[...O,e];lt(n);try{localStorage.setItem(`ekarouter.custom_models.${v}`,JSON.stringify(n))}catch{}_.success(`Model ${t} berhasil ditambahkan`)}else if(D.has(t)){let e=new Set(D);e.delete(t),A(e),_.success(`Model ${t} diaktifkan kembali`)}else _.info(`Model ${t} sudah ada di daftar`);Cn(``),Tn(!1),Dn(!1),An(null)},pr=async t=>{Sn(t);let n=v===`poolside`?t.trim():t.trim().replace(/^([a-zA-Z0-9_-]+)\//,``),r=performance.now();try{let i=await s.testProvider(e,n).catch(e=>({ok:!1,error:c(e)||`Koneksi gagal`,latencyMs:Math.round(performance.now()-r)})),a=Math.round(performance.now()-r);i&&(i.ok===!0||i.success===!0)?bn(e=>({...e,[t]:{status:`success`,latency:i.latencyMs||a||80,msg:`Aktif & Berhasil`}})):bn(e=>({...e,[t]:{status:`error`,latency:i?.latencyMs||a,msg:i?.error||i?.message||(i?.status?`HTTP ${i.status}`:`Model tidak merespons`)}}))}catch(e){bn(n=>({...n,[t]:{status:`error`,latency:Math.round(performance.now()-r),msg:c(e)||`Gagal`}}))}finally{Sn(null)}},mr=e=>{let t=e.id.trim().replace(/^([a-zA-Z0-9_-]+)\//,``);if(!Q.some(e=>e.id.toLowerCase()===t.toLowerCase())){let n={id:t,name:e.name||t,caps:{vision:e.vision,reasoning:e.reasoning}},r=[...O,n];lt(r);try{localStorage.setItem(`ekarouter.custom_models.${v}`,JSON.stringify(r))}catch{}_.success(`Model ${t} diimpor ke daftar`)}else if(D.has(t)){let e=new Set(D);e.delete(t),A(e),_.success(`Model ${t} diaktifkan kembali`)}else _.info(`Model ${t} sudah aktif di daftar`)};return(0,b.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-5`,children:[(0,b.jsx)(`div`,{children:(0,b.jsxs)(i,{to:`/providers`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,b.jsx)(we,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Back to Providers`})]})}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3.5 py-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3.5`,children:[(0,b.jsx)(`div`,{className:`flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border border-border bg-muted/40 p-1.5 shadow-xs overflow-hidden`,children:(0,b.jsx)(`img`,{src:nt,alt:l.name,className:`h-full w-full object-contain rounded-xl`,onError:e=>{e.currentTarget.src=`/providers/custom.png`}})}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-foreground`,children:l.name}),S?(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline ml-1`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Get API Key`})]}):Pe?(0,b.jsxs)(`a`,{href:Pe,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors ml-1`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Website`})]}):null]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[Y.length,` `,Y.length===1?`connection`:`connections`]})]})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>at(!0),className:`inline-flex items-center gap-1.5 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs font-medium text-destructive transition-all hover:bg-destructive/20 hover:border-destructive cursor-pointer active:scale-95 shrink-0`,title:`Hapus ${l.name}`,children:[(0,b.jsx)(ye,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Hapus Provider`})]})]}),gt&&(0,b.jsxs)(`div`,{className:`rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-xs text-amber-800 dark:text-amber-300 flex items-center justify-between gap-3 shadow-xs animate-in fade-in`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,b.jsx)(d,{className:`h-4 w-4 text-amber-400 shrink-0`}),(0,b.jsx)(`span`,{className:`font-semibold`,children:gt})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{_t(null),$n()},className:`rounded-xl bg-[#f0643b] px-3.5 py-1.5 text-xs font-semibold text-white hover:bg-[#ff744c] transition-colors shrink-0`,children:`Tambah`})]}),l.deprecated&&(0,b.jsxs)(`div`,{className:`rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-xs text-amber-300 flex items-start gap-2.5 shadow-sm`,children:[(0,b.jsx)(d,{className:`h-4 w-4 shrink-0 text-amber-400 mt-0.5`}),(0,b.jsxs)(`div`,{className:`leading-relaxed`,children:[(0,b.jsx)(`span`,{className:`font-semibold text-amber-400`,children:`Peringatan: `}),(0,b.jsx)(`span`,{children:l.deprecationNotice?l.deprecationNotice.replace(/^Risk Notice:\s*/i,``):`Provider deprecated.`})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-5 shadow-xs space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Connections`}),Y.length>0&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:Gn,onChange:Kn,className:`h-3.5 w-3.5 rounded border-border bg-input accent-orange-500 cursor-pointer`}),(0,b.jsx)(`span`,{className:`font-medium`,children:`Select All`})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[C.size>0&&(0,b.jsxs)(`button`,{type:`button`,onClick:Qn,className:`inline-flex items-center gap-1.5 rounded-xl border border-danger/30 bg-danger/10 px-3 py-1.5 text-xs font-medium text-danger hover:bg-danger/20 transition-colors`,children:[(0,b.jsx)(ye,{className:`h-3.5 w-3.5`}),(0,b.jsxs)(`span`,{children:[`Delete (`,C.size,`)`]})]}),Y.length>0&&(0,b.jsxs)(b.Fragment,{children:[(()=>{let e=Y.filter(e=>!!(e.poolName||e.poolUrl||e.providerSpecificData?.connectionProxyUrl)).length;return(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{At(null),Ot(!0)},className:g(`inline-flex items-center gap-2 rounded-xl border border-border/80 bg-muted/50 px-3.5 py-2 text-xs font-semibold transition-all cursor-pointer hover:bg-hover shadow-2xs`,e>0?`border-sky-500/40 bg-sky-500/10 text-sky-600 dark:text-sky-400 hover:bg-sky-500/20 shadow-xs`:`text-foreground`),children:[(0,b.jsx)(p,{className:g(`h-4 w-4`,e>0?`text-sky-500 stroke-[2.2]`:`text-muted-foreground`)}),(0,b.jsx)(`span`,{children:`Apply Proxy`})]})})(),w?(0,b.jsxs)(`button`,{type:`button`,onClick:tr,className:`inline-flex items-center gap-2 rounded-xl border border-rose-500/40 bg-rose-500/10 px-3.5 py-2 text-xs font-semibold text-rose-300 hover:bg-rose-500/20 transition-colors shadow-2xs`,children:[(0,b.jsx)(Te,{className:`h-4 w-4`}),(0,b.jsx)(`span`,{children:`Stop`})]}):(0,b.jsxs)(`button`,{type:`button`,onClick:er,disabled:w,className:`inline-flex items-center gap-2 rounded-xl border border-border/80 bg-muted/50 px-3.5 py-2 text-xs font-semibold text-foreground hover:bg-hover transition-colors shadow-2xs`,children:[(0,b.jsx)(h,{className:`h-4 w-4 text-muted-foreground`}),(0,b.jsx)(`span`,{children:`Test Connection One-by-One`})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:`Round Robin`}),(0,b.jsx)(Ce,{checked:ze,onCheckedChange:Be})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1 text-xs text-foreground`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Sticky:`}),(0,b.jsx)(`input`,{type:`number`,min:1,value:Ve,onChange:e=>He(Math.max(1,parseInt(e.target.value)||1)),className:`w-8 bg-transparent text-center font-semibold text-primary outline-none`})]})]})]}),T&&(0,b.jsxs)(`div`,{className:`rounded-xl border border-sky-500/30 bg-sky-500/10 px-4 py-2.5 text-xs text-sky-700 dark:text-sky-200 dark:bg-sky-950/20 flex items-center justify-between animate-in fade-in`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(h,{className:g(`h-4 w-4 text-sky-400 shrink-0`,w&&`animate-spin`)}),(0,b.jsxs)(`span`,{children:[`Total: `,T.total,` | Selesai: `,T.completed,` | Sukses:`,` `,T.passed,` | Gagal: `,T.failed,T.stopped?` (Berhenti)`:``]})]}),w&&(0,b.jsx)(`button`,{type:`button`,onClick:tr,className:`text-rose-400 hover:underline font-semibold`,children:`Stop`})]}),Y.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,b.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-2xl border border-[#2a2f3e] bg-[#14161b] text-zinc-500 mb-3 shadow-inner`,children:(0,b.jsx)(oe,{className:`h-6 w-6 text-zinc-400`})}),(0,b.jsx)(`p`,{className:`text-sm font-semibold text-zinc-200`,children:`Belum ada data`}),(0,b.jsx)(`div`,{className:`mt-3`,children:(0,b.jsxs)(`button`,{type:`button`,onClick:$n,className:`inline-flex items-center gap-1.5 rounded-xl bg-[#f0643b] px-4 py-2 text-xs font-semibold text-white shadow-sm transition-colors hover:bg-[#ff744c]`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5 stroke-[2.5]`}),(0,b.jsx)(`span`,{children:`Add`})]})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`max-h-[460px] overflow-y-auto pr-2 divide-y divide-border custom-scrollbar`,children:Y.map((e,t)=>{let n=t===0,r=t===Y.length-1,i=C.has(e.id),a=Ge[e.id],o=!!(e.poolName||e.poolUrl||e.providerSpecificData?.connectionProxyUrl);return(0,b.jsxs)(`div`,{className:g(`py-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 transition-colors`,!e.isActive&&`opacity-60`),children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:i,onChange:()=>qn(e.id),className:`h-3.5 w-3.5 rounded border-border bg-input accent-orange-500 mt-1 cursor-pointer`}),(0,b.jsxs)(`div`,{className:`flex flex-col -space-y-1 mt-0.5`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>Xn(t,`up`),className:`p-0.5 text-dim hover:text-foreground disabled:opacity-20 disabled:hover:text-dim`,children:(0,b.jsx)(De,{className:`h-3 w-3`})}),(0,b.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>Xn(t,`down`),className:`p-0.5 text-dim hover:text-foreground disabled:opacity-20 disabled:hover:text-dim`,children:(0,b.jsx)(te,{className:`h-3 w-3`})})]}),(0,b.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:(0,b.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,b.jsx)(`p`,{className:`font-semibold text-xs text-foreground truncate`,children:e.name})}),e.displayName&&e.displayName!==e.name&&(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-medium mt-0.5 uppercase tracking-wide`,children:e.displayName}),(0,b.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[e.isActive?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-emerald-500/15 border border-emerald-500/30 text-emerald-700 dark:bg-emerald-950/60 dark:border-emerald-800/80 dark:text-emerald-400 px-2 py-0.5 text-[10px] font-medium`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.8)]`}),`active`]}):(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-muted border border-border text-muted-foreground px-2 py-0.5 text-[10px] font-medium`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-dim`}),`disabled`]}),(0,b.jsx)(`span`,{className:`rounded-md bg-muted border border-border px-1.5 py-0.5 text-[10px] font-medium text-foreground`,children:`API Key`}),o&&(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-sky-500/15 border border-sky-500/35 text-sky-600 dark:text-sky-400 dark:bg-sky-950/60 px-2 py-0.5 text-[10px] font-semibold shadow-xs`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-sky-500 shadow-[0_0_6px_rgba(14,165,233,0.8)]`}),`Proxy`]}),e.lastError&&Je[e.id]?.state!==`success`&&(0,b.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-mono font-medium text-rose-700 bg-rose-500/10 border border-rose-500/25 dark:text-rose-400 dark:bg-rose-950/40 dark:border-rose-800/60 truncate max-w-[420px] inline-block align-middle`,title:e.lastError,children:e.lastError}),(0,b.jsxs)(`span`,{className:`font-mono text-[10px] text-dim`,children:[`#`,e.priority]}),a&&(a.ok||!Je[e.id])&&(0,b.jsx)(`span`,{className:g(`text-[10px] font-medium`,a.ok?`text-emerald-600 dark:text-emerald-400`:`text-rose-600 dark:text-rose-400`),children:a.msg}),(()=>{let t=Je[e.id];return t?(0,b.jsxs)(`span`,{className:g(`rounded-md px-1.5 py-0.5 text-[10px] font-medium border`,t.state===`queued`&&`bg-muted border-border text-muted-foreground`,t.state===`testing`&&`bg-amber-500/15 border-amber-500/30 text-amber-700 dark:bg-amber-950/60 dark:border-amber-800 dark:text-amber-300 animate-pulse`,t.state===`success`&&`bg-emerald-500/15 border-emerald-500/30 text-emerald-700 dark:bg-emerald-950/60 dark:border-emerald-800 dark:text-emerald-400`,t.state===`failed`&&`bg-rose-500/15 border-rose-500/30 text-rose-700 dark:bg-rose-950/60 dark:border-rose-800 dark:text-rose-400`),children:[t.state===`queued`&&`Antre`,t.state===`testing`&&`Menguji...`,t.state===`success`&&`Sukses`,t.state===`failed`&&(t.error||`Gagal`)]}):null})()]}),o&&(0,b.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-xs flex-wrap`,children:[(0,b.jsxs)(`span`,{className:`text-sky-600 dark:text-sky-400 font-medium text-[11px] flex items-center gap-1`,children:[(0,b.jsx)(p,{className:`h-3 w-3 text-sky-500`}),`Pool: `,e.poolName||`Custom`]}),(e.poolUrl||e.providerSpecificData?.connectionProxyUrl)&&(0,b.jsx)(`code`,{className:`rounded bg-sky-500/10 border border-sky-500/25 px-1.5 py-0.5 font-mono text-[10px] text-sky-700 dark:text-sky-300 truncate max-w-[280px]`,children:e.poolUrl||e.providerSpecificData?.connectionProxyUrl})]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 shrink-0 self-end sm:self-center`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{At(e),Ot(!0)},className:g(`flex flex-col items-center gap-0.5 rounded-lg px-2 py-1 transition-colors cursor-pointer`,o?`text-sky-600 dark:text-sky-400 bg-sky-500/10 hover:bg-sky-500/20 font-semibold`:`text-muted-foreground hover:text-foreground hover:bg-hover`),title:o?`Proxy Aktif (Klik untuk ubah)`:`Atur Proxy`,children:[(0,b.jsx)(p,{className:g(`h-4 w-4`,o?`text-sky-500 stroke-[2.2]`:`text-muted-foreground`)}),(0,b.jsx)(`span`,{className:`text-[10px]`,children:`Proxy`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>Un(e),className:`flex flex-col items-center gap-0.5 rounded px-2 py-1 text-muted-foreground hover:text-foreground hover:bg-hover transition-colors`,title:`Edit`,children:[(0,b.jsx)(he,{className:`h-4 w-4`}),(0,b.jsx)(`span`,{className:`text-[10px]`,children:`Edit`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>Zn(e.id),className:`flex flex-col items-center gap-0.5 rounded px-2 py-1 text-danger/80 hover:text-danger hover:bg-danger/10 transition-colors`,title:`Delete`,children:[(0,b.jsx)(ye,{className:`h-4 w-4`}),(0,b.jsx)(`span`,{className:`text-[10px]`,children:`Delete`})]}),(0,b.jsx)(`div`,{className:`ml-1`,children:(0,b.jsx)(Ce,{checked:e.isActive,onCheckedChange:()=>Yn(e)})})]})]},e.id)})}),(0,b.jsx)(`div`,{className:`pt-3 border-t border-border`,children:(0,b.jsxs)(`button`,{type:`button`,onClick:$n,className:`inline-flex items-center gap-1.5 rounded-xl bg-[#f0643b] px-4 py-2 text-xs font-semibold text-white shadow-sm transition-colors hover:bg-[#ff744c]`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5 stroke-[2.5]`}),(0,b.jsx)(`span`,{children:`Add`})]})})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-5 shadow-xs space-y-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between pb-4 border-b border-border`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:`Available Models`}),(0,b.jsx)(`div`,{className:`w-36`,children:(0,b.jsx)(pe,{compact:!0,value:Le,onChange:e=>Re(e.target.value),options:[{label:`Thinking: Auto`,value:`auto`},{label:`Thinking: Low`,value:`low`},{label:`Thinking: Medium`,value:`medium`},{label:`Thinking: High`,value:`high`},{label:`Thinking: Max`,value:`max`}]})})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{dn(!0),U(null),W.length===0&&$()},disabled:H,className:`inline-flex items-center gap-1.5 rounded-xl border border-sky-500/40 bg-sky-500/10 px-3 py-1.5 text-xs font-medium text-sky-600 dark:text-sky-400 hover:bg-sky-500/20 transition-colors disabled:opacity-50 cursor-pointer`,title:`Discover live models from upstream provider`,children:[(0,b.jsx)(_e,{className:g(`h-3.5 w-3.5 text-sky-500`,H&&`animate-spin`)}),(0,b.jsx)(`span`,{children:H?`Discovering...`:`Live Models`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:ur,disabled:mt,className:`inline-flex items-center gap-1.5 rounded-xl border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 transition-colors disabled:opacity-50`,children:[(0,b.jsx)(xe,{className:g(`h-3.5 w-3.5`,mt&&`animate-spin`)}),(0,b.jsx)(`span`,{children:mt?`Menguji`:`Test All`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:yt,className:`inline-flex items-center gap-1.5 rounded-xl border border-border bg-muted/60 px-3 py-1.5 text-xs font-medium text-foreground hover:bg-hover transition-colors`,children:[(0,b.jsx)(ne,{className:`h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400`}),(0,b.jsx)(`span`,{children:`On All`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:bt,className:`inline-flex items-center gap-1.5 rounded-xl border border-border bg-muted/60 px-3 py-1.5 text-xs font-medium text-foreground hover:bg-hover transition-colors`,children:[(0,b.jsx)(Te,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,b.jsx)(`span`,{children:`Off All`})]})]})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:[sr.map(e=>{let t=`${l.alias}/${e.id}`,n=e.caps,r=Oe(e.id,e.name,n),i=Le&&Le!==`auto`?`${t}(${Le})`:t,a=ut[e.id],o=ft===e.id;return(0,b.jsxs)(`div`,{className:g(`group relative flex items-center justify-between gap-2 rounded-xl border p-3 transition-all`,a&&Y.length>0?a.status===`success`?`border-emerald-500/40 bg-emerald-500/10 dark:bg-emerald-950/10`:`border-rose-500/40 bg-rose-500/10 dark:bg-rose-950/10`:`border-border bg-muted/40 hover:border-border-strong hover:bg-muted/70`),children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[a&&Y.length>0?a.status===`success`?(0,b.jsx)(ne,{className:`h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400`}):(0,b.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-600 dark:text-rose-400`}):(0,b.jsx)(ee,{className:`h-4 w-4 shrink-0 text-muted-foreground group-hover:text-primary transition-colors`}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-foreground`,children:t}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 flex-wrap`,children:[(0,b.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground italic`,children:e.name}),(0,b.jsxs)(`div`,{className:`inline-flex items-center gap-1 shrink-0`,children:[r.isCode&&(0,b.jsx)(ve,{className:`h-3 w-3 text-emerald-500 shrink-0`,title:`Code & Terminal Execution`}),r.isVision&&(0,b.jsx)(ce,{className:`h-3 w-3 text-sky-500 shrink-0`,title:`Vision & Multimodal`}),r.isReasoning&&(0,b.jsx)(Ee,{className:`h-3 w-3 text-amber-500 shrink-0`,title:`Deep Reasoning`}),r.isTextOnly&&(0,b.jsx)(le,{className:`h-3 w-3 text-muted-foreground/60 shrink-0`,title:`Text Only`})]}),a&&Y.length>0&&(0,b.jsxs)(`span`,{className:g(`inline-flex items-center gap-1 rounded px-1.5 py-0.2 text-[9px] font-mono`,a.status===`success`?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border border-emerald-500/30`:`bg-rose-500/15 text-rose-700 dark:text-rose-400 border border-rose-500/30`),title:a.msg,children:[(0,b.jsx)(`span`,{className:g(`h-1 w-1 rounded-full`,a.status===`success`?`bg-emerald-500 dark:bg-emerald-400`:`bg-rose-500 dark:bg-rose-400`)}),a.status===`success`?`${a.latency}ms`:(0,b.jsx)(`span`,{className:`truncate max-w-[96px]`,children:a.msg?.includes(`not licensed`)||a.msg?.includes(`No License`)?`403 No License`:a.msg?.includes(`403`)?`403 Denied`:a.msg?.includes(`401`)?`401 Unauth`:a.msg?.includes(`404`)?`404 Not Found`:a.msg?.includes(`429`)?`429 Rate Limit`:a.msg?.includes(`400`)&&a.msg?.includes(`billing`)?`402 Billing`:a.msg?.includes(`400`)?`400 Error`:a.msg?.includes(`500`)?`500 Server Err`:a.msg?.includes(`timeout`)||a.msg?.includes(`timed out`)?`Timeout`:a.msg?.includes(`ECONNREFUSED`)||a.msg?.includes(`network`)?`No Connection`:a.msg?a.msg.slice(0,14):`Error`})]})]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>lr(e.id),disabled:o,className:`p-1 text-dim hover:text-primary transition-colors`,title:`Test`,children:(0,b.jsx)(xe,{className:g(`h-3.5 w-3.5`,o&&`animate-spin text-primary`)})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>vt(e.id),className:`opacity-0 group-hover:opacity-100 p-1 text-dim hover:text-danger transition-all`,title:`Nonaktif`,children:(0,b.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>Jn(i,e.id),className:`p-1 text-dim hover:text-foreground transition-colors`,title:`Salin`,children:Fe===e.id?(0,b.jsx)(u,{className:`h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400`}):(0,b.jsx)(ie,{className:`h-3.5 w-3.5`})})]})]},e.id)}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>Et(!0),className:`flex min-h-[58px] items-center justify-center gap-1.5 rounded-xl border border-dashed border-orange-500/40 bg-orange-500/5 p-3 text-xs font-medium text-orange-400 hover:border-orange-500 hover:bg-orange-500/10 transition-colors cursor-pointer`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Model`})]})]}),cr.length>0&&(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[#242834] space-y-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,b.jsxs)(`span`,{className:`font-medium text-zinc-400`,children:[`Disabled models (`,cr.length,`):`]}),(0,b.jsx)(`span`,{className:`text-[11px] text-zinc-500`,children:`Click chip to activate`})]}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:cr.map(e=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>vt(e.id),className:`group inline-flex items-center gap-1.5 rounded-lg border border-[#282d3b] bg-[#14161b] px-2.5 py-1 text-xs font-mono text-zinc-400 hover:border-orange-500/60 hover:bg-orange-500/10 hover:text-orange-300 transition-all cursor-pointer`,children:[(0,b.jsx)(m,{className:`h-3 w-3 text-zinc-500 group-hover:text-orange-400`}),(0,b.jsx)(`span`,{children:e.id})]},e.id))})]})]}),(0,b.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-5 shadow-xs space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between pb-3 border-b border-border`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-lg bg-primary/10 border border-primary/30 text-primary`,children:(0,b.jsx)(fe,{className:`h-4 w-4`})}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Icon & CDN`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ze?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/15 border border-emerald-500/30 px-2 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 dark:bg-emerald-400`}),`Custom`]}):(0,b.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-muted border border-border px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:`Default`}),Ze&&(0,b.jsx)(`button`,{type:`button`,onClick:Ct,className:`rounded-lg border border-border bg-muted/60 px-2 py-1 text-[11px] text-foreground hover:bg-hover transition-colors`,children:`Reset`})]})]}),et&&(0,b.jsxs)(`div`,{className:`rounded-xl border border-emerald-500/30 bg-emerald-500/10 px-3 py-1.5 text-xs text-emerald-700 dark:text-emerald-300 flex items-center gap-1.5`,children:[(0,b.jsx)(u,{className:`h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400`}),(0,b.jsx)(`span`,{children:et})]}),(0,b.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center gap-4`,children:[(0,b.jsx)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center rounded-2xl border border-border bg-muted/40 p-1.5 shadow-xs overflow-hidden`,children:(0,b.jsx)(`img`,{src:nt,alt:``,className:`h-full w-full object-contain rounded-xl`,onError:e=>{e.currentTarget.src=`/providers/custom.png`}})}),(0,b.jsxs)(`div`,{className:`flex-1 w-full space-y-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,placeholder:`URL`,value:$e,onChange:e=>E(e.target.value),className:`flex-1 rounded-xl border border-border bg-input px-3 py-1.5 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:outline-none`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>xt($e),className:`rounded-xl bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground hover:bg-primary-light transition-colors shrink-0`,children:`Apply`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 rounded-xl border border-border bg-muted/60 px-3 py-1 text-xs font-medium text-foreground hover:bg-hover cursor-pointer transition-colors`,children:[(0,b.jsx)(re,{className:`h-3.5 w-3.5 text-primary`}),(0,b.jsx)(`span`,{children:`Upload`}),(0,b.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/svg+xml,image/webp,image/x-icon`,className:`hidden`,onChange:St})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>E(`https://cdn.jsdelivr.net/gh/owner/repo@main/providers/${v}.png`),className:`rounded-xl border border-border bg-muted/40 px-2.5 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-hover transition-colors`,children:`jsDelivr`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>E(`https://raw.githubusercontent.com/owner/repo/main/providers/${v}.png`),className:`rounded-xl border border-border bg-muted/40 px-2.5 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-hover transition-colors`,children:`GitHub`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>E(`https://cdn.statically.io/gh/owner/repo/main/providers/${v}.png`),className:`rounded-xl border border-border bg-muted/40 px-2.5 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-hover transition-colors`,children:`Statically`})]})]})]})]}),wt&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm`,onClick:()=>j(!1),children:(0,b.jsxs)(`div`,{className:`w-full max-w-[480px] overflow-hidden rounded-2xl border border-[#2f3545] bg-[#161920] shadow-2xl transition-all`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#252a38] px-5 py-3.5 bg-[#11141a]`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ff5f56]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#27c93f]`})]}),(0,b.jsxs)(`h3`,{className:`text-sm font-bold text-white tracking-tight`,children:[`Tambah API Key `,l.name]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-lg p-1.5 text-zinc-400 hover:bg-[#232836] hover:text-white transition-colors`,children:(0,b.jsx)(be,{className:`h-4 w-4`})})]}),(0,b.jsx)(`div`,{className:`px-5 pt-4`,children:(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-1 rounded-xl border border-[#272d3b] bg-[#11141a] p-1`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>{$t(`single`),R({checking:!1})},className:g(`flex items-center justify-center gap-2 rounded-lg py-1.5 text-xs font-semibold transition-all`,Qt===`single`?`bg-[#222836] text-white border border-[#374055] shadow-sm`:`text-zinc-400 hover:text-white hover:bg-[#1a1e28]`),children:`Single`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{$t(`bulk`),R({checking:!1})},className:g(`flex items-center justify-center gap-2 rounded-lg py-1.5 text-xs font-semibold transition-all`,Qt===`bulk`?`bg-[#222836] text-white border border-[#374055] shadow-sm`:`text-zinc-400 hover:text-white hover:bg-[#1a1e28]`),children:`Bulk Add`})]})}),Qt===`bulk`?(0,b.jsxs)(`form`,{onSubmit:or,className:`p-5 space-y-3.5`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,b.jsx)(`label`,{className:`text-xs font-medium text-zinc-300`,children:`API Keys (one per line, format: KEY or NAME:KEY)`}),S&&(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] font-medium text-orange-400 hover:text-orange-300 hover:underline transition-colors`,children:[(0,b.jsx)(f,{className:`h-3 w-3`}),(0,b.jsx)(`span`,{children:`Dapatkan API Key`})]})]}),(0,b.jsx)(`textarea`,{required:!0,rows:5,placeholder:`sk-ant-...
|
|
3
|
+
sk-ant-...
|
|
4
|
+
Backup:sk-ant-...`,value:en,onChange:e=>tn(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] p-3 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono resize-none leading-relaxed`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Priority (Start)`}),(0,b.jsx)(`input`,{type:`number`,min:`1`,required:!0,value:nn,onChange:e=>rn(parseInt(e.target.value)||1),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Proxy Pool`}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsxs)(`select`,{value:F,onChange:e=>Jt(e.target.value),className:`w-full appearance-none rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white focus:border-orange-500 focus:outline-none pr-8 cursor-pointer`,children:[(0,b.jsx)(`option`,{value:`direct`,children:`None`}),q.filter(e=>e.id!==`__none__`).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.id)),(0,b.jsx)(`option`,{value:`custom`,children:`Custom`})]}),(0,b.jsx)(te,{className:`pointer-events-none absolute right-3 top-2.5 h-3.5 w-3.5 text-zinc-400`})]}),F===`custom`&&(0,b.jsx)(`input`,{type:`text`,placeholder:`Proxy`,value:I,onChange:e=>Yt(e.target.value),className:`mt-2 w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-3 border-t border-[#252a38]`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-xl border border-[#2f3545] bg-[#1c202a] px-4 py-2 text-xs font-medium text-zinc-300 hover:bg-[#242a37] hover:text-white transition-colors`,children:`Cancel`}),(0,b.jsx)(`button`,{type:`submit`,disabled:Xt||!en.trim(),className:`rounded-xl bg-[#f0643b] px-4 py-2 text-xs font-semibold text-white hover:bg-[#ff744c] shadow-sm disabled:opacity-50`,children:Xt?`Saving...`:`Save`})]})]}):(0,b.jsxs)(`form`,{onSubmit:ir,className:`p-5 space-y-3.5`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:[`Name `,(0,b.jsx)(`span`,{className:`text-zinc-500 font-normal`,children:`(Optional)`})]}),(0,b.jsx)(`input`,{type:`text`,placeholder:`Name`,value:Ut,onChange:e=>Wt(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,b.jsx)(`label`,{className:`text-xs font-medium text-zinc-300`,children:`API Key`}),S&&(0,b.jsxs)(`a`,{href:S,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] font-medium text-orange-400 hover:text-orange-300 hover:underline transition-colors`,children:[(0,b.jsx)(f,{className:`h-3 w-3`}),(0,b.jsxs)(`span`,{children:[`Dapatkan API Key `,l.name]})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,b.jsx)(`input`,{type:`text`,required:!0,placeholder:`Key`,value:P,onChange:e=>{Gt(e.target.value),R({checking:!1})},className:`flex-1 rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono`}),(0,b.jsx)(`button`,{type:`button`,onClick:ar,disabled:!P.trim()||L.checking,className:`shrink-0 rounded-xl bg-[#222836] hover:bg-[#2b3345] border border-[#353e54] px-4 py-2 text-xs font-semibold text-white transition-all disabled:opacity-50 flex items-center gap-1.5`,children:L.checking?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h,{className:`h-3.5 w-3.5 animate-spin text-orange-400`}),(0,b.jsx)(`span`,{children:`Checking...`})]}):(0,b.jsx)(`span`,{children:`Check`})})]}),L.ok===!0&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-3 py-1.5 text-[11px] font-medium text-emerald-400`,children:[(0,b.jsx)(ne,{className:`h-3.5 w-3.5 shrink-0`}),(0,b.jsxs)(`span`,{children:[`Valid (`,L.latencyMs||120,`ms)`]})]}),L.ok===!1&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2 rounded-lg border border-rose-500/30 bg-rose-500/10 px-3 py-1.5 text-[11px] text-rose-300`,children:[(0,b.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 mt-0.5 text-rose-400`}),(0,b.jsx)(`span`,{className:`truncate`,children:L.error||`Key tidak valid`})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Priority`}),(0,b.jsx)(`input`,{type:`number`,min:`1`,required:!0,value:nn,onChange:e=>rn(parseInt(e.target.value)||1),className:`w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none font-mono`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1`,children:`Proxy Pool`}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsxs)(`select`,{value:F,onChange:e=>Jt(e.target.value),className:`w-full appearance-none rounded-xl border border-[#2f3545] bg-[#12141a] px-3.5 py-2 text-xs text-white focus:border-orange-500 focus:outline-none pr-8 cursor-pointer`,children:[(0,b.jsx)(`option`,{value:`direct`,children:`None`}),q.filter(e=>e.id!==`__none__`).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.id)),(0,b.jsx)(`option`,{value:`custom`,children:`Custom`})]}),(0,b.jsx)(te,{className:`pointer-events-none absolute right-3 top-2.5 h-3.5 w-3.5 text-zinc-400`})]}),F===`custom`&&(0,b.jsx)(`input`,{type:`text`,placeholder:`Proxy`,value:I,onChange:e=>Yt(e.target.value),className:`mt-2 w-full rounded-xl border border-[#2f3545] bg-[#12141a] px-3 py-2 text-xs text-white placeholder-zinc-500 focus:border-orange-500 focus:outline-none`})]}),(0,b.jsx)(`p`,{className:`text-[11px] text-zinc-400 leading-relaxed pt-1`,children:`Check verifies key against provider before saving. Direct proxy routes without intermediary.`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-3 border-t border-[#252a38]`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-xl border border-[#2f3545] bg-[#1c202a] px-4 py-2 text-xs font-medium text-zinc-300 hover:bg-[#242a37] hover:text-white transition-colors`,children:`Cancel`}),(0,b.jsx)(`button`,{type:`submit`,disabled:Xt,className:`rounded-xl bg-[#f0643b] px-4 py-2 text-xs font-semibold text-white hover:bg-[#ff744c] shadow-sm disabled:opacity-50`,children:Xt?`Saving...`:`Save`})]})]})]})}),Tt&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs`,onClick:()=>{Et(!1),V({testing:!1})},children:(0,b.jsxs)(`div`,{className:`w-full max-w-[460px] overflow-hidden rounded-2xl border border-border bg-card p-6 shadow-2xl space-y-5 text-foreground`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ff5f56]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#27c93f]`})]}),(0,b.jsx)(`h3`,{className:`text-base font-bold text-foreground`,children:`Add Custom Model`})]}),(0,b.jsxs)(`form`,{onSubmit:rr,className:`space-y-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(`label`,{className:`block text-xs font-semibold text-foreground`,children:`Model ID`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,required:!0,placeholder:`Model`,value:z,onChange:e=>{an(e.target.value),V({testing:!1})},className:`flex-1 rounded-xl border border-orange-500/80 bg-background px-3.5 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:border-orange-500 focus:outline-none focus:ring-1 focus:ring-orange-500`}),(0,b.jsxs)(`button`,{type:`button`,onClick:nr,disabled:!z.trim()||B.testing,className:`inline-flex items-center gap-1.5 rounded-xl border border-border bg-muted/60 px-4 py-2 text-xs font-medium text-foreground hover:bg-hover transition-colors disabled:opacity-40 cursor-pointer`,children:[(0,b.jsx)(ue,{className:g(`h-3.5 w-3.5 text-muted-foreground`,B.testing&&`animate-spin text-orange-500`)}),(0,b.jsx)(`span`,{children:B.testing?`Testing`:`Test`})]})]}),(0,b.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Sent to provider as:`,` `,(0,b.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-foreground`,children:z.trim().toLowerCase().replace(/^([a-zA-Z0-9_-]+)\//,``)||`model-id`})]}),B.result&&(0,b.jsxs)(`div`,{className:g(`flex items-center gap-2 rounded-xl border p-2 text-xs transition-all`,B.result.ok?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-400`),children:[B.result.ok?(0,b.jsx)(ne,{className:`h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400`}):(0,b.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-600 dark:text-rose-400`}),(0,b.jsx)(`span`,{className:`truncate`,children:B.result.ok?`Model didukung & aktif (${B.result.latencyMs}ms)`:B.result.error||`Model tidak didukung`})]})]}),(0,b.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,b.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Capabilities`}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(Ce,{checked:on,onCheckedChange:sn}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-xs font-semibold text-foreground`,children:`Vision`}),(0,b.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Supports image input`})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(Ce,{checked:cn,onCheckedChange:ln}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`text-xs font-semibold text-foreground`,children:`Reasoning`}),(0,b.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Supports reasoning / thinking`})]})]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-3 pt-4 border-t border-border`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>{Et(!1),V({testing:!1})},className:`rounded-xl px-4 py-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:`Cancel`}),(0,b.jsx)(`button`,{type:`submit`,disabled:!z.trim(),className:g(`rounded-xl px-6 py-2 text-xs font-semibold transition-colors cursor-pointer`,z.trim()?`bg-[#f0643b] text-white hover:bg-[#ff744c]`:`bg-muted text-muted-foreground/50 cursor-not-allowed`),children:`Add Model`})]})]})]})}),un&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs`,onClick:()=>dn(!1),children:(0,b.jsxs)(`div`,{className:`w-full max-w-2xl overflow-hidden rounded-2xl border border-border bg-card shadow-2xl space-y-4 text-foreground flex flex-col max-h-[85vh]`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-3.5 bg-muted/40 shrink-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ff5f56]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#ffbd2e]`}),(0,b.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-[#27c93f]`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(_e,{className:`h-4 w-4 text-primary`}),(0,b.jsxs)(`h3`,{className:`text-sm font-bold text-foreground`,children:[`Live Model Discovery • `,l.name]})]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>dn(!1),className:`rounded-lg p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer`,children:(0,b.jsx)(be,{className:`h-4 w-4`})})]}),(0,b.jsxs)(`div`,{className:`px-5 space-y-3 shrink-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`relative flex-1`,children:(0,b.jsx)(`input`,{type:`text`,placeholder:`URL`,value:fn,onChange:e=>pn(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),$())},className:`w-full rounded-xl border border-border bg-background px-3.5 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary`})}),(0,b.jsxs)(`button`,{type:`button`,onClick:()=>$(),disabled:H,className:`inline-flex items-center gap-1.5 rounded-xl bg-primary px-4 py-2 text-xs font-semibold text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 cursor-pointer shrink-0`,children:[(0,b.jsx)(h,{className:g(`h-3.5 w-3.5`,H&&`animate-spin`)}),(0,b.jsx)(`span`,{children:H?`Fetching...`:`Fetch`})]})]}),hn&&(0,b.jsxs)(`div`,{className:`rounded-xl border border-rose-500/30 bg-rose-500/10 p-3.5 space-y-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,b.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-500 mt-0.5`}),(0,b.jsxs)(`div`,{className:`space-y-1 flex-1 min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold text-rose-600 dark:text-rose-300`,children:`Gagal Mengambil Model dari Endpoint`}),(0,b.jsx)(`p`,{className:`text-[11px] font-mono text-rose-600/90 dark:text-rose-300/90 break-all leading-tight`,children:hn}),(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground pt-0.5`,children:`Masukkan Custom Models URL resmi atau uji coba model manual langsung di bawah:`})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1 border-t border-rose-500/20`,children:[l.signupUrl&&(0,b.jsxs)(`a`,{href:l.signupUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-hover transition-colors`,children:[(0,b.jsx)(f,{className:`h-3 w-3 text-primary`}),(0,b.jsxs)(`span`,{children:[`Dokumentasi Resmi `,l.name]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{pn(`https://api.openai.com/v1/models`),$(`https://api.openai.com/v1/models`)},className:`rounded-lg border border-border bg-card px-2 py-1 text-[11px] font-mono text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:`/v1/models (OpenAI)`}),v===`mistral`&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{pn(`https://api.mistral.ai/v1/models`),$(`https://api.mistral.ai/v1/models`)},className:`rounded-lg border border-border bg-card px-2 py-1 text-[11px] font-mono text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:`Mistral API`}),v===`openrouter`&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{pn(`https://openrouter.ai/api/v1/models`),$(`https://openrouter.ai/api/v1/models`)},className:`rounded-lg border border-border bg-card px-2 py-1 text-[11px] font-mono text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:`OpenRouter API`})]})]}),(0,b.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 p-3 space-y-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsxs)(`h4`,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5 text-primary`}),(0,b.jsx)(`span`,{children:`Uji & Tambah Model Manual`})]}),(0,b.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Probe langsung ke provider`})]}),(0,b.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`text`,placeholder:`Model`,value:G,onChange:e=>{Cn(e.target.value),An(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),dr())},className:`flex-1 rounded-xl border border-border bg-background px-3 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:dr,disabled:!G.trim()||On,className:`inline-flex items-center gap-1.5 rounded-xl border border-border bg-card px-3 py-1.5 text-xs font-medium text-foreground hover:bg-hover transition-colors disabled:opacity-40 cursor-pointer shrink-0`,children:[(0,b.jsx)(xe,{className:g(`h-3.5 w-3.5 text-amber-500`,On&&`animate-spin`)}),(0,b.jsx)(`span`,{children:On?`Testing...`:`Test`})]}),(0,b.jsxs)(`button`,{type:`button`,onClick:fr,disabled:!G.trim(),className:`inline-flex items-center gap-1.5 rounded-xl bg-primary px-3.5 py-1.5 text-xs font-semibold text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-40 cursor-pointer shrink-0`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Tambah`})]})]})]}),K&&(0,b.jsxs)(`div`,{className:g(`flex items-center gap-2 rounded-xl border p-2 text-xs transition-all`,K.ok?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-400`),children:[K.ok?(0,b.jsx)(ne,{className:`h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400`}):(0,b.jsx)(d,{className:`h-4 w-4 shrink-0 text-rose-600 dark:text-rose-400`}),(0,b.jsx)(`span`,{className:`truncate`,children:K.ok?`Model valid & responsif (${K.latencyMs}ms)`:K.error||`Model tidak merespons`})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,b.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,b.jsx)(ge,{className:`absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground`}),(0,b.jsx)(`input`,{type:`text`,placeholder:`Search`,value:_n,onChange:e=>vn(e.target.value),className:`w-full rounded-xl border border-border bg-background pl-8 pr-3 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[W.length,` models found`]}),W.length>0&&(0,b.jsxs)(`button`,{type:`button`,onClick:()=>{if(W.length===0)return;let e=0,t=[...O];if(W.forEach(n=>{let r=n.id.trim().replace(/^([a-zA-Z0-9_-]+)\//,``);Q.some(e=>e.id.toLowerCase()===r.toLowerCase())||(t.push({id:r,name:n.name||r,caps:{vision:n.vision,reasoning:n.reasoning}}),e++)}),e>0){lt(t);try{localStorage.setItem(`ekarouter.custom_models.${v}`,JSON.stringify(t))}catch{}_.success(`Berhasil mengimpor ${e} model baru`)}else _.info(`Semua model sudah ada di daftar`)},className:`inline-flex items-center gap-1.5 rounded-xl border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 transition-colors cursor-pointer`,children:[(0,b.jsx)(ae,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:`Import All`})]})]})]})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-5 min-h-[160px] max-h-[380px] space-y-2`,children:W.length===0?(0,b.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-center text-muted-foreground`,children:[(0,b.jsx)(ee,{className:`h-8 w-8 mb-2 opacity-30`}),(0,b.jsx)(`p`,{className:`text-xs font-medium`,children:`Belum ada model ditemukan`}),(0,b.jsx)(`p`,{className:`text-[11px] opacity-70 mt-0.5`,children:`Gunakan kolom di atas untuk memasukkan URL atau menambah model secara langsung.`})]}):W.filter(e=>{if(!_n.trim())return!0;let t=_n.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)}).map(e=>{let t=e.id.trim().replace(/^([a-zA-Z0-9_-]+)\//,``),n=Q.some(e=>e.id.toLowerCase()===t.toLowerCase()&&!D.has(e.id)),r=yn[e.id],i=xn===e.id,a=Oe(e.id,e.name,{vision:e.vision,reasoning:e.reasoning});return(0,b.jsxs)(`div`,{className:g(`group flex items-center justify-between gap-3 rounded-xl border p-2.5 transition-all`,r?r.status===`success`?`border-emerald-500/40 bg-emerald-500/10 dark:bg-emerald-950/10`:`border-rose-500/40 bg-rose-500/10 dark:bg-rose-950/10`:`border-border bg-muted/30 hover:border-border-strong hover:bg-muted/60`),children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`font-mono text-xs font-semibold text-foreground truncate`,children:e.id}),(0,b.jsxs)(`div`,{className:`inline-flex items-center gap-1 shrink-0`,children:[a.isCode&&(0,b.jsx)(ve,{className:`h-3 w-3 text-emerald-500 shrink-0`,title:`Code & Terminal Execution`}),a.isVision&&(0,b.jsx)(ce,{className:`h-3 w-3 text-sky-500 shrink-0`,title:`Vision & Multimodal`}),a.isReasoning&&(0,b.jsx)(Ee,{className:`h-3 w-3 text-amber-500 shrink-0`,title:`Deep Reasoning`}),a.isTextOnly&&(0,b.jsx)(le,{className:`h-3 w-3 text-muted-foreground/60 shrink-0`,title:`Text Only`})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,b.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.name}),r&&(0,b.jsxs)(`span`,{className:g(`inline-flex items-center gap-1 rounded px-1.5 py-0.2 text-[9px] font-mono`,r.status===`success`?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border border-emerald-500/30`:`bg-rose-500/15 text-rose-700 dark:text-rose-400 border border-rose-500/30`),title:r.msg,children:[(0,b.jsx)(`span`,{className:g(`h-1 w-1 rounded-full`,r.status===`success`?`bg-emerald-500 dark:bg-emerald-400`:`bg-rose-500 dark:bg-rose-400`)}),r.status===`success`?`${r.latency}ms`:(0,b.jsx)(`span`,{className:`truncate max-w-[100px]`,children:r.msg?.includes(`404`)?`404 Not Found`:`Error`})]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>pr(e.id),disabled:i,className:`inline-flex items-center gap-1 rounded-lg border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground hover:bg-hover transition-colors disabled:opacity-50 cursor-pointer`,title:`Test Model`,children:[(0,b.jsx)(xe,{className:g(`h-3 w-3 text-amber-500`,i&&`animate-spin`)}),(0,b.jsx)(`span`,{children:i?`Testing`:`Test`})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>mr(e),className:g(`inline-flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs font-semibold transition-colors cursor-pointer`,n?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/25`:`bg-primary text-primary-foreground hover:bg-primary/90`),title:n?`Already in catalog`:`Add to Provider Models`,children:n?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:`h-3 w-3`}),(0,b.jsx)(`span`,{children:`Active`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(m,{className:`h-3 w-3`}),(0,b.jsx)(`span`,{children:`Add`})]})})]})]},e.id)})})]})}),Dt&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm`,onClick:X,children:(0,b.jsxs)(`div`,{className:`w-full max-w-xl overflow-hidden rounded-2xl border border-[#2f3545] bg-[#1a1d24] shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#2a2f3e] px-6 py-4 bg-[#14171d]`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,b.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-xl bg-orange-500/10 border border-orange-500/30 text-orange-400`,children:(0,b.jsx)(p,{className:`h-4 w-4`})}),(0,b.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:kt?`Proxy (${kt.name})`:C.size>0?`Proxy (${C.size} Akun)`:`Proxy (${Y.length} Akun)`})]}),(0,b.jsx)(`button`,{type:`button`,onClick:X,className:`rounded-lg p-1 text-zinc-400 hover:bg-[#232734] hover:text-white transition-colors`,children:(0,b.jsx)(be,{className:`h-4 w-4`})})]}),(0,b.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,b.jsxs)(`span`,{className:`text-zinc-400`,children:[q.length,` pool`]}),(0,b.jsxs)(`button`,{type:`button`,onClick:Bn,disabled:Fn,className:`inline-flex items-center gap-1.5 rounded-lg border border-[#2e3444] bg-[#222632] px-3 py-1 font-medium text-zinc-200 hover:bg-[#2a303f] hover:text-white transition-colors disabled:opacity-60`,children:[(0,b.jsx)(xe,{className:g(`h-3.5 w-3.5 text-amber-400`,Fn&&`animate-spin text-orange-400`)}),(0,b.jsx)(`span`,{children:Fn?`Pengujian`:`Test All`})]})]}),(0,b.jsxs)(`div`,{className:`space-y-2 max-h-[360px] overflow-y-auto pr-1`,children:[(0,b.jsxs)(`div`,{className:`group flex items-center justify-between gap-3 rounded-xl border border-orange-500/30 bg-orange-950/10 p-3 hover:border-orange-500/60 hover:bg-orange-950/20 transition-all`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1 cursor-pointer`,onClick:()=>Z(`__rotate__`),children:[(0,b.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-orange-500/40 bg-orange-500/10 text-orange-400 shadow-sm`,children:(0,b.jsx)(h,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`font-semibold text-xs text-white group-hover:text-orange-300 transition-colors`,children:`One-to-one (rotate)`}),(0,b.jsx)(`p`,{className:`text-[11px] text-zinc-400 truncate`,children:`Rotasi otomatis proxy ke tiap akun`})]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>Z(`__rotate__`),className:`rounded-xl bg-[#f0643b] px-3 py-1.5 text-xs font-semibold text-white hover:bg-[#ff744c] transition-colors`,children:`Apply`})]}),(0,b.jsxs)(`div`,{className:`group flex items-center justify-between gap-3 rounded-xl border border-[#2a2f3e] bg-[#14161b] p-3 hover:border-zinc-500 hover:bg-[#161a22] transition-all`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1 cursor-pointer`,onClick:()=>Z(`__unbind__`),children:[(0,b.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-[#2a2f3e] bg-[#1c202a] text-zinc-400 shadow-sm`,children:(0,b.jsx)(Te,{className:`h-4 w-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`font-semibold text-xs text-white group-hover:text-zinc-300 transition-colors`,children:`None (unbind all)`}),(0,b.jsx)(`p`,{className:`text-[11px] text-zinc-400 truncate`,children:`Lepas semua proxy dari akun`})]})]}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>Z(`__unbind__`),className:`rounded-xl border border-[#2f3545] bg-[#1e222b] px-3 py-1.5 text-xs font-semibold text-zinc-300 hover:bg-[#252a36] hover:text-white transition-colors`,children:`Lepas`})]}),q.map(e=>{let t=jn[e.name],n=Nn===e.name;return(0,b.jsxs)(`div`,{className:`group flex items-center justify-between gap-3 rounded-xl border border-[#2a2f3e] bg-[#14161b] p-3 hover:border-orange-500/60 hover:bg-[#161a22] transition-all`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1 cursor-pointer`,onClick:()=>Z(e.name),children:[(0,b.jsxs)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-[#2a2f3e] bg-[#1c202a] shadow-sm`,children:[e.type===`cloudflare`&&(0,b.jsx)(ke,{className:`h-5 w-5`}),e.type===`vercel`&&(0,b.jsx)(Ae,{className:`h-4 w-4 text-white`}),e.type===`deno`&&(0,b.jsx)(je,{className:`h-5 w-5`}),e.type===`direct`&&(0,b.jsx)(de,{className:`h-4 w-4 text-sky-400`}),e.type===`custom`&&(0,b.jsx)(p,{className:`h-4 w-4 text-zinc-400`})]}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`font-semibold text-xs text-white truncate group-hover:text-orange-300 transition-colors`,children:e.name}),(0,b.jsxs)(`p`,{className:`text-[11px] text-zinc-400 truncate`,children:[e.type===`cloudflare`&&`Cloudflare Workers`,e.type===`vercel`&&`Vercel Edge`,e.type===`deno`&&`Deno Deploy`,e.type===`direct`&&`Direct`,e.type===`custom`&&`Proxy Pool`]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[n?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-orange-500/10 border border-orange-500/30 px-2 py-1 text-[10px] text-orange-400 font-mono`,children:[(0,b.jsx)(h,{className:`h-3 w-3 animate-spin`}),(0,b.jsx)(`span`,{children:`ping`})]}):t?(0,b.jsxs)(`span`,{className:g(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-mono font-medium`,t.status===`online`?t.latency<500?`bg-emerald-500/15 border border-emerald-500/30 text-emerald-400`:`bg-amber-500/15 border border-amber-500/30 text-amber-400`:`bg-rose-500/15 border border-rose-500/30 text-rose-400`),title:t.error,children:[(0,b.jsx)(`span`,{className:g(`h-1.5 w-1.5 rounded-full`,t.status===`online`?`bg-emerald-400`:`bg-rose-400`)}),t.status===`online`?`${t.latency}ms`:t.error||`offline`]}):null,(0,b.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),zn(e.name,e.id)},disabled:n,className:`rounded-lg border border-[#2e3444] bg-[#222632] p-1.5 text-zinc-400 hover:text-white hover:bg-[#2a303f] transition-colors`,title:`Ping`,children:(0,b.jsx)(h,{className:g(`h-3.5 w-3.5`,n&&`animate-spin`)})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>Z(e.name),className:`rounded-xl bg-[#f0643b] px-3 py-1.5 text-xs font-semibold text-white hover:bg-[#ff744c] transition-colors`,children:`Apply`})]})]},e.name)})]})]}),(0,b.jsx)(`div`,{className:`flex items-center justify-end border-t border-[#2a2f3e] px-6 py-3 bg-[#14171d]`,children:(0,b.jsx)(`button`,{type:`button`,onClick:X,className:`rounded-xl border border-[#2f3545] bg-[#1e222b] px-4 py-1.5 text-xs font-medium text-zinc-300 hover:bg-[#252a36] hover:text-white`,children:`Tutup`})})]})}),jt&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm`,onClick:()=>M(null),children:(0,b.jsxs)(`div`,{className:`w-full max-w-[440px] overflow-hidden rounded-2xl border border-[#2f3545] bg-[#1a1d24] shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#2a2f3e] px-5 py-3.5 bg-[#14171d]`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Edit`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`rounded-lg p-1 text-zinc-400 hover:bg-[#232734] hover:text-white`,children:(0,b.jsx)(be,{className:`h-4 w-4`})})]}),(0,b.jsxs)(`form`,{onSubmit:Wn,className:`p-5 space-y-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1.5`,children:`Nama`}),(0,b.jsx)(`input`,{type:`text`,placeholder:`Nama`,value:Mt,onChange:e=>Nt(e.target.value),className:`w-full rounded-xl border border-[#2f3545] bg-[#14161b] px-3.5 py-2 text-xs text-white focus:border-orange-500 focus:outline-none`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1.5`,children:`Display`}),(0,b.jsx)(`input`,{type:`text`,value:Pt,onChange:e=>Ft(e.target.value),placeholder:`Display`,className:`w-full rounded-xl border border-[#2f3545] bg-[#14161b] px-3.5 py-2 text-xs text-white placeholder-zinc-600 focus:border-orange-500 focus:outline-none`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1.5`,children:`Proxy`}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsxs)(`select`,{value:N,onChange:e=>It(e.target.value),className:`w-full appearance-none rounded-xl border border-[#2f3545] bg-[#14161b] px-3.5 py-2 pr-9 text-xs text-white focus:border-orange-500 focus:outline-none cursor-pointer`,children:[(0,b.jsx)(`option`,{value:`__none__`,children:`Direct (Tanpa Proxy)`}),q.filter(e=>e.id!==`__none__`).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.type,`)`]},e.id)),(0,b.jsx)(`option`,{value:`__custom__`,children:`Custom URL`})]}),(0,b.jsx)(te,{className:`pointer-events-none absolute right-3 top-2.5 h-4 w-4 text-zinc-400`})]})]}),N===`__custom__`&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`block text-xs font-medium text-zinc-300 mb-1.5`,children:`Custom Proxy URL`}),(0,b.jsx)(`input`,{type:`text`,value:Lt,onChange:e=>Rt(e.target.value),placeholder:`Proxy`,className:`w-full rounded-xl border border-[#2f3545] bg-[#14161b] px-3.5 py-2 text-xs text-white placeholder-zinc-600 focus:border-orange-500 focus:outline-none font-mono`})]}),(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`rounded-xl border border-[#2f3545] bg-[#1e222b] px-4 py-2 text-xs font-medium text-zinc-300 hover:bg-[#252a36] hover:text-white`,children:`Batal`}),(0,b.jsx)(`button`,{type:`submit`,disabled:zt,className:`rounded-xl bg-[#f0643b] px-4 py-2 text-xs font-semibold text-white hover:bg-[#ff744c] disabled:opacity-50`,children:zt?`Menyimpan...`:`Simpan`})]})]})]})}),it&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs p-4 animate-in fade-in`,children:(0,b.jsxs)(`div`,{className:`w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-xl space-y-4 animate-in zoom-in-95`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-destructive/10 text-destructive border border-destructive/20`,children:(0,b.jsx)(ye,{className:`h-5 w-5`})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:`Hapus Provider`}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:[`Apakah Anda yakin ingin menghapus `,(0,b.jsx)(`strong`,{children:l.name}),`?`]})]})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`Tindakan ini akan menghapus provider, semua koneksi akun, serta konfigurasi model terkait secara permanen dari database.`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:ot,onClick:()=>at(!1),className:`rounded-lg border border-border bg-card px-3.5 py-1.5 text-xs font-medium text-foreground hover:bg-hover cursor-pointer`,children:`Batal`}),(0,b.jsxs)(`button`,{type:`button`,disabled:ot,onClick:ct,className:`inline-flex items-center gap-1.5 rounded-lg bg-destructive px-3.5 py-1.5 text-xs font-medium text-destructive-foreground hover:bg-destructive/90 cursor-pointer disabled:opacity-50`,children:[ot?(0,b.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}):(0,b.jsx)(ye,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{children:ot?`Menghapus...`:`Hapus Provider`})]})]})]})})]})}function Ne(){let{id:e}=v.useParams();return(0,b.jsx)(Me,{providerId:e})}export{Ne as component};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_id-BC10EHRw.js","assets/jsx-runtime-B-hcVAMW.js","assets/useNavigate-D06Ztr27.js","assets/preload-helper-CzRBhNKp.js","assets/react-dom-8HkkFvw6.js","assets/useQuery-BrM5_EQu.js","assets/QueryClientProvider-BjElddVn.js","assets/api-lXjeGSiV.js","assets/createLucideIcon-CLdWFMku.js","assets/bot-mZlhzHVu.js","assets/check-36OnHiEM.js","assets/chevron-down-DxUrtHFo.js","assets/triangle-alert-DUFscLic.js","assets/cloud-upload-D41DfGnv.js","assets/copy-B1k2VT2A.js","assets/lock-Chb45-Rn.js","assets/external-link-BYVStqz6.js","assets/eye-off-DIe2-cve.js","assets/eye-Cbs9C6DS.js","assets/file-text-BRzD_S8I.js","assets/flask-conical-CoRklKsr.js","assets/globe-hcLYcRzz.js","assets/image-B10s4838.js","assets/kit-DGWILC5k.js","assets/loader-circle-NEOay2w5.js","assets/refresh-cw-CHzni4H4.js","assets/x-CGuQtexA.js","assets/utils-B6KiDbIe.js","assets/key-BXUPFSjV.js","assets/network-D0tNT-6h.js","assets/pencil-CFgylVBP.js","assets/plus-qKI-KwZh.js","assets/search-BtJsgOj6.js","assets/sparkles-DZ5Pl1vD.js","assets/terminal-BkaGpO2M.js","assets/trash-2-D9HI9O7Q.js","assets/zap-BS7lyU9U.js","assets/dist-yiyhte89.js","assets/providersData-lrEpUDQM.js","assets/OrangeSwitch-Dc_G3ztN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./preload-helper-CzRBhNKp.js";var r=t(`/providers/$id`)({head:({params:e})=>({meta:[{title:`${e.id} — Providers — EkaRouter`},{name:`description`,content:`Provider connection management and available models.`}]}),component:e(()=>n(()=>import(`./_id-BC10EHRw.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),`component`)});export{r as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(){let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_API_BASE_URL:`http://127.0.0.1:20128`,VITE_API_URL:`http://127.0.0.1:20128`,VITE_BACKEND_URL:`http://127.0.0.1:20128`}.VITE_API_BASE_URL||{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_API_BASE_URL:`http://127.0.0.1:20128`,VITE_API_URL:`http://127.0.0.1:20128`,VITE_BACKEND_URL:`http://127.0.0.1:20128`}.VITE_BACKEND_URL||{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`,VITE_API_BASE_URL:`http://127.0.0.1:20128`,VITE_API_URL:`http://127.0.0.1:20128`,VITE_BACKEND_URL:`http://127.0.0.1:20128`}.VITE_API_URL||typeof process<`u`&&({}.VITE_API_BASE_URL||{}.VITE_BACKEND_URL||{}.BACKEND_URL||{}.API_BASE_URL);if(typeof e==`string`&&e.trim().length>0){let t=e.trim();return t===`/`||t===`""`||t===`''`?``:t.replace(/\/+$/,``)}if(typeof window<`u`){let{protocol:e,hostname:t,port:n}=window.location;return n!==`20128`&&(t===`localhost`||t===`127.0.0.1`||t===`::1`)?`${e}//${t}:20128`:``}return``}var t=e(),n=class extends Error{status;constructor(e,t){super(t),this.status=e,this.name=`ApiError`}};async function r(e,r={}){let{timeoutMs:i,signal:a,...o}=r,s=new AbortController,c=!1,l=i===0?0:i??3e4,u;l>0&&(u=setTimeout(()=>{c=!0,s.abort()},l)),a&&(a.aborted?s.abort():a.addEventListener(`abort`,()=>s.abort(),{once:!0}));let d={"Content-Type":`application/json`,...o.headers??{}};if(typeof window<`u`){let e=localStorage.getItem(`auth_token`);e&&!d.Authorization&&(d.Authorization=`Bearer ${e}`)}try{let r=await fetch(`${t}${e}`,{...o,credentials:`include`,headers:d,signal:s.signal});if(!r.ok){let e=r.statusText||`Request failed`;try{let t=await r.json();e=t.error||t.message||e}catch{}throw new n(r.status,e)}return r.status===204?void 0:await r.json()}catch(t){throw c?new n(408,`Waktu permintaan habis (timeout)`):t instanceof n?t:t instanceof DOMException&&t.name===`AbortError`?new n(0,`Permintaan dibatalkan`):(console.error(`[EkaRouter API] Failed ${e}:`,t),new n(0,`Daemon tidak terjangkau`))}finally{u&&clearTimeout(u)}}function i(e){return e instanceof n?e.status===0?e.message:`[${e.status}] ${e.message}`:e instanceof Error?e.message:`Unknown error`}var a=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&r!==`all`&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``},o={health:()=>r(`/api/health`),init:()=>r(`/api/init`),version:()=>r(`/api/version`),setLocale:e=>r(`/api/locale`,{method:`POST`,body:JSON.stringify({locale:e})}),authStatus:()=>r(`/api/auth/status`),login:async e=>{let t=await r(`/api/auth/login`,{method:`POST`,body:JSON.stringify({password:e})});return t.success&&t.token&&typeof window<`u`&&localStorage.setItem(`auth_token`,t.token),t},logout:async()=>(typeof window<`u`&&localStorage.removeItem(`auth_token`),r(`/api/auth/logout`,{method:`POST`})),resetPassword:(e,t)=>r(`/api/auth/reset-password`,{method:`POST`,body:JSON.stringify({currentPassword:e,newPassword:t})}),connections:(e={})=>r(`/api/providers/client${a(e)}`),providers:async()=>{let e=await r(`/api/providers`);return Array.isArray(e)?e:e?.connections??e?.data??[]},providerDefinitions:()=>r(`/api/providers/definitions`),provider:e=>r(`/api/providers/${e}`),createProvider:e=>r(`/api/providers`,{method:`POST`,body:JSON.stringify(e)}),updateProvider:(e,t)=>r(`/api/providers/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteProvider:e=>r(`/api/providers/${e}`,{method:`DELETE`}),validateProvider:e=>r(`/api/providers/validate`,{method:`POST`,body:JSON.stringify(e)}),testProvider:(e,t)=>r(`/api/providers/${e}/test${t?`?model=${encodeURIComponent(t)}`:``}`,{method:`POST`}),providerModels:e=>r(`/api/providers/${e}/models`),testProviderModels:(e,t)=>r(`/api/providers/${e}/test-models`,{method:`POST`,body:JSON.stringify(t)}),discoverProviderModels:(e,t={})=>r(`/api/providers/${e}/discover-models`,{method:`POST`,body:JSON.stringify(t)}),providerNodes:async()=>{let e=await r(`/api/provider-nodes`);return Array.isArray(e)?e:e?.nodes??e?.data??[]},createProviderNode:e=>r(`/api/provider-nodes`,{method:`POST`,body:JSON.stringify(e)}),deleteProviderNode:e=>r(`/api/provider-nodes/${e}`,{method:`DELETE`}),proxyPools:async()=>{let e=await r(`/api/proxy-pools`);return Array.isArray(e)?e:e?.proxyPools??e?.data??[]},createProxyPool:e=>r(`/api/proxy-pools`,{method:`POST`,body:JSON.stringify(e)}),updateProxyPool:(e,t)=>r(`/api/proxy-pools/${e}`,{method:`PUT`,body:JSON.stringify(t)}),testProxyPool:e=>r(`/api/proxy-pools/${e}/test`,{method:`POST`}),deleteProxyPool:e=>r(`/api/proxy-pools/${e}`,{method:`DELETE`}),combos:async()=>{let e=await r(`/api/combos`);return Array.isArray(e)?e:e?.combos??e?.data??[]},createCombo:e=>r(`/api/combos`,{method:`POST`,body:JSON.stringify(e)}),updateCombo:(e,t)=>r(`/api/combos/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteCombo:e=>r(`/api/combos/${e}`,{method:`DELETE`}),keys:async()=>{let e=await r(`/api/keys`);return Array.isArray(e)?e:e?.keys??e?.data??[]},createKey:e=>r(`/api/keys`,{method:`POST`,body:JSON.stringify({name:e})}),updateKey:(e,t)=>r(`/api/keys/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteKey:e=>r(`/api/keys/${e}`,{method:`DELETE`}),models:async()=>{let e=await r(`/api/models`),t=(Array.isArray(e)?e:e?.models??e?.data??[]).map(e=>{let t=e.id||e.model||e.routedModel||e.fullModel||e.name||``;return{...e,id:t,name:e.name||e.model||t}});return{data:t,models:t,aliases:e?.aliases??{}}},connectionQuota:(e,t=!1)=>r(`/api/usage/${e}${t?`?force=1`:``}`),usageStats:e=>r(`/api/usage/stats${a({period:e})}`),usageHistory:async(e,t=50)=>{let n=await r(`/api/usage/history${a({period:e,limit:t})}`),i=Array.isArray(n)?n:n?.logs??n?.data??[];return{logs:i,data:i,total:n?.total??i.length}},settings:()=>r(`/api/settings`),updateSettings:e=>r(`/api/settings`,{method:`PATCH`,body:JSON.stringify(e)}),exportDatabase:()=>r(`/api/settings/database`),importDatabase:e=>r(`/api/settings/database`,{method:`POST`,body:JSON.stringify(e)}),headroomStatus:()=>r(`/api/headroom/status`),headroomStart:()=>r(`/api/headroom/start`,{method:`POST`}),headroomStop:()=>r(`/api/headroom/stop`,{method:`POST`}),shutdown:()=>r(`/api/version/shutdown`,{method:`POST`}),testProxy:e=>r(`/api/settings/proxy-test`,{method:`POST`,body:JSON.stringify(e)}),skills:()=>r(`/api/skills`),cliToolsStatuses:()=>r(`/api/cli-tools/all-statuses`),pxpipeStatus:()=>r(`/api/pxpipe/status`),pxpipeHealth:()=>r(`/api/pxpipe/health`,{method:`POST`}),pxpipeLogs:(e=50)=>r(`/api/pxpipe/logs?limit=${e}`),pxpipeStats:()=>r(`/api/pxpipe/stats`),pxpipeStart:()=>r(`/api/pxpipe/start`,{method:`POST`}),pxpipeStop:()=>r(`/api/pxpipe/stop`,{method:`POST`}),pxpipeRestart:()=>r(`/api/pxpipe/restart`,{method:`POST`}),pxpipeInstall:()=>r(`/api/pxpipe/install`,{method:`POST`}),translatorTranslate:(e,t)=>r(`/api/translator/translate`,{method:`POST`,body:JSON.stringify({body:e,step:t})}),translatorSend:(e,t)=>r(`/api/translator/send`,{method:`POST`,body:JSON.stringify({body:e,model:t})}),translatorLoad:()=>r(`/api/translator/load`),translatorSave:e=>r(`/api/translator/save`,{method:`POST`,body:JSON.stringify(e)}),translatorConsoleLogs:()=>r(`/api/translator/console-logs`),translatorClearConsoleLogs:()=>r(`/api/translator/console-logs`,{method:`DELETE`}),mitmStatus:()=>r(`/api/cli-tools/antigravity-mitm`),mitmSave:e=>r(`/api/cli-tools/antigravity-mitm`,{method:`POST`,body:JSON.stringify(e)}),mitmAliases:e=>r(`/api/cli-tools/antigravity-mitm/alias?tool=${encodeURIComponent(e)}`)};async function s(e,r,i){let a={"Content-Type":`application/json`,Accept:`text/event-stream, application/json`};if(typeof window<`u`){let e=localStorage.getItem(`auth_token`);e&&(a.Authorization=`Bearer ${e}`)}let o=[`${t}/v1/chat/completions`,`${t}/api/chat/completions`,`${t}/api/dashboard/chat/completions`],s=null,c=null;for(let n of o)try{let r=typeof window<`u`&&!!t&&!t.startsWith(window.location.origin),o=await fetch(n,{method:`POST`,credentials:r?`same-origin`:`include`,headers:a,body:JSON.stringify({...e,stream:e.stream??!0}),signal:i??null});if((o.headers.get(`content-type`)||``).toLowerCase().includes(`text/html`))continue;s=o;break}catch(e){if(e?.name===`AbortError`)throw e;c=e}if(!s)throw new n(0,c?.message||`Daemon tidak terjangkau`);if(!s.ok){let e=s.statusText||`Request failed`;try{let t=await s.text();try{let n=JSON.parse(t);typeof n.error==`string`?e=n.error:n.error?.message?e=n.error.message:n.message?e=n.message:t&&(e=t)}catch{t&&(e=t)}}catch{}throw new n(s.status,e)}if((s.headers.get(`content-type`)||``).toLowerCase().includes(`application/json`)){let e=await s.json(),t=e?.choices?.[0]?.message?.content??e?.choices?.[0]?.text??e?.content??``;t&&r(t);return}if(!s.body)throw new n(0,`Response kosong`);let l=s.body.getReader(),u=new TextDecoder(`utf-8`),d=``;for(;;){let{done:e,value:t}=await l.read();if(e)break;d+=u.decode(t,{stream:!0});let i=d.split(`
|
|
2
|
+
`);d=i.pop()??``;for(let e of i){let t=e.trim();if(!t||t.startsWith(`:`)||!t.startsWith(`data:`))continue;let i=t.slice(5).trim();if(i===`[DONE]`)return;try{let e=JSON.parse(i);if(e.error)throw new n(500,(typeof e.error==`string`?e.error:e.error.message)||`Stream error`);let t=e.choices?.[0]?.delta?.content??e.choices?.[0]?.message?.content??e.choices?.[0]?.text??``;t&&r(t)}catch(e){if(e instanceof n)throw e;i&&!i.startsWith(`{`)&&r(i)}}}}function c(){return`${t}/api/usage/stream`}export{c as a,s as i,o as n,i as r,t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]);export{t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/callback-pJodpDyd.js","assets/jsx-runtime-B-hcVAMW.js","assets/check-36OnHiEM.js","assets/createLucideIcon-CLdWFMku.js","assets/triangle-alert-DUFscLic.js","assets/copy-B1k2VT2A.js","assets/refresh-cw-CHzni4H4.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./preload-helper-CzRBhNKp.js";var r=t(`/callback`)({validateSearch:e=>({code:e.code||``,token:e.token||``,state:e.state||``,error:e.error||``,error_description:e.error_description||``}),component:e(()=>n(()=>import(`./callback-pJodpDyd.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-B-hcVAMW.js";import{t as r}from"./check-36OnHiEM.js";import{n as i,t as a}from"./triangle-alert-DUFscLic.js";import{t as o}from"./copy-B1k2VT2A.js";import{t as s}from"./refresh-cw-CHzni4H4.js";import{t as c}from"./callback-D2O49UZw.js";var l=e(t()),u=n();function d(){let e=c.useSearch(),[t,n]=(0,l.useState)(`processing`),[d,f]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let t=e.code||``,r=e.token||``,i=e.state||``,a=e.error||``;if(typeof window<`u`)try{let e=new URLSearchParams(window.location.search);if(t||=e.get(`code`)||``,r||=e.get(`token`)||e.get(`access_token`)||``,i||=e.get(`state`)||``,a||=e.get(`error`)||``,window.location.hash){let e=new URLSearchParams(window.location.hash.replace(/^#\/?\??/,``));t||=e.get(`code`)||``,r||=e.get(`token`)||e.get(`access_token`)||``,i||=e.get(`state`)||``,a||=e.get(`error`)||``}}catch{}let o={type:`oauth_callback`,code:t,token:r,state:i,error:a,ts:Date.now()};if(window.opener){try{window.opener.postMessage(o,`*`)}catch{}try{window.opener.postMessage(o,window.location.origin)}catch{}}if(typeof BroadcastChannel<`u`)try{let e=new BroadcastChannel(`oauth_callback`);e.postMessage(o),e.close()}catch{}if(typeof window<`u`&&(t||r))try{localStorage.setItem(`oauth_callback`,JSON.stringify(o))}catch{}t||r?(n(`success`),setTimeout(()=>{try{window.close()}catch{}},1200)):n(`manual`)},[e]),(0,u.jsx)(`div`,{className:`min-h-[80vh] flex items-center justify-center p-4`,children:(0,u.jsxs)(`div`,{className:`w-full max-w-sm rounded-2xl border border-[#2f3545] bg-[#1a1d24] p-6 text-center shadow-2xl space-y-4`,children:[t===`processing`&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-2xl bg-orange-500/10 border border-orange-500/30 text-orange-400`,children:(0,u.jsx)(s,{className:`h-6 w-6 animate-spin`})}),(0,u.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Memproses Otorisasi`}),(0,u.jsx)(`p`,{className:`text-xs text-zinc-400`,children:`Menghubungkan akun ke sistem...`})]}),t===`success`&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-2xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-400`,children:(0,u.jsx)(i,{className:`h-6 w-6`})}),(0,u.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Otorisasi Berhasil`}),(0,u.jsx)(`p`,{className:`text-xs text-zinc-400`,children:`Jendela ini akan tertutup otomatis...`})]}),t===`manual`&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-2xl bg-amber-500/10 border border-amber-500/30 text-amber-400`,children:(0,u.jsx)(a,{className:`h-6 w-6`})}),(0,u.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Salin URL Callback`}),(0,u.jsx)(`p`,{className:`text-xs text-zinc-400`,children:`Salin URL di bawah lalu tempel pada aplikasi.`}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-[#2f3545] bg-[#14161b] p-2.5 text-left`,children:[(0,u.jsx)(`input`,{readOnly:!0,value:typeof window<`u`?window.location.href:``,className:`flex-1 bg-transparent font-mono text-[11px] text-zinc-300 outline-none truncate`}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(window.location.href),f(!0),setTimeout(()=>f(!1),2e3)},className:`rounded-lg bg-[#232734] p-1.5 text-zinc-300 hover:text-white`,children:d?(0,u.jsx)(r,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,u.jsx)(o,{className:`h-3.5 w-3.5 text-zinc-300`})})]})]})]})})}export{d as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CLdWFMku.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
|