omnigateway 0.1.0 → 0.1.1
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 +8 -8
- package/bin/omni.js +57 -22
- package/gateway.js +39 -5
- package/package.json +2 -2
- package/public/assets/{CopyValue-BwjFnqW2.js → CopyValue-DrPV_Qao.js} +1 -1
- package/public/assets/{Lamp-CSv_5d5k.js → Lamp-WOotyOTd.js} +4 -4
- package/public/assets/{Modal-1tHwlj0o.js → Modal-CXsglS9k.js} +1 -1
- package/public/assets/{Rack-DANVhi_U.js → Rack-Be09hoVn.js} +1 -1
- package/public/assets/{Toggle-pWcL2A-N.js → Toggle-Cd2Jy_Z1.js} +1 -1
- package/public/assets/{_app-C5mYmzgk.js → _app-Bf5ZUmaT.js} +1 -1
- package/public/assets/{_app.accounts-e7Mbaxdc.js → _app.accounts-BmFfVWsr.js} +6 -2
- package/public/assets/_app.index-Ck_5mdeH.js +61 -0
- package/public/assets/{_app.keys-DTREQf0P.js → _app.keys-C2XDmQJL.js} +1 -1
- package/public/assets/{_app.logs-Co3QPpc1.js → _app.logs-C2Xv-Izr.js} +1 -1
- package/public/assets/{_app.models-DPSKIyeq.js → _app.models-DCxR_HKM.js} +1 -1
- package/public/assets/{_app.settings-15ZMiM5O.js → _app.settings-SBc1Uaro.js} +1 -1
- package/public/assets/{_app.usage-BBffCDCD.js → _app.usage-BO3toUhx.js} +1 -1
- package/public/assets/{catalog-DmrbfYQe.js → catalog-B1clfKRA.js} +1 -1
- package/public/assets/{index-DnNTc35a.js → index-JXZlD4dH.js} +2 -2
- package/public/assets/{login-DNvWG7Nv.js → login-CkrCC4MV.js} +1 -1
- package/public/favicon.svg +25 -0
- package/public/index.html +3 -1
- package/public/assets/_app.index-CxunMQ_m.js +0 -57
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Then set up and start:
|
|
|
77
77
|
```bash
|
|
78
78
|
omni db migrate # create the database
|
|
79
79
|
omni admin set-password # prompts; the console signs in with this
|
|
80
|
-
omni start # serves the API and the console on 127.0.0.1:
|
|
80
|
+
omni start # serves the API and the console on 127.0.0.1:9000
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
Connect an account. The CLI prints a URL to open, and waits:
|
|
@@ -103,14 +103,14 @@ omni keys create --label laptop
|
|
|
103
103
|
Now use it:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
curl http://127.0.0.1:
|
|
106
|
+
curl http://127.0.0.1:9000/v1/chat/completions \
|
|
107
107
|
-H 'content-type: application/json' \
|
|
108
108
|
-H 'authorization: Bearer <gateway-key>' \
|
|
109
109
|
-d '{"model": "fast", "messages": [{"role": "user", "content": "Hello"}]}'
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Everything above is also available in the browser at
|
|
113
|
-
`http://127.0.0.1:
|
|
113
|
+
`http://127.0.0.1:9000`, which walks the same steps.
|
|
114
114
|
|
|
115
115
|
## Using it from a client
|
|
116
116
|
|
|
@@ -132,7 +132,7 @@ Ask for one of your virtual models by name. A bare provider model
|
|
|
132
132
|
(`claude-sonnet-5`, `gpt-5`) also works if an account can serve it.
|
|
133
133
|
|
|
134
134
|
Most tools that accept a custom base URL work unchanged: set it to
|
|
135
|
-
`http://127.0.0.1:
|
|
135
|
+
`http://127.0.0.1:9000` and use a gateway key where the provider key goes.
|
|
136
136
|
|
|
137
137
|
## The CLI
|
|
138
138
|
|
|
@@ -186,7 +186,7 @@ Configuration is environment variables, read from the installation's `.env`:
|
|
|
186
186
|
| --- | --- | --- | --- |
|
|
187
187
|
| `OMNI_ENCRYPTION_KEY` | Yes | — | Encrypts provider credentials at rest; 16 characters minimum |
|
|
188
188
|
| `OMNI_HOST` | No | `127.0.0.1` | Listener host |
|
|
189
|
-
| `OMNI_PORT` | No | `
|
|
189
|
+
| `OMNI_PORT` | No | `9000` | Listener port |
|
|
190
190
|
| `OMNI_DB_PATH` | No | `./omnigateway.db` | SQLite database path |
|
|
191
191
|
| `OMNI_BASE_URL` | No | derived from host and port | Public origin for OAuth callbacks; set this behind a reverse proxy |
|
|
192
192
|
| `OMNI_STATIC_DIR` | No | the console shipped with the server | Serve a different console build |
|
|
@@ -203,13 +203,13 @@ client-identity overrides.
|
|
|
203
203
|
```bash
|
|
204
204
|
docker build -t omnigateway .
|
|
205
205
|
docker run --rm \
|
|
206
|
-
-p
|
|
206
|
+
-p 9000:9000 \
|
|
207
207
|
-e OMNI_ENCRYPTION_KEY="$(openssl rand -base64 32)" \
|
|
208
208
|
-v omnigateway-data:/data \
|
|
209
209
|
omnigateway
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
The container listens on `0.0.0.0:
|
|
212
|
+
The container listens on `0.0.0.0:9000` and keeps its database at
|
|
213
213
|
`/data/omnigateway.db`. Note that **the image builds the gateway only**: it
|
|
214
214
|
serves the APIs and returns 404 for the console. Use the CLI or the control API
|
|
215
215
|
against it, or install the npm package if you want the console.
|
|
@@ -258,7 +258,7 @@ cd omnigateway
|
|
|
258
258
|
bun install
|
|
259
259
|
cp .env.example .env # then set OMNI_ENCRYPTION_KEY
|
|
260
260
|
bun run build:dashboard # the gateway serves this build
|
|
261
|
-
bun run dev # gateway on
|
|
261
|
+
bun run dev # gateway on 9000, with file watching
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
Releases are published to npm from a `v*` tag, with provenance attesting which
|
package/bin/omni.js
CHANGED
|
@@ -159,7 +159,7 @@ function loadConfig(env) {
|
|
|
159
159
|
throw new Error(`OMNI_ENCRYPTION_KEY must be set to at least ${MIN_KEY_LENGTH} characters. ` + "Generate one with: openssl rand -base64 32");
|
|
160
160
|
}
|
|
161
161
|
const host = optionalText(env.OMNI_HOST, "127.0.0.1");
|
|
162
|
-
const rawPort = env.OMNI_PORT ?? "
|
|
162
|
+
const rawPort = env.OMNI_PORT ?? "9000";
|
|
163
163
|
const port = Number(rawPort);
|
|
164
164
|
if (!DECIMAL_INTEGER.test(rawPort) || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
165
165
|
throw new Error(`OMNI_PORT must be an integer between 1 and 65535, got "${rawPort}"`);
|
|
@@ -17008,10 +17008,22 @@ function createCredentialRepo(db, key) {
|
|
|
17008
17008
|
limit_value = excluded.limit_value,
|
|
17009
17009
|
resets_at = excluded.resets_at,
|
|
17010
17010
|
observed_at = excluded.observed_at`);
|
|
17011
|
+
const prune = db.prepare("DELETE FROM quota_windows WHERE credential_id = ? AND window_type NOT IN (SELECT value FROM json_each(?))");
|
|
17012
|
+
const kept = new Map;
|
|
17013
|
+
for (const r of rows) {
|
|
17014
|
+
const types2 = kept.get(r.credentialId);
|
|
17015
|
+
if (types2 === undefined)
|
|
17016
|
+
kept.set(r.credentialId, [r.windowType]);
|
|
17017
|
+
else
|
|
17018
|
+
types2.push(r.windowType);
|
|
17019
|
+
}
|
|
17011
17020
|
db.transaction(() => {
|
|
17012
17021
|
for (const r of rows) {
|
|
17013
17022
|
stmt.run(r.credentialId, r.windowType, r.startsAt, r.used, r.limit, r.resetsAt, r.observedAt);
|
|
17014
17023
|
}
|
|
17024
|
+
for (const [credentialId, types2] of kept) {
|
|
17025
|
+
prune.run(credentialId, JSON.stringify(types2));
|
|
17026
|
+
}
|
|
17015
17027
|
})();
|
|
17016
17028
|
}
|
|
17017
17029
|
};
|
|
@@ -17725,14 +17737,34 @@ function toResult3(token, fallbackRefresh, deps, fallbackAccountId = null) {
|
|
|
17725
17737
|
providerData: { accountId: claims.accountId ?? fallbackAccountId }
|
|
17726
17738
|
};
|
|
17727
17739
|
}
|
|
17740
|
+
function windowTypeOf(value, fallback) {
|
|
17741
|
+
const record2 = recordOf(value);
|
|
17742
|
+
if (record2 === null)
|
|
17743
|
+
return fallback;
|
|
17744
|
+
const seconds = numberOf(record2, [
|
|
17745
|
+
"limit_window_seconds",
|
|
17746
|
+
"limitWindowSeconds",
|
|
17747
|
+
"window_seconds",
|
|
17748
|
+
"windowSeconds"
|
|
17749
|
+
]);
|
|
17750
|
+
if (seconds === null || seconds <= 0)
|
|
17751
|
+
return fallback;
|
|
17752
|
+
if (seconds <= 6 * 60 * 60)
|
|
17753
|
+
return "fiveHour";
|
|
17754
|
+
if (seconds <= 36 * 60 * 60)
|
|
17755
|
+
return "daily";
|
|
17756
|
+
return "weekly";
|
|
17757
|
+
}
|
|
17728
17758
|
function parseOpenAIUsage(value, now) {
|
|
17729
17759
|
const root = recordOf(value);
|
|
17730
17760
|
if (root === null)
|
|
17731
17761
|
return null;
|
|
17732
17762
|
const rateLimit = nestedOf(root, ["rate_limit", "rateLimit"]) ?? root;
|
|
17763
|
+
const primary = rateLimit.primary_window ?? rateLimit.primaryWindow;
|
|
17764
|
+
const secondary = rateLimit.secondary_window ?? rateLimit.secondaryWindow;
|
|
17733
17765
|
return reportFrom([
|
|
17734
|
-
windowFrom(
|
|
17735
|
-
windowFrom(
|
|
17766
|
+
windowFrom(primary, windowTypeOf(primary, "fiveHour"), now),
|
|
17767
|
+
windowFrom(secondary, windowTypeOf(secondary, "weekly"), now)
|
|
17736
17768
|
]);
|
|
17737
17769
|
}
|
|
17738
17770
|
var openaiOAuth = {
|
|
@@ -19098,24 +19130,29 @@ var settingsSet = {
|
|
|
19098
19130
|
};
|
|
19099
19131
|
|
|
19100
19132
|
// apps/cli/src/commands/status.ts
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19133
|
+
var WINDOW_ORDER = {
|
|
19134
|
+
fiveHour: 0,
|
|
19135
|
+
daily: 1,
|
|
19136
|
+
weekly: 2
|
|
19137
|
+
};
|
|
19138
|
+
var WINDOW_LABEL = {
|
|
19139
|
+
fiveHour: "5h",
|
|
19140
|
+
daily: "24h",
|
|
19141
|
+
weekly: "7d"
|
|
19142
|
+
};
|
|
19143
|
+
function reportedWindows(windows) {
|
|
19144
|
+
return windows.filter((window) => window.limit !== null && window.limit > 0).sort((a, b) => WINDOW_ORDER[a.windowType] - WINDOW_ORDER[b.windowType]);
|
|
19111
19145
|
}
|
|
19112
|
-
function quotaCell(ctx, windows,
|
|
19113
|
-
const
|
|
19114
|
-
if (
|
|
19146
|
+
function quotaCell(ctx, windows, now) {
|
|
19147
|
+
const reported = reportedWindows(windows);
|
|
19148
|
+
if (reported.length === 0)
|
|
19115
19149
|
return paint(ctx, "dim", "unknown");
|
|
19116
|
-
const
|
|
19117
|
-
|
|
19118
|
-
|
|
19150
|
+
const parts = reported.map((window) => {
|
|
19151
|
+
const used = Math.round(window.used / window.limit * 100);
|
|
19152
|
+
return state(ctx, used < 90, `${WINDOW_LABEL[window.windowType]} ${used}%`);
|
|
19153
|
+
});
|
|
19154
|
+
const observedAt = Math.min(...reported.map((window) => window.observedAt));
|
|
19155
|
+
return `${parts.join(" \xB7 ")} ${paint(ctx, "dim", `(${formatAge(observedAt, now)} ago)`)}`;
|
|
19119
19156
|
}
|
|
19120
19157
|
var status2 = {
|
|
19121
19158
|
usage: "status",
|
|
@@ -19132,7 +19169,6 @@ var status2 = {
|
|
|
19132
19169
|
}
|
|
19133
19170
|
const credentials = store === null ? [] : await store.credentials.list();
|
|
19134
19171
|
const quotaRows = store === null ? [] : await store.credentials.listQuota();
|
|
19135
|
-
const settings = store === null ? null : await store.config.getSettings();
|
|
19136
19172
|
const configured = store === null ? false : await createAdminAuth(store, {
|
|
19137
19173
|
now: ctx.now,
|
|
19138
19174
|
sessionTtlMs: 0
|
|
@@ -19178,12 +19214,11 @@ no credentials; add one with: omni connect <provider>`;
|
|
|
19178
19214
|
}
|
|
19179
19215
|
const rows = credentials.map((credential) => {
|
|
19180
19216
|
const windows = byCredential.get(credential.id) ?? [];
|
|
19181
|
-
const headroom = quotaHeadroom(credential, windows, ctx.now(), settings?.quotaPollIntervalMs ?? 0);
|
|
19182
19217
|
return [
|
|
19183
19218
|
credential.label,
|
|
19184
19219
|
provider(ctx, credential.provider),
|
|
19185
19220
|
state(ctx, credential.enabled, credential.enabled ? "enabled" : "disabled"),
|
|
19186
|
-
quotaCell(ctx, windows,
|
|
19221
|
+
quotaCell(ctx, windows, ctx.now())
|
|
19187
19222
|
];
|
|
19188
19223
|
});
|
|
19189
19224
|
return `${header}
|
package/gateway.js
CHANGED
|
@@ -5307,7 +5307,7 @@ function loadConfig(env) {
|
|
|
5307
5307
|
throw new Error(`OMNI_ENCRYPTION_KEY must be set to at least ${MIN_KEY_LENGTH} characters. ` + "Generate one with: openssl rand -base64 32");
|
|
5308
5308
|
}
|
|
5309
5309
|
const host = optionalText(env.OMNI_HOST, "127.0.0.1");
|
|
5310
|
-
const rawPort = env.OMNI_PORT ?? "
|
|
5310
|
+
const rawPort = env.OMNI_PORT ?? "9000";
|
|
5311
5311
|
const port = Number(rawPort);
|
|
5312
5312
|
if (!DECIMAL_INTEGER.test(rawPort) || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
5313
5313
|
throw new Error(`OMNI_PORT must be an integer between 1 and 65535, got "${rawPort}"`);
|
|
@@ -22384,10 +22384,22 @@ function createCredentialRepo(db, key) {
|
|
|
22384
22384
|
limit_value = excluded.limit_value,
|
|
22385
22385
|
resets_at = excluded.resets_at,
|
|
22386
22386
|
observed_at = excluded.observed_at`);
|
|
22387
|
+
const prune = db.prepare("DELETE FROM quota_windows WHERE credential_id = ? AND window_type NOT IN (SELECT value FROM json_each(?))");
|
|
22388
|
+
const kept = new Map;
|
|
22389
|
+
for (const r of rows) {
|
|
22390
|
+
const types2 = kept.get(r.credentialId);
|
|
22391
|
+
if (types2 === undefined)
|
|
22392
|
+
kept.set(r.credentialId, [r.windowType]);
|
|
22393
|
+
else
|
|
22394
|
+
types2.push(r.windowType);
|
|
22395
|
+
}
|
|
22387
22396
|
db.transaction(() => {
|
|
22388
22397
|
for (const r of rows) {
|
|
22389
22398
|
stmt.run(r.credentialId, r.windowType, r.startsAt, r.used, r.limit, r.resetsAt, r.observedAt);
|
|
22390
22399
|
}
|
|
22400
|
+
for (const [credentialId, types2] of kept) {
|
|
22401
|
+
prune.run(credentialId, JSON.stringify(types2));
|
|
22402
|
+
}
|
|
22391
22403
|
})();
|
|
22392
22404
|
}
|
|
22393
22405
|
};
|
|
@@ -23095,14 +23107,34 @@ function toResult3(token, fallbackRefresh, deps, fallbackAccountId = null) {
|
|
|
23095
23107
|
providerData: { accountId: claims.accountId ?? fallbackAccountId }
|
|
23096
23108
|
};
|
|
23097
23109
|
}
|
|
23110
|
+
function windowTypeOf(value, fallback) {
|
|
23111
|
+
const record2 = recordOf(value);
|
|
23112
|
+
if (record2 === null)
|
|
23113
|
+
return fallback;
|
|
23114
|
+
const seconds = numberOf(record2, [
|
|
23115
|
+
"limit_window_seconds",
|
|
23116
|
+
"limitWindowSeconds",
|
|
23117
|
+
"window_seconds",
|
|
23118
|
+
"windowSeconds"
|
|
23119
|
+
]);
|
|
23120
|
+
if (seconds === null || seconds <= 0)
|
|
23121
|
+
return fallback;
|
|
23122
|
+
if (seconds <= 6 * 60 * 60)
|
|
23123
|
+
return "fiveHour";
|
|
23124
|
+
if (seconds <= 36 * 60 * 60)
|
|
23125
|
+
return "daily";
|
|
23126
|
+
return "weekly";
|
|
23127
|
+
}
|
|
23098
23128
|
function parseOpenAIUsage(value, now) {
|
|
23099
23129
|
const root = recordOf(value);
|
|
23100
23130
|
if (root === null)
|
|
23101
23131
|
return null;
|
|
23102
23132
|
const rateLimit = nestedOf(root, ["rate_limit", "rateLimit"]) ?? root;
|
|
23133
|
+
const primary = rateLimit.primary_window ?? rateLimit.primaryWindow;
|
|
23134
|
+
const secondary = rateLimit.secondary_window ?? rateLimit.secondaryWindow;
|
|
23103
23135
|
return reportFrom([
|
|
23104
|
-
windowFrom(
|
|
23105
|
-
windowFrom(
|
|
23136
|
+
windowFrom(primary, windowTypeOf(primary, "fiveHour"), now),
|
|
23137
|
+
windowFrom(secondary, windowTypeOf(secondary, "weekly"), now)
|
|
23106
23138
|
]);
|
|
23107
23139
|
}
|
|
23108
23140
|
var openaiOAuth = {
|
|
@@ -39211,7 +39243,7 @@ async function startQuotaPoller(deps) {
|
|
|
39211
39243
|
if (quotaPollIntervalMs <= 0)
|
|
39212
39244
|
return () => {};
|
|
39213
39245
|
let running = false;
|
|
39214
|
-
const
|
|
39246
|
+
const pass = () => {
|
|
39215
39247
|
if (running)
|
|
39216
39248
|
return;
|
|
39217
39249
|
running = true;
|
|
@@ -39222,7 +39254,9 @@ async function startQuotaPoller(deps) {
|
|
|
39222
39254
|
}).finally(() => {
|
|
39223
39255
|
running = false;
|
|
39224
39256
|
});
|
|
39225
|
-
}
|
|
39257
|
+
};
|
|
39258
|
+
pass();
|
|
39259
|
+
const timer = setInterval(pass, quotaPollIntervalMs);
|
|
39226
39260
|
timer.unref?.();
|
|
39227
39261
|
return () => clearInterval(timer);
|
|
39228
39262
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnigateway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Self-hosted AI gateway with Anthropic- and OpenAI-compatible APIs, an admin console, and a CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Harismawan <mail@harismawan.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@node-rs/argon2": "2.0.2"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"bun": ">=1.
|
|
22
|
+
"bun": ">=1.3.0"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,Dt as t,I as n,Kt as r,M as i,Ot as a}from"./queries-vY5lJqBe.js";import{m as o}from"./Rack-
|
|
1
|
+
import{B as e,Dt as t,I as n,Kt as r,M as i,Ot as a}from"./queries-vY5lJqBe.js";import{m as o}from"./Rack-Be09hoVn.js";var s=o(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),c=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),l=r(a(),1);function u(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function d(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=u(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var f=t(),p=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: stretch;
|
|
4
4
|
gap: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,Dt as t,z as n}from"./queries-vY5lJqBe.js";function r(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function i(e){return e.status>=400||e.errorCode!==null}function a(e,t){let n=[],a=0,o=0,s=0,c=0,l=0;for(let t of e)i(t)&&(a+=1),t.ttftMs!==null&&Number.isFinite(t.ttftMs)&&n.push(t.ttftMs),o+=t.costUsd,s+=t.inputTokens,c+=t.outputTokens,l+=t.cacheReadTokens;let u=t/6e4;return{requests:e.length,errors:a,errorRate:e.length===0?0:a/e.length,ratePerMin:u<=0?0:e.length/u,ttftP50:r(n,.5),ttftP95:r(n,.95),costUsd:o,inputTokens:s,outputTokens:c,cacheReadTokens:l}}function o(e,t){let{now:n,spanMs:a,count:o}=t,s=a/o,c=n-a,l=Array.from({length:o},(e,t)=>({at:c+t*s,total:0,errors:0,costUsd:0,ttftMs:null})),u=Array.from({length:o},()=>[]);for(let t of e){if(t.at<c||t.at>n)continue;let e=Math.min(o-1,Math.floor((t.at-c)/s)),r=l[e];r!==void 0&&(r.total+=1,r.costUsd+=t.costUsd,i(t)&&(r.errors+=1),t.ttftMs!==null&&Number.isFinite(t.ttftMs)&&u[e]?.push(t.ttftMs))}for(let[e,t]of l.entries())t.ttftMs=r(u[e]??[],.5);return l}var s={ok:`●`,warn:`◐`,down:`○`,idle:`·`},c={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function l(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?c[r]:`disabled`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0}}if(e.length===0)return{state:`idle`,note:`unused`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0};let i=`ok`,a=``,o=null,s=null,l=0;for(let n of e){if(n.ewmaTtftMs!==null&&(o=o===null?n.ewmaTtftMs:Math.max(o,n.ewmaTtftMs)),n.lastUsedAt!==null&&(s=s===null?n.lastUsedAt:Math.max(s,n.lastUsedAt)),l=Math.max(l,n.consecutiveFailures),n.breakerState===`open`){i=`down`,a=`breaker open`;continue}if(n.rateLimitedUntil!==null&&n.rateLimitedUntil>t&&i!==`down`){i=`warn`,a=`rate limited`;continue}n.breakerState===`halfOpen`&&i===`ok`&&(i=`warn`,a=`probing`)}return{state:i,note:a,ttftMs:o,lastUsedAt:s,consecutiveFailures:l}}var u={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function d(e){return Math.max(e,6e4)*3}function f(e,t,n){return e.observedAt<=0||t-e.observedAt>d(n)}function p(e,t,n,r){let i=u[e.windowType];return e.observedAt<=0?`${i} · never observed`:f(e,t,n)?`${i} · stale, read ${r(e.observedAt,t)}`:e.resetsAt===null?i:`${i} · resets ${r(e.resetsAt,t)}`}function
|
|
1
|
+
import{B as e,Dt as t,z as n}from"./queries-vY5lJqBe.js";function r(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function i(e){return e.status>=400||e.errorCode!==null}function a(e,t){let n=[],a=0,o=0,s=0,c=0,l=0;for(let t of e)i(t)&&(a+=1),t.ttftMs!==null&&Number.isFinite(t.ttftMs)&&n.push(t.ttftMs),o+=t.costUsd,s+=t.inputTokens,c+=t.outputTokens,l+=t.cacheReadTokens;let u=t/6e4;return{requests:e.length,errors:a,errorRate:e.length===0?0:a/e.length,ratePerMin:u<=0?0:e.length/u,ttftP50:r(n,.5),ttftP95:r(n,.95),costUsd:o,inputTokens:s,outputTokens:c,cacheReadTokens:l}}function o(e,t){let{now:n,spanMs:a,count:o}=t,s=a/o,c=n-a,l=Array.from({length:o},(e,t)=>({at:c+t*s,total:0,errors:0,costUsd:0,ttftMs:null})),u=Array.from({length:o},()=>[]);for(let t of e){if(t.at<c||t.at>n)continue;let e=Math.min(o-1,Math.floor((t.at-c)/s)),r=l[e];r!==void 0&&(r.total+=1,r.costUsd+=t.costUsd,i(t)&&(r.errors+=1),t.ttftMs!==null&&Number.isFinite(t.ttftMs)&&u[e]?.push(t.ttftMs))}for(let[e,t]of l.entries())t.ttftMs=r(u[e]??[],.5);return l}var s={ok:`●`,warn:`◐`,down:`○`,idle:`·`},c={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function l(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?c[r]:`disabled`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0}}if(e.length===0)return{state:`idle`,note:`unused`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0};let i=`ok`,a=``,o=null,s=null,l=0;for(let n of e){if(n.ewmaTtftMs!==null&&(o=o===null?n.ewmaTtftMs:Math.max(o,n.ewmaTtftMs)),n.lastUsedAt!==null&&(s=s===null?n.lastUsedAt:Math.max(s,n.lastUsedAt)),l=Math.max(l,n.consecutiveFailures),n.breakerState===`open`){i=`down`,a=`breaker open`;continue}if(n.rateLimitedUntil!==null&&n.rateLimitedUntil>t&&i!==`down`){i=`warn`,a=`rate limited`;continue}n.breakerState===`halfOpen`&&i===`ok`&&(i=`warn`,a=`probing`)}return{state:i,note:a,ttftMs:o,lastUsedAt:s,consecutiveFailures:l}}var u={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function d(e){return Math.max(e,6e4)*3}function f(e,t,n){return e.observedAt<=0||t-e.observedAt>d(n)}function p(e,t,n,r){let i=u[e.windowType];return e.observedAt<=0?`${i} · never observed`:f(e,t,n)?`${i} · stale, read ${r(e.observedAt,t)}`:e.resetsAt===null?i:`${i} · resets ${r(e.resetsAt,t)}`}var m={fiveHour:0,daily:1,weekly:2};function h(e){return e.filter(e=>e.limit!==null&&e.limit>0).map(e=>({window:e,fraction:Math.min(1,e.used/e.limit)})).sort((e,t)=>m[e.window.windowType]-m[t.window.windowType])}function g(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return n}var _=t(),v={ok:n`
|
|
2
2
|
color: ${({theme:e})=>e.color.ok};
|
|
3
3
|
`,warn:n`
|
|
4
4
|
color: ${({theme:e})=>e.color.warn};
|
|
@@ -6,10 +6,10 @@ import{B as e,Dt as t,z as n}from"./queries-vY5lJqBe.js";function r(e,t){if(e.le
|
|
|
6
6
|
color: ${({theme:e})=>e.color.down};
|
|
7
7
|
`,idle:n`
|
|
8
8
|
color: ${({theme:e})=>e.color.inkFaint};
|
|
9
|
-
`},
|
|
9
|
+
`},y=e.span`
|
|
10
10
|
font-family: ${({theme:e})=>e.font.mono};
|
|
11
11
|
font-size: 12px;
|
|
12
12
|
line-height: 1;
|
|
13
13
|
flex: none;
|
|
14
|
-
${({$state:e})=>
|
|
15
|
-
`;function
|
|
14
|
+
${({$state:e})=>v[e]}
|
|
15
|
+
`;function b({state:e,label:t,className:n}){return(0,_.jsx)(y,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:s[e]})}export{g as a,h as c,l as i,a as l,u as n,i as o,o as r,p as s,b as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,D as t,Dt as n,I as r,Kt as i,Ot as a,U as o,j as s}from"./queries-vY5lJqBe.js";import{m as c}from"./Rack-DANVhi_U.js";var l=c(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),u=i(a(),1),d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0});function p(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}f(p,`setRef`);function m(...e){return t=>{let n=!1,r=e.map(e=>{let r=p(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():p(e[t],null)}}}}f(m,`composeRefs`);function h(...e){return u.useCallback(m(...e),e)}f(h,`useComposedRefs`);var g=n(),_=i(o(),1),v=Object.defineProperty,y=(e,t)=>v(e,`name`,{value:t,configurable:!0});function b(e){let t=u.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];E(r)&&typeof ie==`function`&&(r=ie(r._payload)),u.Children.forEach(r,e=>{if(ee(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;E(n)&&typeof ie==`function`&&(n=ie(n._payload)),a=C(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=u.cloneElement(a,void 0,s):!o&&u.Children.count(r)===1&&u.isValidElement(r)&&(a=r);let c=a?T(a):void 0,l=h(n,c);if(!a){if(r||r===0)throw Error(o?re(e):ne(e));return r}let d=w(i,a.props??{});return a.type!==u.Fragment&&(d.ref=n?l:c),u.cloneElement(a,d)});return t.displayName=`${e}.Slot`,t}y(b,`createSlot`);var x=Symbol.for(`radix.slottable`);function S(e){let t=y(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=x,t}y(S,`createSlottable`);var C=y((e,t)=>{if(`child`in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function w(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}y(w,`mergeProps`);function T(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}y(T,`getElementRef`);function ee(e){return u.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===x}y(ee,`isSlottable`);var te=Symbol.for(`react.lazy`);function E(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===te&&`_payload`in e&&D(e._payload)}y(E,`isLazyComponent`);function D(e){return typeof e==`object`&&!!e&&`then`in e}y(D,`isPromiseLike`);var ne=y(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),re=y(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),ie=u.use,ae=Object.defineProperty,oe=(e,t)=>ae(e,`name`,{value:t,configurable:!0}),O=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=b(`Primitive.${t}`),r=u.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,g.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function se(e,t){e&&_.flushSync(()=>e.dispatchEvent(t))}oe(se,`dispatchDiscreteCustomEvent`);var ce=Object.defineProperty,k=(e,t)=>ce(e,`name`,{value:t,configurable:!0});function le(e,t){let n=u.createContext(t);n.displayName=e+`Context`;let r=k(e=>{let{children:t,...r}=e,i=u.useMemo(()=>r,Object.values(r));return(0,g.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=u.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return k(i,`useContext`),[r,i]}k(le,`createContext`);function ue(e,t=[]){let n=[];function r(t,r){let i=u.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=k(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=u.useMemo(()=>o,Object.values(o));return(0,g.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,d=u.useContext(l);if(d)return d;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return k(s,`useContext`),[o,s]}k(r,`createContext`);let i=k(()=>{let t=n.map(e=>u.createContext(e));return k(function(n){let r=n?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,de(i,...t)]}k(ue,`createContextScope`);function de(...e){let t=e[0];if(e.length===1)return t;let n=k(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return k(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}k(de,`composeContextScopes`);var fe=Object.defineProperty,A=(e,t)=>fe(e,`name`,{value:t,configurable:!0}),pe=!!(typeof window<`u`&&window.document&&window.document.createElement);function j(e,t,{checkForDefaultPrevented:n=!0}={}){return A(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}A(j,`composeEventHandlers`);function me(e){if(!pe)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}A(me,`getOwnerWindow`);function he(e){if(!pe)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}A(he,`getOwnerDocument`);function ge(e,t=!1){let{activeElement:n}=he(e);if(!n?.nodeName)return null;if(_e(n)&&n.contentDocument)return ge(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=he(n).getElementById(e);if(t)return t}}return n}A(ge,`getActiveElement`);function _e(e){return e.tagName===`IFRAME`}A(_e,`isFrame`);var M=globalThis?.document?u.useLayoutEffect:()=>{},ve=Object.defineProperty,ye=(e,t)=>ve(e,`name`,{value:t,configurable:!0}),be=u.useEffectEvent,xe=u.useInsertionEffect;function Se(e){if(typeof be==`function`)return be(e);let t=u.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof xe==`function`?xe(()=>{t.current=e}):M(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}ye(Se,`useEffectEvent`);var Ce=Object.defineProperty,N=(e,t)=>Ce(e,`name`,{value:t,configurable:!0}),we=u.useInsertionEffect||M;function Te({prop:e,defaultProp:t,onChange:n=N(()=>{},`onChange`),caller:r}){let[i,a,o]=Ee({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,u.useCallback(t=>{if(s){let n=De(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}N(Te,`useControllableState`);function Ee({defaultProp:e,onChange:t}){let[n,r]=u.useState(e),i=u.useRef(n),a=u.useRef(t);return we(()=>{a.current=t},[t]),u.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}N(Ee,`useUncontrolledState`);function De(e){return typeof e==`function`}N(De,`isFunction`);var Oe=Symbol(`RADIX:SYNC_STATE`);function ke(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Se(o),d=[{...n,state:a}];r&&d.push(r);let[f,p]=u.useReducer((t,n)=>{if(n.type===Oe)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...d),m=f.state,h=u.useRef(m);u.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=u.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return u.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:Oe,state:i})},[i,f.state,c]),[g,p]}N(ke,`useControllableStateReducer`);var Ae=Object.defineProperty,P=(e,t)=>Ae(e,`name`,{value:t,configurable:!0});function je(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}P(je,`useStateMachine`);var Me=P(e=>{let{present:t,children:n}=e,r=Ne(t),i=typeof n==`function`?n({present:r.isPresent}):u.Children.only(n),a=Fe(r.ref,Ie(i));return typeof n==`function`||r.isPresent?u.cloneElement(i,{ref:a}):null},`Presence`);function Ne(e){let[t,n]=u.useState(),r=u.useRef(null),i=u.useRef(e),a=u.useRef(`none`),o=u.useRef(void 0),[s,c]=je(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return u.useEffect(()=>{s===`mounted`?(a.current=o.current??F(r.current),o.current=void 0):a.current=`none`},[s]),M(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=F(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),M(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=P(a=>{let o=F(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=P(e=>{e.target===t&&(a.current=F(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:u.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=F(t)}else r.current=null;n(e)},[])}}P(Ne,`usePresence`);function Pe(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}P(Pe,`setRef`);function Fe(...e){let t=u.useRef(e);return t.current=e,u.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Pe(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Pe(n[e],null)}}},[])}P(Fe,`useStableComposedRefs`);function F(e){return e?.animationName||`none`}P(F,`getAnimationName`);function Ie(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}P(Ie,`getElementRef`);var Le=Object.defineProperty,Re=(e,t)=>Le(e,`name`,{value:t,configurable:!0}),ze=u.useId||(()=>void 0),Be=0;function I(e){let[t,n]=u.useState(ze());return M(()=>{e||n(e=>e??String(Be++))},[e]),e||(t?`radix-${t}`:``)}Re(I,`useId`);var Ve=Object.defineProperty,He=(e,t)=>Ve(e,`name`,{value:t,configurable:!0});function L(e){let t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}He(L,`useCallbackRef`);var Ue=Object.defineProperty,R=(e,t)=>Ue(e,`name`,{value:t,configurable:!0}),We=`dismissableLayer.update`,Ge=`dismissableLayer.pointerDownOutside`,Ke=`dismissableLayer.focusOutside`,qe,Je=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ye=u.forwardRef(R(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,d=u.useContext(Je),[f,p]=u.useState(null),m=f?.ownerDocument??globalThis?.document,[,_]=u.useState({}),v=h(t,p),y=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=b?y.indexOf(b):-1,S=f?y.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=u.useRef(!1),ee=Qe(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...d.branches].some(t=>t.contains(e));return w&&!t},[d.branches,w])}),te=$e(e=>{if(r&&T.current)return;let t=e.target;[...d.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),E=f?S===y.length-1:!1,D=L(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return u.useEffect(()=>{if(E)return m.addEventListener(`keydown`,D,{capture:!0}),()=>m.removeEventListener(`keydown`,D,{capture:!0})},[m,E,D]),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(qe=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),et(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=qe))}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),et())},[f,d]),u.useEffect(()=>{let e=R(()=>_({}),`handleUpdate`);return document.addEventListener(We,e),()=>document.removeEventListener(We,e)},[]),(0,g.jsx)(O.div,{...l,ref:v,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:j(e.onFocusCapture,te.onFocusCapture),onBlurCapture:j(e.onBlurCapture,te.onBlurCapture),onPointerDownCapture:j(e.onPointerDownCapture,ee.onPointerDownCapture)})},`DismissableLayer`));function Xe(){let e=u.useContext(Je),[t,n]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}R(Xe,`useDismissableLayerSurface`);var Ze=R(()=>!0,`IS_TRUE`);function Qe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ze}=t,s=L(e),c=u.useRef(!1),l=u.useRef(!1),d=u.useRef(new Map),f=u.useRef(()=>{});return u.useEffect(()=>{function e(){l.current=!1,i.current=!1,d.current.clear()}R(e,`resetOutsideInteraction`);function t(){return Array.from(d.current.values()).some(Boolean)}R(t,`isOutsideInteractionIntercepted`);function u(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||d.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}R(u,`handleInteractionCapture`);function p(e){l.current&&d.current.set(e.type,!1)}R(p,`handleInteractionBubble`);let m=R(a=>{if(a.target&&!c.current){let u=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||tt(Ge,s,p,{discrete:!0})};if(R(u,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,d.current.clear(),!r||a.button!==0?u():(n.removeEventListener(`click`,f.current),f.current=u,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,u,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,u,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:R(()=>c.current=!0,`onPointerDownCapture`)}}R(Qe,`usePointerDownOutside`);function $e(e,t=globalThis?.document){let n=L(e),r=u.useRef(!1);return u.useEffect(()=>{let e=R(e=>{e.target&&!r.current&&tt(Ke,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:R(()=>r.current=!0,`onFocusCapture`),onBlurCapture:R(()=>r.current=!1,`onBlurCapture`)}}R($e,`useFocusOutside`);function et(){let e=new CustomEvent(We);document.dispatchEvent(e)}R(et,`dispatchUpdate`);function tt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?se(i,a):i.dispatchEvent(a)}R(tt,`handleAndDispatchCustomEvent`);var nt=Object.defineProperty,z=(e,t)=>nt(e,`name`,{value:t,configurable:!0}),rt=`focusScope.autoFocusOnMount`,it=`focusScope.autoFocusOnUnmount`,at={bubbles:!1,cancelable:!0},ot=u.forwardRef(z(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=u.useState(null),l=L(i),d=L(a),f=u.useRef(null),p=h(t,c),m=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:B(f.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||B(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&B(s)};z(e,`handleFocusIn`),z(t,`handleFocusOut`),z(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),u.useEffect(()=>{if(s){pt.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(rt,at);s.addEventListener(rt,l),s.dispatchEvent(t),t.defaultPrevented||(st(gt(lt(s)),{select:!0}),document.activeElement===e&&B(s))}return()=>{s.removeEventListener(rt,l),setTimeout(()=>{let t=new CustomEvent(it,at);s.addEventListener(it,d),s.dispatchEvent(t),t.defaultPrevented||B(e??document.body,{select:!0}),s.removeEventListener(it,d),pt.remove(m)},0)}}},[s,l,d,m]);let _=u.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ct(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&B(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&B(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,g.jsx)(O.div,{tabIndex:-1,...o,ref:p,onKeyDown:_})},`FocusScope`));function st(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(B(r,{select:t}),document.activeElement!==n)return}z(st,`focusFirst`);function ct(e){let t=lt(e);return[ut(t,e),ut(t.reverse(),e)]}z(ct,`getTabbableEdges`);function lt(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:z(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}z(lt,`getTabbableCandidates`);function ut(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):dt(r,{upTo:t})))return r}z(ut,`findVisible`);function dt(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}z(dt,`isHidden`);function ft(e){return e instanceof HTMLInputElement&&`select`in e}z(ft,`isSelectableInput`);function B(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ft(e)&&t&&e.select()}}z(B,`focus`);var pt=mt();function mt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ht(e,t),e.unshift(t)},remove(t){e=ht(e,t),e[0]?.resume()}}}z(mt,`createFocusScopesStack`);function ht(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}z(ht,`arrayRemove`);function gt(e){return e.filter(e=>e.tagName!==`A`)}z(gt,`removeLinks`);var _t=Object.defineProperty,vt=u.forwardRef(((e,t)=>_t(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=u.useState(!1);M(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?_.createPortal((0,g.jsx)(O.div,{...r,ref:t}),o):null},`Portal`)),yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0}),V=0,H=null;function xt(e){return St(),e.children}bt(xt,`FocusGuards`);function St(){u.useEffect(()=>{H||={start:Ct(),end:Ct()};let{start:e,end:t}=H;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),V++,()=>{V===1&&(H?.start.remove(),H?.end.remove(),H=null),V=Math.max(0,V-1)}},[])}bt(St,`useFocusGuards`);function Ct(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}bt(Ct,`createFocusGuard`);var U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},U.apply(this,arguments)};function wt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Tt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var W=`right-scroll-bar-position`,G=`width-before-scroll-bar`,Et=`with-scroll-bars-hidden`,Dt=`--removed-body-scroll-bar-size`;function Ot(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function kt(e,t){var n=(0,u.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var At=typeof window<`u`?u.useLayoutEffect:u.useEffect,jt=new WeakMap;function Mt(e,t){var n=kt(t||null,function(t){return e.forEach(function(e){return Ot(e,t)})});return At(function(){var t=jt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ot(e,null)}),i.forEach(function(e){r.has(e)||Ot(e,a)})}jt.set(n,e)},[e]),n}function Nt(e){return e}function Pt(e,t){t===void 0&&(t=Nt);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ft(e){e===void 0&&(e={});var t=Pt(null);return t.options=U({async:!0,ssr:!1},e),t}var It=function(e){var t=e.sideCar,n=wt(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return u.createElement(r,U({},n))};It.isSideCarExport=!0;function Lt(e,t){return e.useMedium(t),It}var Rt=Ft(),zt=function(){},K=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:zt,onWheelCapture:zt,onTouchMoveCapture:zt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=wt(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=Mt([n,t]),w=U(U({},x),i);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:Rt,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?u.cloneElement(u.Children.only(s),U(U({},w),{ref:C})):u.createElement(y,U({},w,{className:c,ref:C}),s))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},K.classNames={fullWidth:G,zeroRight:W};var Bt,Vt=function(){if(Bt)return Bt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ht(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Vt();return t&&e.setAttribute(`nonce`,t),e}function Ut(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Gt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ht())&&(Ut(t,n),Wt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Kt=function(){var e=Gt();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},qt=function(){var e=Kt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Jt={left:0,top:0,right:0,gap:0},Yt=function(e){return parseInt(e||``,10)||0},Xt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Yt(n),Yt(r),Yt(i)]},Zt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Jt;var t=Xt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qt=qt(),q=`data-scroll-locked`,$t=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
1
|
+
import{B as e,D as t,Dt as n,I as r,Kt as i,Ot as a,U as o,j as s}from"./queries-vY5lJqBe.js";import{m as c}from"./Rack-Be09hoVn.js";var l=c(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),u=i(a(),1),d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0});function p(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}f(p,`setRef`);function m(...e){return t=>{let n=!1,r=e.map(e=>{let r=p(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():p(e[t],null)}}}}f(m,`composeRefs`);function h(...e){return u.useCallback(m(...e),e)}f(h,`useComposedRefs`);var g=n(),_=i(o(),1),v=Object.defineProperty,y=(e,t)=>v(e,`name`,{value:t,configurable:!0});function b(e){let t=u.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];E(r)&&typeof ie==`function`&&(r=ie(r._payload)),u.Children.forEach(r,e=>{if(ee(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;E(n)&&typeof ie==`function`&&(n=ie(n._payload)),a=C(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=u.cloneElement(a,void 0,s):!o&&u.Children.count(r)===1&&u.isValidElement(r)&&(a=r);let c=a?T(a):void 0,l=h(n,c);if(!a){if(r||r===0)throw Error(o?re(e):ne(e));return r}let d=w(i,a.props??{});return a.type!==u.Fragment&&(d.ref=n?l:c),u.cloneElement(a,d)});return t.displayName=`${e}.Slot`,t}y(b,`createSlot`);var x=Symbol.for(`radix.slottable`);function S(e){let t=y(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=x,t}y(S,`createSlottable`);var C=y((e,t)=>{if(`child`in e.props){let t=e.props.child;return u.isValidElement(t)?u.cloneElement(t,void 0,e.props.children(t.props.children)):null}return u.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function w(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}y(w,`mergeProps`);function T(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}y(T,`getElementRef`);function ee(e){return u.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===x}y(ee,`isSlottable`);var te=Symbol.for(`react.lazy`);function E(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===te&&`_payload`in e&&D(e._payload)}y(E,`isLazyComponent`);function D(e){return typeof e==`object`&&!!e&&`then`in e}y(D,`isPromiseLike`);var ne=y(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),re=y(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),ie=u.use,ae=Object.defineProperty,oe=(e,t)=>ae(e,`name`,{value:t,configurable:!0}),O=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=b(`Primitive.${t}`),r=u.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,g.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function se(e,t){e&&_.flushSync(()=>e.dispatchEvent(t))}oe(se,`dispatchDiscreteCustomEvent`);var ce=Object.defineProperty,k=(e,t)=>ce(e,`name`,{value:t,configurable:!0});function le(e,t){let n=u.createContext(t);n.displayName=e+`Context`;let r=k(e=>{let{children:t,...r}=e,i=u.useMemo(()=>r,Object.values(r));return(0,g.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=u.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return k(i,`useContext`),[r,i]}k(le,`createContext`);function ue(e,t=[]){let n=[];function r(t,r){let i=u.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=k(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=u.useMemo(()=>o,Object.values(o));return(0,g.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,d=u.useContext(l);if(d)return d;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return k(s,`useContext`),[o,s]}k(r,`createContext`);let i=k(()=>{let t=n.map(e=>u.createContext(e));return k(function(n){let r=n?.[e]||t;return u.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,de(i,...t)]}k(ue,`createContextScope`);function de(...e){let t=e[0];if(e.length===1)return t;let n=k(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return k(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}k(de,`composeContextScopes`);var fe=Object.defineProperty,A=(e,t)=>fe(e,`name`,{value:t,configurable:!0}),pe=!!(typeof window<`u`&&window.document&&window.document.createElement);function j(e,t,{checkForDefaultPrevented:n=!0}={}){return A(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}A(j,`composeEventHandlers`);function me(e){if(!pe)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}A(me,`getOwnerWindow`);function he(e){if(!pe)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}A(he,`getOwnerDocument`);function ge(e,t=!1){let{activeElement:n}=he(e);if(!n?.nodeName)return null;if(_e(n)&&n.contentDocument)return ge(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=he(n).getElementById(e);if(t)return t}}return n}A(ge,`getActiveElement`);function _e(e){return e.tagName===`IFRAME`}A(_e,`isFrame`);var M=globalThis?.document?u.useLayoutEffect:()=>{},ve=Object.defineProperty,ye=(e,t)=>ve(e,`name`,{value:t,configurable:!0}),be=u.useEffectEvent,xe=u.useInsertionEffect;function Se(e){if(typeof be==`function`)return be(e);let t=u.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof xe==`function`?xe(()=>{t.current=e}):M(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}ye(Se,`useEffectEvent`);var Ce=Object.defineProperty,N=(e,t)=>Ce(e,`name`,{value:t,configurable:!0}),we=u.useInsertionEffect||M;function Te({prop:e,defaultProp:t,onChange:n=N(()=>{},`onChange`),caller:r}){let[i,a,o]=Ee({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,u.useCallback(t=>{if(s){let n=De(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}N(Te,`useControllableState`);function Ee({defaultProp:e,onChange:t}){let[n,r]=u.useState(e),i=u.useRef(n),a=u.useRef(t);return we(()=>{a.current=t},[t]),u.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}N(Ee,`useUncontrolledState`);function De(e){return typeof e==`function`}N(De,`isFunction`);var Oe=Symbol(`RADIX:SYNC_STATE`);function ke(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Se(o),d=[{...n,state:a}];r&&d.push(r);let[f,p]=u.useReducer((t,n)=>{if(n.type===Oe)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...d),m=f.state,h=u.useRef(m);u.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=u.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return u.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:Oe,state:i})},[i,f.state,c]),[g,p]}N(ke,`useControllableStateReducer`);var Ae=Object.defineProperty,P=(e,t)=>Ae(e,`name`,{value:t,configurable:!0});function je(e,t){return u.useReducer((e,n)=>t[e][n]??e,e)}P(je,`useStateMachine`);var Me=P(e=>{let{present:t,children:n}=e,r=Ne(t),i=typeof n==`function`?n({present:r.isPresent}):u.Children.only(n),a=Fe(r.ref,Ie(i));return typeof n==`function`||r.isPresent?u.cloneElement(i,{ref:a}):null},`Presence`);function Ne(e){let[t,n]=u.useState(),r=u.useRef(null),i=u.useRef(e),a=u.useRef(`none`),o=u.useRef(void 0),[s,c]=je(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return u.useEffect(()=>{s===`mounted`?(a.current=o.current??F(r.current),o.current=void 0):a.current=`none`},[s]),M(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=F(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),M(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=P(a=>{let o=F(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=P(e=>{e.target===t&&(a.current=F(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:u.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=F(t)}else r.current=null;n(e)},[])}}P(Ne,`usePresence`);function Pe(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}P(Pe,`setRef`);function Fe(...e){let t=u.useRef(e);return t.current=e,u.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Pe(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Pe(n[e],null)}}},[])}P(Fe,`useStableComposedRefs`);function F(e){return e?.animationName||`none`}P(F,`getAnimationName`);function Ie(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}P(Ie,`getElementRef`);var Le=Object.defineProperty,Re=(e,t)=>Le(e,`name`,{value:t,configurable:!0}),ze=u.useId||(()=>void 0),Be=0;function I(e){let[t,n]=u.useState(ze());return M(()=>{e||n(e=>e??String(Be++))},[e]),e||(t?`radix-${t}`:``)}Re(I,`useId`);var Ve=Object.defineProperty,He=(e,t)=>Ve(e,`name`,{value:t,configurable:!0});function L(e){let t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>((...e)=>t.current?.(...e)),[])}He(L,`useCallbackRef`);var Ue=Object.defineProperty,R=(e,t)=>Ue(e,`name`,{value:t,configurable:!0}),We=`dismissableLayer.update`,Ge=`dismissableLayer.pointerDownOutside`,Ke=`dismissableLayer.focusOutside`,qe,Je=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ye=u.forwardRef(R(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,d=u.useContext(Je),[f,p]=u.useState(null),m=f?.ownerDocument??globalThis?.document,[,_]=u.useState({}),v=h(t,p),y=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=b?y.indexOf(b):-1,S=f?y.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=u.useRef(!1),ee=Qe(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...d.branches].some(t=>t.contains(e));return w&&!t},[d.branches,w])}),te=$e(e=>{if(r&&T.current)return;let t=e.target;[...d.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),E=f?S===y.length-1:!1,D=L(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return u.useEffect(()=>{if(E)return m.addEventListener(`keydown`,D,{capture:!0}),()=>m.removeEventListener(`keydown`,D,{capture:!0})},[m,E,D]),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(qe=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),et(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=qe))}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),et())},[f,d]),u.useEffect(()=>{let e=R(()=>_({}),`handleUpdate`);return document.addEventListener(We,e),()=>document.removeEventListener(We,e)},[]),(0,g.jsx)(O.div,{...l,ref:v,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:j(e.onFocusCapture,te.onFocusCapture),onBlurCapture:j(e.onBlurCapture,te.onBlurCapture),onPointerDownCapture:j(e.onPointerDownCapture,ee.onPointerDownCapture)})},`DismissableLayer`));function Xe(){let e=u.useContext(Je),[t,n]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}R(Xe,`useDismissableLayerSurface`);var Ze=R(()=>!0,`IS_TRUE`);function Qe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ze}=t,s=L(e),c=u.useRef(!1),l=u.useRef(!1),d=u.useRef(new Map),f=u.useRef(()=>{});return u.useEffect(()=>{function e(){l.current=!1,i.current=!1,d.current.clear()}R(e,`resetOutsideInteraction`);function t(){return Array.from(d.current.values()).some(Boolean)}R(t,`isOutsideInteractionIntercepted`);function u(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||d.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}R(u,`handleInteractionCapture`);function p(e){l.current&&d.current.set(e.type,!1)}R(p,`handleInteractionBubble`);let m=R(a=>{if(a.target&&!c.current){let u=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||tt(Ge,s,p,{discrete:!0})};if(R(u,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,d.current.clear(),!r||a.button!==0?u():(n.removeEventListener(`click`,f.current),f.current=u,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,u,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,u,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:R(()=>c.current=!0,`onPointerDownCapture`)}}R(Qe,`usePointerDownOutside`);function $e(e,t=globalThis?.document){let n=L(e),r=u.useRef(!1);return u.useEffect(()=>{let e=R(e=>{e.target&&!r.current&&tt(Ke,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:R(()=>r.current=!0,`onFocusCapture`),onBlurCapture:R(()=>r.current=!1,`onBlurCapture`)}}R($e,`useFocusOutside`);function et(){let e=new CustomEvent(We);document.dispatchEvent(e)}R(et,`dispatchUpdate`);function tt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?se(i,a):i.dispatchEvent(a)}R(tt,`handleAndDispatchCustomEvent`);var nt=Object.defineProperty,z=(e,t)=>nt(e,`name`,{value:t,configurable:!0}),rt=`focusScope.autoFocusOnMount`,it=`focusScope.autoFocusOnUnmount`,at={bubbles:!1,cancelable:!0},ot=u.forwardRef(z(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=u.useState(null),l=L(i),d=L(a),f=u.useRef(null),p=h(t,c),m=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?f.current=t:B(f.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||B(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&B(s)};z(e,`handleFocusIn`),z(t,`handleFocusOut`),z(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),u.useEffect(()=>{if(s){pt.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(rt,at);s.addEventListener(rt,l),s.dispatchEvent(t),t.defaultPrevented||(st(gt(lt(s)),{select:!0}),document.activeElement===e&&B(s))}return()=>{s.removeEventListener(rt,l),setTimeout(()=>{let t=new CustomEvent(it,at);s.addEventListener(it,d),s.dispatchEvent(t),t.defaultPrevented||B(e??document.body,{select:!0}),s.removeEventListener(it,d),pt.remove(m)},0)}}},[s,l,d,m]);let _=u.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ct(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&B(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&B(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,g.jsx)(O.div,{tabIndex:-1,...o,ref:p,onKeyDown:_})},`FocusScope`));function st(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(B(r,{select:t}),document.activeElement!==n)return}z(st,`focusFirst`);function ct(e){let t=lt(e);return[ut(t,e),ut(t.reverse(),e)]}z(ct,`getTabbableEdges`);function lt(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:z(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}z(lt,`getTabbableCandidates`);function ut(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):dt(r,{upTo:t})))return r}z(ut,`findVisible`);function dt(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}z(dt,`isHidden`);function ft(e){return e instanceof HTMLInputElement&&`select`in e}z(ft,`isSelectableInput`);function B(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ft(e)&&t&&e.select()}}z(B,`focus`);var pt=mt();function mt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ht(e,t),e.unshift(t)},remove(t){e=ht(e,t),e[0]?.resume()}}}z(mt,`createFocusScopesStack`);function ht(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}z(ht,`arrayRemove`);function gt(e){return e.filter(e=>e.tagName!==`A`)}z(gt,`removeLinks`);var _t=Object.defineProperty,vt=u.forwardRef(((e,t)=>_t(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=u.useState(!1);M(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?_.createPortal((0,g.jsx)(O.div,{...r,ref:t}),o):null},`Portal`)),yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0}),V=0,H=null;function xt(e){return St(),e.children}bt(xt,`FocusGuards`);function St(){u.useEffect(()=>{H||={start:Ct(),end:Ct()};let{start:e,end:t}=H;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),V++,()=>{V===1&&(H?.start.remove(),H?.end.remove(),H=null),V=Math.max(0,V-1)}},[])}bt(St,`useFocusGuards`);function Ct(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}bt(Ct,`createFocusGuard`);var U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},U.apply(this,arguments)};function wt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Tt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var W=`right-scroll-bar-position`,G=`width-before-scroll-bar`,Et=`with-scroll-bars-hidden`,Dt=`--removed-body-scroll-bar-size`;function Ot(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function kt(e,t){var n=(0,u.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var At=typeof window<`u`?u.useLayoutEffect:u.useEffect,jt=new WeakMap;function Mt(e,t){var n=kt(t||null,function(t){return e.forEach(function(e){return Ot(e,t)})});return At(function(){var t=jt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ot(e,null)}),i.forEach(function(e){r.has(e)||Ot(e,a)})}jt.set(n,e)},[e]),n}function Nt(e){return e}function Pt(e,t){t===void 0&&(t=Nt);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ft(e){e===void 0&&(e={});var t=Pt(null);return t.options=U({async:!0,ssr:!1},e),t}var It=function(e){var t=e.sideCar,n=wt(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return u.createElement(r,U({},n))};It.isSideCarExport=!0;function Lt(e,t){return e.useMedium(t),It}var Rt=Ft(),zt=function(){},K=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:zt,onWheelCapture:zt,onTouchMoveCapture:zt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=wt(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=Mt([n,t]),w=U(U({},x),i);return u.createElement(u.Fragment,null,d&&u.createElement(S,{sideCar:Rt,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?u.cloneElement(u.Children.only(s),U(U({},w),{ref:C})):u.createElement(y,U({},w,{className:c,ref:C}),s))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},K.classNames={fullWidth:G,zeroRight:W};var Bt,Vt=function(){if(Bt)return Bt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ht(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Vt();return t&&e.setAttribute(`nonce`,t),e}function Ut(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Gt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ht())&&(Ut(t,n),Wt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Kt=function(){var e=Gt();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},qt=function(){var e=Kt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Jt={left:0,top:0,right:0,gap:0},Yt=function(e){return parseInt(e||``,10)||0},Xt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Yt(n),Yt(r),Yt(i)]},Zt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Jt;var t=Xt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qt=qt(),q=`data-scroll-locked`,$t=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
2
|
.${Et} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,D as t,Dt as n,F as r,H as i,I as a,Kt as o,O as s,Ot as c,P as l,W as u,j as d,k as f,m as p,p as m}from"./queries-vY5lJqBe.js";import{t as h}from"./index-
|
|
1
|
+
import{B as e,D as t,Dt as n,F as r,H as i,I as a,Kt as o,O as s,Ot as c,P as l,W as u,j as d,k as f,m as p,p as m}from"./queries-vY5lJqBe.js";import{t as h}from"./index-JXZlD4dH.js";import{l as g,r as _,t as v}from"./Lamp-WOotyOTd.js";var y=o(c(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,y.createContext)({}),D=()=>(0,y.useContext)(E),O=(0,y.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,y.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),j=k(`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`}]]),ee=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),te=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ne=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),re=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ie=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ae=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),oe=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),se=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ce=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),M=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),N=new Intl.NumberFormat(`en-US`);function P(e){return Number.isFinite(e)?e<1e4?N.format(Math.round(e)):M.format(e).toLowerCase():`—`}function F(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${M.format(e).toLowerCase()}`:`—`}function I(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function L(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var R=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function z(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=R.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function B(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${z(n)} ago`:`in ${z(n)}`}function V(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}function H(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function U(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var W=n(),G=(0,y.createContext)(null);function le({children:e}){let[t,n]=(0,y.useState)(!0),r=(0,y.useCallback)(()=>n(e=>!e),[]),i=(0,y.useMemo)(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return(0,W.jsx)(G,{value:i,children:e})}function K(){return(0,y.use)(G)??{live:!1,toggle:()=>{},cadence:()=>!1}}var ue=e.svg`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,Dt as t,F as n,Kt as r,Ot as i}from"./queries-vY5lJqBe.js";import{m as a}from"./Rack-
|
|
1
|
+
import{B as e,Dt as t,F as n,Kt as r,Ot as i}from"./queries-vY5lJqBe.js";import{m as a}from"./Rack-Be09hoVn.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./Modal-CXsglS9k.js";var p=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),m=r(i(),1),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0});function _(e){let[t,n]=m.useState(void 0);return u(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}g(_,`useSize`);var v=t(),y=Object.defineProperty,b=(e,t)=>y(e,`name`,{value:t,configurable:!0}),x=`Switch`,[S,C]=o(x),[w,T]=S(x);function E(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,h]=c({prop:n,defaultProp:i??!1,onChange:l,caller:x}),[g,_]=m.useState(null),[y,b]=m.useState(null),S=m.useRef(!1),[C,T]=m.useReducer(e=>e+1,0),E={checked:p,setChecked:h,disabled:a,control:g,setControl:_,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:S,userInteractionCount:C,onUserInteraction:T,required:u,defaultChecked:i,isFormControl:!g||!!o||!!g.closest(`form`),bubbleInput:y,setBubbleInput:b};return(0,v.jsx)(w,{scope:t,...E,children:P(f)?f(E):r})}b(E,`SwitchProvider`);var D=`SwitchTrigger`,O=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:o,disabled:c,checked:u,required:f,setControl:p,setChecked:h,hasConsumerStoppedPropagationRef:g,onUserInteraction:_,isFormControl:y,bubbleInput:x}=T(D,e),S=d(r,p),C=m.useRef(u);return m.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=b(()=>h(C.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,h]),(0,v.jsx)(l.button,{type:`button`,role:`switch`,"aria-checked":u,"aria-required":f,"data-state":F(u),"data-disabled":c?``:void 0,disabled:c,value:o,...n,ref:S,onClick:s(t,e=>{_(),h(e=>!e),x&&y&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})})},`SwitchTrigger`)),k=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,v.jsx)(E,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(O,{...d,ref:t,__scopeSwitch:n}),e&&(0,v.jsx)(N,{__scopeSwitch:n})]})})},`Switch`)),A=`SwitchThumb`,j=m.forwardRef(b(function(e,t){let{__scopeSwitch:n,...r}=e,i=T(A,n);return(0,v.jsx)(l.span,{"data-state":F(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),M=`SwitchBubbleInput`,N=m.forwardRef(b(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:c,defaultChecked:u,required:f,disabled:p,name:h,value:g,form:y,bubbleInput:b,setBubbleInput:x}=T(M,e),S=d(r,x),C=_(i),w=m.useRef(!1),E=m.useRef(c),D=m.useRef(o);m.useEffect(()=>{let e=b;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==D.current;D.current=o;let i=E.current!==c;E.current=c;let s=!(r&&a.current);if(i&&n){w.current=!r;let t=new Event(`click`,{bubbles:s});n.call(e,c),e.dispatchEvent(t),w.current=!1}},[b,c,a,o]);let O=m.useRef(c);return(0,v.jsx)(l.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:u??O.current,required:f,disabled:p,name:h,value:g,form:y,...n,tabIndex:-1,ref:S,onClick:s(t,e=>{w.current&&e.stopPropagation()}),style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function P(e){return typeof e==`function`}b(P,`isFunction`);function F(e){return e?`checked`:`unchecked`}b(F,`getState`);var I=e.p`
|
|
2
2
|
font-size: 13px;
|
|
3
3
|
color: ${({theme:e})=>e.color.inkDim};
|
|
4
4
|
`;function L({open:e,onOpenChange:t,title:r,body:i,confirmLabel:a,busy:o,onConfirm:s}){return(0,v.jsx)(f,{open:e,onOpenChange:t,title:r,width:`420px`,footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(n,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),(0,v.jsx)(n,{type:`button`,$variant:`danger`,disabled:o===!0,onClick:s,children:a})]}),children:(0,v.jsx)(I,{children:i})})}var R=e(k)`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Dt as e}from"./queries-vY5lJqBe.js";import{o as t}from"./index-
|
|
1
|
+
import{Dt as e}from"./queries-vY5lJqBe.js";import{o as t}from"./index-JXZlD4dH.js";import{i as n,n as r}from"./Rack-Be09hoVn.js";var i=e(),a=()=>(0,i.jsx)(n,{children:(0,i.jsx)(r,{children:(0,i.jsx)(t,{})})});export{a as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,B as t,D as n,Dt as r,F as i,I as a,Kt as o,M as s,Ot as c,S as l,c as u,i as d,k as f,o as p,r as m,s as h,t as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-
|
|
1
|
+
import{A as e,B as t,D as n,Dt as r,F as i,I as a,Kt as o,M as s,Ot as c,S as l,c as u,i as d,k as f,o as p,r as m,s as h,t as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-Be09hoVn.js";import{t as C}from"./CopyValue-DrPV_Qao.js";import{n as w,r as T,t as ee}from"./Toggle-Cd2Jy_Z1.js";import{r as te,t as E}from"./catalog-B1clfKRA.js";import{t as D}from"./Modal-CXsglS9k.js";import{a as O,c as ne,i as re,n as k,s as A,t as j}from"./Lamp-WOotyOTd.js";import{t as M}from"./Chip-D0YiqYkz.js";import{i as N,n as P,r as F,t as I}from"./Field-DdscQ9OO.js";import{t as ie}from"./Meter-Bm1oQE2U.js";import{a as L,i as R,n as z,r as B,t as V}from"./States-DPTTYUHL.js";import{i as H,n as U,r as W,t as G}from"./Table-LkPaHBsj.js";var K=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),q=o(c(),1),J=r(),ae=Object.keys(E),Y={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},X={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`},oe=t.ol`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: ${({theme:e})=>e.space(3)};
|
|
@@ -44,4 +44,8 @@ import{A as e,B as t,D as n,Dt as r,F as i,I as a,Kt as o,M as s,Ot as c,S as l,
|
|
|
44
44
|
`,me=t(f)`
|
|
45
45
|
min-width: 130px;
|
|
46
46
|
gap: 6px;
|
|
47
|
-
|
|
47
|
+
`,he=t.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: 4px;
|
|
51
|
+
`;function ge(){let e=l();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function _e(){let{cadence:t}=v(),r=h(),o=p(t(1e4)),c=_(),l=u(),{commit:d}=ge(),[m,g]=(0,q.useState)(!1),[x,C]=(0,q.useState)(null),E=Date.now(),D=r.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=c.data?.quotaPollIntervalMs??3e5,I=D.filter(e=>e.enabled).length,R=r.isLoading?`Reading connected accounts…`:D.length===0?`No provider credentials are connected, so every request fails at the router.`:`${I} of ${D.length} accounts are enabled and eligible for routing.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{legend:`Accounts`,title:`Provider accounts`,summary:R,actions:(0,J.jsxs)(i,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(T,{}),`Connect an account`]})}),r.isError?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(z,{error:r.error,onRetry:()=>void r.refetch()})}):r.isLoading?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(B,{rows:5})}):D.length===0?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(V,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:(0,J.jsx)(i,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(s,{$gap:4,children:de.filter(e=>D.some(t=>t.provider===e)).map(t=>{let r=D.filter(e=>e.provider===t);return(0,J.jsx)(fe,{$provider:t,legend:Z[t],meta:`${r.length} account${r.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(e,{children:(0,J.jsxs)(G,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(W,{$width:`24%`,children:`Account`}),(0,J.jsx)(W,{$width:`20%`,children:`Sign-in`}),(0,J.jsx)(W,{$align:`right`,$width:`86px`,children:`Tier`}),(0,J.jsx)(W,{$align:`right`,$width:`94px`,children:`Weight`}),(0,J.jsx)(W,{$align:`center`,$width:`86px`,children:`Enabled`}),(0,J.jsx)(W,{$width:`160px`,children:`Quota`}),(0,J.jsx)(W,{$align:`right`,$width:`88px`,children:`TTFT`}),(0,J.jsx)(W,{$align:`right`,$width:`130px`,children:`Token expires`}),(0,J.jsx)(W,{$width:`48px`})]})}),(0,J.jsx)(`tbody`,{children:r.map(e=>{let t=re(N.get(e.id)??[],E,e.enabled,e.disabledReason),r=ne(P.get(e.id)??[]);return(0,J.jsxs)(H,{children:[(0,J.jsxs)(U,{children:[(0,J.jsxs)(f,{$gap:2,children:[(0,J.jsx)(j,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsx)(Q,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}d(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(pe,{children:t.note})]}),(0,J.jsx)(U,{children:(0,J.jsxs)(f,{$gap:1,children:[(0,J.jsx)(M,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(n,{children:e.accountEmail})]})}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)($,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}d(e.id,{tier:n})}})}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)($,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}d(e.id,{weight:n})}})}),(0,J.jsx)(U,{$align:`center`,children:(0,J.jsx)(ee,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>d(e.id,{enabled:t})})}),(0,J.jsx)(U,{children:r.length===0?(0,J.jsx)(n,{children:`unknown`}):(0,J.jsx)(he,{children:r.map(({window:e,fraction:t})=>(0,J.jsxs)(me,{children:[(0,J.jsx)(ie,{fraction:t,label:`${k[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,J.jsx)(n,{children:A(e,E,F,y)})]},e.windowType))})}),(0,J.jsx)(U,{$align:`right`,$mono:!0,children:b(t.ttftMs)}),(0,J.jsx)(U,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:y(e.expiresAt,E)}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)(a,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>C(e),children:(0,J.jsx)(te,{})})})]},e.id)})})]})})},t)})}),(0,J.jsx)(ue,{open:m,onOpenChange:g,onConnected:()=>void r.refetch()}),(0,J.jsx)(w,{open:x!==null,onOpenChange:e=>{e||C(null)},title:`Remove account`,body:x===null?``:`Removing "${x.label}" deletes its stored token. Any model target pointing at ${Z[x.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:l.isPending,onConfirm:()=>{x!==null&&l.mutate(x.id,{onSettled:()=>C(null)})}})]})}var ve=_e;export{ve as component};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,H as s,M as c,N as l,O as u,h as d,j as f,k as p,m,o as h,s as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,f as b,l as x,o as S,r as C,s as w,t as T,u as E}from"./Rack-Be09hoVn.js";import{a as D,c as O,i as k,l as ee,n as A,o as j,r as M,s as N,t as P}from"./Lamp-WOotyOTd.js";import{n as F,t as I}from"./Chip-D0YiqYkz.js";import{t as L}from"./Meter-Bm1oQE2U.js";import{a as R,n as z,t as B}from"./States-DPTTYUHL.js";import{i as V,n as H,r as U,t as W}from"./Table-LkPaHBsj.js";import{t as G}from"./Readout-CYg6UOop.js";var K=i(),q=t(l)`
|
|
2
|
+
font-weight: 500;
|
|
3
|
+
display: block;
|
|
4
|
+
max-width: 24ch;
|
|
5
|
+
`,J=t.span`
|
|
6
|
+
font-size: 11px;
|
|
7
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
8
|
+
`,Y=t.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 6px;
|
|
12
|
+
width: 118px;
|
|
13
|
+
`,te=t.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 4px;
|
|
17
|
+
`;function X({credentials:t,health:n,quota:i,usage:a,quotaPollIntervalMs:c,now:l}){let u=D(n,e=>e.credentialId),d=D(i,e=>e.credentialId),f=new Map(a.map(e=>[e.key,e])),m={down:0,warn:1,ok:2,idle:3},h=t.map(e=>({credential:e,status:k(u.get(e.id)??[],l,e.enabled,e.disabledReason),quota:O(d.get(e.id)??[]),usage:f.get(e.id)})).sort((e,t)=>m[e.status.state]-m[t.status.state]||e.credential.tier-t.credential.tier);return(0,K.jsx)(R,{legend:`Accounts`,meta:`${t.length} connected`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:t.length===0?(0,K.jsx)(B,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,K.jsx)(o,{as:s,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,K.jsx)(e,{children:(0,K.jsxs)(W,{children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(U,{children:`Account`}),(0,K.jsx)(U,{children:`Provider`}),(0,K.jsx)(U,{$align:`right`,children:`Tier`}),(0,K.jsx)(U,{children:`Quota`}),(0,K.jsx)(U,{$align:`right`,children:`TTFT`}),(0,K.jsx)(U,{$align:`right`,children:`Requests`}),(0,K.jsx)(U,{$align:`right`,children:`Last used`})]})}),(0,K.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:i})=>(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(P,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(q,{children:e.label}),t.note===``?null:(0,K.jsx)(J,{children:t.note})]})]})}),(0,K.jsx)(H,{children:(0,K.jsx)(F,{provider:e.provider})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:e.tier}),(0,K.jsx)(H,{children:n.length===0?(0,K.jsx)(J,{children:`unknown`}):(0,K.jsx)(te,{children:n.map(({window:e,fraction:t})=>(0,K.jsxs)(Y,{children:[(0,K.jsx)(L,{fraction:t,label:`${A[e.windowType]} window, ${Math.round(t*100)}% used`}),(0,K.jsx)(r,{children:N(e,l,c,y)})]},e.windowType))})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:x(t.ttftMs)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:i===void 0?`—`:w(i.requests)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:y(t.lastUsedAt,l)})]},e.id))})]})})})}var Z=t.ul`
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
`,Q=t.li`
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: ${({theme:e})=>e.space(2)};
|
|
24
|
+
padding: 6px ${({theme:e})=>e.space(3)};
|
|
25
|
+
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
26
|
+
|
|
27
|
+
&:last-child {
|
|
28
|
+
border-bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
`,ne=t(l)`
|
|
31
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
max-width: 30ch;
|
|
34
|
+
`,re=t(u)`
|
|
35
|
+
color: ${({theme:e})=>e.color.down};
|
|
36
|
+
font-size: 11px;
|
|
37
|
+
`;function ie({logs:e}){let t=e.slice(0,12);return(0,K.jsx)(R,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/logs`,$size:`sm`,children:`Open logs`}),children:t.length===0?(0,K.jsx)(B,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,K.jsx)(Z,{children:t.map(e=>(0,K.jsxs)(Q,{children:[(0,K.jsx)(P,{state:j(e)?`down`:`ok`,label:j(e)?`failed with ${e.status}`:`succeeded`}),(0,K.jsx)(u,{$dim:!0,children:S(e.at)}),(0,K.jsx)(ne,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,K.jsx)(u,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,K.jsx)(f,{}),e.errorCode===null?null:(0,K.jsx)(re,{children:e.errorCode}),e.attempts>1?(0,K.jsxs)(u,{$dim:!0,children:[e.attempts,`×`]}):null,(0,K.jsx)(u,{$dim:!0,children:x(e.durationMs)}),(0,K.jsx)(u,{$dim:!0,children:b(e.costUsd)})]},e.id))})})}var ae=t.ul`
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: ${({theme:e})=>e.space(3)};
|
|
41
|
+
`,oe=t(l)`
|
|
42
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
43
|
+
font-size: 12.5px;
|
|
44
|
+
`,se=t.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
height: 5px;
|
|
47
|
+
border-radius: 2px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
50
|
+
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
51
|
+
`,ce=t.div`
|
|
52
|
+
flex: ${({$grow:e})=>e} 0 0;
|
|
53
|
+
background: ${({$color:e})=>e};
|
|
54
|
+
opacity: 0.8;
|
|
55
|
+
`,le=t.div`
|
|
56
|
+
flex: ${({$grow:e})=>e} 0 0;
|
|
57
|
+
`;function ue({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let i=Math.max(1,...[...n.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,K.jsx)(R,{legend:`Models`,meta:`${e.length} configured`,actions:(0,K.jsx)(o,{as:s,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,K.jsx)(B,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,K.jsx)(o,{as:s,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,K.jsx)(ae,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,a=[...new Set(e.targets.map(e=>e.provider))];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(oe,{title:e.id,children:e.id}),e.isAlias?(0,K.jsx)(I,{children:`alias`}):null,(0,K.jsx)(I,{$tone:`accent`,children:e.strategy}),(0,K.jsx)(f,{}),(0,K.jsx)(u,{$dim:!0,children:w(t?.requests??0)}),(0,K.jsx)(r,{children:`req`}),(0,K.jsx)(u,{$dim:!0,children:b(t?.costUsd??0)})]}),(0,K.jsxs)(se,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[a.map(e=>(0,K.jsx)(ce,{$color:`var(--p-${e})`,$grow:n/a.length},e)),(0,K.jsx)(le,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var de=t.div`
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
|
|
60
|
+
gap: ${({theme:e})=>e.space(3)};
|
|
61
|
+
`;function fe({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=ee(r,t),a=M(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`;return(0,K.jsxs)(de,{children:[(0,K.jsx)(G,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,K.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,K.jsx)(G,{legend:`Error rate`,value:E(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,K.jsx)(C,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),(0,K.jsx)(G,{legend:`Time to first token`,value:x(i.ttftP50),unit:`p95 ${x(i.ttftP95)}`,trace:(0,K.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${x(i.ttftP50)}`})}),(0,K.jsx)(G,{legend:`Spend`,value:b(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,K.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${b(i.costUsd)} total`})})]})}var $=36e5;function pe(){let{cadence:e}=v(),t=g(),r=h(e(1e4)),i=d(),o=m(500,e(1e4)),s=_(),l=Date.now(),u=Math.floor((l-$)/6e4)*6e4,f=n({groupBy:`credential`,since:u},e(6e4)),p=t.data??[],y=D(r.data?.health??[],e=>e.credentialId),b=p.filter(e=>k(y.get(e.id)??[],l,e.enabled,e.disabledReason).state===`down`),x=t.isLoading||o.isLoading?`Reading the gateway…`:p.length===0?`No accounts are connected, so every request fails at the router.`:b.length>0?`${b.length} account${b.length===1?` is`:`s are`} out of rotation.`:`All ${p.length} accounts are answering. Nothing needs attention.`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),o.isError?(0,K.jsx)(R,{legend:`Traffic`,children:(0,K.jsx)(z,{legend:`The gateway did not answer`,error:o.error,onRetry:()=>void o.refetch()})}):(0,K.jsxs)(c,{$gap:4,children:[(0,K.jsx)(fe,{logs:o.data??[],windowMs:$,now:l}),(0,K.jsx)(X,{credentials:p,health:r.data?.health??[],quota:r.data?.quota??[],usage:f.data??[],quotaPollIntervalMs:s.data?.quotaPollIntervalMs??3e5,now:l}),(0,K.jsxs)(a,{$min:`340px`,$gap:4,children:[(0,K.jsx)(ue,{models:i.data??[],logs:o.data??[]}),(0,K.jsx)(ie,{logs:o.data??[]})]})]})]})}var me=pe;export{me as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,a as u,d,g as f,h as p,k as m}from"./queries-vY5lJqBe.js";import{c as h,t as g}from"./Rack-
|
|
1
|
+
import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,a as u,d,g as f,h as p,k as m}from"./queries-vY5lJqBe.js";import{c as h,t as g}from"./Rack-Be09hoVn.js";import{t as _}from"./CopyValue-DrPV_Qao.js";import{n as v,r as y,t as b}from"./Toggle-Cd2Jy_Z1.js";import{t as x}from"./Modal-CXsglS9k.js";import{t as S}from"./Chip-D0YiqYkz.js";import{n as C,t as w}from"./Field-DdscQ9OO.js";import{a as T,i as E,n as D,r as O,t as k}from"./States-DPTTYUHL.js";import{i as A,n as j,r as M,t as N}from"./Table-LkPaHBsj.js";var P=a(l(),1),F=r(),I=t.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 2px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,k as u,m as d,s as f}from"./queries-vY5lJqBe.js";import{a as p,c as m,f as h,l as g,o as _,p as v,s as y,t as b}from"./Rack-
|
|
1
|
+
import{A as e,B as t,D as n,Dt as r,F as i,Kt as a,M as o,N as s,O as c,Ot as l,k as u,m as d,s as f}from"./queries-vY5lJqBe.js";import{a as p,c as m,f as h,l as g,o as _,p as v,s as y,t as b}from"./Rack-Be09hoVn.js";import{t as x}from"./Modal-CXsglS9k.js";import{o as S,t as C}from"./Lamp-WOotyOTd.js";import{n as w,t as T}from"./Chip-D0YiqYkz.js";import{i as E,n as D}from"./Field-DdscQ9OO.js";import{a as O,n as k,r as A,t as j}from"./States-DPTTYUHL.js";import{i as M,n as N,r as P,t as F}from"./Table-LkPaHBsj.js";var I=a(l(),1),L=r(),R=[50,100,250,500],z=t(u)`
|
|
2
2
|
gap: ${({theme:e})=>e.space(2)};
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
`,B=t(D)`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,_ as u,h as d,j as f,k as p,l as m,u as h,y as g}from"./queries-vY5lJqBe.js";import{m as _,t as v}from"./Rack-
|
|
1
|
+
import{B as e,D as t,Dt as n,F as r,I as i,Kt as a,M as o,N as s,O as c,Ot as l,_ as u,h as d,j as f,k as p,l as m,u as h,y as g}from"./queries-vY5lJqBe.js";import{m as _,t as v}from"./Rack-Be09hoVn.js";import{n as y,r as b,t as x}from"./Toggle-Cd2Jy_Z1.js";import{n as S,r as C,t as w}from"./catalog-B1clfKRA.js";import{n as ee,t as T}from"./Chip-D0YiqYkz.js";import{i as E,n as D,r as O,t as k}from"./Field-DdscQ9OO.js";import{t as te}from"./Meter-Bm1oQE2U.js";import{a as A,i as j,n as ne,r as M,t as N}from"./States-DPTTYUHL.js";var re=_(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),P=_(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),F=a(l(),1),I=n(),L=[`tier`,`health`,`quota`,`cost`,`latency`,`recency`],ie={tier:`How preferred this tier is`,health:`Consecutive failures and breaker state`,quota:`Headroom in the tightest window, against how much of it is left`,cost:`Price against the other candidates`,latency:`Observed time to first token`,recency:`How long this pair has been idle`},ae=e.li`
|
|
2
2
|
padding: ${({theme:e})=>e.space(2)} 0;
|
|
3
3
|
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,O as o,Ot as s,j as c,k as l,v as u,y as d}from"./queries-vY5lJqBe.js";import{t as f}from"./Rack-
|
|
1
|
+
import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,O as o,Ot as s,j as c,k as l,v as u,y as d}from"./queries-vY5lJqBe.js";import{t as f}from"./Rack-Be09hoVn.js";import{n as p,t as m}from"./Field-DdscQ9OO.js";import{t as h}from"./Meter-Bm1oQE2U.js";import{a as g,i as _,n as v,r as y}from"./States-DPTTYUHL.js";var b=i(s(),1),x=n(),S=[{id:`tier`,label:`Tier`,blurb:`How strongly a lower tier is preferred.`},{id:`health`,label:`Health`,blurb:`Penalty for recent failures and an open breaker.`},{id:`quota`,label:`Quota`,blurb:`Preference for accounts keeping ahead of their window's burn rate.`},{id:`cost`,label:`Cost`,blurb:`Preference for the cheaper target of the candidates.`},{id:`latency`,label:`Latency`,blurb:`Preference for the faster observed first token.`},{id:`recency`,label:`Recency`,blurb:`Preference for accounts that have been idle.`}],C=[{id:`maxAttempts`,label:`Attempts per request`,hint:`How many candidates dispatch may try before giving up. 1 disables failover.`,unit:`attempts`,step:1,min:1},{id:`requestDeadlineMs`,label:`Request deadline`,hint:`How long a single client request may take across all attempts.`,unit:`ms`,step:1e3,min:1},{id:`breakerThreshold`,label:`Breaker threshold`,hint:`Consecutive failures on one account and model before it is taken out of rotation.`,unit:`failures`,step:1,min:1},{id:`breakerCooldownMs`,label:`Breaker cooldown`,hint:`Base wait before a tripped account is probed again. Doubles per extra failure.`,unit:`ms`,step:1e3,min:1},{id:`logRetentionDays`,label:`Log retention`,hint:`How long request rows are kept before maintenance prunes them.`,unit:`days`,step:1,min:1},{id:`quotaPollIntervalMs`,label:`Quota poll interval`,hint:`How often each account's provider is asked for its remaining quota. 0 disables polling. Takes effect on restart.`,unit:`ms`,step:6e4,min:0}],w=e.div`
|
|
2
2
|
display: grid;
|
|
3
3
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
4
4
|
gap: ${({theme:e})=>e.space(3)};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,Gt as s,K as c,Kt as l,M as u,N as d,O as f,Ot as p,U as m,Wt as h,d as g,k as _,s as v}from"./queries-vY5lJqBe.js";import{i as y,n as b,r as x}from"./index-
|
|
1
|
+
import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,Gt as s,K as c,Kt as l,M as u,N as d,O as f,Ot as p,U as m,Wt as h,d as g,k as _,s as v}from"./queries-vY5lJqBe.js";import{i as y,n as b,r as x}from"./index-JXZlD4dH.js";import{a as S,f as C,l as w,r as T,s as E,t as D,u as O}from"./Rack-Be09hoVn.js";import{a as k,n as A,r as j,t as M}from"./States-DPTTYUHL.js";import{i as N,n as P,r as F,t as I}from"./Table-LkPaHBsj.js";import{t as ee}from"./Readout-CYg6UOop.js";var L=l(p(),1),te=[{id:`1h`,label:`1 hour`,ms:36e5,grain:`raw`,by:`hour`},{id:`24h`,label:`24 hours`,ms:864e5,grain:`raw`,by:`hour`},{id:`7d`,label:`7 days`,ms:6048e5,grain:`raw`,by:`hour`},{id:`30d`,label:`30 days`,ms:2592e6,grain:`raw`,by:`hour`},{id:`90d`,label:`90 days`,ms:7776e6,grain:`daily`,by:`day`},{id:`1y`,label:`12 months`,ms:31536e6,grain:`daily`,by:`day`}];function ne(e){return te.find(t=>t.id===e)??te[1]}var re=[{id:`requests`,label:`Requests`,of:e=>e.requests,format:E},{id:`tokens`,label:`Tokens`,of:e=>e.inputTokens+e.outputTokens,format:E},{id:`cost`,label:`Cost`,of:e=>e.costUsd,format:C}];function ie(e){return re.find(t=>t.id===e)??re[0]}var ae=36e5;function oe(e,t){let n=Number(e);return Number.isFinite(n)?t===`hour`?n*ae:n:NaN}function se(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function ce(e,t,n){let r=[];if(n===`hour`){let n=Math.floor(e/ae)*ae;for(let e=n;e<=t;e+=ae)r.push(e);return r}let i=new Date(se(e));for(;i.getTime()<=t;)r.push(i.getTime()),i.setDate(i.getDate()+1);return r}function le(e,t){return Number.isFinite(e)?new Date(e).toLocaleString(`en-GB`,{day:`2-digit`,month:`short`,...t===`hour`?{hour:`2-digit`,hour12:!1}:{year:`2-digit`}}):`—`}function ue(e){return new Date(e).toLocaleDateString(`en-GB`,{weekday:`short`,day:`numeric`,month:`short`,year:`numeric`})}var de={requests:0,errors:0,costUsd:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,durationMsSum:0};function fe(e,t){return{requests:e.requests+t.requests,errors:e.errors+t.errors,costUsd:e.costUsd+t.costUsd,inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens+t.cacheWriteTokens,durationMsSum:e.durationMsSum+t.durationMsSum}}function pe(e){return e.reduce(fe,de)}function me(e,t){let n=new Map;for(let t of e){let e=t.split??t.key;n.set(e,fe(n.get(e)??de,t))}return new Map([...n.entries()].sort((e,n)=>t.of(he(n[1]))-t.of(he(e[1]))))}function he(e){return{key:``,...e}}function ge(e,t,n,r){let i=new Map;for(let t of e){let e=`${oe(t.key,n)} ${t.split??`unknown`}`;i.set(e,(i.get(e)??0)+r.of(t))}let a=new Set(e.map(e=>e.split??`unknown`));return t.map(e=>{let t={at:e};for(let n of a)t[n]=i.get(`${e} ${n}`)??0;return t})}var _e=t(o)`
|
|
2
2
|
border-color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.ruleStrong};
|
|
3
3
|
color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.inkDim};
|
|
4
4
|
background: ${({theme:e,$on:t})=>t?e.color.accentWash:e.color.panelRaised};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./Rack-
|
|
1
|
+
import{m as e}from"./Rack-Be09hoVn.js";var t=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),n={anthropic:{defaultModel:`claude-opus-5`,models:[{id:`claude-fable-5`,label:`Claude Fable 5`,pricing:{input:10,output:50,cacheRead:1}},{id:`claude-opus-5`,label:`Claude Opus 5`,pricing:{input:5,output:25,cacheRead:.5}},{id:`claude-sonnet-5`,label:`Claude Sonnet 5`,pricing:{input:3,output:15,cacheRead:.3}},{id:`claude-haiku-4-5`,label:`Claude Haiku 4.5`,pricing:{input:1,output:5,cacheRead:.1}}]},openai:{defaultModel:`gpt-5.6`,models:[{id:`gpt-5.6`,label:`GPT-5.6 — routes to Sol`,pricing:{input:5,output:30,cacheRead:.5}},{id:`gpt-5.6-sol`,label:`GPT-5.6 Sol — deepest reasoning`,pricing:{input:5,output:30,cacheRead:.5}},{id:`gpt-5.6-terra`,label:`GPT-5.6 Terra — balanced`,pricing:{input:2,output:12,cacheRead:.2}},{id:`gpt-5.6-luna`,label:`GPT-5.6 Luna — fastest`,pricing:{input:.2,output:1.2,cacheRead:.02}}]},kimi:{defaultModel:`k3-256k`,models:[{id:`k3-256k`,label:`Kimi K3 — 256K`,pricing:{input:3,output:15,cacheRead:.3}},{id:`k3`,label:`Kimi K3 — up to 1M`,pricing:{input:3,output:15,cacheRead:.3}},{id:`kimi-for-coding`,label:`Kimi K2.7 Code`,pricing:{input:.95,output:4,cacheRead:.19}},{id:`kimi-for-coding-highspeed`,label:`Kimi K2.7 Code — High Speed`,pricing:{input:.95,output:8,cacheRead:.19}}]}};function r(e,t){return n[e].models.find(e=>e.id===t)?.pricing??null}export{r as n,t as r,n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-Bf5ZUmaT.js","assets/queries-vY5lJqBe.js","assets/Rack-Be09hoVn.js","assets/Lamp-WOotyOTd.js","assets/login-CkrCC4MV.js","assets/Field-DdscQ9OO.js","assets/States-DPTTYUHL.js","assets/_app.index-Ck_5mdeH.js","assets/Chip-D0YiqYkz.js","assets/Meter-Bm1oQE2U.js","assets/Table-LkPaHBsj.js","assets/Readout-CYg6UOop.js","assets/_app.accounts-BmFfVWsr.js","assets/CopyValue-DrPV_Qao.js","assets/Toggle-Cd2Jy_Z1.js","assets/Modal-CXsglS9k.js","assets/catalog-B1clfKRA.js","assets/_app.keys-C2XDmQJL.js","assets/_app.logs-C2Xv-Izr.js","assets/_app.models-DCxR_HKM.js","assets/_app.settings-SBc1Uaro.js","assets/_app.usage-BO3toUhx.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{$ as e,At as t,B as n,Bt as r,Ct as i,D as a,Dt as o,Et as s,F as c,Ft as l,G as u,H as d,Ht as f,It as p,J as m,Kt as h,Lt as g,M as _,Mt as v,Nt as y,Ot as b,Pt as x,Q as ee,R as S,Rt as te,St as ne,T as re,Tt as ie,U as ae,Ut as oe,V as se,Vt as ce,W as le,Wt as ue,X as de,Y as C,Z as w,_t as fe,at as pe,bt as me,ct as he,dt as T,et as E,ft as ge,gt as _e,ht as ve,it as ye,jt as be,kt as xe,lt as Se,mt as Ce,n as we,nt as Te,ot as Ee,pt as De,q as Oe,rt as ke,st as Ae,tt as je,ut as Me,vt as Ne,w as Pe,wt as Fe,xt as Ie,yt as Le,zt as Re}from"./queries-vY5lJqBe.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ze=class extends oe{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new xe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Be(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){v.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>p(t,e))}findAll(e={}){return this.getAll().filter(t=>p(e,t))}notify(e){v.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return v.batch(()=>Promise.all(e.map(e=>e.continue().catch(te))))}};function Be(e){return e.options.scope?.id}var Ve=class extends oe{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){let i=n.queryKey,a=n.queryHash??l(i,n),o=this.get(a);return o||(o=new t({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){v.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>g(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>g(e,t)):t}notify(e){v.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){v.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){v.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},He=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ve,this.#t=e.mutationCache||new ze,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=f.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=be.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),i=n.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(r(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return v.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;v.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return v.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=v.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(te).catch(te)}invalidateQueries(e,t={}){return v.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=v.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(te)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(te)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(r(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(te).catch(te)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(te).catch(te)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return be.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(x(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Re(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(x(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Re(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=l(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ce&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Ue(e){return e?.isNotFound===!0}function We(){try{return sessionStorage}catch{return}}var Ge=`tsr-scroll-restoration-v1_3`,Ke=We();function qe(){try{return JSON.parse(Ke?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Je(){try{Ke?.setItem(Ge,JSON.stringify(Ye))}catch{}}var Ye=qe(),Xe=`data-scroll-restoration-id`,Ze=e=>e.state.__TSR_key||e.href;function Qe(e){let t=e.getAttribute(Xe);if(t)return`[${Xe}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var $e=!1,et=`window`;function tt(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function nt(e){let t=new Set;for(let n of e){if(n===et)continue;let e=tt(n);e&&t.add(e)}return t}function rt(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Ze,a=new Set,o=e=>{let t=Ye[e]||={};for(let e of a)e===document?t[et]={scrollX,scrollY}:e.isConnected&&(t[Qe(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,$e=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{$e||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Je()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Ye[d];if(e){let t=Ye[u];for(let n in e){if(n===et){if(s)continue}else{let e=tt(n);if(!e||s&&o&&(l??=nt(o),l.has(e)))continue}t||=Ye[u]={},t[n]??=e[n]}}}$e=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=nt(o));let t=e&&i&&c,s=r.restoring?Ye[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===et){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=tt(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{$e=!1}}))}function it(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function at(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function ot(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=at(r):Array.isArray(t)?t.push(at(r)):n[e]=[t,at(r)]}return n}var st=lt(JSON.parse),ct=ut(JSON.stringify,JSON.parse);function lt(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=ot(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function ut(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=it(e,r);return t?`?${t}`:``}}var dt=`__root__`;function ft(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function pt(e){return e instanceof Response&&!!e.options}function mt(e){return{input:({url:t})=>{for(let n of e)t=gt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=D(e[n],t);return t}}}function ht(t){let n=je(t.basepath),r=`/${n}`,i=t.caseSensitive?r:r.toLowerCase(),a=`${i}/`;return{input:({url:e})=>{let n=t.caseSensitive?e.pathname:e.pathname.toLowerCase();return n===i?e.pathname=`/`:n.startsWith(a)&&(e.pathname=e.pathname.slice(r.length)),e},output:({url:t})=>(t.pathname=e([`/`,n,t.pathname]),t)}}function gt(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function D(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function _t(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{De(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var vt=`__TSR_index`,yt=`popstate`,bt=`beforeunload`;function xt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Tt(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[vt];i=St(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[vt];i=St(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[vt]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function St(e,t){t||={};let n=Et();return{...t,key:n,__TSR_key:n,[vt]:e}}function Ct(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Tt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Et();t.history.replaceState({[vt]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(S._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),S._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Tt(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),S.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[vt]-l.state[vt],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},ee=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=xt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(bt,ee,{capture:!0}),t.removeEventListener(yt,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(bt,ee,{capture:!0}),t.addEventListener(yt,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||b(`REPLACE`),n},S}function wt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Tt(e,t){let n=wt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Et();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[vt]:0,key:a,__TSR_key:a}}}function Et(){return(Math.random()+1).toString(36).substring(7)}function Dt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Ot(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function O({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function kt(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var At=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=w(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Ct()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Me(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=_t(this.latestLocation,e),rt(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=je(a);t&&t!==`/`&&e.push(ht({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:mt(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Se(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&he(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:a,state:o})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let a=this.options.parseSearch(n),s=this.options.stringifySearch(a);return{href:e+s+r,publicHref:e+s+r,pathname:Ce(e).path,external:!1,searchStr:s,search:ne(t?.search,a),hash:Ce(r.slice(1)).path,state:i(t?.state,o)}}let s=new URL(a,this.origin),c=gt(this.rewrite,s),l=this.options.parseSearch(c.search),u=this.options.stringifySearch(l);return c.search=u,{href:c.href.replace(c.origin,``),publicHref:a,pathname:Ce(c.pathname).path,external:!!this.rewrite&&c.origin!==this.origin,searchStr:u,search:ne(t?.search,l),hash:Ce(c.hash.slice(1)).path,state:i(t?.state,o)}},r=n(e),{__tempLocation:a,__tempKey:o}=r.state;if(a&&(!o||o===this.tempLocationKey)){let e=n(a);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>E({base:e,to:t.includes(`//`)?de(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Ee(ke(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),{matchedRoutes:n?.branch||[this.routesById.__root__],routeParams:t,foundRoute:n?.route}},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let a=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,o=t.to?`${t.to}`:void 0,s=r.search,c=Object.assign(Object.create(null),r.params),l=o?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(a,`.`),u=o?this.resolvePathWithBase(l,o):l,d=It(t.params,c),f=this.routesByPath[ke(u)],p;if(f)p=this.getRouteBranch(f);else if(u.includes(`$`))p=[];else{let e=this.getMatchedRoutes(u);p=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(p=[...p,this.options.notFoundRoute])}if(p.length&&Ne(d))for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(d,t(d))}catch{}}let m=e.leaveParams?u:Ce(ee({path:u,params:d,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,h=s;if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Nt(t.options.validateSearch,{...e,...h}))}catch{}}),h=e}h=Pt(h,t,p,e._includeValidateSearch),h=ne(s,h);let g=this.options.stringifySearch(h),_=t.hash===!0?n.hash:t.hash?fe(t.hash,n.hash):void 0,v=_?`#${_}`:``,y=t.state===!0?n.state:t.state?fe(t.state,n.state):{};y=i(n.state,y);let b=`${m}${g}${v}`,x,S,te=!1;if(this.rewrite){let e=new URL(b,this.origin),t=D(this.rewrite,e);x=e.href.replace(e.origin,``),t.origin===this.origin?S=t.pathname+t.search+t.hash:(S=t.href,te=!0)}else x=_e(b),S=x;return{publicHref:S,href:x,pathname:m,search:h,searchStr:g,state:y,hash:_??``,external:te,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=pe(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=It(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=ke(this.latestLocation.href)===ke(n.href)&&ve(O(n.state),O(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=Tt(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=gt(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Le(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Mn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Ot(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Dt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=(e.options._builtLocation??this.buildLocation(e.options)).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Le(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Bt,this.preloadRoute=e=>Nn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ae(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ve(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?ve(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??ct,parseSearch:e.parseSearch??st,protocolAllowlist:e.protocolAllowlist??ge}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=ye(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:a}=n,{matchedRoutes:o}=n,s=!1;(r?r.path!==`/`&&a[`**`]:ke(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:s=!0);let c=s?Ft(this.options.notFoundMode,o):void 0,l=Array(o.length),u=this._committed,d=(e,t)=>{let n=u[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?u.find(t=>t.routeId===e.id):void 0};for(let n=0;n<o.length;n++){let r=o[n],s=l[n-1],u,f,p;{let n=s?.search??e.search,i=s?._strictSearch??void 0;try{let e=Nt(r.options.validateSearch,{...n})??void 0;u={...n,...e},f={...i,...e}}catch(e){let r=e;if(e instanceof jt||(r=new jt(e.message,{cause:e})),t?.throwOnError)throw r;u=n,f={},p=r}}let m=``,h=``;try{m=r.options.loaderDeps?.({search:u})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=ee({path:r.fullPath,params:a,decoder:this.pathParamsDecoder,server:this.isServer}),v=r.id+g+h,y=d(r,n),b=this._cache.get(v)??(y?.id===v?y:void 0),x=b?._strictParams??_,S;if(!b)try{Lt(r,x)}catch(e){if(S=Ue(e)||pt(e)?e:new Mt(e.message,{cause:e}),t?.throwOnError)throw S}Object.assign(a,x);let te=y?`stay`:`enter`,re;if(b)re={...b,cause:te,params:y?.params??a,_strictParams:x,search:ne(y?y.search:b.search,u),_strictSearch:f,searchError:p};else{let e=Dt(r)?`pending`:`success`;re={id:v,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??a,_strictParams:x,pathname:g,updatedAt:Date.now(),search:y?ne(y.search,u):u,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:S,context:{},abortController:t?._controller??new AbortController,cause:te,loaderDeps:y?i(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:r.options.staticData||{},fullPath:r.fullPath}}let ie=c===r.id;re._notFound&&!ie&&(re.error=void 0),re._notFound=ie,l[n]=re}for(let e=0;e<l.length;e++){let n=l[e];n.params=n.cause===`stay`?ne(n.params,a):a,t?._controller&&(n.context={})}return l}matchRoutesLightweight(e){let t=Ie(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let{matchedRoutes:a,routeParams:o}=this.getMatchedRoutes(e.pathname),s=Ie(a),c={...e.search};for(let e of a)try{Object.assign(c,Nt(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{Lt(t,e)}catch{}u=e}let d={matchedRoutes:a,fullPath:s.fullPath,search:c,params:u};return this.lightweightCache.set(e,[r,d]),d}},jt=class extends Error{},Mt=class extends Error{};function Nt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new jt(`Async validation not supported`);if(n.issues)throw new jt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Pt(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=Nt(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=fe(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function Ft(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return dt}function It(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,fe(e,t))}function Lt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Rt(e,t){return e.options[t]?.preload?.()}function zt(e,t){let n=Rt(e,`component`),r=Rt(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function Bt(e,t,n){let r=()=>t===!1?void 0:t?Rt(e,t):zt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Vt(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var Ht=0,Ut=1,Wt=2,Gt=3,Kt=4;function qt(e){return typeof e[0]==`number`}function Jt(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function Yt(e,t){return e.routesById[t.routeId]}function Xt(e,t,n){return pt(e)?[Gt,e]:Ue(e)?(e.routeId||=n,[Wt,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[Ut,e]:[Ht,e])}function Zt(e,t){let n=Xt(t,!0,e.id);if(n[0]!==Ut)return n;try{e.options.onError?.(n[1])}catch(t){n=Xt(t,!0,e.id)}return n}function Qt(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[Kt]):Zt(e,t)}function $t(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function en(e,t,n,r,i){let[a,o]=t,s=n[0].signal,c=!!n[4];for(let t=n[7]??0;t<r;t++){let r=o[t],i=Yt(e,r);r.abortController=n[0];let l=o[t-1]?.context??e.options.context??{},u={params:r.params,location:a,navigate:$t(e,a),buildLocation:e.buildLocation,cause:c?`preload`:r.cause,abortController:n[0],preload:c,matches:o,routeId:i.id},d=l;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...u,deps:r.loaderDeps,context:l})||{}),d={...l,...e},r.context=d}catch(a){return nn(e,r),[t,Qt(i,a,n)]}if(s.aborted||!n[2]())return n[0].abort(),[t,[Kt]];let f=r.paramsError??r.searchError;if(f!==void 0)return nn(e,r),[t,Qt(i,f,n)];let p=i.options.beforeLoad;if(!p)continue;let m={...u,search:r.search,context:d,...e.options.additionalContext},h=r.status;h===`success`&&(r.status=`pending`),n[8]?.();try{cn(e,r,`beforeLoad`,n[0]);let a=await Jt(p(m),s);if(!n[2]())return n[0].abort(),[t,[Kt]];let o=Xt(a,!1,i.id);if(o[0]!==Ht)return nn(e,r),[t,o];r.context={...d,...a}}catch(a){return nn(e,r),[t,Qt(i,a,n)]}finally{h===`success`&&r.status===`pending`&&(r.status=`success`),cn(e,r,!1,n[0])}}i()}function tn(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function nn(e,t){let n=t._flight;t._flight=void 0,tn(e,t,n)?.abort()}function rn(e,t,n){let r=[];for(let i of t)if(!n?.includes(i)){let t=i._flight;i._flight=void 0;let n=tn(e,i,t);n&&r.push(n)}for(let e of r)e.abort()}function an(e,t,n){let r=[];for(let i of t)if(!n.includes(i)){let t=i._flight;if(i._flight=void 0,t?.[2]===1&&e._flights?.get(i.id)===t&&n.some(e=>e.id===i.id))t[2]=0;else{let n=tn(e,i,t);n&&r.push(n)}}for(let e of r)e.abort()}function on(e){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}function sn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function cn(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function ln(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:$t(e,s),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function un(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[Kt];if(!i)return[Ht,void 0];let l=n._flight;cn(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(ln(e,t,n,r,s,a,o))).then(e=>Xt(e,!1,r.id),e=>Xt(e,!0,r.id)).then(t=>(t[0]!==Ht&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Ut&&l[2]?Zt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await Jt(l[0],c)}catch(t){if(t!==c)throw t;return nn(e,n),[Kt]}finally{cn(e,n,!1,s)}}function dn(e,t,n){t[0]===Ht?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==Gt&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function fn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&nn(e,r)}function pn(e,t){return t[0]===Ut||t[0]===Wt?{...e,status:t[0]===Ut?`error`:`notFound`,error:t[1],_flight:void 0}:e}function mn(e,t,n,r,i,a){let o=t[1][n],s=Yt(e,o),c=!!a[4],l=c?e._cache.get(o.id):void 0,u,d=!1,f;try{if(o.status===`success`&&(u=s.options.shouldReload,typeof u==`function`&&(u=u(ln(e,t,o,s,a[0],i,c))),a[2]()||(a[0].abort(),f=[Kt])),!f)if(o.status!==`success`)d=!0;else{let t=a[4]||o.preload?s.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:s.options.staleTime??e.options.defaultStaleTime??0;d=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=t&&(a[6]||o.cause===`enter`||a[3].some(e=>e.routeId===o.routeId&&e.id!==o.id)))}}catch(t){o.invalid=!0,nn(e,o),f=Qt(s,t,a)}let p=s.options.loader,m=typeof p==`function`?p:p?.handler,h=(!c||s.options.preload!==!1)&&p?e._flights?.get(o.id):void 0;h===o._flight||f?h=void 0:h&&!d&&!c&&u===void 0?d=!0:d||(h=void 0);let g=!!(p&&d&&o.status===`success`&&!c&&!a[5]&&((typeof p==`function`?void 0:p?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),_=d&&(!c||s.options.preload!==!1),v=_&&!g&&(o.status!==`success`||!!p),y=s.lazyFn&&s._lazy!==!0?a[8]:void 0;if(_&&!p&&(o.invalid=!1,o.updatedAt=Date.now()),h&&h[2]++,v){let t=o._flight;o._flight=h,tn(e,o,t)?.abort(),o.status===`success`&&(o.status=`pending`),a[8]?.()}_||(o.isFetching=!1);let b=(f?Promise.resolve(f):v?un(e,t,o,s,m,i,c,a[0]):Promise.resolve([Ht,o.loaderData])).then(t=>(v&&(dn(o,t,c),t[0]===Ht&&(c&&p&&!a[0].signal.aborted&&fn(e,o,l),o.status=`pending`)),t)),x=Jt(Promise.resolve().then(()=>Bt(s,void 0,y)),a[0].signal).then(()=>void 0,e=>[n,Qt(s,e,a)]).then(e=>b.then(t=>(v&&!e&&t[0]===Ht&&o.status===`pending`&&a[2]()&&(o.status=`success`,a[8]?.()),e)));if(r.push([n,b,x]),!g)return b.then(e=>pn(o,e));let ee={...o,status:`pending`,preload:!1,_flight:h};o.invalid=!1,o.isFetching=`loader`;let S=un(e,t,ee,s,m,i,!1,a[0]).then(e=>(o.isFetching=!1,dn(ee,e,!1),e));return(t[2]??=[]).push([n,S,x,ee]),S.then(e=>pn(ee,e))}async function hn(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Yt(e,t[n]),a=Bt(i,!1);if(a)try{await Jt(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function gn(e,t){t[2]&&=(rn(e,t[2].map(e=>e[3])),void 0)}async function _n(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=Gt)throw[a,t];!i&&t[0]!==Ht&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Gt)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function vn(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Wt?hn(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=Gt)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==Ht&&t[0]<Gt&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=Gt){let n=c[1];if(n[0]!==Gt||n[1].options.reloadDocument||i<20)return gn(e,t),n;l=!0,c=[0,[Ut,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===Ut?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};f();try{await Jt(i?Promise.resolve().then(()=>Bt(Yt(e,u),a===Ut?`errorComponent`:`notFoundComponent`)):Promise.all([Bt(Yt(e,u)),Bt(Yt(e,u),`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return gn(e,t),[Kt]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),gn(e,t),rn(e,s),f()):(u.status=`success`,o?.())}return t}async function yn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Yt(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await Jt(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function bn(e,t,n,r){let i=[t,n],a=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&a>=0){let t=await hn(e,i[1],void 0,r[0].signal,a);t!==a&&(n[a]._notFound=void 0,n[t]._notFound=!0),a=t}let o=a<0?n.length:a+1,s=[],c=r[7]??0,l=c?Promise.resolve(i[1][c-1]):void 0,u=()=>{for(let t=c;t<o&&!r[0].signal.aborted;t++)l=mn(e,i,t,s,l,r)},d=await en(e,i,r,o,u);d&&(r[5]=!0,o=d[0],d[1][0]===Wt?(d[2]=await hn(e,i[1],d,r[0].signal),o=Math.min(o,d[2]+1)):d[1][0]>=Gt&&(o=0),u()),r[2]()&&!r[4]&&on(e);let f;try{let t=vn(e,i,s,r[0],r[1],_n(s,d,i[2]),r[8]);i[2]?.length&&(i[3]=_n(i[2],void 0,void 0,t.then(e=>qt(e)?0:Vt(e[1]).length,()=>0))),f=await t}catch(t){throw gn(e,i),t}return qt(f)?f:yn(e,f,r[0].signal,r[7]===f[1].length?r[7]:0)}function xn(e,t){let n=e.stores.matches.get();for(let r=0;r<t.length;r++){let i=t[r],a=i.status===`success`,o=a&&n[r]?.id===i.id&&n[r]?.status===`pending`;if(a&&!o)continue;let s=Yt(e,i),c=o||i.invalid?0:s.options.pendingMs??e.options.defaultPendingMs,l=s.options.pendingComponent??e.options.defaultPendingComponent;return l&&typeof c==`number`&&c!==1/0?[c,r,s.options.pendingMinMs??e.options.defaultPendingMinMs??0,l]:void 0}}function Sn(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=xn(e,t[3]);if(!a)return;let[o,s,c,l]=a,u=t[3][s].id;if(!n||n[1]!==s||i!==u){clearTimeout(n?.[3]);let r=e.stores.matches.get()[s],i=r?.id===u&&r.status===`pending`;e._pending=n=[t,s,i?Date.now()+c:t[4]+o,void 0,i?Promise.resolve(!0):void 0,l]}if(n[4]&&!r&&n[5]===l)return;if(n[5]=l,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>{Sn(e,t)},r);return}n[2]=0}let d=t[3].map(e=>({...e,_flight:void 0}));d[s].status=`pending`;let f=e.startTransition(()=>e.stores.setMatches(d),d).then(t=>(t&&e._pending===n&&n[4]===f&&!n[2]&&(n[2]=Date.now()+c),t));n[4]=f}function Cn(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function wn(e,t){e._committed=t,e.stores.setMatches(t)}function Tn(e,t){rn(e,t[1]),gn(e,t)}function En(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=Vt(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=Yt(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,wn(e,n),rn(e,[...a.values(),...i],[...n,...s.values()]),kt(e,i,n,()=>e._tx===t)}async function Dn(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function On(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function kn(e,t){Cn(e,t),t[0].abort(),rn(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function An(e,t,n,r,i){let a=n.map(e=>({...e}));sn(a);for(let t of r)nn(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await vn(e,o,r,t[0],t[1],i)}catch(t){throw rn(e,a),t}if(qt(s)){rn(e,a),s[0]===Gt&&e._tx===t&&e._committed===n&&await On(e,t,s[1]);return}let c=await yn(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){rn(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),nn(e,n))}wn(e,c[1]),rn(e,n,c[1])}async function jn(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await bn(e,t[2],t[3],o);if(qt(s)){s[0]===Gt&&e._tx===t?(Cn(e,t),rn(e,t[3]),t[3]=[],e._tx===t&&await On(e,t,s[1])):kn(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await Jt(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await Jt(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){Cn(e,t),Tn(e,s);return}let l=t[2],u=Ot(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){Tn(e,s);return}let n=await e.startTransition(()=>{Cn(e,t),En(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){gn(e,s);return}d?.length&&An(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Mn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await Dn(e,n);return}let f=Ot(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await Dn(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),sn(m)}catch(t){if(u.abort(),!pt(t)){await Dn(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await Dn(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){rn(e,m),await Dn(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>jn(e,_,p,()=>Sn(e,_),t?.sync,g)).catch(()=>{e._tx===_&&kn(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&cn(e,t,!1)}n[0].abort(),an(e,n[3],_[3])}if(e._tx!==_){rn(e,_[3]),_[3]=[],await Dn(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),Sn(e,_);try{await _[5]}finally{await Dn(e,_)}}async function Nn(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),sn(o)}catch(e){a.abort(),Ue(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await bn(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),rn(e,o),a.abort()}if(!qt(t))return t[1];if(s&&t[0]===Gt&&!t[1].options.reloadDocument)return Nn(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){Ue(e)||console.error(e)}}var Pn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=t=>{this.originalIndex=t.originalIndex;let n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=dt:this.parentRoute||T();let i=r?dt:n?.path;i&&i!==`/`&&(i=Te(i));let a=n?.id||i,o=r?dt:e([this.parentRoute.id===`__root__`?``:this.parentRoute.id,a]);i===`__root__`&&(i=`/`),o!==`__root__`&&(o=e([`/`,o]));let s=o===`__root__`?`/`:e([this.parentRoute.fullPath,i]);this._path=i,this._id=o,this._fullPath=s,this._to=ke(s)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>ft({from:this.fullPath,...e}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Fn=class extends Pn{constructor(e){super(e)}},k=h(b(),1),A=o();function In(e){return(0,A.jsx)(Ln,{...e})}var Ln=class extends k.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?k.createElement(this.props.errorComponent??Rn,{error:e,reset:this.reset}):this.props.children}};function Rn({error:e}){let[t,n]=k.useState(!1);return(0,A.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,A.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,A.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,A.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,A.jsx)(`div`,{children:(0,A.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,A.jsx)(`code`,{children:e.message}):null})}):null]})}var zn=k.createContext(void 0),Bn=k.createContext(void 0),j=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(j||{});function Vn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Hn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Un=[],Wn=0,{link:Gn,unlink:Kn,propagate:qn,checkDirty:Jn,shallowPropagate:Yn}=Vn({update(e){return e._update()},notify(e){Un[Zn++]=e,e.flags&=~j.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=j.Mutable|j.Dirty,tr(e))}}),Xn=0,Zn=0,Qn,$n=0;function er(e){try{++$n,e()}finally{--$n||nr()}}function tr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Kn(n,e)}function nr(){if(!($n>0)){for(;Xn<Zn;){let e=Un[Xn];Un[Xn++]=void 0,e.notify()}Xn=0,Zn=0}}function rr(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?j.None:j.Mutable,get(){return Qn!==void 0&&Gn(i,Qn,Wn),i._snapshot},subscribe(e){let t=Hn(e),n={current:!1},r=ir(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Qn,o=t?.compare??Object.is;if(n)Qn=i,++Wn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=j.Mutable|j.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Qn=a,n&&(i.flags&=~j.RecursedCheck),tr(i)}}};return n?(i.flags=j.Mutable|j.Dirty,i.get=function(){let e=i.flags;if(e&j.Dirty||e&j.Pending&&Jn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Yn(e)}}else e&j.Pending&&(i.flags=e&~j.Pending);return Qn!==void 0&&Gn(i,Qn,Wn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(qn(e),Yn(e),nr())}},i}function ir(e){let t=()=>{let t=Qn;Qn=n,++Wn,n.depsTail=void 0,n.flags=j.Watching|j.RecursedCheck;try{return e()}finally{Qn=t,n.flags&=~j.RecursedCheck,tr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:j.Watching|j.RecursedCheck,notify(){let e=this.flags;e&j.Dirty||e&j.Pending&&Jn(this.deps,this)?t():this.flags=j.Watching},stop(){this.flags=j.None,this.depsTail=void 0,tr(this)}};return t(),n}var ar={};function or(e,t){let n=k.useRef();return r=>{let a=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=i(n.current,a):a}}function sr(e){let t=Oe(),n=k.useContext(e.from?Bn:zn),r=e.from??n,i=t.stores.getMatchStore(r),a=or(e,t),o=u(i,e=>e?a(e):ar);if(o!==ar)return o;(e.shouldThrow??!0)&&T()}function cr(e){return sr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function lr(e){let{select:t,...n}=e;return sr({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function ur(e){return sr({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function dr(e){return sr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function fr(e){return sr({...e,select:t=>e.select?e.select(t.context):t.context})}var pr=class extends Pn{constructor(e){super(e),this.useMatch=e=>sr({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>fr({...e,from:this.id}),this.useSearch=e=>dr({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ur({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>lr({...e,from:this.id}),this.useLoaderData=e=>cr({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function mr(e){return new pr(e)}function hr(){return e=>_r(e)}var gr=class extends Fn{constructor(e){super(e),this.useMatch=e=>sr({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>fr({...e,from:this.id}),this.useSearch=e=>dr({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ur({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>lr({...e,from:this.id}),this.useLoaderData=e=>cr({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function _r(e){return new gr(e)}function vr(e){return new yr(e,{silent:!0}).createRoute}var yr=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=mr(e);return t.isRoot=!1,t},this.silent=t?.silent}};function br(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(me(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r)if(Fe)Fe(a());else throw a();return k.createElement(r,e)};return o.preload=a,o}function xr(e){let t=Oe(),n=`not-found-${u(t.stores.location,e=>e.pathname)}-${u(t.stores.status,e=>e)}`;return(0,A.jsx)(In,{getResetKey:()=>n,onCatch:(t,n)=>{if(Ue(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Ue(t))return e.fallback?.(t);throw t},children:e.children})}function Sr(){return(0,A.jsx)(`p`,{children:`Not Found`})}function Cr(e){return(0,A.jsx)(A.Fragment,{children:e.children})}function wr(e,t,n){return t.options.notFoundComponent?(0,A.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,A.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,A.jsx)(Sr,{})}function Tr(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,A.jsx)(n,{}):null}var Er=(e,t)=>e[0]===t[0]&&e[1]===t[1],Dr=k.memo(function({routeId:e}){let t=Oe();return(0,A.jsx)(Or,{router:t,match:u(t.stores.getMatchStore(e),e=>e)})});function Or({router:e,match:t}){let n=e.routesById[t.routeId],r=Tr(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)?k.Suspense:Cr,l=i?In:Cr,u=o?xr:Cr;return(0,A.jsxs)(n.isRoot?n.options.shellComponent??Cr:Cr,{children:[(0,A.jsx)(zn.Provider,{value:t.routeId,children:(0,A.jsx)(c,{fallback:r,children:(0,A.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Ue(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,A.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return k.createElement(o,e)},children:s?(0,A.jsx)(C,{fallback:r,children:(0,A.jsx)(kr,{match:t})}):(0,A.jsx)(kr,{match:t})})})})}),null]})}var kr=k.memo(function({match:e}){let t=Oe(),n=e.routeId,r=t.routesById[n],i=k.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=k.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,A.jsx)(e,{},i):(0,A.jsx)(Ar,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t._tx)throw t._tx[5];return Tr(t,r)}if(e.status===`notFound`)return wr(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ar=k.memo(function(){let e=Oe(),t=k.useContext(zn),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=u(a,e=>[!!e._notFound,e.error],Er),i=u(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return wr(e,e.routesById[t],r);if(!i)return null;let a=(0,A.jsx)(Dr,{routeId:i});return t===`__root__`?(0,A.jsx)(k.Suspense,{fallback:Tr(e),children:a}):a});function jr(e,t){let n=e[1];e.length=0,n?.(t)}function Mr(){let e=Oe(),t=e._rendered??=[];return e.startTransition=(e,n)=>new Promise((r,i)=>{jr(t,!1),t.push(n,r),k.startTransition(()=>{try{e()}catch(e){t[1]===r&&(t.length=0),i(e)}})}),ie(()=>{let n=e.history.subscribe(e.load);e.updateLatestLocation();let r=e.latestLocation,i=e.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ke(r.publicHref)!==ke(i.publicHref))return e.commitLocation({...i,replace:!0,ignoreBlocker:!0}),n;let a=e.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?t.push(e.stores.matches.get(),t=>{t&&e.emit({type:`onRendered`,...Ot(a,a)})}):e._tx||e.load().catch(console.error),n},[e,e.history]),null}function Nr(){let e=Oe(),t=e.routesById[dt],n=Tr(e,t),r=e.ssr?Cr:k.Suspense,i=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Mr,{}),(0,A.jsx)(r,{fallback:n,children:(0,A.jsx)(Pr,{})})]});return e.options.InnerWrap?(0,A.jsx)(e.options.InnerWrap,{children:i}):i}function Pr(){let e=Oe(),t=e._rendered,n=u(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;ie(()=>{t[0]===n&&jr(t,!0)},[t,n]);let a=i?(0,A.jsx)(Dr,{routeId:i}):null;return(0,A.jsx)(zn.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,A.jsx)(In,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Fr=e=>({createMutableStore:rr,createReadonlyStore:rr,batch:er}),Ir=e=>new Lr(e),Lr=class extends At{constructor(e){super(e,Fr)}};function Rr({router:e,children:t,...n}){Ne(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,A.jsx)(m.Provider,{value:e,children:t});return e.options.Wrap?(0,A.jsx)(e.options.Wrap,{children:r}):r}function zr({router:e,...t}){return(0,A.jsx)(Rr,{router:e,...t,children:(0,A.jsx)(Nr,{})})}var Br=ue((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}var ee=!1,S=-1,te=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-ne<te)}function ie(){if(g=!1,ee){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(S),S=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){S=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(S),S=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Vr=ue(((e,t)=>{t.exports=Br()})),Hr=ue((e=>{var t=Vr(),n=b(),r=ae();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case x:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,C=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function T(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function E(e,t){me++,pe[me]=e.current,e.current=t}var ge=he(null),_e=he(null),ve=he(null),ye=he(null);function be(e,t){switch(E(ve,t),E(_e,e),E(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}T(ge),E(ge,e)}function xe(){T(ge),T(_e),T(ve)}function Se(e){e.memoizedState!==null&&E(ye,e);var t=ge.current,n=Hd(t,e.type);t!==n&&(E(_e,e),E(ge,n))}function Ce(e){_e.current===e&&(T(ge),T(_e)),ye.current===e&&(T(ye),Qf._currentValue=fe)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+we+e+Te}var De=!1;function Oe(e,t){if(!e||De)return``;De=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -18,7 +18,7 @@ Error generating stack: `+e.message+`
|
|
|
18
18
|
font-size: 13px;
|
|
19
19
|
color: ${({theme:e})=>e.color.inkDim};
|
|
20
20
|
max-width: 48ch;
|
|
21
|
-
`,Kr=hr()({component:Ar,notFoundComponent:()=>(0,A.jsx)(Wr,{children:(0,A.jsxs)(_,{$gap:3,style:{alignItems:`center`},children:[(0,A.jsx)(a,{children:`Not found`}),(0,A.jsx)(Gr,{children:`This console has no screen at that address.`}),(0,A.jsx)(c,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),qr=`modulepreload`,Jr=function(e){return`/`+e},Yr={},Xr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Jr(t,n),t=s(t),t in Yr)return;Yr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:qr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Zr=vr(`/_app`)({beforeLoad:async({context:e,location:t})=>{if(!(await e.queryClient.ensureQueryData({queryKey:we.status,queryFn:()=>re(`/api/status`),revalidateIfStale:!0})).authenticated)throw ft({to:`/login`,search:{next:t.href}})},component:br(()=>Xr(()=>import(`./_app-
|
|
21
|
+
`,Kr=hr()({component:Ar,notFoundComponent:()=>(0,A.jsx)(Wr,{children:(0,A.jsxs)(_,{$gap:3,style:{alignItems:`center`},children:[(0,A.jsx)(a,{children:`Not found`}),(0,A.jsx)(Gr,{children:`This console has no screen at that address.`}),(0,A.jsx)(c,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),qr=`modulepreload`,Jr=function(e){return`/`+e},Yr={},Xr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Jr(t,n),t=s(t),t in Yr)return;Yr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:qr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Zr=vr(`/_app`)({beforeLoad:async({context:e,location:t})=>{if(!(await e.queryClient.ensureQueryData({queryKey:we.status,queryFn:()=>re(`/api/status`),revalidateIfStale:!0})).authenticated)throw ft({to:`/login`,search:{next:t.href}})},component:br(()=>Xr(()=>import(`./_app-Bf5ZUmaT.js`),__vite__mapDeps([0,1,2,3])),`component`)}),Qr=vr(`/login`)({validateSearch:e=>typeof e.next==`string`?{next:e.next}:{},component:br(()=>Xr(()=>import(`./login-CkrCC4MV.js`),__vite__mapDeps([4,1,3,5,6])),`component`)}),$r=vr(`/_app/`)({component:br(()=>Xr(()=>import(`./_app.index-Ck_5mdeH.js`),__vite__mapDeps([7,1,2,3,8,9,6,10,11])),`component`)}),ei=vr(`/_app/accounts`)({component:br(()=>Xr(()=>import(`./_app.accounts-BmFfVWsr.js`),__vite__mapDeps([12,1,2,3,13,14,15,16,8,5,9,6,10])),`component`)}),ti=vr(`/_app/keys`)({component:br(()=>Xr(()=>import(`./_app.keys-C2XDmQJL.js`),__vite__mapDeps([17,1,2,3,13,14,15,8,5,6,10])),`component`)}),ni=vr(`/_app/logs`)({component:br(()=>Xr(()=>import(`./_app.logs-C2Xv-Izr.js`),__vite__mapDeps([18,1,2,3,15,8,5,6,10])),`component`)}),ri=vr(`/_app/models`)({component:br(()=>Xr(()=>import(`./_app.models-DCxR_HKM.js`),__vite__mapDeps([19,1,2,3,14,15,16,8,5,9,6])),`component`)}),ii=vr(`/_app/settings`)({component:br(()=>Xr(()=>import(`./_app.settings-SBc1Uaro.js`),__vite__mapDeps([20,1,2,3,5,9,6])),`component`)}),ai=vr(`/_app/usage`)({component:br(()=>Xr(()=>import(`./_app.usage-BO3toUhx.js`),__vite__mapDeps([21,1,2,3,6,10,11])),`component`)}),oi=Zr.update({id:`/_app`,getParentRoute:()=>Kr}),si=Qr.update({id:`/login`,path:`/login`,getParentRoute:()=>Kr}),ci=$r.update({id:`/`,path:`/`,getParentRoute:()=>oi}),li={AppAccountsRoute:ei.update({id:`/accounts`,path:`/accounts`,getParentRoute:()=>oi}),AppKeysRoute:ti.update({id:`/keys`,path:`/keys`,getParentRoute:()=>oi}),AppLogsRoute:ni.update({id:`/logs`,path:`/logs`,getParentRoute:()=>oi}),AppModelsRoute:ri.update({id:`/models`,path:`/models`,getParentRoute:()=>oi}),AppSettingsRoute:ii.update({id:`/settings`,path:`/settings`,getParentRoute:()=>oi}),AppUsageRoute:ai.update({id:`/usage`,path:`/usage`,getParentRoute:()=>oi}),AppIndexRoute:ci},ui={AppRoute:oi._addFileChildren(li),LoginRoute:si},di=Kr._addFileChildren(ui)._addFileTypes();function fi(e){let t=t=>{!(t instanceof Pe)||!t.isUnauthenticated||e.isLoginRoute()||e.onUnauthenticated()};return new He({queryCache:new Ve({onError:t}),mutationCache:new ze({onError:t}),defaultOptions:{queries:{retry:(e,t)=>t instanceof Pe&&t.isUnauthenticated?!1:e<2,staleTime:5e3,refetchOnWindowFocus:!0},mutations:{retry:!1}}})}var pi=S`
|
|
22
22
|
:root {
|
|
23
23
|
color-scheme: light;
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,Ot as o,P as s,W as c,b as l,f as u,k as d,x as f}from"./queries-vY5lJqBe.js";import{a as p}from"./index-
|
|
1
|
+
import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,Ot as o,P as s,W as c,b as l,f as u,k as d,x as f}from"./queries-vY5lJqBe.js";import{a as p}from"./index-JXZlD4dH.js";import{t as m}from"./Lamp-WOotyOTd.js";import{n as h,t as g}from"./Field-DdscQ9OO.js";import{i as _,o as v}from"./States-DPTTYUHL.js";var y=i(o()),b=n(),x=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="OmniGateway">
|
|
2
|
+
<title>OmniGateway</title>
|
|
3
|
+
<!--
|
|
4
|
+
Three inbound lines converging into one outbound line: many provider
|
|
5
|
+
accounts behind a single endpoint, which is the whole product in one mark.
|
|
6
|
+
|
|
7
|
+
Drawn on a solid accent badge rather than as bare strokes so it survives a
|
|
8
|
+
16px tab on either a light or a dark browser chrome without needing two
|
|
9
|
+
variants. Stroke weight is 3 for the same reason — thinner reads as fuzz
|
|
10
|
+
once the icon is scaled down.
|
|
11
|
+
-->
|
|
12
|
+
<rect width="32" height="32" rx="7" fill="#2f5fd0" />
|
|
13
|
+
<g
|
|
14
|
+
fill="none"
|
|
15
|
+
stroke="#ffffff"
|
|
16
|
+
stroke-width="3"
|
|
17
|
+
stroke-linecap="round"
|
|
18
|
+
stroke-linejoin="round"
|
|
19
|
+
>
|
|
20
|
+
<path d="M7 8h5.5l3.5 8" />
|
|
21
|
+
<path d="M7 16h9" />
|
|
22
|
+
<path d="M7 24h5.5l3.5 -8" />
|
|
23
|
+
<path d="M16 16h9" />
|
|
24
|
+
</g>
|
|
25
|
+
</svg>
|
package/public/index.html
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<!-- Self-hosted, like the fonts: the console contacts no third-party origin. -->
|
|
7
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
6
8
|
<title>OmniGateway</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-JXZlD4dH.js"></script>
|
|
8
10
|
<link rel="modulepreload" crossorigin href="/assets/queries-vY5lJqBe.js">
|
|
9
11
|
<link rel="stylesheet" crossorigin href="/assets/index-Co2s5xMk.css">
|
|
10
12
|
</head>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,H as s,M as c,N as l,O as u,h as d,j as f,k as p,m,o as h,s as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,f as b,l as x,o as S,r as C,s as w,t as T,u as E}from"./Rack-DANVhi_U.js";import{a as D,c as O,i as k,l as ee,n as A,o as j,r as M,s as N,t as P}from"./Lamp-CSv_5d5k.js";import{n as F,t as I}from"./Chip-D0YiqYkz.js";import{t as L}from"./Meter-Bm1oQE2U.js";import{a as R,n as z,t as B}from"./States-DPTTYUHL.js";import{i as V,n as H,r as U,t as W}from"./Table-LkPaHBsj.js";import{t as G}from"./Readout-CYg6UOop.js";var K=i(),q=t(l)`
|
|
2
|
-
font-weight: 500;
|
|
3
|
-
display: block;
|
|
4
|
-
max-width: 24ch;
|
|
5
|
-
`,J=t.span`
|
|
6
|
-
font-size: 11px;
|
|
7
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
8
|
-
`,Y=t.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
gap: 6px;
|
|
12
|
-
width: 118px;
|
|
13
|
-
`;function te({credentials:t,health:n,quota:i,usage:a,quotaPollIntervalMs:c,now:l}){let u=D(n,e=>e.credentialId),d=D(i,e=>e.credentialId),f=new Map(a.map(e=>[e.key,e])),m={down:0,warn:1,ok:2,idle:3},h=t.map(e=>({credential:e,status:k(u.get(e.id)??[],l,e.enabled,e.disabledReason),quota:ee(d.get(e.id)??[]),usage:f.get(e.id)})).sort((e,t)=>m[e.status.state]-m[t.status.state]||e.credential.tier-t.credential.tier);return(0,K.jsx)(R,{legend:`Accounts`,meta:`${t.length} connected`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:t.length===0?(0,K.jsx)(B,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,K.jsx)(o,{as:s,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,K.jsx)(e,{children:(0,K.jsxs)(W,{children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(U,{children:`Account`}),(0,K.jsx)(U,{children:`Provider`}),(0,K.jsx)(U,{$align:`right`,children:`Tier`}),(0,K.jsx)(U,{children:`Quota`}),(0,K.jsx)(U,{$align:`right`,children:`TTFT`}),(0,K.jsx)(U,{$align:`right`,children:`Requests`}),(0,K.jsx)(U,{$align:`right`,children:`Last used`})]})}),(0,K.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:i})=>(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(P,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(q,{children:e.label}),t.note===``?null:(0,K.jsx)(J,{children:t.note})]})]})}),(0,K.jsx)(H,{children:(0,K.jsx)(F,{provider:e.provider})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:e.tier}),(0,K.jsx)(H,{children:n===null?(0,K.jsx)(J,{children:`unknown`}):(0,K.jsxs)(Y,{children:[(0,K.jsx)(L,{fraction:n.fraction,label:`${A[n.window.windowType]} window, ${Math.round(n.fraction*100)}% used`}),(0,K.jsx)(r,{children:N(n.window,l,c,y)})]})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:x(t.ttftMs)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:i===void 0?`—`:w(i.requests)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:y(t.lastUsedAt,l)})]},e.id))})]})})})}var X=t.ul`
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
`,Z=t.li`
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
20
|
-
padding: 6px ${({theme:e})=>e.space(3)};
|
|
21
|
-
border-bottom: 1px solid ${({theme:e})=>e.color.rule};
|
|
22
|
-
|
|
23
|
-
&:last-child {
|
|
24
|
-
border-bottom: 0;
|
|
25
|
-
}
|
|
26
|
-
`,Q=t(l)`
|
|
27
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
28
|
-
font-size: 12px;
|
|
29
|
-
max-width: 30ch;
|
|
30
|
-
`,ne=t(u)`
|
|
31
|
-
color: ${({theme:e})=>e.color.down};
|
|
32
|
-
font-size: 11px;
|
|
33
|
-
`;function re({logs:e}){let t=e.slice(0,12);return(0,K.jsx)(R,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/logs`,$size:`sm`,children:`Open logs`}),children:t.length===0?(0,K.jsx)(B,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,K.jsx)(X,{children:t.map(e=>(0,K.jsxs)(Z,{children:[(0,K.jsx)(P,{state:j(e)?`down`:`ok`,label:j(e)?`failed with ${e.status}`:`succeeded`}),(0,K.jsx)(u,{$dim:!0,children:S(e.at)}),(0,K.jsx)(Q,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,K.jsx)(u,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,K.jsx)(f,{}),e.errorCode===null?null:(0,K.jsx)(ne,{children:e.errorCode}),e.attempts>1?(0,K.jsxs)(u,{$dim:!0,children:[e.attempts,`×`]}):null,(0,K.jsx)(u,{$dim:!0,children:x(e.durationMs)}),(0,K.jsx)(u,{$dim:!0,children:b(e.costUsd)})]},e.id))})})}var ie=t.ul`
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
37
|
-
`,ae=t(l)`
|
|
38
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
39
|
-
font-size: 12.5px;
|
|
40
|
-
`,oe=t.div`
|
|
41
|
-
display: flex;
|
|
42
|
-
height: 5px;
|
|
43
|
-
border-radius: 2px;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
46
|
-
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
47
|
-
`,se=t.div`
|
|
48
|
-
flex: ${({$grow:e})=>e} 0 0;
|
|
49
|
-
background: ${({$color:e})=>e};
|
|
50
|
-
opacity: 0.8;
|
|
51
|
-
`,ce=t.div`
|
|
52
|
-
flex: ${({$grow:e})=>e} 0 0;
|
|
53
|
-
`;function le({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let i=Math.max(1,...[...n.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,K.jsx)(R,{legend:`Models`,meta:`${e.length} configured`,actions:(0,K.jsx)(o,{as:s,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,K.jsx)(B,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,K.jsx)(o,{as:s,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,K.jsx)(ie,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,a=[...new Set(e.targets.map(e=>e.provider))];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(ae,{title:e.id,children:e.id}),e.isAlias?(0,K.jsx)(I,{children:`alias`}):null,(0,K.jsx)(I,{$tone:`accent`,children:e.strategy}),(0,K.jsx)(f,{}),(0,K.jsx)(u,{$dim:!0,children:w(t?.requests??0)}),(0,K.jsx)(r,{children:`req`}),(0,K.jsx)(u,{$dim:!0,children:b(t?.costUsd??0)})]}),(0,K.jsxs)(oe,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[a.map(e=>(0,K.jsx)(se,{$color:`var(--p-${e})`,$grow:n/a.length},e)),(0,K.jsx)(ce,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var ue=t.div`
|
|
54
|
-
display: grid;
|
|
55
|
-
grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
|
|
56
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
57
|
-
`;function de({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=O(r,t),a=M(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`;return(0,K.jsxs)(ue,{children:[(0,K.jsx)(G,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,K.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,K.jsx)(G,{legend:`Error rate`,value:E(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,K.jsx)(C,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),(0,K.jsx)(G,{legend:`Time to first token`,value:x(i.ttftP50),unit:`p95 ${x(i.ttftP95)}`,trace:(0,K.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${x(i.ttftP50)}`})}),(0,K.jsx)(G,{legend:`Spend`,value:b(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,K.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${b(i.costUsd)} total`})})]})}var $=36e5;function fe(){let{cadence:e}=v(),t=g(),r=h(e(1e4)),i=d(),o=m(500,e(1e4)),s=_(),l=Date.now(),u=Math.floor((l-$)/6e4)*6e4,f=n({groupBy:`credential`,since:u},e(6e4)),p=t.data??[],y=D(r.data?.health??[],e=>e.credentialId),b=p.filter(e=>k(y.get(e.id)??[],l,e.enabled,e.disabledReason).state===`down`),x=t.isLoading||o.isLoading?`Reading the gateway…`:p.length===0?`No accounts are connected, so every request fails at the router.`:b.length>0?`${b.length} account${b.length===1?` is`:`s are`} out of rotation.`:`All ${p.length} accounts are answering. Nothing needs attention.`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),o.isError?(0,K.jsx)(R,{legend:`Traffic`,children:(0,K.jsx)(z,{legend:`The gateway did not answer`,error:o.error,onRetry:()=>void o.refetch()})}):(0,K.jsxs)(c,{$gap:4,children:[(0,K.jsx)(de,{logs:o.data??[],windowMs:$,now:l}),(0,K.jsx)(te,{credentials:p,health:r.data?.health??[],quota:r.data?.quota??[],usage:f.data??[],quotaPollIntervalMs:s.data?.quotaPollIntervalMs??3e5,now:l}),(0,K.jsxs)(a,{$min:`340px`,$gap:4,children:[(0,K.jsx)(le,{models:i.data??[],logs:o.data??[]}),(0,K.jsx)(re,{logs:o.data??[]})]})]})]})}var pe=fe;export{pe as component};
|