omnigateway 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -17
- package/bin/omni.js +41 -3
- package/gateway.js +41 -3
- package/package.json +1 -1
- package/public/assets/{Confirm-gd8Y6snu.js → Confirm-BO1xS6uH.js} +1 -1
- package/public/assets/{CopyValue-Dds-Ow9a.js → CopyValue-BiiqC_Z2.js} +1 -1
- package/public/assets/{Field-D-14HF0x.js → Field-b0ohzqzR.js} +1 -1
- package/public/assets/{Match-CgNxphvS.js → Match-B2ZxNor3.js} +1 -1
- package/public/assets/{Modal-Dj3LvMS9.js → Modal-OALemCh6.js} +1 -1
- package/public/assets/{Rack-B4c0dbIb.js → Rack-DhVnjAjC.js} +1 -1
- package/public/assets/{Readout-Du15WYx0.js → Readout-VYnpaTMg.js} +1 -1
- package/public/assets/{States-CxLDlCaw.js → States-6G9NsYha.js} +1 -1
- package/public/assets/{TokenBreakdown-BySwFK6Q.js → TokenBreakdown-B9RanXin.js} +1 -1
- package/public/assets/_app-ChlUa_Ov.js +1 -0
- package/public/assets/_app.accounts-CJ6lFXIx.js +64 -0
- package/public/assets/{_app.console-CoaRdkB1.js → _app.console-eFiUh-OA.js} +1 -1
- package/public/assets/{_app.database-CES5ec5g.js → _app.database-BHaMpXld.js} +1 -1
- package/public/assets/{_app.index-DwOZe1A-.js → _app.index-C1vtrxnM.js} +1 -1
- package/public/assets/{_app.keys-B5HrAu2U.js → _app.keys-Bz6-VVJi.js} +1 -1
- package/public/assets/{_app.logs-NbfIexz0.js → _app.logs-DV7O6ZUp.js} +1 -1
- package/public/assets/{_app.models-B1MdFRtQ.js → _app.models-KIctkivt.js} +1 -1
- package/public/assets/{_app.plugins._pluginId-ByMziW8p.js → _app.plugins._pluginId-BbqXEJUB.js} +1 -1
- package/public/assets/{_app.settings-BkDkGkKF.js → _app.settings-B8zjCira.js} +1 -1
- package/public/assets/_app.usage-C4GR06sI.js +83 -0
- package/public/assets/{index-gMv8Qs7m.js → index-B2twwe7y.js} +3 -3
- package/public/assets/{login-cCXnl34r.js → login-CJz2YA-O.js} +1 -1
- package/public/assets/plus-C7a0RuII.js +1 -0
- package/public/assets/queries-BOAAI06M.js +142 -0
- package/public/assets/shared-Rzhx6i7s.js +84 -0
- package/public/assets/{trash-2-ZPh3619D.js → trash-2-C7-QrCg5.js} +1 -1
- package/public/index.html +3 -3
- package/public/assets/_app-Dx_xnlud.js +0 -1
- package/public/assets/_app.accounts-DvBYnbfS.js +0 -64
- package/public/assets/_app.usage-DNpM8Nub.js +0 -83
- package/public/assets/plus-fXfUTt6_.js +0 -1
- package/public/assets/queries-CIOPbRcE.js +0 -142
- package/public/assets/shared-B4o-2quR.js +0 -84
package/README.md
CHANGED
|
@@ -772,29 +772,26 @@ unknown plugin safer. Integrity checking proves you received the bytes the
|
|
|
772
772
|
registry advertised, and nothing about who wrote them or what they do once the
|
|
773
773
|
gateway imports them.
|
|
774
774
|
|
|
775
|
-
|
|
775
|
+
None ship in this repository, deliberately. The first one did, and moving it out
|
|
776
|
+
is what proved the plugin API actually works from outside: while it built as a
|
|
777
|
+
workspace sibling it could reach internal packages no published plugin can, and
|
|
778
|
+
two bugs hid in exactly that gap.
|
|
776
779
|
|
|
777
780
|
| Plugin | What it does |
|
|
778
781
|
| --- | --- |
|
|
779
|
-
| [
|
|
780
|
-
|
|
781
|
-
It is not installed by default, is not in the npm package, and is not in the
|
|
782
|
-
Docker image. Build it from a checkout and install the result:
|
|
782
|
+
| [`@omnigateway/pokemon`](https://github.com/harismawan/omnigateway-plugin-pokemon) | A Pokémon companion. Each gateway key raises one that hatches, evolves, and graduates into a Pokédex on the tokens that key spends, with a shop that spends a wallet of those same tokens. |
|
|
783
783
|
|
|
784
784
|
```bash
|
|
785
|
-
|
|
786
|
-
omni plugin
|
|
785
|
+
omni plugin install @omnigateway/pokemon
|
|
786
|
+
omni plugin verify pokemon
|
|
787
787
|
omni restart
|
|
788
788
|
```
|
|
789
789
|
|
|
790
|
-
The path ends in `pokemon` because the installer takes the target directory name
|
|
791
|
-
from the source and refuses a manifest whose id disagrees with it — so a plugin
|
|
792
|
-
cannot be installed under a name that is not its own.
|
|
793
|
-
|
|
794
790
|
It needs outbound access to `pokeapi.co` and `raw.githubusercontent.com` for
|
|
795
791
|
species data and sprites, which its manifest declares and `omni plugin verify
|
|
796
|
-
pokemon` prints back. Those assets are Nintendo and Game Freak intellectual
|
|
797
|
-
runtime and never vendored into
|
|
792
|
+
pokemon` prints back. Those assets are Nintendo and Game Freak intellectual
|
|
793
|
+
property, fetched at runtime and never vendored — into that repository, this one,
|
|
794
|
+
or anything either publishes.
|
|
798
795
|
|
|
799
796
|
`verify` is the one to run before restarting a gateway that people are using: it
|
|
800
797
|
reaches the same verdict the next boot will, from the same code, without loading
|
|
@@ -819,14 +816,20 @@ from the path:
|
|
|
819
816
|
|
|
820
817
|
```bash
|
|
821
818
|
# wherever you build — a workstation, CI
|
|
822
|
-
bun run build
|
|
823
|
-
tar -czf
|
|
819
|
+
bun run build # your plugin's own build
|
|
820
|
+
tar -czf my-plugin.tgz -C dist my-plugin
|
|
824
821
|
|
|
825
822
|
# on the host
|
|
826
|
-
scp
|
|
827
|
-
ssh gateway-host 'omni plugin install /tmp/
|
|
823
|
+
scp my-plugin.tgz gateway-host:/tmp/
|
|
824
|
+
ssh gateway-host 'omni plugin install /tmp/my-plugin.tgz && omni plugin verify my-plugin && omni restart'
|
|
828
825
|
```
|
|
829
826
|
|
|
827
|
+
Whatever you pack, the manifest must sit at the **root** of the archive once one
|
|
828
|
+
wrapping directory is stripped. A build that nests it — `dist/my-plugin/omni-plugin.json`
|
|
829
|
+
inside a tarball made from the repository root — is refused with "has no
|
|
830
|
+
omni-plugin.json at its root", and that is the most common way a plugin that
|
|
831
|
+
builds fine turns out not to install.
|
|
832
|
+
|
|
830
833
|
Plaintext `http://` is refused outright and always will be: what arrives over
|
|
831
834
|
that fetch is code the gateway process will `import`, so anyone between you and
|
|
832
835
|
the host would be choosing what the gateway runs. Silently upgrading to `https://`
|
package/bin/omni.js
CHANGED
|
@@ -19991,7 +19991,7 @@ var CORE_TABLES = [
|
|
|
19991
19991
|
"usage_rollup",
|
|
19992
19992
|
"virtual_models"
|
|
19993
19993
|
];
|
|
19994
|
-
var CORE_TABLE_REFERENCE = new RegExp(`\\b(?:${CORE_TABLES.join("|")})\\b
|
|
19994
|
+
var CORE_TABLE_REFERENCE = new RegExp(`\\b(?:${CORE_TABLES.join("|")})\\b`, "i");
|
|
19995
19995
|
var PREFIX3 = "plugin_";
|
|
19996
19996
|
function stripNoise(sql) {
|
|
19997
19997
|
let out = "";
|
|
@@ -19999,7 +19999,25 @@ function stripNoise(sql) {
|
|
|
19999
19999
|
while (i < sql.length) {
|
|
20000
20000
|
const c = sql[i];
|
|
20001
20001
|
const next = sql[i + 1];
|
|
20002
|
-
if (c === "'") {
|
|
20002
|
+
if (c === '"' || c === "`" || c === "[") {
|
|
20003
|
+
const close = c === "[" ? "]" : c;
|
|
20004
|
+
out += c;
|
|
20005
|
+
i += 1;
|
|
20006
|
+
while (i < sql.length) {
|
|
20007
|
+
if (sql[i] === close) {
|
|
20008
|
+
if (close !== "]" && sql[i + 1] === close) {
|
|
20009
|
+
out += close + close;
|
|
20010
|
+
i += 2;
|
|
20011
|
+
continue;
|
|
20012
|
+
}
|
|
20013
|
+
break;
|
|
20014
|
+
}
|
|
20015
|
+
out += sql[i];
|
|
20016
|
+
i += 1;
|
|
20017
|
+
}
|
|
20018
|
+
out += close;
|
|
20019
|
+
i += 1;
|
|
20020
|
+
} else if (c === "'") {
|
|
20003
20021
|
i += 1;
|
|
20004
20022
|
while (i < sql.length) {
|
|
20005
20023
|
if (sql[i] === "'") {
|
|
@@ -20041,6 +20059,7 @@ function assertPluginId(pluginId) {
|
|
|
20041
20059
|
throw new Error(`plugin id ${JSON.stringify(pluginId)} is not a valid identifier`);
|
|
20042
20060
|
}
|
|
20043
20061
|
}
|
|
20062
|
+
var CONNECTION_STATEMENT = /^\s*(pragma|attach|detach|vacuum)\b/i;
|
|
20044
20063
|
function prepare(pluginId, sql) {
|
|
20045
20064
|
assertPluginId(pluginId);
|
|
20046
20065
|
const expanded = sql.replace(PLACEHOLDER, (_match, name) => {
|
|
@@ -20049,12 +20068,29 @@ function prepare(pluginId, sql) {
|
|
|
20049
20068
|
}
|
|
20050
20069
|
return tableFor(pluginId, name);
|
|
20051
20070
|
});
|
|
20052
|
-
const
|
|
20071
|
+
const stripped = stripNoise(expanded);
|
|
20072
|
+
const connection = CONNECTION_STATEMENT.exec(stripped);
|
|
20073
|
+
if (connection !== null) {
|
|
20074
|
+
throw new Error(`plugin sql may not ${connection[1]?.toUpperCase()}: the database handle is the gateway's, ` + "and this would reconfigure it for everything sharing it");
|
|
20075
|
+
}
|
|
20076
|
+
const found = CORE_TABLE_REFERENCE.exec(stripped);
|
|
20053
20077
|
if (found !== null) {
|
|
20054
20078
|
throw new Error(`plugin sql may not reference the core table ${found[0]}`);
|
|
20055
20079
|
}
|
|
20056
20080
|
return expanded;
|
|
20057
20081
|
}
|
|
20082
|
+
function schemaObjects(db) {
|
|
20083
|
+
const rows = db.query("SELECT name FROM sqlite_master").all();
|
|
20084
|
+
return new Set(rows.map((row) => row.name));
|
|
20085
|
+
}
|
|
20086
|
+
function assertOwnNamespace(db, pluginId, before) {
|
|
20087
|
+
const prefix = `${PREFIX3}${pluginId}_`;
|
|
20088
|
+
for (const name of schemaObjects(db)) {
|
|
20089
|
+
if (before.has(name) || name.startsWith(prefix) || name.startsWith("sqlite_"))
|
|
20090
|
+
continue;
|
|
20091
|
+
throw new Error(`plugin migration created ${name}, which is outside this plugin's namespace \u2014 ` + `name it {{\u2026}} so it becomes ${prefix}\u2026`);
|
|
20092
|
+
}
|
|
20093
|
+
}
|
|
20058
20094
|
function toBinding(value, index) {
|
|
20059
20095
|
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean" || value instanceof Uint8Array) {
|
|
20060
20096
|
return value;
|
|
@@ -20083,8 +20119,10 @@ function createPluginRepo(db) {
|
|
|
20083
20119
|
throw new Error("migration version must be a positive integer");
|
|
20084
20120
|
}
|
|
20085
20121
|
const sql = prepare(pluginId, migration.sql);
|
|
20122
|
+
const before = schemaObjects(db);
|
|
20086
20123
|
db.transaction(() => {
|
|
20087
20124
|
db.run(sql);
|
|
20125
|
+
assertOwnNamespace(db, pluginId, before);
|
|
20088
20126
|
db.run("INSERT INTO plugin_migrations (plugin_id, version, applied_at) VALUES (?,?,?)", [pluginId, migration.version, Date.now()]);
|
|
20089
20127
|
})();
|
|
20090
20128
|
applied.push(migration.version);
|
package/gateway.js
CHANGED
|
@@ -25465,7 +25465,7 @@ var CORE_TABLES = [
|
|
|
25465
25465
|
"usage_rollup",
|
|
25466
25466
|
"virtual_models"
|
|
25467
25467
|
];
|
|
25468
|
-
var CORE_TABLE_REFERENCE = new RegExp(`\\b(?:${CORE_TABLES.join("|")})\\b
|
|
25468
|
+
var CORE_TABLE_REFERENCE = new RegExp(`\\b(?:${CORE_TABLES.join("|")})\\b`, "i");
|
|
25469
25469
|
var PREFIX3 = "plugin_";
|
|
25470
25470
|
function stripNoise(sql) {
|
|
25471
25471
|
let out = "";
|
|
@@ -25473,7 +25473,25 @@ function stripNoise(sql) {
|
|
|
25473
25473
|
while (i < sql.length) {
|
|
25474
25474
|
const c = sql[i];
|
|
25475
25475
|
const next = sql[i + 1];
|
|
25476
|
-
if (c === "'") {
|
|
25476
|
+
if (c === '"' || c === "`" || c === "[") {
|
|
25477
|
+
const close = c === "[" ? "]" : c;
|
|
25478
|
+
out += c;
|
|
25479
|
+
i += 1;
|
|
25480
|
+
while (i < sql.length) {
|
|
25481
|
+
if (sql[i] === close) {
|
|
25482
|
+
if (close !== "]" && sql[i + 1] === close) {
|
|
25483
|
+
out += close + close;
|
|
25484
|
+
i += 2;
|
|
25485
|
+
continue;
|
|
25486
|
+
}
|
|
25487
|
+
break;
|
|
25488
|
+
}
|
|
25489
|
+
out += sql[i];
|
|
25490
|
+
i += 1;
|
|
25491
|
+
}
|
|
25492
|
+
out += close;
|
|
25493
|
+
i += 1;
|
|
25494
|
+
} else if (c === "'") {
|
|
25477
25495
|
i += 1;
|
|
25478
25496
|
while (i < sql.length) {
|
|
25479
25497
|
if (sql[i] === "'") {
|
|
@@ -25515,6 +25533,7 @@ function assertPluginId(pluginId) {
|
|
|
25515
25533
|
throw new Error(`plugin id ${JSON.stringify(pluginId)} is not a valid identifier`);
|
|
25516
25534
|
}
|
|
25517
25535
|
}
|
|
25536
|
+
var CONNECTION_STATEMENT = /^\s*(pragma|attach|detach|vacuum)\b/i;
|
|
25518
25537
|
function prepare(pluginId, sql) {
|
|
25519
25538
|
assertPluginId(pluginId);
|
|
25520
25539
|
const expanded = sql.replace(PLACEHOLDER, (_match, name) => {
|
|
@@ -25523,12 +25542,29 @@ function prepare(pluginId, sql) {
|
|
|
25523
25542
|
}
|
|
25524
25543
|
return tableFor(pluginId, name);
|
|
25525
25544
|
});
|
|
25526
|
-
const
|
|
25545
|
+
const stripped = stripNoise(expanded);
|
|
25546
|
+
const connection = CONNECTION_STATEMENT.exec(stripped);
|
|
25547
|
+
if (connection !== null) {
|
|
25548
|
+
throw new Error(`plugin sql may not ${connection[1]?.toUpperCase()}: the database handle is the gateway's, ` + "and this would reconfigure it for everything sharing it");
|
|
25549
|
+
}
|
|
25550
|
+
const found = CORE_TABLE_REFERENCE.exec(stripped);
|
|
25527
25551
|
if (found !== null) {
|
|
25528
25552
|
throw new Error(`plugin sql may not reference the core table ${found[0]}`);
|
|
25529
25553
|
}
|
|
25530
25554
|
return expanded;
|
|
25531
25555
|
}
|
|
25556
|
+
function schemaObjects(db) {
|
|
25557
|
+
const rows = db.query("SELECT name FROM sqlite_master").all();
|
|
25558
|
+
return new Set(rows.map((row) => row.name));
|
|
25559
|
+
}
|
|
25560
|
+
function assertOwnNamespace(db, pluginId, before) {
|
|
25561
|
+
const prefix = `${PREFIX3}${pluginId}_`;
|
|
25562
|
+
for (const name of schemaObjects(db)) {
|
|
25563
|
+
if (before.has(name) || name.startsWith(prefix) || name.startsWith("sqlite_"))
|
|
25564
|
+
continue;
|
|
25565
|
+
throw new Error(`plugin migration created ${name}, which is outside this plugin's namespace \u2014 ` + `name it {{\u2026}} so it becomes ${prefix}\u2026`);
|
|
25566
|
+
}
|
|
25567
|
+
}
|
|
25532
25568
|
function toBinding(value, index) {
|
|
25533
25569
|
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean" || value instanceof Uint8Array) {
|
|
25534
25570
|
return value;
|
|
@@ -25557,8 +25593,10 @@ function createPluginRepo(db) {
|
|
|
25557
25593
|
throw new Error("migration version must be a positive integer");
|
|
25558
25594
|
}
|
|
25559
25595
|
const sql = prepare(pluginId, migration.sql);
|
|
25596
|
+
const before = schemaObjects(db);
|
|
25560
25597
|
db.transaction(() => {
|
|
25561
25598
|
db.run(sql);
|
|
25599
|
+
assertOwnNamespace(db, pluginId, before);
|
|
25562
25600
|
db.run("INSERT INTO plugin_migrations (plugin_id, version, applied_at) VALUES (?,?,?)", [pluginId, migration.version, Date.now()]);
|
|
25563
25601
|
})();
|
|
25564
25602
|
applied.push(migration.version);
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{lt as e}from"./queries-
|
|
1
|
+
import{lt as e}from"./queries-BOAAI06M.js";import{t}from"./Modal-OALemCh6.js";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";import a from"styled-components";var o=a.p`
|
|
2
2
|
font-size: 13px;
|
|
3
3
|
color: ${({theme:e})=>e.color.inkDim};
|
|
4
4
|
`;function s({open:a,onOpenChange:s,title:c,body:l,confirmLabel:u,busy:d,onConfirm:f}){return r(t,{open:a,onOpenChange:s,title:c,width:`420px`,footer:i(n,{children:[r(e,{type:`button`,onClick:()=>s(!1),children:`Cancel`}),r(e,{type:`button`,$variant:`danger`,disabled:d===!0,onClick:f,children:u})]}),children:r(o,{children:l})})}export{s as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{at as e,ut as t}from"./queries-
|
|
1
|
+
import{at as e,ut as t}from"./queries-BOAAI06M.js";import{c as n}from"./Rack-DhVnjAjC.js";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import l from"styled-components";var u=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=n(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=n(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=n(`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`}]]);function m(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 h(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=m(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var g=l.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: stretch;
|
|
4
4
|
gap: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e}from"./queries-
|
|
1
|
+
import{$ as e}from"./queries-BOAAI06M.js";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import i from"styled-components";var a=`
|
|
2
2
|
width: 100%;
|
|
3
3
|
border-radius: 3px;
|
|
4
4
|
transition: border-color 120ms ease;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_t as e,ht as t,pt as n}from"./queries-
|
|
1
|
+
import{_t as e,ht as t,pt as n}from"./queries-BOAAI06M.js";import{n as r}from"./matchContext-BOenO3J2.js";import*as i from"react";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";function c(e){return e?.isNotFound===!0}function l(e){return o(u,{...e})}var u=class extends i.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?i.createElement(this.props.errorComponent??d,{error:e,reset:this.reset}):this.props.children}};function d({error:e}){let[t,n]=i.useState(!1);return s(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[s(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[o(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),o(`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`})]}),o(`div`,{style:{height:`.25rem`}}),t?o(`div`,{children:o(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?o(`code`,{children:e.message}):null})}):null]})}function f(e){let r=t(),i=`not-found-${n(r.stores.location,e=>e.pathname)}-${n(r.stores.status,e=>e)}`;return o(l,{getResetKey:()=>i,onCatch:(t,n)=>{if(c(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(c(t))return e.fallback?.(t);throw t},children:e.children})}function p(){return o(`p`,{children:`Not Found`})}function m(e){return o(a,{children:e.children})}function h(e,t,n){return t.options.notFoundComponent?o(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?o(e.options.defaultNotFoundComponent,{...n}):o(p,{})}function g(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?o(n,{}):null}var _=(e,t)=>e[0]===t[0]&&e[1]===t[1],v=i.memo(function({routeId:e}){let r=t();return o(y,{router:r,match:n(r.stores.getMatchStore(e),e=>e)})});function y({router:t,match:n}){let a=t.routesById[n.routeId],u=g(t,a),d=a.options.errorComponent??t.options.defaultErrorComponent,p=a.options.onCatch??t.options.defaultOnCatch,h=a.isRoot?a.options.notFoundComponent??t.options.notFoundRoute?.options.component:a.options.notFoundComponent,_=n.ssr===!1||n.ssr===`data-only`,v=a.options.wrapInSuspense??u??(a.options.errorComponent?.preload||_)?i.Suspense:m,y=d?l:m,x=h?f:m;return s(a.isRoot?a.options.shellComponent??m:m,{children:[o(r.Provider,{value:n.routeId,children:o(v,{fallback:u,children:o(y,{getResetKey:()=>n,errorComponent:d,onCatch:(e,t)=>{if(c(e))throw e.routeId??=n.routeId,e;p?.(e,t)},children:o(x,{fallback:e=>{if(e.routeId??=n.routeId,e.routeId!==n.routeId)throw e;return i.createElement(h,e)},children:_?o(e,{fallback:u,children:o(b,{match:n})}):o(b,{match:n})})})})}),null]})}var b=i.memo(function({match:e}){let n=t(),r=e.routeId,a=n.routesById[r],s=i.useMemo(()=>{let t=(a.options.remountDeps??n.options.defaultRemountDeps)?.({routeId:r,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return t?JSON.stringify(t):void 0},[r,e.loaderDeps,e._strictParams,e._strictSearch,a.options.remountDeps,n.options.defaultRemountDeps]),c=i.useMemo(()=>{let e=a.options.component??n.options.defaultComponent;return e?o(e,{},s):o(x,{})},[s,a.options.component,n.options.defaultComponent]);if(e.status===`pending`){if(n._tx)throw n._tx[5];return g(n,a)}if(e.status===`notFound`)return h(n,a,e.error);if(e.status===`error`)throw e.error;return c}),x=i.memo(function(){let e=t(),a=i.useContext(r),s,c,l;{let t=e.stores.getMatchStore(a);[s,c]=n(t,e=>[!!e._notFound,e.error],_),l=n(e.stores.ids,e=>e[e.indexOf(a)+1])}if(s)return h(e,e.routesById[a],c);if(!l)return null;let u=o(v,{routeId:l});return a===`__root__`?o(i.Suspense,{fallback:g(e),children:u}):u});export{l as a,m as i,x as n,c as o,g as r,v as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,it as t,ut as n}from"./queries-CIOPbRcE.js";import{c as r}from"./Rack-B4c0dbIb.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-9ps0Qd15.js";import*as f from"react";import{useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import*as _ from"react-dom";import v from"styled-components";var ee=r(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),te=Object.defineProperty,y=(e,t)=>te(e,`name`,{value:t,configurable:!0});function b(e,t){return f.useReducer((e,n)=>t[e][n]??e,e)}y(b,`useStateMachine`);var x=y(e=>{let{present:t,children:n}=e,r=S(t),i=typeof n==`function`?n({present:r.isPresent}):f.Children.only(n),a=w(r.ref,ne(i));return typeof n==`function`||r.isPresent?f.cloneElement(i,{ref:a}):null},`Presence`);function S(e){let[t,n]=f.useState(),r=f.useRef(null),i=f.useRef(e),a=f.useRef(`none`),o=f.useRef(void 0),[c,l]=b(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return f.useEffect(()=>{c===`mounted`?(a.current=o.current??T(r.current),o.current=void 0):a.current=`none`},[c]),s(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=T(t);e?(o.current=s,l(`MOUNT`)):s===`none`||t?.display===`none`?l(`UNMOUNT`):l(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,l]),s(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=y(a=>{let o=T(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(l(`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=y(e=>{e.target===t&&(a.current=T(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)}}l(`ANIMATION_END`)},[t,l]),{isPresent:[`mounted`,`unmountSuspended`].includes(c),ref:f.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=T(t)}else r.current=null;n(e)},[])}}y(S,`usePresence`);function C(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}y(C,`setRef`);function w(...e){let t=f.useRef(e);return t.current=e,f.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=C(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():C(n[e],null)}}},[])}y(w,`useStableComposedRefs`);function T(e){return e?.animationName||`none`}y(T,`getAnimationName`);function ne(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(ne,`getElementRef`);var re=Object.defineProperty,ie=(e,t)=>re(e,`name`,{value:t,configurable:!0}),E=f.useId||(()=>void 0),ae=0;function D(e){let[t,n]=f.useState(E());return s(()=>{e||n(e=>e??String(ae++))},[e]),e||(t?`radix-${t}`:``)}ie(D,`useId`);var oe=Object.defineProperty,se=(e,t)=>oe(e,`name`,{value:t,configurable:!0});function O(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>((...e)=>t.current?.(...e)),[])}se(O,`useCallbackRef`);var ce=Object.defineProperty,k=(e,t)=>ce(e,`name`,{value:t,configurable:!0}),le=`dismissableLayer.update`,ue=`dismissableLayer.pointerDownOutside`,de=`dismissableLayer.focusOutside`,fe,pe=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),me=f.forwardRef(k(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...p}=e,m=f.useContext(pe),[g,_]=f.useState(null),v=g?.ownerDocument??globalThis?.document,[,ee]=f.useState({}),te=a(t,_),y=Array.from(m.layers),[b]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),x=b?y.indexOf(b):-1,S=g?y.indexOf(g):-1,C=m.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=f.useRef(!1),ne=_e(e=>{s?.(e),u?.(e),e.defaultPrevented||d?.()},{ownerDocument:v,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...m.branches].some(t=>t.contains(e));return w&&!t},[m.branches,w])}),re=ve(e=>{if(r&&T.current)return;let t=e.target;[...m.branches].some(e=>e.contains(t))||(c?.(e),u?.(e),e.defaultPrevented||d?.())},v),ie=g?S===y.length-1:!1,E=O(e=>{e.key===`Escape`&&(o?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))});return f.useEffect(()=>{if(ie)return v.addEventListener(`keydown`,E,{capture:!0}),()=>v.removeEventListener(`keydown`,E,{capture:!0})},[v,ie,E]),f.useEffect(()=>{if(g)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(fe=v.body.style.pointerEvents,v.body.style.pointerEvents=`none`),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),ye(),()=>{n&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=fe))}},[g,v,n,m]),f.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),ye())},[g,m]),f.useEffect(()=>{let e=k(()=>ee({}),`handleUpdate`);return document.addEventListener(le,e),()=>document.removeEventListener(le,e)},[]),h(i.div,{...p,ref:te,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:l(e.onFocusCapture,re.onFocusCapture),onBlurCapture:l(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:l(e.onPointerDownCapture,ne.onPointerDownCapture)})},`DismissableLayer`));function he(){let e=f.useContext(pe),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}k(he,`useDismissableLayerSurface`);var ge=k(()=>!0,`IS_TRUE`);function _e(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ge}=t,s=O(e),c=f.useRef(!1),l=f.useRef(!1),u=f.useRef(new Map),d=f.useRef(()=>{});return f.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}k(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}k(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}k(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}k(p,`handleInteractionBubble`);let m=k(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||be(ue,s,p,{discrete:!0})};if(k(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!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`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:k(()=>c.current=!0,`onPointerDownCapture`)}}k(_e,`usePointerDownOutside`);function ve(e,t=globalThis?.document){let n=O(e),r=f.useRef(!1);return f.useEffect(()=>{let e=k(e=>{e.target&&!r.current&&be(de,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:k(()=>r.current=!0,`onFocusCapture`),onBlurCapture:k(()=>r.current=!1,`onBlurCapture`)}}k(ve,`useFocusOutside`);function ye(){let e=new CustomEvent(le);document.dispatchEvent(e)}k(ye,`dispatchUpdate`);function be(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?c(i,a):i.dispatchEvent(a)}k(be,`handleAndDispatchCustomEvent`);var xe=Object.defineProperty,A=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Se=`focusScope.autoFocusOnMount`,Ce=`focusScope.autoFocusOnUnmount`,we={bubbles:!1,cancelable:!0},Te=f.forwardRef(A(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...c}=e,[l,u]=f.useState(null),d=O(o),p=O(s),m=f.useRef(null),g=a(t,u),_=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let e=function(e){if(_.paused||!l)return;let t=e.target;l.contains(t)?m.current=t:M(m.current,{select:!0})},t=function(e){if(_.paused||!l)return;let t=e.relatedTarget;t!==null&&(l.contains(t)||M(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&M(l)};A(e,`handleFocusIn`),A(t,`handleFocusOut`),A(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,l,_.paused]),f.useEffect(()=>{if(l){je.add(_);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(Se,we);l.addEventListener(Se,d),l.dispatchEvent(t),t.defaultPrevented||(Ee(Ne(j(l)),{select:!0}),document.activeElement===e&&M(l))}return()=>{l.removeEventListener(Se,d),setTimeout(()=>{let t=new CustomEvent(Ce,we);l.addEventListener(Ce,p),l.dispatchEvent(t),t.defaultPrevented||M(e??document.body,{select:!0}),l.removeEventListener(Ce,p),je.remove(_)},0)}}},[l,d,p,_]);let v=f.useCallback(e=>{if(!n&&!r||_.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]=De(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&M(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&M(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,_.paused]);return h(i.div,{tabIndex:-1,...c,ref:g,onKeyDown:v})},`FocusScope`));function Ee(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(M(r,{select:t}),document.activeElement!==n)return}A(Ee,`focusFirst`);function De(e){let t=j(e);return[Oe(t,e),Oe(t.reverse(),e)]}A(De,`getTabbableEdges`);function j(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:A(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}A(j,`getTabbableCandidates`);function Oe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ke(r,{upTo:t})))return r}A(Oe,`findVisible`);function ke(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}A(ke,`isHidden`);function Ae(e){return e instanceof HTMLInputElement&&`select`in e}A(Ae,`isSelectableInput`);function M(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ae(e)&&t&&e.select()}}A(M,`focus`);var je=Me();function Me(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=N(e,t),e.unshift(t)},remove(t){e=N(e,t),e[0]?.resume()}}}A(Me,`createFocusScopesStack`);function N(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}A(N,`arrayRemove`);function Ne(e){return e.filter(e=>e.tagName!==`A`)}A(Ne,`removeLinks`);var Pe=Object.defineProperty,Fe=f.forwardRef(((e,t)=>Pe(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[a,o]=f.useState(!1);s(()=>o(!0),[]);let c=n||a&&globalThis?.document?.body;return c?_.createPortal(h(i.div,{...r,ref:t}),c):null},`Portal`)),Ie=Object.defineProperty,Le=(e,t)=>Ie(e,`name`,{value:t,configurable:!0}),P=0,F=null;function Re(e){return ze(),e.children}Le(Re,`FocusGuards`);function ze(){f.useEffect(()=>{F||={start:Be(),end:Be()};let{start:e,end:t}=F;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),P++,()=>{P===1&&(F?.start.remove(),F?.end.remove(),F=null),P=Math.max(0,P-1)}},[])}Le(ze,`useFocusGuards`);function Be(){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}Le(Be,`createFocusGuard`);var I=function(){return I=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},I.apply(this,arguments)};function Ve(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 He(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 L=`right-scroll-bar-position`,R=`width-before-scroll-bar`,Ue=`with-scroll-bars-hidden`,We=`--removed-body-scroll-bar-size`;function z(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ge(e,t){var n=p(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 Ke=typeof window<`u`?f.useLayoutEffect:f.useEffect,qe=new WeakMap;function Je(e,t){var n=Ge(t||null,function(t){return e.forEach(function(e){return z(e,t)})});return Ke(function(){var t=qe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||z(e,null)}),i.forEach(function(e){r.has(e)||z(e,a)})}qe.set(n,e)},[e]),n}function Ye(e){return e}function Xe(e,t){t===void 0&&(t=Ye);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 Ze(e){e===void 0&&(e={});var t=Xe(null);return t.options=I({async:!0,ssr:!1},e),t}var Qe=function(e){var t=e.sideCar,n=Ve(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 f.createElement(r,I({},n))};Qe.isSideCarExport=!0;function $e(e,t){return e.useMedium(t),Qe}var et=Ze(),B=function(){},V=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:B}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,ee=v===void 0?`div`:v,te=e.gapMode,y=Ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=p,x=Je([n,t]),S=I(I({},y),i);return f.createElement(f.Fragment,null,u&&f.createElement(b,{sideCar:et,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:te}),o?f.cloneElement(f.Children.only(s),I(I({},S),{ref:x})):f.createElement(ee,I({},S,{className:c,ref:x}),s))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:R,zeroRight:L};var tt,nt=function(){if(tt)return tt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nt();return t&&e.setAttribute(`nonce`,t),e}function it(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function at(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ot=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rt())&&(it(t,n),at(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},st=function(){var e=ot();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ct=function(){var e=st();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},lt={left:0,top:0,right:0,gap:0},H=function(e){return parseInt(e||``,10)||0},ut=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[H(n),H(r),H(i)]},dt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return lt;var t=ut(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])}},ft=ct(),U=`data-scroll-locked`,pt=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{$ as e,it as t,ut as n}from"./queries-BOAAI06M.js";import{c as r}from"./Rack-DhVnjAjC.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-9ps0Qd15.js";import*as f from"react";import{useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import*as _ from"react-dom";import v from"styled-components";var ee=r(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),te=Object.defineProperty,y=(e,t)=>te(e,`name`,{value:t,configurable:!0});function b(e,t){return f.useReducer((e,n)=>t[e][n]??e,e)}y(b,`useStateMachine`);var x=y(e=>{let{present:t,children:n}=e,r=S(t),i=typeof n==`function`?n({present:r.isPresent}):f.Children.only(n),a=w(r.ref,ne(i));return typeof n==`function`||r.isPresent?f.cloneElement(i,{ref:a}):null},`Presence`);function S(e){let[t,n]=f.useState(),r=f.useRef(null),i=f.useRef(e),a=f.useRef(`none`),o=f.useRef(void 0),[c,l]=b(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return f.useEffect(()=>{c===`mounted`?(a.current=o.current??T(r.current),o.current=void 0):a.current=`none`},[c]),s(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=T(t);e?(o.current=s,l(`MOUNT`)):s===`none`||t?.display===`none`?l(`UNMOUNT`):l(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,l]),s(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=y(a=>{let o=T(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(l(`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=y(e=>{e.target===t&&(a.current=T(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)}}l(`ANIMATION_END`)},[t,l]),{isPresent:[`mounted`,`unmountSuspended`].includes(c),ref:f.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=T(t)}else r.current=null;n(e)},[])}}y(S,`usePresence`);function C(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}y(C,`setRef`);function w(...e){let t=f.useRef(e);return t.current=e,f.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=C(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():C(n[e],null)}}},[])}y(w,`useStableComposedRefs`);function T(e){return e?.animationName||`none`}y(T,`getAnimationName`);function ne(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(ne,`getElementRef`);var re=Object.defineProperty,ie=(e,t)=>re(e,`name`,{value:t,configurable:!0}),E=f.useId||(()=>void 0),ae=0;function D(e){let[t,n]=f.useState(E());return s(()=>{e||n(e=>e??String(ae++))},[e]),e||(t?`radix-${t}`:``)}ie(D,`useId`);var oe=Object.defineProperty,se=(e,t)=>oe(e,`name`,{value:t,configurable:!0});function O(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>((...e)=>t.current?.(...e)),[])}se(O,`useCallbackRef`);var ce=Object.defineProperty,k=(e,t)=>ce(e,`name`,{value:t,configurable:!0}),le=`dismissableLayer.update`,ue=`dismissableLayer.pointerDownOutside`,de=`dismissableLayer.focusOutside`,fe,pe=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),me=f.forwardRef(k(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...p}=e,m=f.useContext(pe),[g,_]=f.useState(null),v=g?.ownerDocument??globalThis?.document,[,ee]=f.useState({}),te=a(t,_),y=Array.from(m.layers),[b]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),x=b?y.indexOf(b):-1,S=g?y.indexOf(g):-1,C=m.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=f.useRef(!1),ne=_e(e=>{s?.(e),u?.(e),e.defaultPrevented||d?.()},{ownerDocument:v,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...m.branches].some(t=>t.contains(e));return w&&!t},[m.branches,w])}),re=ve(e=>{if(r&&T.current)return;let t=e.target;[...m.branches].some(e=>e.contains(t))||(c?.(e),u?.(e),e.defaultPrevented||d?.())},v),ie=g?S===y.length-1:!1,E=O(e=>{e.key===`Escape`&&(o?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))});return f.useEffect(()=>{if(ie)return v.addEventListener(`keydown`,E,{capture:!0}),()=>v.removeEventListener(`keydown`,E,{capture:!0})},[v,ie,E]),f.useEffect(()=>{if(g)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(fe=v.body.style.pointerEvents,v.body.style.pointerEvents=`none`),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),ye(),()=>{n&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=fe))}},[g,v,n,m]),f.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),ye())},[g,m]),f.useEffect(()=>{let e=k(()=>ee({}),`handleUpdate`);return document.addEventListener(le,e),()=>document.removeEventListener(le,e)},[]),h(i.div,{...p,ref:te,style:{pointerEvents:C?w?`auto`:`none`:void 0,...e.style},onFocusCapture:l(e.onFocusCapture,re.onFocusCapture),onBlurCapture:l(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:l(e.onPointerDownCapture,ne.onPointerDownCapture)})},`DismissableLayer`));function he(){let e=f.useContext(pe),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}k(he,`useDismissableLayerSurface`);var ge=k(()=>!0,`IS_TRUE`);function _e(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ge}=t,s=O(e),c=f.useRef(!1),l=f.useRef(!1),u=f.useRef(new Map),d=f.useRef(()=>{});return f.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}k(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}k(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}k(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}k(p,`handleInteractionBubble`);let m=k(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||be(ue,s,p,{discrete:!0})};if(k(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!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`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:k(()=>c.current=!0,`onPointerDownCapture`)}}k(_e,`usePointerDownOutside`);function ve(e,t=globalThis?.document){let n=O(e),r=f.useRef(!1);return f.useEffect(()=>{let e=k(e=>{e.target&&!r.current&&be(de,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:k(()=>r.current=!0,`onFocusCapture`),onBlurCapture:k(()=>r.current=!1,`onBlurCapture`)}}k(ve,`useFocusOutside`);function ye(){let e=new CustomEvent(le);document.dispatchEvent(e)}k(ye,`dispatchUpdate`);function be(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?c(i,a):i.dispatchEvent(a)}k(be,`handleAndDispatchCustomEvent`);var xe=Object.defineProperty,A=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Se=`focusScope.autoFocusOnMount`,Ce=`focusScope.autoFocusOnUnmount`,we={bubbles:!1,cancelable:!0},Te=f.forwardRef(A(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...c}=e,[l,u]=f.useState(null),d=O(o),p=O(s),m=f.useRef(null),g=a(t,u),_=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let e=function(e){if(_.paused||!l)return;let t=e.target;l.contains(t)?m.current=t:M(m.current,{select:!0})},t=function(e){if(_.paused||!l)return;let t=e.relatedTarget;t!==null&&(l.contains(t)||M(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&M(l)};A(e,`handleFocusIn`),A(t,`handleFocusOut`),A(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,l,_.paused]),f.useEffect(()=>{if(l){je.add(_);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(Se,we);l.addEventListener(Se,d),l.dispatchEvent(t),t.defaultPrevented||(Ee(Ne(j(l)),{select:!0}),document.activeElement===e&&M(l))}return()=>{l.removeEventListener(Se,d),setTimeout(()=>{let t=new CustomEvent(Ce,we);l.addEventListener(Ce,p),l.dispatchEvent(t),t.defaultPrevented||M(e??document.body,{select:!0}),l.removeEventListener(Ce,p),je.remove(_)},0)}}},[l,d,p,_]);let v=f.useCallback(e=>{if(!n&&!r||_.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]=De(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&M(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&M(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,_.paused]);return h(i.div,{tabIndex:-1,...c,ref:g,onKeyDown:v})},`FocusScope`));function Ee(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(M(r,{select:t}),document.activeElement!==n)return}A(Ee,`focusFirst`);function De(e){let t=j(e);return[Oe(t,e),Oe(t.reverse(),e)]}A(De,`getTabbableEdges`);function j(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:A(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}A(j,`getTabbableCandidates`);function Oe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ke(r,{upTo:t})))return r}A(Oe,`findVisible`);function ke(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}A(ke,`isHidden`);function Ae(e){return e instanceof HTMLInputElement&&`select`in e}A(Ae,`isSelectableInput`);function M(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ae(e)&&t&&e.select()}}A(M,`focus`);var je=Me();function Me(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=N(e,t),e.unshift(t)},remove(t){e=N(e,t),e[0]?.resume()}}}A(Me,`createFocusScopesStack`);function N(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}A(N,`arrayRemove`);function Ne(e){return e.filter(e=>e.tagName!==`A`)}A(Ne,`removeLinks`);var Pe=Object.defineProperty,Fe=f.forwardRef(((e,t)=>Pe(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[a,o]=f.useState(!1);s(()=>o(!0),[]);let c=n||a&&globalThis?.document?.body;return c?_.createPortal(h(i.div,{...r,ref:t}),c):null},`Portal`)),Ie=Object.defineProperty,Le=(e,t)=>Ie(e,`name`,{value:t,configurable:!0}),P=0,F=null;function Re(e){return ze(),e.children}Le(Re,`FocusGuards`);function ze(){f.useEffect(()=>{F||={start:Be(),end:Be()};let{start:e,end:t}=F;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),P++,()=>{P===1&&(F?.start.remove(),F?.end.remove(),F=null),P=Math.max(0,P-1)}},[])}Le(ze,`useFocusGuards`);function Be(){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}Le(Be,`createFocusGuard`);var I=function(){return I=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},I.apply(this,arguments)};function Ve(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 He(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 L=`right-scroll-bar-position`,R=`width-before-scroll-bar`,Ue=`with-scroll-bars-hidden`,We=`--removed-body-scroll-bar-size`;function z(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ge(e,t){var n=p(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 Ke=typeof window<`u`?f.useLayoutEffect:f.useEffect,qe=new WeakMap;function Je(e,t){var n=Ge(t||null,function(t){return e.forEach(function(e){return z(e,t)})});return Ke(function(){var t=qe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||z(e,null)}),i.forEach(function(e){r.has(e)||z(e,a)})}qe.set(n,e)},[e]),n}function Ye(e){return e}function Xe(e,t){t===void 0&&(t=Ye);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 Ze(e){e===void 0&&(e={});var t=Xe(null);return t.options=I({async:!0,ssr:!1},e),t}var Qe=function(e){var t=e.sideCar,n=Ve(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 f.createElement(r,I({},n))};Qe.isSideCarExport=!0;function $e(e,t){return e.useMedium(t),Qe}var et=Ze(),B=function(){},V=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:B}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,ee=v===void 0?`div`:v,te=e.gapMode,y=Ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=p,x=Je([n,t]),S=I(I({},y),i);return f.createElement(f.Fragment,null,u&&f.createElement(b,{sideCar:et,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:te}),o?f.cloneElement(f.Children.only(s),I(I({},S),{ref:x})):f.createElement(ee,I({},S,{className:c,ref:x}),s))});V.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},V.classNames={fullWidth:R,zeroRight:L};var tt,nt=function(){if(tt)return tt;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nt();return t&&e.setAttribute(`nonce`,t),e}function it(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function at(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ot=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rt())&&(it(t,n),at(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},st=function(){var e=ot();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ct=function(){var e=st();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},lt={left:0,top:0,right:0,gap:0},H=function(e){return parseInt(e||``,10)||0},ut=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[H(n),H(r),H(i)]},dt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return lt;var t=ut(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])}},ft=ct(),U=`data-scroll-locked`,pt=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
|
.${Ue} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,D as t,E as n,ct as r,dt as i,et as a,ft as o,it as s,k as c,lt as l,nt as u,ut as d}from"./queries-
|
|
1
|
+
import{$ as e,D as t,E as n,ct as r,dt as i,et as a,ft as o,it as s,k as c,lt as l,nt as u,ut as d}from"./queries-BOAAI06M.js";import{t as f}from"./index-B2twwe7y.js";import{E as p,O as m,T as h,_ as ee,r as te,t as g}from"./Lamp-BDf7-dMa.js";import{createContext as _,createElement as v,forwardRef as y,use as b,useCallback as x,useContext as S,useId as C,useMemo as w,useState as T}from"react";import{jsx as E,jsxs as D}from"react/jsx-runtime";import O,{css as k}from"styled-components";var A=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ne=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),re=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),j=e=>{let t=re(e);return t.charAt(0).toUpperCase()+t.slice(1)},M={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`},ie=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ae=_({}),oe=()=>S(ae),se=y(({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=``}=oe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return v(`svg`,{ref:c,...M,width:t??l??M.width,height:t??l??M.height,stroke:e??f,strokeWidth:m,className:A(`lucide`,p,i),...!a&&!ie(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>v(e,t)),...Array.isArray(a)?a:[a]])}),N=(e,t)=>{let n=y(({className:n,...r},i)=>v(se,{ref:i,iconNode:t,className:A(`lucide-${ne(j(e))}`,`lucide-${e}`,n),...r}));return n.displayName=j(e),n},ce=N(`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`}]]),P=N(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),le=N(`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`}]]),ue=N(`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`}]]),F=N(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),de=N(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),I=N(`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`}]]),L=N(`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`}]]),R=N(`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`}]]),z=N(`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`}]]),B=N(`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`}]]),V=N(`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`}]]),H=N(`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`}]]),fe=N(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),U=_(null);function pe({children:e}){let[t,n]=T(!0),r=x(()=>n(e=>!e),[]),i=w(()=>({live:t,toggle:r,cadence:e=>t?e:!1}),[t,r]);return E(U,{value:i,children:e})}function W(){return b(U)??{live:!1,toggle:()=>{},cadence:()=>!1}}var me=O.svg`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e}from"./queries-
|
|
1
|
+
import{$ as e}from"./queries-BOAAI06M.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r from"styled-components";var i=r.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 6px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,it as t,lt as n,nt as r,q as i}from"./queries-
|
|
1
|
+
import{$ as e,it as t,lt as n,nt as r,q as i}from"./queries-BOAAI06M.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s,{keyframes as c}from"styled-components";var l=s.section`
|
|
2
2
|
background: ${({theme:e})=>e.color.panel};
|
|
3
3
|
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
4
4
|
border-radius: ${({theme:e})=>e.radius.panel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,s as t}from"./Rack-
|
|
1
|
+
import{c as e,s as t}from"./Rack-DhVnjAjC.js";import{S as n}from"./Lamp-BDf7-dMa.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{keyframes as o}from"styled-components";var s=e(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),c=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),l=new Intl.NumberFormat(`en-US`);function u(e){return`${l.format(e.inputTokens)} input, ${l.format(e.outputTokens)} output, ${l.format(e.cacheReadTokens)} cache read, ${l.format(e.cacheWriteTokens)} cache write tokens`}var d=a.span`
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
flex-wrap: wrap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./Match-B2ZxNor3.js";import{i as t,n}from"./Rack-DhVnjAjC.js";import{jsx as r}from"react/jsx-runtime";var i=()=>r(t,{children:r(n,{children:r(e,{})})});export{i as component};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{A as e,C as t,E as n,J as r,T as i,Y as a,c as o,dt as s,t as c,w as l}from"./shared-Rzhx6i7s.js";import{$ as u,A as d,W as f,at as p,et as m,f as h,g,h as _,l as v,lt as y,nt as b,r as x,rt as S,u as C,ut as w,v as T,z as E}from"./queries-BOAAI06M.js";import{a as D,c as O,t as k}from"./Rack-DhVnjAjC.js";import{n as A,r as ee,t as te}from"./CopyValue-BiiqC_Z2.js";import{t as ne}from"./plus-C7a0RuII.js";import{t as j}from"./trash-2-C7-QrCg5.js";import{t as re}from"./Modal-OALemCh6.js";import{t as M}from"./Toggle-DMk46RX2.js";import{t as N}from"./Confirm-BO1xS6uH.js";import{D as P,S as F,T as I,a as L,g as ie,h as ae,i as oe,m as se,n as ce,o as le,p as ue,s as R,t as de,u as fe,v as pe,w as me,x as he,y as ge}from"./Lamp-BDf7-dMa.js";import{t as _e}from"./Chip-BltJSw8A.js";import{i as z,n as B,r as ve,t as V}from"./Field-b0ohzqzR.js";import{t as ye}from"./Meter-stpt3vQu.js";import{a as H,i as U,n as be,r as xe,t as Se}from"./States-6G9NsYha.js";import{i as Ce,n as W,r as G,t as we}from"./Table-CVDZ69Zx.js";import{t as Te}from"./catalog-BBKm8Ih8.js";import*as Ee from"react";import{Fragment as De,forwardRef as Oe,useCallback as ke,useEffect as Ae,useState as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var je=O(`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`}]]),Me=Object.keys(Te);function Ne(e){return Te[e].authTypes}function Pe(e){return Ne(e).includes(`oauth`)?`oauth`:`apiKey`}var Fe={oauth:`Authorize in the browser`,apiKey:`Paste an API key`},Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},Ie={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.`,kilo:`Approve the code on Kilo's device page. This dialog finishes on its own.`,grok:`Authorize in the browser. When it redirects to 127.0.0.1, paste the whole URL.`,custom:`Enter endpoint metadata and API key.`},Le={openai:`http://localhost:1455/auth/callback?code=…`,grok:`http://127.0.0.1:56121/callback?code=…`},Re=X.ol`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: ${({theme:e})=>e.space(3)};
|
|
5
|
+
`,ze=X.div`
|
|
6
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
7
|
+
font-size: 26px;
|
|
8
|
+
letter-spacing: 0.22em;
|
|
9
|
+
text-align: center;
|
|
10
|
+
padding: ${({theme:e})=>e.space(3)};
|
|
11
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
12
|
+
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
13
|
+
border-radius: ${({theme:e})=>e.radius.control};
|
|
14
|
+
`,Be=X.p`
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
color: ${({theme:e})=>e.color.down};
|
|
17
|
+
`,Ve=X.p`
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
20
|
+
`;function He({open:e,credentials:t,onOpenChange:n,onConnected:r}){let[i,a]=K(`anthropic`),[o,s]=K(Pe(`anthropic`)),[c,l]=K(``),[d,f]=K(null),[m,g]=K(``),[_,S]=K(``),w=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[T,E]=K(``),[D,O]=K(``),[k,A]=K(`chat_completions`),[ee,ne]=K(``),[j,M]=K(null),N=C(),P=v(),F=h(),I=ke(()=>{f(null),g(``),S(``),E(``),O(``),A(`chat_completions`),ne(``),M(null),l(``),N.reset(),P.reset(),F.reset()},[N,P,F]),L=ke(e=>{e||I(),n(e)},[n,I]);return Ae(()=>{if(d===null||d.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await x(d.flowId);if(e)return;if(t.status===`complete`){I(),n(!1),r();return}}catch(t){if(e)return;M(U(t)),f(null);return}e||(i=setTimeout(()=>void t(),d.pollIntervalMs))},i=setTimeout(()=>void t(),d.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[d,r,n,I]),J(re,{open:e,onOpenChange:L,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:d===null?Y(q,{children:[J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:N.isPending||F.isPending,onClick:()=>{if(M(null),o===`apiKey`){F.mutate({provider:i,apiKey:ee,label:c.trim()||void 0,...i===`custom`?{endpointId:_,endpointLabel:T,origin:D,protocol:k}:{}},{onSuccess:()=>{I(),n(!1),r()},onError:e=>M(U(e))});return}N.mutate({provider:i,label:c.trim().length===0?Z[i]:c.trim()},{onSuccess:e=>f(e),onError:e=>M(U(e))})},children:o===`apiKey`?F.isPending?`Adding…`:`Add API key`:N.isPending?`Starting…`:`Start authorization`})]}):d.kind===`device`?J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}):Y(q,{children:[J(y,{type:`button`,onClick:()=>L(!1),children:`Cancel`}),J(y,{type:`button`,$variant:`primary`,disabled:P.isPending||m.trim().length===0,onClick:()=>{d!==null&&(M(null),P.mutate({flowId:d.flowId,code:m.trim()},{onSuccess:()=>{I(),n(!1),r()},onError:e=>M(U(e))}))},children:P.isPending?`Finishing…`:`Finish connecting`})]}),children:Y(Re,{children:[d===null?Y(p,{$gap:3,children:[J(V,{label:`Provider`,children:e=>J(z,{...e,value:i,onChange:e=>{let t=e.target.value;a(t),s(Pe(t))},children:Me.map(e=>J(`option`,{value:e,children:Z[e]},e))})}),Ne(i).length>1?J(V,{label:`How to connect`,children:e=>J(z,{...e,value:o,onChange:e=>s(e.target.value),children:Ne(i).map(e=>J(`option`,{value:e,children:Fe[e]},e))})}):null,i===`custom`?Y(q,{children:[w.length===0?null:J(V,{label:`Existing endpoint`,children:e=>Y(z,{...e,value:_,onChange:e=>{let t=w.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){S(``),E(``),O(``),A(`chat_completions`);return}S(String(t.providerData.endpointId)),E(String(t.providerData.endpointLabel)),O(String(t.providerData.origin)),A(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[J(`option`,{value:``,children:`Create new endpoint`}),w.map(e=>J(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),J(V,{label:`Endpoint ID`,children:e=>J(B,{...e,value:_,onChange:e=>S(e.target.value)})}),J(V,{label:`Endpoint label`,children:e=>J(B,{...e,value:T,onChange:e=>E(e.target.value)})}),J(V,{label:`Server origin`,children:e=>J(B,{...e,value:D,placeholder:`https://server.example`,onChange:e=>O(e.target.value)})}),D.trim().toLowerCase().startsWith(`http://`)?J(Be,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,J(V,{label:`Protocol`,children:e=>Y(z,{...e,value:k,onChange:e=>A(e.target.value),children:[J(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),J(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,o===`apiKey`?J(V,{label:`API key`,children:e=>J(B,{...e,type:`password`,value:ee,autoComplete:`off`,onChange:e=>ne(e.target.value)})}):null,J(V,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>J(B,{...e,value:c,placeholder:Z[i],onChange:e=>l(e.target.value)})})]}):Y(p,{$gap:3,children:[Y(p,{$gap:1,children:[J(u,{children:`Step 1 — authorize`}),J(b,{$gap:2,children:Y(y,{as:`a`,href:d.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[J(je,{}),`Open `,Z[i]]})}),J(te,{value:d.authorizeUrl,label:`Copy authorization link`})]}),d.userCode===null?null:Y(p,{$gap:1,children:[J(u,{children:`Step 2 — enter this code`}),J(ze,{children:d.userCode})]}),d.kind===`device`?Y(Ve,{children:[Ie[i],` Waiting for authorization…`]}):J(V,{label:`Authorization code`,hint:Ie[i],...j===null?{}:{problem:j},children:e=>J(B,{...e,value:m,autoFocus:!0,placeholder:Le[i]??`code#state`,onChange:e=>g(e.target.value)})})]}),j===null||d?.kind===`pkce`?null:J(Be,{children:j})]})})}var Ue=[`axis`],We=Oe((e,n)=>Ee.createElement(t,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Ue,tooltipPayloadSearcher:a,categoricalChartProps:e,ref:n})),Ge=X(b)`
|
|
21
|
+
gap: ${({theme:e})=>e.space(5)};
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
`,Q=X.div`
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 2px;
|
|
27
|
+
`,$=X.span`
|
|
28
|
+
font-size: 11.5px;
|
|
29
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
30
|
+
`,Ke={budget:`1 4`,projection:`6 4`},qe=`projected`;function Je(e){let t=new Map;for(let{key:n,points:r}of e)for(let e of r){let r=t.get(e.at)??{at:e.at};r[n]=e.percent,t.set(e.at,r)}return[...t.values()].sort((e,t)=>e.at-t.at)}function Ye(e,t,n){return[Math.min(e,...n.map(e=>e.pace.from.at)),Math.max(t,...n.map(e=>e.pace.to.at))]}function Xe(e,t){let n=t?.windowStartsAt??null;return n===null||e.resetsAt===null?null:n-(e.resetsAt-n)}function Ze({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>{let t=L(n,e.windowType);return{window:e,estimate:t,since:Xe(e,t)}}),o=a.map(e=>e.since).filter(e=>e!==null),s=o.length===0?0:Math.min(...o),c=d({credentialId:e,since:s},o.length>0),l=c.data?.samples??[],u=c.data?.gatewayRates??[];return J(p,{$gap:4,children:a.map(e=>J($e,{window:e.window,estimate:e.estimate,since:e.since,samples:l.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:u.find(t=>t.windowType===e.window.windowType),pollIntervalMs:r,now:i},e.window.windowType))})}function Qe(e,t,n){let r=ge(e,t);return r===`ok`?`lasts the window`:r!==`empty`||t.exhaustsAt===null?`unknown`:t.exhaustsAt<=n?`empty now`:`empty ~${me(t.exhaustsAt-n)} before it resets`}function $e({window:t,estimate:a,since:d,samples:f,gatewayRate:h,pollIntervalMs:g,now:_}){let v=ce[t.windowType],y=t.limit===null?`${F(t.used)} used`:`${F(t.used)} of ${F(t.limit)} used`;if(a===void 0||a.stale||fe(t,_,g))return Y(p,{$gap:2,children:[Y(b,{$gap:2,$wrap:!0,children:[Y(u,{children:[v,` window`]}),J($,{children:y})]}),J($,{children:`reading is stale`})]});let x=pe(ae(f),t),S=x.flatMap(e=>{let t=oe(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),C=ue(t,a),w=Je([...x,...S.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...C===null?[]:[{key:qe,points:[C.from,C.to]}]]),T=new Set(x.map(e=>e.key)),E=Math.max(100,...C===null?[]:[C.from.percent,C.to.percent].map(e=>Math.ceil(e)));return Y(p,{$gap:2,children:[Y(b,{$gap:2,$wrap:!0,children:[Y(u,{children:[v,` window`]}),J($,{children:y})]}),Y(Ge,{children:[Y(Q,{children:[J(u,{children:`Window average`}),J(m,{children:a.ratePerHour===null?`unknown`:`${F(a.ratePerHour)}/h`})]}),Y(Q,{children:[J(u,{children:`Estimate`}),J(m,{children:Qe(t,a,_)})]}),Y(Q,{children:[J(u,{children:`Projected`}),J(m,{children:C===null?`unknown`:`${Math.round(C.to.percent)}% of limit by reset`})]}),Y(Q,{children:[J(u,{children:`This gateway accounts for`}),J(m,{children:h?.gatewayRatePerHour===void 0||h.gatewayRatePerHour===null?`unknown`:`${F(h.gatewayRatePerHour)} tokens/h`})]})]}),t.limit===null?J($,{children:`no ceiling reported`}):t.resetsAt===null||d===null?J($,{children:`no reset reported`}):x.length===0?J($,{children:`not yet observed`}):Y(q,{children:[J(u,{children:[`Used, this window and the one before`,...S.length===0?[]:[`budget dotted`],...C===null?[]:[`projection dashed`]].join(` · `)}),J(c,{$height:160,children:J(s,{width:`100%`,height:`100%`,children:Y(We,{data:w,margin:{top:4,right:8,bottom:4,left:4},children:[J(e,{stroke:`var(--rule)`,vertical:!1}),J(i,{dataKey:`at`,type:`number`,scale:`time`,domain:Ye(d,t.resetsAt,S),tickFormatter:e=>he(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:40}),J(l,{domain:[0,E],allowDataOverflow:!0,tickFormatter:e=>`${Math.round(e)}%`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(r,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t.find(e=>T.has(String(e.dataKey)));if(n===void 0||typeof n.value!=`number`)return null;let r=n.payload.at;return Y(o,{children:[J(`div`,{children:he(r)}),Y(`div`,{children:[n.value.toFixed(1),`% used`]})]})}}),x.map(e=>J(n,{type:`monotone`,dataKey:e.key,stroke:`var(--accent)`,strokeWidth:2,dot:e.points.length===1&&{r:2.5,fill:`var(--accent)`,stroke:`var(--accent)`},connectNulls:!0,isAnimationActive:!1},e.key)),S.map(e=>J(n,{type:`linear`,dataKey:e.key,stroke:`var(--ink-faint)`,strokeWidth:1.5,strokeDasharray:Ke.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),C===null?null:J(n,{type:`linear`,dataKey:qe,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:Ke.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}var et=[`anthropic`,`openai`,`kimi`,`kilo`,`grok`,`custom`],tt={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},nt=X(H)`
|
|
31
|
+
border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
|
|
32
|
+
`,rt=X(B)`
|
|
33
|
+
width: 100%;
|
|
34
|
+
min-width: 140px;
|
|
35
|
+
height: 26px;
|
|
36
|
+
font-family: ${({theme:e})=>e.font.sans};
|
|
37
|
+
font-size: 12.5px;
|
|
38
|
+
background: transparent;
|
|
39
|
+
border-color: transparent;
|
|
40
|
+
|
|
41
|
+
&:hover:not(:disabled),
|
|
42
|
+
&:focus {
|
|
43
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
44
|
+
border-color: ${({theme:e})=>e.color.ruleStrong};
|
|
45
|
+
}
|
|
46
|
+
`,it=X(ve)`
|
|
47
|
+
width: 62px;
|
|
48
|
+
height: 26px;
|
|
49
|
+
`,at=X.span`
|
|
50
|
+
display: block;
|
|
51
|
+
padding-left: 9px;
|
|
52
|
+
font-size: 11px;
|
|
53
|
+
color: ${({theme:e})=>e.color.inkDim};
|
|
54
|
+
`,ot=X.div`
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: 96px 1fr;
|
|
57
|
+
align-items: center;
|
|
58
|
+
min-width: 208px;
|
|
59
|
+
gap: 6px;
|
|
60
|
+
`,st=X.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 4px;
|
|
64
|
+
`;function ct(){let e=f();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function lt(){let{cadence:e}=D(),t=g(),n=_(e(1e4)),r=E(),i=T(),{commit:a}=ct(),[o,s]=K(!1),[c,l]=K(null),[d,f]=K(new Set),m=e=>f(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),h=Date.now(),v=t.data??[],x=R(n.data?.health??[],e=>e.credentialId),C=R(n.data?.quota??[],e=>e.credentialId),O=R(n.data?.burn??[],e=>e.credentialId),te=r.data?.quotaPollIntervalMs??3e5,re=v.filter(e=>e.enabled).length,F=t.isLoading?`Reading connected accounts…`:v.length===0?`No provider credentials are connected, so every request fails at the router.`:`${re} of ${v.length} accounts are enabled and eligible for routing.`;return Y(q,{children:[J(k,{legend:`Accounts`,title:`Provider accounts`,summary:F,actions:Y(y,{type:`button`,$variant:`primary`,onClick:()=>s(!0),children:[J(ne,{}),`Connect an account`]})}),t.isError?J(H,{legend:`Accounts`,children:J(be,{error:t.error,onRetry:()=>void t.refetch()})}):t.isLoading?J(H,{legend:`Accounts`,children:J(xe,{rows:5})}):v.length===0?J(H,{legend:`Accounts`,children:J(Se,{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:J(y,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>s(!0),children:`Connect an account`})})}):J(p,{$gap:4,children:et.filter(e=>v.some(t=>t.provider===e)).map(e=>{let t=v.filter(t=>t.provider===e);return J(nt,{$provider:e,legend:tt[e],meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:J(S,{children:Y(we,{children:[J(`thead`,{children:Y(`tr`,{children:[J(G,{$width:`24%`,children:`Account`}),J(G,{$width:`20%`,children:`Sign-in`}),J(G,{$align:`right`,$width:`86px`,children:`Tier`}),J(G,{$align:`right`,$width:`94px`,children:`Weight`}),J(G,{$align:`center`,$width:`86px`,children:`Enabled`}),J(G,{$width:`240px`,children:`Quota`}),J(G,{$align:`right`,$width:`88px`,children:`TTFT`}),J(G,{$align:`right`,$width:`130px`,children:`Token expires`}),J(G,{$width:`76px`})]})}),J(`tbody`,{children:t.map(e=>{let t=le(x.get(e.id)??[],h,e.enabled,e.disabledReason),n=C.get(e.id)??[],r=O.get(e.id)??[],i=ie(n),o=d.has(e.id);return Y(De,{children:[Y(Ce,{children:[Y(W,{children:[Y(b,{$gap:2,children:[J(de,{state:t.state,label:t.note===``?`healthy`:t.note}),J(rt,{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}a(e.id,{label:n})}})]}),t.note===``?null:J(at,{children:t.note})]}),J(W,{children:Y(b,{$gap:1,children:[J(_e,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:J(u,{children:e.accountEmail})]})}),J(W,{$align:`right`,children:J(it,{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}a(e.id,{tier:n})}})}),J(W,{$align:`right`,children:J(it,{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}a(e.id,{weight:n})}})}),J(W,{$align:`center`,children:J(M,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>a(e.id,{enabled:t})})}),J(W,{children:i.length===0?J(u,{children:`unknown`}):J(st,{children:i.map(({window:e,fraction:t})=>Y(ot,{children:[J(ye,{fraction:t,label:`${ce[e.windowType]} window, ${Math.round(t*100)}% used`}),J(u,{children:se(e,h,te,P,L(r,e.windowType))})]},e.windowType))})}),J(W,{$align:`right`,$mono:!0,children:I(t.ttftMs)}),J(W,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:P(e.expiresAt,h)}),J(W,{$align:`right`,children:Y(b,{$gap:1,$justify:`flex-end`,children:[n.length===0?null:J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":o,"aria-label":`${o?`Hide`:`Show`} quota history for ${e.label}`,title:`${o?`Hide`:`Show`} quota history for ${e.label}`,onClick:()=>m(e.id),children:J(o?ee:A,{})}),J(w,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>l(e),children:J(j,{})})]})})]}),o?J(Ce,{children:J(W,{colSpan:9,children:J(Ze,{credentialId:e.id,windows:n,burn:r,pollIntervalMs:te,now:h})})}):null]},e.id)})})]})})},e)})}),J(He,{open:o,credentials:t.data??[],onOpenChange:s,onConnected:()=>void t.refetch()}),J(N,{open:c!==null,onOpenChange:e=>{e||l(null)},title:`Remove account`,body:c===null?``:`Removing "${c.label}" deletes its stored token. Any model target pointing at ${tt[c.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:i.isPending,onConfirm:()=>{c!==null&&i.mutate(c.id,{onSettled:()=>l(null)})}})]})}var ut=lt;export{ut as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e,nt as t,t as n,tt as r}from"./queries-
|
|
1
|
+
import{d as e,nt as t,t as n,tt as r}from"./queries-BOAAI06M.js";import{a as i,t as a}from"./Rack-DhVnjAjC.js";import{S as o}from"./Lamp-BDf7-dMa.js";import{i as s}from"./Field-b0ohzqzR.js";import{a as c,n as l,r as u,t as d}from"./States-6G9NsYha.js";import{useLayoutEffect as f,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"styled-components";var v=[100,200,500],y=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],b=_(t)`
|
|
2
2
|
gap: ${({theme:e})=>e.space(2)};
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
`,x=_(s)`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,H as t,I as n,K as r,M as i,N as a,Q as o,S as s,V as c,_ as l,a as u,at as d,b as f,lt as p,m,nt as h,ot as g,rt as _,st as v,w as y}from"./queries-
|
|
1
|
+
import{$ as e,H as t,I as n,K as r,M as i,N as a,Q as o,S as s,V as c,_ as l,a as u,at as d,b as f,lt as p,m,nt as h,ot as g,rt as _,st as v,w as y}from"./queries-BOAAI06M.js";import{c as b,t as x}from"./Rack-DhVnjAjC.js";import{t as S}from"./Confirm-BO1xS6uH.js";import{C as ee,E as C,T as w,b as T}from"./Lamp-BDf7-dMa.js";import{r as E,t as D}from"./Field-b0ohzqzR.js";import{t as O}from"./Meter-stpt3vQu.js";import{a as k,i as A,n as j,r as M,t as N}from"./States-6G9NsYha.js";import{i as P,n as F,r as I,t as te}from"./Table-CVDZ69Zx.js";import{t as L}from"./Readout-VYnpaTMg.js";import{n as R}from"./reasons-Cb8yF4Oy.js";import{useQueryClient as ne}from"@tanstack/react-query";import{useCallback as re,useEffect as ie,useState as z}from"react";import{Fragment as ae,jsx as B,jsxs as V}from"react/jsx-runtime";import H from"styled-components";var U=b(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),W=b(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),G=b(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),K=b(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),q={systemd:`systemd is capturing this process, so a restart asks the manager to bring the unit back rather than signalling the gateway itself.`,container:`This gateway is running in a container, so a restart is an exit and the container's restart policy decides what happens next.`,none:`Nothing is supervising this process. It was started directly, and whatever stops it leaves it stopped.`},J=H.p`
|
|
2
2
|
font-size: 12px;
|
|
3
3
|
color: ${({theme:e})=>e.color.inkDim};
|
|
4
4
|
max-width: 72ch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,D as t,G as n,O as r,Q as i,at as a,dt as o,et as s,g as c,h as l,it as u,lt as d,nt as f,ot as p,rt as m,z as h}from"./queries-
|
|
1
|
+
import{$ as e,D as t,G as n,O as r,Q as i,at as a,dt as o,et as s,g as c,h as l,it as u,lt as d,nt as f,ot as p,rt as m,z as h}from"./queries-BOAAI06M.js";import{a as g,r as _,t as v}from"./Rack-DhVnjAjC.js";import{n as y,t as b}from"./TokenBreakdown-B9RanXin.js";import{D as x,E as S,O as C,S as w,T,_ as E,a as D,d as O,f as k,g as ee,l as te,m as A,n as j,o as M,r as ne,s as N,t as P,x as F}from"./Lamp-BDf7-dMa.js";import{n as I,t as L}from"./Chip-BltJSw8A.js";import{t as re}from"./Meter-stpt3vQu.js";import{a as R,n as z,t as B}from"./States-6G9NsYha.js";import{i as V,n as H,r as U,t as W}from"./Table-CVDZ69Zx.js";import{t as G}from"./Readout-VYnpaTMg.js";import{Fragment as K,jsx as q,jsxs as J}from"react/jsx-runtime";import Y from"styled-components";var X=Y(p)`
|
|
2
2
|
font-weight: 500;
|
|
3
3
|
display: block;
|
|
4
4
|
max-width: 24ch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,C as t,O as n,P as r,R as i,at as a,et as o,lt as s,nt as c,ot as l,p as u,rt as d,ut as f}from"./queries-
|
|
1
|
+
import{$ as e,C as t,O as n,P as r,R as i,at as a,et as o,lt as s,nt as c,ot as l,p as u,rt as d,ut as f}from"./queries-BOAAI06M.js";import{o as p,t as m}from"./Rack-DhVnjAjC.js";import{n as h,r as g,t as _}from"./CopyValue-BiiqC_Z2.js";import{t as v}from"./plus-C7a0RuII.js";import{t as y}from"./Modal-OALemCh6.js";import{t as b}from"./Toggle-DMk46RX2.js";import{t as x}from"./Confirm-BO1xS6uH.js";import{C as S}from"./Lamp-BDf7-dMa.js";import{t as C}from"./Chip-BltJSw8A.js";import{n as w,r as T,t as E}from"./Field-b0ohzqzR.js";import{t as D}from"./Meter-stpt3vQu.js";import{a as O,i as k,n as A,r as j,t as M}from"./States-6G9NsYha.js";import{i as N,n as P,r as F,t as I}from"./Table-CVDZ69Zx.js";import{Fragment as L,useState as R}from"react";import{Fragment as z,jsx as B,jsxs as V}from"react/jsx-runtime";import H from"styled-components";var U=[{dimension:`requests`,window:`1m`},{dimension:`requests`,window:`5h`},{dimension:`requests`,window:`1w`},{dimension:`tokens`,window:`1m`},{dimension:`tokens`,window:`5h`},{dimension:`tokens`,window:`1w`},{dimension:`spend`,window:`5h`},{dimension:`spend`,window:`1w`},{dimension:`concurrency`,window:null}];function W(e){return e.window===null?e.dimension:`${e.dimension}:${e.window}`}var G={requests:`Requests`,tokens:`Tokens`,spend:`Spend`,concurrency:`Concurrent`},K={"1m":`per minute`,"5h":`per 5 hours`,"1w":`per week`};function q(e){let t=G[e.dimension];return e.window===null?t:`${t} ${K[e.window]}`}function J(e,t){return e===`spend`?`$${t<1?t.toFixed(4):t.toFixed(2)}`:t.toLocaleString(`en-US`)}function Y(e){return e.used===null||e.limit<=0?null:Math.max(0,e.used/e.limit)}function X(e){let t=null,n=-1;for(let r of e){let e=Y(r);e!==null&&e>n&&(t=r,n=e)}return t}function Z(e){let t={};for(let e of U)t[W(e)]=``;if(e===null)return t;for(let n of U){let r=n.window===null?e.concurrency:n.dimension===`requests`?e.requests?.[n.window]:n.dimension===`tokens`?e.tokens?.[n.window]:n.window===`1m`?void 0:e.spend?.[n.window];r!=null&&(t[W(n)]=String(r))}return t}function Q(e){let t={},n={},r={},i;for(let a of U){let o=(e[W(a)]??``).trim();if(o.length===0)continue;let s=Number(o),c=a.dimension===`spend`;if(!Number.isFinite(s)||s<=0||!c&&!Number.isInteger(s))return{problem:c?`${q(a)} must be an amount above zero, or blank for no limit.`:`${q(a)} must be a whole number above zero, or blank for no limit.`};a.window===null?i=s:a.dimension===`requests`?t[a.window]=s:a.dimension===`tokens`?n[a.window]=s:a.window!==`1m`&&(r[a.window]=s)}return{limits:{...Object.keys(t).length>0?{requests:t}:{},...Object.keys(n).length>0?{tokens:n}:{},...Object.keys(r).length>0?{spend:r}:{},...i===void 0?{}:{concurrency:i}}}}var ee=H.div`
|
|
2
2
|
display: grid;
|
|
3
3
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
4
4
|
gap: ${({theme:e})=>e.space(2)};
|