@feltdb/core 0.4.13 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands.js +38 -24
- package/dist/cli/index.js +1 -1
- package/dist/create/cli.js +23 -3
- package/dist/create/create.js +4 -6
- package/dist/create/docker-compose-generator.js +23 -5
- package/dist/create/package-versions.js +1 -1
- package/dist/studio/components/ConflictExplorer.d.ts.map +1 -1
- package/dist/studio/components/index.js +1 -1
- package/dist/studio/{components-bHTARBin.js → components-9kDSWiGL.js} +7 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-app/assets/{index-BqKquLuU.js → index-DVdvmf69.js} +1 -1
- package/dist/studio-app/index.html +1 -1
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import http from 'http';
|
|
7
|
+
import net from 'net';
|
|
7
8
|
import { createRequire } from 'module';
|
|
8
9
|
import { spawn, spawnSync } from 'child_process';
|
|
9
10
|
import { createFeltDB, diffFlowSpec, formatFlowSpec, parseFlowSpec, planFlowSpecMigration, validateFlowSpec } from '@feltdb/core';
|
|
10
|
-
const RELEASE_VERSION = '0.4.13';
|
|
11
11
|
function loadProjectEnvironment(file = path.resolve('.env.local')) {
|
|
12
12
|
if (!fs.existsSync(file))
|
|
13
13
|
return;
|
|
@@ -24,6 +24,19 @@ function loadProjectEnvironment(file = path.resolve('.env.local')) {
|
|
|
24
24
|
process.env[key] = value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
async function availablePort(preferred, host = '127.0.0.1') {
|
|
28
|
+
for (let port = preferred; port < preferred + 100; port += 1) {
|
|
29
|
+
const available = await new Promise(resolve => {
|
|
30
|
+
const server = net.createServer();
|
|
31
|
+
server.unref();
|
|
32
|
+
server.once('error', () => resolve(false));
|
|
33
|
+
server.listen(port, host, () => server.close(() => resolve(true)));
|
|
34
|
+
});
|
|
35
|
+
if (available)
|
|
36
|
+
return port;
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`No available port found between ${preferred} and ${preferred + 99}`);
|
|
39
|
+
}
|
|
27
40
|
export async function handleCommand(command, args) {
|
|
28
41
|
switch (command) {
|
|
29
42
|
case 'studio':
|
|
@@ -387,35 +400,36 @@ async function handleDev(args) {
|
|
|
387
400
|
const runtimeNamespace = config.runtime === 'managed'
|
|
388
401
|
? process.env.VITE_FELTDB_MANAGED_NAMESPACE || config.namespace
|
|
389
402
|
: config.namespace;
|
|
390
|
-
const
|
|
391
|
-
const
|
|
392
|
-
|
|
403
|
+
const requestedAppPort = Number(args.includes('--port') ? args[args.indexOf('--port') + 1] || '5173' : '5173');
|
|
404
|
+
const requestedStudioPort = Number(args.includes('--studio-port') ? args[args.indexOf('--studio-port') + 1] || '3000' : '3000');
|
|
405
|
+
const appPort = String(await availablePort(requestedAppPort));
|
|
406
|
+
const studioPort = String(await availablePort(requestedStudioPort));
|
|
407
|
+
if (appPort !== String(requestedAppPort))
|
|
408
|
+
console.log(`Port ${requestedAppPort} is busy; using ${appPort} for the application.`);
|
|
409
|
+
if (studioPort !== String(requestedStudioPort))
|
|
410
|
+
console.log(`Port ${requestedStudioPort} is busy; using ${studioPort} for Studio.`);
|
|
411
|
+
process.env.APP_PORT = appPort;
|
|
412
|
+
process.env.STUDIO_PORT = studioPort;
|
|
413
|
+
let selfHostedStarted = false;
|
|
393
414
|
const stopSelfHosted = () => {
|
|
394
|
-
if (
|
|
395
|
-
|
|
415
|
+
if (selfHostedStarted) {
|
|
416
|
+
spawnSync('docker', ['compose', 'stop', 'feltdb'], { cwd: process.cwd(), stdio: 'ignore' });
|
|
417
|
+
selfHostedStarted = false;
|
|
418
|
+
}
|
|
396
419
|
};
|
|
397
420
|
if (config.runtime === 'self-hosted') {
|
|
398
421
|
const docker = spawnSync('docker', ['version'], { stdio: 'ignore' });
|
|
399
422
|
if (docker.status !== 0) {
|
|
400
423
|
throw new Error('Self-hosted development requires Docker Desktop or Docker Engine. Install Docker, start it, and rerun npm run dev.');
|
|
401
424
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
'-v', `${containerName}-data:/data`,
|
|
411
|
-
image,
|
|
412
|
-
'--allow-origin', `http://127.0.0.1:${appPort}`,
|
|
413
|
-
'--allow-origin', `http://127.0.0.1:${studioPort}`,
|
|
414
|
-
], { stdio: 'inherit' });
|
|
415
|
-
selfHosted.once('exit', code => {
|
|
416
|
-
if (code && code !== 0)
|
|
417
|
-
console.error(`Self-hosted FeltDB server exited with status ${code}`);
|
|
418
|
-
});
|
|
425
|
+
if (!fs.existsSync(path.join(process.cwd(), 'docker-compose.yml'))) {
|
|
426
|
+
throw new Error('Self-hosted project is missing docker-compose.yml. Regenerate the project with create-feltdb.');
|
|
427
|
+
}
|
|
428
|
+
console.log('Building and starting the generated self-hosted FeltDB service...');
|
|
429
|
+
const compose = spawnSync('docker', ['compose', 'up', '--build', '--detach', 'feltdb'], { cwd: process.cwd(), stdio: 'inherit' });
|
|
430
|
+
if (compose.status !== 0)
|
|
431
|
+
throw new Error(`docker compose failed with status ${compose.status ?? 'unknown'}`);
|
|
432
|
+
selfHostedStarted = true;
|
|
419
433
|
(_c = process.env).VITE_FELTDB_URL || (_c.VITE_FELTDB_URL = 'http://127.0.0.1:7700');
|
|
420
434
|
}
|
|
421
435
|
console.log('FeltDB Dev Server');
|
|
@@ -426,7 +440,7 @@ async function handleDev(args) {
|
|
|
426
440
|
const open = !args.includes('--no-open');
|
|
427
441
|
console.log(`Application: http://127.0.0.1:${appPort}`);
|
|
428
442
|
console.log(`Studio: http://127.0.0.1:${studioPort}\n`);
|
|
429
|
-
const viteArgs = ['--host', '127.0.0.1', '--port', appPort, ...(open ? ['--open'] : [])];
|
|
443
|
+
const viteArgs = ['--host', '127.0.0.1', '--port', appPort, '--strictPort', ...(open ? ['--open'] : [])];
|
|
430
444
|
const vite = runLocalVite(viteArgs, false);
|
|
431
445
|
let shuttingDown = false;
|
|
432
446
|
const stopVite = () => { if (!vite.killed)
|
package/dist/cli/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import * as path from 'path';
|
|
|
23
23
|
import * as readline from 'readline';
|
|
24
24
|
import { getClient } from './api-client.js';
|
|
25
25
|
import { loadFeltDBConfig, createDefaultConfig, validateModel, } from './config.js';
|
|
26
|
-
const VERSION = '0.4.
|
|
26
|
+
const VERSION = '0.4.14';
|
|
27
27
|
function prompt(question) {
|
|
28
28
|
const rl = readline.createInterface({
|
|
29
29
|
input: process.stdin,
|
package/dist/create/cli.js
CHANGED
|
@@ -73,6 +73,14 @@ async function prompt(message) {
|
|
|
73
73
|
const interface_ = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
74
74
|
return new Promise(resolve => interface_.question(message, value => { interface_.close(); resolve(value.trim()); }));
|
|
75
75
|
}
|
|
76
|
+
async function promptForProjectName(defaultName = 'feltdb-app') {
|
|
77
|
+
while (true) {
|
|
78
|
+
const value = (await prompt(`What should we name your FeltDB app? (${defaultName}): `)) || defaultName;
|
|
79
|
+
if (/^[a-z0-9][a-z0-9-]*$/.test(value))
|
|
80
|
+
return value;
|
|
81
|
+
console.log('Use lowercase letters, numbers, and dashes (for example: customer-portal).');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
76
84
|
async function promptSecret(message) {
|
|
77
85
|
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
78
86
|
return '';
|
|
@@ -207,7 +215,7 @@ Deployment Target (Explicit):
|
|
|
207
215
|
Requires production FeltDB instance or self-host
|
|
208
216
|
|
|
209
217
|
--self-host Dedicated FeltDB server with Docker Compose
|
|
210
|
-
Best for:
|
|
218
|
+
Best for: Staging first, then explicit production promotion
|
|
211
219
|
Generates Docker Compose with persistent /data volume
|
|
212
220
|
|
|
213
221
|
--managed Managed FeltDB runtime
|
|
@@ -245,10 +253,12 @@ Learn more: https://github.com/rkendel1/feltdb`);
|
|
|
245
253
|
}
|
|
246
254
|
// Find project name (first non-flag argument)
|
|
247
255
|
let projectName = 'feltdb-app';
|
|
256
|
+
let projectNameProvided = false;
|
|
248
257
|
for (let i = 0; i < args.length; i++) {
|
|
249
258
|
const arg = args[i];
|
|
250
259
|
if (!arg.startsWith('-')) {
|
|
251
260
|
projectName = arg;
|
|
261
|
+
projectNameProvided = true;
|
|
252
262
|
break;
|
|
253
263
|
}
|
|
254
264
|
// Skip next arg if current arg is a flag that takes a value
|
|
@@ -260,10 +270,16 @@ Learn more: https://github.com/rkendel1/feltdb`);
|
|
|
260
270
|
const shouldInstall = !args.includes('--no-install');
|
|
261
271
|
const shouldStart = !args.includes('--no-start');
|
|
262
272
|
let options = parseArgs(args);
|
|
273
|
+
if (!projectNameProvided && !shouldAutoYes && process.stdin.isTTY && process.stdout.isTTY) {
|
|
274
|
+
projectName = await promptForProjectName(projectName);
|
|
275
|
+
}
|
|
276
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(projectName)) {
|
|
277
|
+
throw new Error('Application names must use lowercase letters, numbers, and dashes.');
|
|
278
|
+
}
|
|
263
279
|
const runtimeDescriptions = {
|
|
264
280
|
'browser': 'Browser with IndexedDB (local-first, no server)',
|
|
265
281
|
'node': 'Node.js server (server-side authority)',
|
|
266
|
-
'self-hosted': 'Self-hosted with Docker Compose (
|
|
282
|
+
'self-hosted': 'Self-hosted with Docker Compose (staging)',
|
|
267
283
|
'managed': 'Managed FeltDB service (hosted persistence, sync, and workloads)',
|
|
268
284
|
};
|
|
269
285
|
if (!runtimeDescriptions[options.runtime]) {
|
|
@@ -286,6 +302,7 @@ Learn more: https://github.com/rkendel1/feltdb`);
|
|
|
286
302
|
console.log(`Capabilities: ${options.capabilities}`);
|
|
287
303
|
console.log('\n═══════════════════════════════════════════════\n');
|
|
288
304
|
const projectDir = path.resolve(process.cwd(), projectName);
|
|
305
|
+
let projectCreated = false;
|
|
289
306
|
try {
|
|
290
307
|
await createProject({
|
|
291
308
|
projectName,
|
|
@@ -298,6 +315,7 @@ Learn more: https://github.com/rkendel1/feltdb`);
|
|
|
298
315
|
webllm: options.webllm,
|
|
299
316
|
capabilities: options.capabilities,
|
|
300
317
|
});
|
|
318
|
+
projectCreated = true;
|
|
301
319
|
if (options.runtime === 'managed') {
|
|
302
320
|
console.log('\n☁️ Setting up your managed FeltDB account...\n');
|
|
303
321
|
const email = process.env.FELTDB_MANAGED_EMAIL || (shouldAutoYes ? '' : await prompt('Email: '));
|
|
@@ -341,7 +359,9 @@ Learn more: https://github.com/rkendel1/feltdb`);
|
|
|
341
359
|
}
|
|
342
360
|
}
|
|
343
361
|
catch (error) {
|
|
344
|
-
console.error(
|
|
362
|
+
console.error(projectCreated
|
|
363
|
+
? `❌ The project was created at ${projectDir}, but setup or startup failed:`
|
|
364
|
+
: '❌ Failed to create project:', error);
|
|
345
365
|
process.exit(1);
|
|
346
366
|
}
|
|
347
367
|
}
|
package/dist/create/create.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
6
|
import { randomBytes } from 'crypto';
|
|
8
7
|
import { feltdbPackageRange } from './package-versions.js';
|
|
9
8
|
import { generateDockerCompose, generateDockerfile, generateDockerIgnore, generateDotEnvLocal, generateFeltDBDockerfile, generateStudioDockerfile, } from './docker-compose-generator.js';
|
|
@@ -1218,7 +1217,8 @@ VITE_FELTDB_MANAGED_NAMESPACE=
|
|
|
1218
1217
|
VITE_FELTDB_MANAGED_ENVIRONMENT=production
|
|
1219
1218
|
|
|
1220
1219
|
# Override the default self-hosted container image
|
|
1221
|
-
#
|
|
1220
|
+
# By default the server image is built locally from the bundled source.
|
|
1221
|
+
# Example override: your-registry.example/feltdb:staging
|
|
1222
1222
|
FELTDB_IMAGE=
|
|
1223
1223
|
|
|
1224
1224
|
# Node environment
|
|
@@ -1239,11 +1239,8 @@ NODE_ENV=development
|
|
|
1239
1239
|
fs.writeFileSync(path.join(projectDir, 'Dockerfile'), generateDockerfile(dockerConfig, framework));
|
|
1240
1240
|
fs.writeFileSync(path.join(projectDir, 'Dockerfile.feltdb'), generateFeltDBDockerfile(dockerConfig));
|
|
1241
1241
|
fs.writeFileSync(path.join(projectDir, 'Dockerfile.studio'), generateStudioDockerfile(dockerConfig));
|
|
1242
|
-
const serverSource = fileURLToPath(new URL('./server-source', import.meta.url));
|
|
1243
|
-
fs.cpSync(serverSource, path.join(projectDir, '.feltdb', 'server-source'), { recursive: true });
|
|
1244
1242
|
fs.writeFileSync(path.join(projectDir, '.dockerignore'), generateDockerIgnore());
|
|
1245
1243
|
const dockerEnvironment = generateDotEnvLocal(dockerConfig, randomBytes(32).toString('hex'));
|
|
1246
|
-
fs.writeFileSync(path.join(projectDir, '.env.docker'), dockerEnvironment);
|
|
1247
1244
|
// Docker Compose loads .env automatically; it is already excluded from git.
|
|
1248
1245
|
fs.writeFileSync(path.join(projectDir, '.env'), dockerEnvironment);
|
|
1249
1246
|
}
|
|
@@ -1497,7 +1494,8 @@ Verify vector database connection and that embeddings are enabled in capabilitie
|
|
|
1497
1494
|
- Check out example projects in the templates
|
|
1498
1495
|
- Join the community Discord for support
|
|
1499
1496
|
`;
|
|
1500
|
-
|
|
1497
|
+
// Keep generated projects focused; the runtime guide lives in FeltDB's docs.
|
|
1498
|
+
void runtimeGuide;
|
|
1501
1499
|
// Create .gitignore
|
|
1502
1500
|
const gitignore = `node_modules/
|
|
1503
1501
|
dist/
|
|
@@ -14,16 +14,33 @@ export function generateDockerCompose(config) {
|
|
|
14
14
|
build:
|
|
15
15
|
context: .
|
|
16
16
|
dockerfile: Dockerfile.feltdb
|
|
17
|
+
args:
|
|
18
|
+
FELTDB_VERSION: ${config.version}
|
|
17
19
|
container_name: \${COMPOSE_PROJECT_NAME}-feltdb
|
|
18
20
|
environment:
|
|
19
21
|
FELTDB_APP_NAME: \${FELTDB_APP_NAME:-${config.appName}}
|
|
20
22
|
FELTDB_APP_ID: \${FELTDB_APP_ID:-${config.appId}}
|
|
21
23
|
FELTDB_VERSION: \${FELTDB_VERSION:-${config.version}}
|
|
24
|
+
FELTDB_ENVIRONMENT: \${FELTDB_ENVIRONMENT:-staging}
|
|
22
25
|
FELTDB_PEERS: \${FELTDB_PEERS:-}
|
|
23
26
|
FELTDB_MASTER_KEY: \${FELTDB_MASTER_KEY}
|
|
24
27
|
NODE_ENV: \${NODE_ENV:-production}
|
|
25
28
|
ports:
|
|
26
29
|
- "\${FELTDB_API_PORT:-${config.port}}:7700"
|
|
30
|
+
command:
|
|
31
|
+
- feltdb-server
|
|
32
|
+
- --host
|
|
33
|
+
- 0.0.0.0
|
|
34
|
+
- --port
|
|
35
|
+
- "7700"
|
|
36
|
+
- --namespace
|
|
37
|
+
- \${FELTDB_APP_ID:-${config.appId}}
|
|
38
|
+
- --data
|
|
39
|
+
- /data/feltdb.log
|
|
40
|
+
- --allow-origin
|
|
41
|
+
- http://127.0.0.1:\${APP_PORT:-5173}
|
|
42
|
+
- --allow-origin
|
|
43
|
+
- http://127.0.0.1:\${STUDIO_PORT:-${config.studioPort}}
|
|
27
44
|
volumes:
|
|
28
45
|
- feltdb_data:/data
|
|
29
46
|
- ./feltdb.flow:/app/feltdb.flow:ro
|
|
@@ -106,11 +123,13 @@ volumes:
|
|
|
106
123
|
`;
|
|
107
124
|
}
|
|
108
125
|
export function generateFeltDBDockerfile(config) {
|
|
109
|
-
return `# FeltDB server
|
|
126
|
+
return `# Build the matching FeltDB server without adding engine source to the application.
|
|
110
127
|
FROM rust:1.96-alpine AS builder
|
|
111
|
-
RUN apk add --no-cache pkgconf openssl-dev musl-dev
|
|
128
|
+
RUN apk add --no-cache nodejs npm pkgconf openssl-dev musl-dev
|
|
112
129
|
WORKDIR /source
|
|
113
|
-
|
|
130
|
+
ARG FELTDB_VERSION=${config.version}
|
|
131
|
+
RUN npm install --global "create-feltdb@\${FELTDB_VERSION}" \
|
|
132
|
+
&& cp -R "\$(npm root --global)/create-feltdb/dist/server-source/." /source/
|
|
114
133
|
RUN cargo build -p feltdb-server --release --locked
|
|
115
134
|
|
|
116
135
|
FROM alpine:3.22
|
|
@@ -191,6 +210,7 @@ COMPOSE_PROJECT_NAME=${config.appName.toLowerCase().replace(/[^a-z0-9]/g, '-')}
|
|
|
191
210
|
FELTDB_APP_NAME=${config.appName}
|
|
192
211
|
FELTDB_APP_ID=${config.appId}
|
|
193
212
|
FELTDB_VERSION=${config.version}
|
|
213
|
+
FELTDB_ENVIRONMENT=staging
|
|
194
214
|
FELTDB_API_PORT=${config.port}
|
|
195
215
|
FELTDB_REPLICATION_PORT=${config.replicationPort}
|
|
196
216
|
FELTDB_PEERS=
|
|
@@ -203,8 +223,6 @@ FELTDB_API_URL=http://feltdb:7700
|
|
|
203
223
|
# Studio Configuration
|
|
204
224
|
STUDIO_PORT=${config.studioPort}
|
|
205
225
|
|
|
206
|
-
# Runtime
|
|
207
|
-
NODE_ENV=production
|
|
208
226
|
`;
|
|
209
227
|
}
|
|
210
228
|
export function generateHealthCheckScript() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// One release train keeps generated applications installable. The repository
|
|
2
2
|
// validation script checks these values against every workspace manifest.
|
|
3
|
-
export const FELTDB_PACKAGE_VERSION = '0.4.
|
|
3
|
+
export const FELTDB_PACKAGE_VERSION = '0.4.14';
|
|
4
4
|
export const feltdbPackageRange = `^${FELTDB_PACKAGE_VERSION}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConflictExplorer.d.ts","sourceRoot":"","sources":["../../src/components/ConflictExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,MAAM,WAAW,qBAAqB;IAAG,EAAE,CAAC,EAAE,YAAY,CAAC;IAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAAE;AACrG,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ConflictExplorer.d.ts","sourceRoot":"","sources":["../../src/components/ConflictExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,MAAM,WAAW,qBAAqB;IAAG,EAAE,CAAC,EAAE,YAAY,CAAC;IAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAAE;AACrG,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,qBAAqB,qBAI1E;AACD,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p, x as m } from "../components-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p, x as m } from "../components-9kDSWiGL.js";
|
|
2
2
|
import { t as h } from "../KeyManagementPanel-DZuSeWBK.js";
|
|
3
3
|
import { ManagedInstancePanel as g } from "./ManagedInstancePanel.js";
|
|
4
4
|
export { c as AgentExplorer, f as ApplicationDesigner, p as CapabilityExplorer, t as ConflictExplorer, a as ExecutionViewer, s as GlobalSearch, i as HealthCenter, h as KeyManagementPanel, g as ManagedInstancePanel, r as OperationsExplorer, m as OverviewDashboard, n as PeerMap, e as ProvenanceViewer, l as ReferenceExplorer, u as SettingsPanel, o as StateExplorer, d as WorkflowVisualizer };
|
|
@@ -662,7 +662,13 @@ function j({ db: e, model: t }) {
|
|
|
662
662
|
//#endregion
|
|
663
663
|
//#region src/components/ConflictExplorer.tsx
|
|
664
664
|
function M({ db: e, diagnostics: t }) {
|
|
665
|
-
let n =
|
|
665
|
+
let n = (() => {
|
|
666
|
+
try {
|
|
667
|
+
return e?.sync();
|
|
668
|
+
} catch {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
})(), r = n?.conflicts_detected ?? 0;
|
|
666
672
|
return /* @__PURE__ */ c("div", {
|
|
667
673
|
className: "studio-model-page",
|
|
668
674
|
children: [
|
package/dist/studio/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "./components-
|
|
1
|
+
import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "./components-9kDSWiGL.js";
|
|
2
2
|
import { t as x } from "./KeyManagementPanel-DZuSeWBK.js";
|
|
3
3
|
import { ManagedInstanceUtil as S } from "./utils/managed-instance.js";
|
|
4
4
|
import { ManagedInstancePanel as C } from "./components/ManagedInstancePanel.js";
|
|
@@ -7,7 +7,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
7
7
|
Error generating stack: `+e.message+`
|
|
8
8
|
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function ks(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function As(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var js=typeof WeakMap==`function`?WeakMap:Map;function Ms(e,t,n){n=so(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),As(e,t)},n}function Ns(e,t,n){n=so(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){As(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){As(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ps(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new js;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function Fs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Is(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=so(-1,1),t.tag=2,co(n,t,1))),n.lanes|=1),e)}var Ls=C.ReactCurrentOwner,Rs=!1;function zs(e,t,n,r){t.child=e===null?Wa(t,null,n,r):Ua(t,e.child,n,r)}function Bs(e,t,n,r,i){n=n.render;var a=t.ref;return Qa(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&n&&wa(t),t.flags|=1,zs(e,t,r,i),t.child)}function Vs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Hs(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Fr:n,n(o,r)&&e.ref===t.ref)return oc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref){if(Rs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,oc(e,t,i)}}return Gs(e,t,n,r,i)}function Us(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},B(qc,Kc),Kc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,B(qc,Kc),Kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,B(qc,Kc),Kc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),B(qc,Kc),Kc|=r;return zs(e,t,i,n),t.child}function Ws(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,i){var a=ta(n)?$i:Zi.current;return a=ea(t,a),Qa(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&r&&wa(t),t.flags|=1,zs(e,t,n,i),t.child)}function Ks(e,t,n,r,i){if(ta(n)){var a=!0;aa(t)}else a=!1;if(Qa(t,i),t.stateNode===null)ac(e,t),Ts(t,n,r),Ds(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=$a(l):(l=ta(n)?$i:Zi.current,l=ea(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Es(t,o,r,l),io=!1;var f=t.memoizedState;o.state=f,fo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Qi.current||io?(typeof u==`function`&&(Ss(t,n,u,r),c=t.memoizedState),(s=io||ws(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,oo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:xs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=$a(c):(c=ta(n)?$i:Zi.current,c=ea(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Es(t,o,r,c),io=!1,f=t.memoizedState,o.state=f,fo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Qi.current||io?(typeof p==`function`&&(Ss(t,n,p,r),m=t.memoizedState),(l=io||ws(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qs(e,t,n,r,a,i)}function qs(e,t,n,r,i,a){Ws(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&oa(t,n,!1),oc(e,t,a);r=t.stateNode,Ls.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ua(t,e.child,null,a),t.child=Ua(t,null,s,a)):zs(e,t,s,a),t.memoizedState=r.state,i&&oa(t,n,!0),t.child}function Js(e){var t=e.stateNode;t.pendingContext?ra(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ra(e,t.context,!1),yo(e,t.containerInfo)}function Ys(e,t,n,r,i){return Ia(),La(i),t.flags|=256,zs(e,t,n,r),t.child}var Xs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Qs(e,t,n){var r=t.pendingProps,i=H.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),B(H,i&1),e===null)return Ma(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Zs(n),t.memoizedState=Xs,e):$s(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return tc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Zs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Xs,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $s(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ec(e,t,n,r){return r!==null&&La(r),Ua(t,e.child,null,n),e=$s(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ks(Error(r(422))),ec(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ua(t,e.child,null,s),t.child.memoizedState=Zs(s),t.memoizedState=Xs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ec(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ks(o,i,void 0),ec(e,t,s,i)}if(c=(s&e.childLanes)!==0,Rs||c){if(i=Y,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,ro(e,a),hl(i,e,a,-1))}return kl(),i=ks(Error(r(421))),ec(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Da=Pi(a.nextSibling),Ea=t,V=!0,Oa=null,e!==null&&(_a[va++]=ba,_a[va++]=xa,_a[va++]=ya,ba=e.id,xa=e.overflow,ya=t),t=$s(t,i.children),t.flags|=4096,t)}function nc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Za(e.return,t,n)}function rc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ic(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(zs(e,t,r.children,n),r=H.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nc(e,n,t);else if(e.tag===19)nc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(B(H,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rc(t,!0,n,null,a);break;case`together`:rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sc(e,t,n){switch(t.tag){case 3:Js(t),Ia();break;case 5:xo(t);break;case 1:ta(t.type)&&aa(t);break;case 4:yo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;B(Ga,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(B(H,H.current&1),e=oc(e,t,n),e===null?null:e.sibling):Qs(e,t,n):(B(H,H.current&1),t.flags|=128,null);B(H,H.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ic(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(H,H.current),r)break;return null;case 22:case 23:return t.lanes=0,Us(e,t,n)}return oc(e,t,n)}var cc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},lc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,vo(ho.current);var o=null;switch(n){case`input`:i=Ce(e,i),r=Ce(e,r),o=[];break;case`select`:i=k({},i,{value:void 0}),r=k({},r,{value:void 0}),o=[];break;case`textarea`:i=je(e,i),r=je(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=wi)}Ge(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&R(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},uc=function(e,t,n,r){n!==r&&(t.flags|=4)};function dc(e,t){if(!V)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pc(e,t,n){var i=t.pendingProps;switch(Ta(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fc(t),null;case 1:return ta(t.type)&&na(),fc(t),null;case 3:return i=t.stateNode,bo(),z(Qi),z(Zi),To(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Pa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oa!==null&&(yl(Oa),Oa=null))),fc(t),null;case 5:So(t);var o=vo(_o.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return fc(t),null}if(e=vo(ho.current),Pa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Li]=t,i[Ri]=s,e=!!(t.mode&1),n){case`dialog`:R(`cancel`,i),R(`close`,i);break;case`iframe`:case`object`:case`embed`:R(`load`,i);break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],i);break;case`source`:R(`error`,i);break;case`img`:case`image`:case`link`:R(`error`,i),R(`load`,i);break;case`details`:R(`toggle`,i);break;case`input`:we(i,s),R(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},R(`invalid`,i);break;case`textarea`:Me(i,s),R(`invalid`,i)}for(var c in Ge(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&R(`scroll`,i)}switch(n){case`input`:be(i),De(i,s,!0);break;case`textarea`:be(i),Pe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=wi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Fe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Li]=t,e[Ri]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:R(`cancel`,e),R(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:R(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],e);o=i;break;case`source`:R(`error`,e),o=i;break;case`img`:case`image`:case`link`:R(`error`,e),R(`load`,e),o=i;break;case`details`:R(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),R(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=k({},i,{value:void 0}),R(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),R(`invalid`,e);break;default:o=i}for(s in Ge(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ue(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Re(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ze(e,u):typeof u==`number`&&ze(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&R(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:be(e),De(e,i,!1);break;case`textarea`:be(e),Pe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+_e(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ae(e,!!i.multiple,i.defaultValue,!0):Ae(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=wi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fc(t),null;case 6:if(e&&t.stateNode!=null)uc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=vo(_o.current),vo(ho.current),Pa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Li]=t,(s=i.nodeValue!==n)&&(e=Ea,e!==null))switch(e.tag){case 3:Ci(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ci(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Li]=t,t.stateNode=i}return fc(t),null;case 13:if(z(H),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(V&&Da!==null&&t.mode&1&&!(t.flags&128))Fa(),Ia(),t.flags|=98560,s=!1;else if(s=Pa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Li]=t}else Ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fc(t),s=!1}else Oa!==null&&(yl(Oa),Oa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||H.current&1?Q===0&&(Q=3):kl())),t.updateQueue!==null&&(t.flags|=4),fc(t),null);case 4:return bo(),e===null&&pi(t.stateNode.containerInfo),fc(t),null;case 10:return Xa(t.type._context),fc(t),null;case 17:return ta(t.type)&&na(),fc(t),null;case 19:if(z(H),s=t.memoizedState,s===null)return fc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)dc(s,!1);else{if(Q!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Co(e),c!==null){for(t.flags|=128,dc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return B(H,H.current&1|2),t.child}e=e.sibling}s.tail!==null&&A()>tl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=Co(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!V)return fc(t),null}else 2*A()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=A(),t.sibling=null,n=H.current,B(H,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Kc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Ta(t),t.tag){case 1:return ta(t.type)&&na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bo(),z(Qi),z(Zi),To(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return So(t),null;case 13:if(z(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(H),null;case 4:return bo(),null;case 10:return Xa(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function yc(e,t,n){try{n()}catch(n){$(e,t,n)}}var bc=!1;function xc(e,t){if(Ti=Sn,e=zr(),Br(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ei={focusedElem:e,selectionRange:n},Sn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:xs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Li],delete t[Ri],delete t[Bi],delete t[Vi],delete t[Hi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var q=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount==`function`)try{Nt.onCommitFiberUnmount(Mt,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=q,i=Ac;q=null,jc(e,t,n),q=r,Ac=i,q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):q.removeChild(n.stateNode));break;case 18:q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?Ni(e.parentNode,n):e.nodeType===1&&Ni(e,n),bn(e)):Ni(q,n.stateNode));break;case 4:r=q,i=Ac,q=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),q=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,jc(e,t,n),gc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:q=c.stateNode,Ac=!1;break a;case 3:q=c.stateNode.containerInfo,Ac=!0;break a;case 4:q=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(q===null)throw Error(r(160));Mc(o,s,a),q=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{Sc(3,e,e.return),Cc(3,e)}catch(t){$(e,e.return,t)}try{Sc(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&Te(a,o),Ke(c,s);var u=Ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ue(a,f):d===`dangerouslySetInnerHTML`?Re(a,f):d===`children`?ze(a,f):S(a,d,f,u)}switch(c){case`input`:Ee(a,o);break;case`textarea`:Ne(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ae(a,!!o.multiple,o.multiple?[]:``,!1):Ae(a,!!o.multiple,o.defaultValue,!0)):Ae(a,!!o.multiple,m,!1)}a[Ri]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{bn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=A())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(gc=(u=gc)||d,Pc(t,e),gc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:Sc(4,p,p.return);break;case 1:vc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:vc(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=He(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Ec(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(ze(a,``),i.flags&=-33),kc(e,Dc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Oc(e,Dc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){K=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||hc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||gc;s=hc;var l=gc;if(hc=o,(gc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,K=c);for(;a!==null;)K=a,Rc(a,t,n),a=a.sibling;K=i,hc=s,gc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):zc(e,t,n)}}function zc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gc||Cc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!gc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&po(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}po(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&bn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gc||t.flags&512&&wc(t)}catch(e){$(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Cc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{wc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{wc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,J=0,Y=null,X=null,Z=0,Kc=0,qc=Yi(0),Q=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return J&6?A():dl===-1?dl=A():dl}function ml(e){return e.mode&1?J&2&&Z!==0?Z&-Z:Ra.transition===null?(e=M,e===0?(e=window.event,e=e===void 0?16:Dn(e.type),e):e):(fl===0&&(fl=Gt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));qt(e,n,i),(!(J&2)||e!==Y)&&(e===Y&&(!(J&2)&&(Xc|=n),Q===4&&xl(e,Z)),gl(e,i),n===1&&J===0&&!(t.mode&1)&&(tl=A()+500,ca&&fa()))}function gl(e,t){var n=e.callbackNode;Ut(e,t);var r=Vt(e,e===Y?Z:0);if(r===0)n!==null&&Ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ct(n),t===1)e.tag===0?da(Sl.bind(null,e)):ua(Sl.bind(null,e)),ji(function(){!(J&6)&&fa()}),n=null;else{switch(Xt(r)){case 1:n=Dt;break;case 4:n=Ot;break;case 16:n=kt;break;case 536870912:n=jt;break;default:n=kt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,J&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=Vt(e,e===Y?Z:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=J;J|=2;var o=Ol();(Y!==e||Z!==t)&&(nl=null,tl=A()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ya(),Uc.current=o,J=a,X===null?(Y=null,Z=0,t=Q):t=0}if(t!==0){if(t===2&&(a=Wt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Wt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-A(),10<t)){if(Vt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ft(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=A()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,A()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Pr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ft(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(J&6)throw Error(r(327));Ll();var t=Vt(e,0);if(!(t&1))return gl(e,A()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Wt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,A()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,A()),null}function Cl(e,t){var n=J;J|=1;try{return e(t)}finally{J=n,J===0&&(tl=A()+500,ca&&fa())}}function wl(e){sl!==null&&sl.tag===0&&!(J&6)&&Ll();var t=J;J|=1;var n=Gc.transition,r=M;try{if(Gc.transition=null,M=1,e)return e()}finally{M=r,Gc.transition=n,J=t,!(J&6)&&fa()}}function Tl(){Kc=qc.current,z(qc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ki(n)),X!==null)for(n=X.return;n!==null;){var r=n;switch(Ta(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&na();break;case 3:bo(),z(Qi),z(Zi),To();break;case 5:So(r);break;case 4:bo();break;case 13:z(H);break;case 19:z(H);break;case 10:Xa(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Y=e,X=e=Yl(e.current,null),Z=Kc=t,Q=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,eo!==null){for(t=0;t<eo.length;t++)if(n=eo[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}eo=null}return e}function Dl(e,t){do{var n=X;try{if(Ya(),Eo.current=_s,ko){for(var i=U.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(Oo=0,G=W=U=null,Ao=!1,jo=0,Wc.current=null,n===null||n.return===null){Q=1,Jc=t,X=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Z,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Fs(s);if(m!==null){m.flags&=-257,Is(m,s,c,o,t),m.mode&1&&Ps(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Ps(o,u,t),kl();break a}l=Error(r(426))}else if(V&&c.mode&1){var _=Fs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Is(_,s,c,o,t),La(Os(l,c));break a}}o=l=Os(l,c),Q!==4&&(Q=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ms(o,l,t);uo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ns(o,c,t);uo(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,X===n&&n!==null&&(X=n=n.return);continue}break}while(1)}function Ol(){var e=Uc.current;return Uc.current=_s,e===null?_s:e}function kl(){(Q===0||Q===3||Q===2)&&(Q=4),Y===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Y,Z)}function Al(e,t){var n=J;J|=2;var i=Ol();(Y!==e||Z!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ya(),J=n,Uc.current=i,X!==null)throw Error(r(261));return Y=null,Z=0,Q}function jl(){for(;X!==null;)Nl(X)}function Ml(){for(;X!==null&&!wt();)Nl(X)}function Nl(e){var t=Ul(e.alternate,e,Kc);e.memoizedProps=e.pendingProps,t===null?Pl(e):X=t,Wc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mc(n,t),n!==null){n.flags&=32767,X=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Q=6,X=null;return}}else if(n=pc(n,t,Kc),n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Q===0&&(Q=5)}function Fl(e,t,n){var r=M,i=Gc.transition;try{Gc.transition=null,M=1,Il(e,t,n,r)}finally{Gc.transition=i,M=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(J&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Jt(e,o),e===Y&&(X=Y=null,Z=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(kt,function(){return Ll(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=M;M=1;var c=J;J|=4,Wc.current=null,xc(e,n),Fc(n,e),Vr(Ei),Sn=!!Ti,Ei=Ti=null,e.current=n,Lc(n,e,a),Tt(),J=c,M=s,Gc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),Pt(n.stateNode,i),gl(e,A()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,fa(),null}function Ll(){if(sl!==null){var e=Xt(cl),t=Gc.transition,n=M;try{if(Gc.transition=null,M=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,J&6)throw Error(r(331));var a=J;for(J|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:Sc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(Tc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Sc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Cc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(J=a,fa(),Nt&&typeof Nt.onPostCommitFiberRoot==`function`)try{Nt.onPostCommitFiberRoot(Mt,e)}catch{}i=!0}return i}finally{M=n,Gc.transition=t}}return!1}function Rl(e,t,n){t=Os(n,t),t=Ms(e,t,1),e=co(e,t,1),t=pl(),e!==null&&(qt(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=Os(n,e),e=Ns(t,e,1),t=co(t,e,1),e=pl(),t!==null&&(qt(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Y===e&&(Z&n)===n&&(Q===4||Q===3&&(Z&130023424)===Z&&500>A()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=zt,zt<<=1,!(zt&130023424)&&(zt=4194304)):t=1);var n=pl();e=ro(e,t),e!==null&&(qt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Qi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}}else Rs=!1,V&&t.flags&1048576&&Ca(t,ga,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=ea(t,Zi.current);Qa(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ta(i)?(o=!0,aa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ao(t),a.updater=Cs,t.stateNode=a,a._reactInternals=t,Ds(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,V&&o&&wa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=xs(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,xs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,oo(e,t),fo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Os(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}if(i!==a){a=Os(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}for(Da=Pi(t.stateNode.containerInfo.firstChild),Ea=t,V=!0,Oa=null,n=Wa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ia(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return xo(t),e===null&&Ma(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Di(i,a)?s=null:o!==null&&Di(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Ma(t),null;case 13:return Qs(e,t,n);case 4:return yo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ua(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,B(Ga,i._currentValue),i._currentValue=s,o!==null){if(Pr(o.value,s)){if(o.children===a.children&&!Qi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=so(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Za(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Za(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Qa(t,n),a=$a(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=xs(i,t.pendingProps),a=xs(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),ac(e,t),t.tag=1,ta(i)?(e=!0,aa(t)):e=!1,Qa(t,n),Ts(t,i,a),Ds(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return St(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===re)return 11;if(e===O)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ee:return Zl(n.children,a,o,t);case te:s=8,a|=8;break;case E:return e=Kl(12,n,t,a|2),e.elementType=E,e.lanes=o,e;case ie:return e=Kl(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=Kl(19,n,t,a),e.elementType=ae,e.lanes=o,e;case se:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case ne:s=9;break a;case re:s=11;break a;case O:s=14;break a;case oe:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=se,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Kt(0),this.expirationTimes=Kt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ao(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Xi;e=e._reactInternals;a:{if(gt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(ta(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(ta(n))return ia(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=pl(),i=ml(n),a=so(r,i),a.callback=t??null,co(n,a,i),e.current.lanes=i,qt(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=so(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=co(i,t,o),e!==null&&(hl(e,i,o,a),lo(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[zi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=en();e={blockedOn:null,target:e,priority:t};for(var n=0;n<un.length&&t!==0&&t<un[n].priority;n++);un.splice(n,0,e),n===0&&hn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[zi]=o.current,pi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[zi]=c.current,pi(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bt(t.pendingLanes);n!==0&&(Yt(t,n|1),gl(t,A()),!(J&6)&&(tl=A()+500,fa()))}break;case 13:wl(function(){var t=ro(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},Qt=function(e){if(e.tag===13){var t=ro(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},$t=function(e){if(e.tag===13){var t=ml(e),n=ro(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},en=function(){return M},tn=function(e,t){var n=M;try{return M=e,t()}finally{M=n}},Ye=function(e,t,n){switch(t){case`input`:if(Ee(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ki(i);if(!a)throw Error(r(90));xe(i),Ee(i,a)}}}break;case`textarea`:Ne(e,n);break;case`select`:t=n.value,t!=null&&Ae(e,!!n.multiple,t,!1)}},tt=Cl,nt=wl;var yu={usingClientEntryPoint:!1,Events:[Wi,Gi,Ki,$e,et,Cl]},bu={findFiberByHostInstance:Ui,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{Mt=Su.inject(xu),Nt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[zi]=t.current,pi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=bt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[zi]=t.current,pi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[zi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u(),1),_=c(h(),1),v=`modulepreload`,y=function(e){return`/`+e},b={},x=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=y(t,n),t=s(t),t in b)return;b[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:v,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},S=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,C=/^[\\/]{2}/;function w(e,t){return t+e.replace(/\\/g,`/`)}var T=`popstate`;function ee(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function te(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return ie(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:ae(t)}return oe(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ne(){return Math.random().toString(36).substring(2,10)}function re(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ie(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?O(t):t,state:n,key:t&&t.key||r||ne(),mask:i}}function ae({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function O(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function oe(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=ee(e)?e:ie(h.location,e,t);n&&n(r,e),l=u()+1;let d=re(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=ee(e)?e:ie(h.location,e,t);n&&n(r,e),l=u();let i=re(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return se(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(T,d),c=e,()=>{i.removeEventListener(T,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function se(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),E(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:ae(t);return i=i.replace(/ $/,`%20`),!n&&C.test(i)&&(i=r+i),new URL(i,r)}function ce(e,t,n=`/`){return le(e,t,n,!1)}function le(e,t,n,r,i){let a=De((typeof t==`string`?O(t):t).pathname||`/`,n);if(a==null)return null;let o=i??k(e),s=null,c=Ee(a);for(let e=0;s==null&&e<o.length;++e)s=Se(o[e],c,r);return s}function k(e){let t=ue(e);return fe(t),t}function ue(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Fe([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ue(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:be(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Te(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of de(e.path))a(e,t,!0,n)}),t}function de(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=de(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function fe(e){e.sort((e,t)=>e.score===t.score?xe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var pe=/^:[\w-]+$/,me=3,he=2,ge=1,_e=10,ve=-2,ye=e=>e===`*`;function be(e,t){let n=e.split(`/`),r=n.length;return n.some(ye)&&(r+=ve),t&&(r+=he),n.filter(e=>!ye(e)).reduce((e,t)=>e+(pe.test(t)?me:t===``?ge:_e),r)}function xe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Se(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?we(u,l,s.matcher,s.compiledParams):Ce(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Ce({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Fe([a,d.pathname]),pathnameBase:Le(Fe([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Fe([a,d.pathnameBase]))}return o}function Ce(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Te(e.path,e.caseSensitive,e.end);return we(e,t,n,r)}function we(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Te(e,t=!1,n=!0){D(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ee(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function De(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Oe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?O(e):e,a;return n?(n=Pe(n),a=n.startsWith(`/`)?ke(n.substring(1),`/`):ke(n,t)):a=t,{pathname:a,search:Re(r),hash:ze(i)}}function ke(e,t){let n=Ie(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Ae(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function je(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Me(e){let t=je(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ne(e,t,n,r=!1){let i;typeof e==`string`?i=O(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),Ae(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),Ae(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),Ae(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Oe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Pe=e=>e.replace(/[\\/]{2,}/g,`/`),Fe=e=>Pe(e.join(`/`)),Ie=e=>e.replace(/\/+$/,``),Le=e=>Ie(e).replace(/^\/*/,`/`),Re=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ze=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Be=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ve(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function He(e){return Fe(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ue=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function We(e,t){let n=e;if(typeof n!=`string`||!S.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ue)try{let e=new URL(window.location.href),r=C.test(n)?new URL(w(n,e.protocol)):new URL(n),a=De(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ge=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ge);var Ke=[`GET`,...Ge];new Set(Ke);var qe=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Je(e){try{return qe.includes(new URL(e).protocol)}catch{return!1}}var Ye=g.createContext(null);Ye.displayName=`DataRouter`;var Xe=g.createContext(null);Xe.displayName=`DataRouterState`;var Ze=g.createContext(!1);function Qe(){return g.useContext(Ze)}var $e=g.createContext({isTransitioning:!1});$e.displayName=`ViewTransition`;var et=g.createContext(new Map);et.displayName=`Fetchers`;var tt=g.createContext(null);tt.displayName=`Await`;var nt=g.createContext(null);nt.displayName=`Navigation`;var rt=g.createContext(null);rt.displayName=`Location`;var it=g.createContext({outlet:null,matches:[],isDataRoute:!1});it.displayName=`Route`;var at=g.createContext(null);at.displayName=`RouteError`;var ot=`REACT_ROUTER_ERROR`,st=`REDIRECT`,ct=`ROUTE_ERROR_RESPONSE`;function lt(e){if(e.startsWith(`${ot}:${st}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function ut(e){if(e.startsWith(`${ot}:${ct}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Be(t.status,t.statusText,t.data)}catch{}}function dt(e,{relative:t}={}){E(ft(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=g.useContext(nt),{hash:i,pathname:a,search:o}=vt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Fe([n,a])),r.createHref({pathname:s,search:o,hash:i})}function ft(){return g.useContext(rt)!=null}function pt(){return E(ft(),`useLocation() may be used only in the context of a <Router> component.`),g.useContext(rt).location}var mt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ht(e){g.useContext(nt).static||g.useLayoutEffect(e)}function gt(){let{isDataRoute:e}=g.useContext(it);return e?Pt():_t()}function _t(){E(ft(),`useNavigate() may be used only in the context of a <Router> component.`);let e=g.useContext(Ye),{basename:t,navigator:n}=g.useContext(nt),{matches:r}=g.useContext(it),{pathname:i}=pt(),a=JSON.stringify(Me(r)),o=g.useRef(!1);return ht(()=>{o.current=!0}),g.useCallback((r,s={})=>{if(D(o.current,mt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ne(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Fe([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}g.createContext(null);function vt(e,{relative:t}={}){let{matches:n}=g.useContext(it),{pathname:r}=pt(),i=JSON.stringify(Me(n));return g.useMemo(()=>Ne(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function yt(e,t){return bt(e,t)}function bt(e,t,n){E(ft(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=g.useContext(nt),{matches:i}=g.useContext(it),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;It(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
9
9
|
|
|
10
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=pt(),d;if(t){let e=typeof t==`string`?O(t):t;E(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ce(e,{pathname:p});D(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),D(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Et(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Fe([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Fe([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?g.createElement(rt.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function xt(){let e=Nt(),t=Ve(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=g.createElement(g.Fragment,null,g.createElement(`p`,null,`💿 Hey developer 👋`),g.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,g.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,g.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),g.createElement(g.Fragment,null,g.createElement(`h2`,null,`Unexpected Application Error!`),g.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?g.createElement(`pre`,{style:i},n):null,o)}var St=g.createElement(xt,null),Ct=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ut(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:g.createElement(it.Provider,{value:this.props.routeContext},g.createElement(at.Provider,{value:e,children:this.props.component}));return this.context?g.createElement(Tt,{error:e},t):t}};Ct.contextType=Ze;var wt=new WeakMap;function Tt({children:e,error:t}){let{basename:n}=g.useContext(nt);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=lt(t.digest);if(e){let r=wt.get(t);if(r)throw r;let i=We(e.location,n),a=i.absoluteURL||i.to;if(Je(a))throw Error(`Invalid redirect location`);if(Ue&&!wt.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw wt.set(t,n),n}}return g.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function A({routeContext:e,match:t,children:n}){let r=g.useContext(Ye);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(it.Provider,{value:e},n)}function Et(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:He(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||St,o&&(s<0&&c===0?(It(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?g.createElement(n.route.Component,null):n.route.element?n.route.element:e,g.createElement(A,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?g.createElement(Ct,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Dt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ot(e){let t=g.useContext(Ye);return E(t,Dt(e)),t}function kt(e){let t=g.useContext(Xe);return E(t,Dt(e)),t}function At(e){let t=g.useContext(it);return E(t,Dt(e)),t}function jt(e){let t=At(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Mt(){return jt(`useRouteId`)}function Nt(){let e=g.useContext(at),t=kt(`useRouteError`),n=jt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Pt(){let{router:e}=Ot(`useNavigate`),t=jt(`useNavigate`),n=g.useRef(!1);return ht(()=>{n.current=!0}),g.useCallback(async(r,i={})=>{D(n.current,mt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ft={};function It(e,t,n){!t&&!Ft[e]&&(Ft[e]=!0,D(!1,n))}g.memo(Lt);function Lt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return bt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function j(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Rt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){E(!ft(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=g.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=O(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=g.useMemo(()=>{let e=De(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return D(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:g.createElement(nt.Provider,{value:c},g.createElement(rt.Provider,{children:t,value:h}))}function zt({children:e,location:t}){return yt(Bt(e),t)}g.Component;function Bt(e,t=[]){let n=[];return g.Children.forEach(e,(e,r)=>{if(!g.isValidElement(e))return;let i=[...t,r];if(e.type===g.Fragment){n.push.apply(n,Bt(e.props.children,i));return}E(e.type===j,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Bt(e.props.children,i)),n.push(a)}),n}var Vt=`get`,Ht=`application/x-www-form-urlencoded`;function Ut(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Wt(e){return Ut(e)&&e.tagName.toLowerCase()===`button`}function Gt(e){return Ut(e)&&e.tagName.toLowerCase()===`form`}function Kt(e){return Ut(e)&&e.tagName.toLowerCase()===`input`}function qt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Jt(e,t){return e.button===0&&(!t||t===`_self`)&&!qt(e)}var Yt=null;function M(){if(Yt===null)try{new FormData(document.createElement(`form`),0),Yt=!1}catch{Yt=!0}return Yt}var Xt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Zt(e){return e!=null&&!Xt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ht}"`),null):e}function Qt(e,t){let n,r,i,a,o;if(Gt(e)){let o=e.getAttribute(`action`);r=o?De(o,t):null,n=e.getAttribute(`method`)||Vt,i=Zt(e.getAttribute(`enctype`))||Ht,a=new FormData(e)}else if(Wt(e)||Kt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?De(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Vt,i=Zt(e.getAttribute(`formenctype`))||Zt(o.getAttribute(`enctype`))||Ht,a=new FormData(o,e),!M()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Ut(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Vt,r=null,i=Ht,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function $t(e,t){if(e===!1||e==null)throw Error(t)}function en(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&De(i.pathname,t)===`/`?`${Ie(t)}/_root.${r}`:`${Ie(i.pathname)}.${r}`,i}async function tn(e,t){if(e.id in t)return t[e.id];try{let n=await x(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nn(e){return e!=null&&typeof e.page==`string`}function rn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function an(e,t,n){return un((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await tn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(rn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function on(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function sn(e,t,{includeHydrateFallback:n}={}){return cn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function cn(e){return[...new Set(e)]}function ln(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function un(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!nn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ln(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function dn(){let e=g.useContext(Ye);return $t(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function fn(){let e=g.useContext(Xe);return $t(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var pn=g.createContext(void 0);pn.displayName=`FrameworkContext`;function mn(){let e=g.useContext(pn);return $t(e,`You must render this element inside a <HydratedRouter> element`),e}function hn(e,t){let n=g.useContext(pn),[r,i]=g.useState(!1),[a,o]=g.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=g.useRef(null);g.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),g.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:gn(s,p),onBlur:gn(c,m),onMouseEnter:gn(l,p),onMouseLeave:gn(u,m),onTouchStart:gn(d,p)}]:[a,f,{}]:[!1,f,{}]}function gn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _n({page:e,...t}){let n=Qe(),{nonce:r}=mn(),{router:i}=dn(),a=g.useMemo(()=>ce(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?g.createElement(yn,{page:e,matches:a,...t}):g.createElement(bn,{page:e,matches:a,...t})):null}function vn(e){let{manifest:t,routeModules:n}=mn(),[r,i]=g.useState([]);return g.useEffect(()=>{let r=!1;return an(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function yn({page:e,matches:t,...n}){let r=pt(),{future:i}=mn(),{basename:a}=dn(),o=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=en(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return g.createElement(g.Fragment,null,o.map(e=>g.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function bn({page:e,matches:t,...n}){let r=pt(),{future:i,manifest:a,routeModules:o}=mn(),{basename:s}=dn(),{loaderData:c,matches:l}=fn(),u=g.useMemo(()=>on(e,t,l,a,r,`data`),[e,t,l,a,r]),d=g.useMemo(()=>on(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=en(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=g.useMemo(()=>sn(d,a),[d,a]),m=vn(d);return g.createElement(g.Fragment,null,f.map(e=>g.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>g.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>g.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function xn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}g.Component;var Sn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Sn&&(window.__reactRouterVersion=`7.18.2`)}catch{}function Cn({basename:e,children:t,useTransitions:n,window:r}){let i=g.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=g.useState({action:a.action,location:a.location}),c=g.useCallback(e=>{n===!1?s(e):g.startTransition(()=>s(e))},[n]);return g.useLayoutEffect(()=>a.listen(c),[a,c]),g.createElement(Rt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var N=g.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:_,useTransitions:v}=g.useContext(nt),y=typeof l==`string`&&S.test(l),b=We(l,h);l=b.to;let x=dt(l,{relative:r}),C=pt(),w=null;if(o){let e=Ne(o,[],C.mask?C.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Fe([h,e.pathname])),w=_.createHref(e)}let[T,ee,te]=hn(n,p),E=On(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:v});function D(t){e&&e(t),t.defaultPrevented||E(t)}let ne=!(b.isExternal||i),re=g.createElement(`a`,{...p,...te,href:(ne?w:void 0)||b.absoluteURL||x,onClick:ne?D:e,ref:xn(m,ee),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return T&&!y?g.createElement(g.Fragment,null,re,g.createElement(_n,{page:x})):re});N.displayName=`Link`;var wn=g.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=vt(a,{relative:c.relative}),d=pt(),f=g.useContext(Xe),{navigator:p,basename:m}=g.useContext(nt),h=f!=null&&Nn(u)&&o===!0,_=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&m&&(y=De(y,m)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return g.createElement(N,{...c,"aria-current":w,className:T,ref:l,style:ee,to:a,viewTransition:o},typeof s==`function`?s(C):s)});wn.displayName=`NavLink`;var Tn=g.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Vt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=g.useContext(nt),_=jn(),v=Mn(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&S.test(s);return g.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?g.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Tn.displayName=`Form`;function En(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dn(e){let t=g.useContext(Ye);return E(t,En(e)),t}function On(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=gt(),d=pt(),f=vt(e,{relative:o});return g.useCallback(p=>{if(Jt(p,t)){p.preventDefault();let t=n===void 0?ae(d)===ae(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?g.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var kn=0,An=()=>`__${String(++kn)}__`;function jn(){let{router:e}=Dn(`useSubmit`),{basename:t}=g.useContext(nt),n=Mt(),r=e.fetch,i=e.navigate;return g.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Qt(e,t);if(a.navigate===!1){let e=a.fetcherKey||An();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Mn(e,{relative:t}={}){let{basename:n}=g.useContext(nt),r=g.useContext(it);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...vt(e||`.`,{relative:t})},o=pt();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Fe([n,a.pathname])),ae(a)}function Nn(e,{relative:t}={}){let n=g.useContext($e);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Dn(`useViewTransitionState`),i=vt(e,{relative:t});if(!n.isTransitioning)return!1;let a=De(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=De(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ce(i.pathname,o)!=null||Ce(i.pathname,a)!=null}var Pn=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),P=o(((e,t)=>{t.exports=Pn()}))();function Fn({stats:e}){return e?(0,P.jsxs)(`div`,{className:`overview-dashboard`,children:[(0,P.jsxs)(`div`,{className:`dashboard-header`,children:[(0,P.jsx)(`h1`,{children:`FeltDB Studio`}),(0,P.jsx)(`div`,{className:`namespace-badge`,children:e.namespace})]}),(0,P.jsxs)(`div`,{className:`dashboard-grid`,children:[(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Runtime`}),(0,P.jsx)(`div`,{className:`status-indicator ${e.status}`,children:`●`}),(0,P.jsx)(`span`,{children:e.status.charAt(0).toUpperCase()+e.status.slice(1)})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Storage`}),(0,P.jsxs)(`span`,{children:[e.persistence,` / `,e.storageBackend]})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Peers`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.peersCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Objects`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.objectsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Operations`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.operationsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Capabilities`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.capabilitiesCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Executions`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.executionsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Workflows`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.workflowsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Agents`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.agentsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Conflicts`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.conflictsCount})]})]})]}):(0,P.jsx)(`div`,{className:`overview-dashboard loading`,children:(0,P.jsx)(`p`,{children:`Loading runtime information...`})})}function In(e,t=`default`){let[n,r]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!e){r(null);return}let n=e.runtime(),i=n.runtime===`browser`?`browser`:n.runtime===`node`?`self-hosted`:`remote`;r({db:e,connected:!0,namespace:t,instanceId:e.instanceId?.()||`unknown`,environment:i})},[e,t]),n}function Ln(e,t=null,n=`default`){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!e){i(null);return}let r=async()=>{try{let r=e.runtime(),a=e.health(),o=e.sync?.(),s=t?await Promise.all(t.collections.map(t=>e.collection(t.name).count())):[];i({namespace:n,status:a?.status||`healthy`,storageBackend:r.storage,persistence:r.persistent?`durable`:`volatile`,peersCount:o?.connected_peers?.length||0,objectsCount:s.reduce((e,t)=>e+t,0),operationsCount:o?.sequence||0,capabilitiesCount:t?.capabilities.length||0,executionsCount:await e.collection(`_flow_executions`).count()||await e.collection(`Decision`).count(),workflowsCount:t?.workflows.length||0,agentsCount:t?.agents.length||0,conflictsCount:o?.conflicts_detected||0})}catch(e){console.error(`Failed to fetch dashboard stats:`,e)}};r();let a=setInterval(r,5e3);return()=>clearInterval(a)},[e,t,n]),r}function Rn(e){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null),s=(0,g.useCallback)(async()=>{if(e){i(!0),o(null);try{let t=e.health();n(t)}catch(e){o(e instanceof Error?e.message:`Failed to fetch diagnostics`)}finally{i(!1)}}},[e]);return(0,g.useEffect)(()=>{s()},[e,s]),{diagnostics:t,loading:r,error:a,refresh:s}}function zn(e,t){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)(!0),[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e){a(!0),s(null);try{let n=e.collection(t).subscribe(e=>{r(e),a(!1)});return()=>n()}catch(e){s(e instanceof Error?e.message:`Failed to load collection`),a(!1)}}},[e,t]),{items:n,loading:i,error:o}}function Bn(e){let[t,n]=(0,g.useState)([]);return(0,g.useEffect)(()=>{if(!e){n([]);return}let t=()=>{try{let t=e.sync?.();n(t?.connected_peers||[])}catch(e){console.error(`Failed to fetch peers:`,e)}};t();let r=setInterval(t,2e3);return()=>clearInterval(r)},[e]),t}function Vn({db:e,definition:t,namespace:n,bridgedItems:r}){let{items:i,loading:a,error:o}=zn(e,t.name),s=r??i,[c,l]=(0,g.useState)(null);return(0,P.jsxs)(`article`,{className:`state-collection studio-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`collection`}),(0,P.jsx)(`h2`,{children:t.name})]}),(0,P.jsx)(`strong`,{children:r?r.length:a?`…`:i.length})]}),o&&(0,P.jsx)(`p`,{className:`runtime-error`,children:o}),(!a||r)&&!s.length&&(0,P.jsx)(`div`,{className:`model-empty compact`,children:`No records yet. Mutations will appear here live.`}),s.map((e,r)=>{let i=String(e.id??e.key??r);return(0,P.jsxs)(`button`,{className:`state-row`,onClick:()=>l(c===r?null:r),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`b`,{children:i}),(0,P.jsxs)(`small`,{children:[`flow://`,n,`/`,t.name,`/`,i]})]}),(0,P.jsx)(`span`,{children:c===r?`−`:`+`}),c===r&&(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]},i)})]})}function Hn({db:e,model:t,namespace:n=`default`,applicationUrl:r=``}){let i=(0,g.useRef)(null),[a,o]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!r)return;let e=new URL(r).origin,t=()=>i.current?.contentWindow?.postMessage({type:`feltdb:studio:read`,requestId:`live`},e),n=n=>{n.origin===e&&(n.data?.type===`feltdb:studio:ready`&&t(),n.data?.type===`feltdb:studio:data`&&o(n.data.records))};window.addEventListener(`message`,n);let a=window.setInterval(t,1500);return()=>{window.removeEventListener(`message`,n),window.clearInterval(a)}},[r]),(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Data`}),(0,P.jsx)(`p`,{children:`Live application records grouped by collection. Select a record to inspect every field.`})]}),r&&(0,P.jsx)(`iframe`,{ref:i,className:`studio-data-bridge`,src:r,title:`FeltDB application data bridge`,onLoad:()=>i.current?.contentWindow?.postMessage({type:`feltdb:studio:read`,requestId:`initial`},new URL(r).origin)}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.collections.length??0,` collections`]}),(0,P.jsxs)(`span`,{children:[n,` namespace`]}),(0,P.jsx)(`span`,{children:e?`runtime connected`:`runtime unavailable`})]}),(0,P.jsxs)(`div`,{className:`state-grid`,children:[t?.collections.map(t=>(0,P.jsx)(Vn,{db:e??null,definition:t,namespace:n,bridgedItems:a?.[t.name]},t.name)),!t?.collections.length&&(0,P.jsxs)(`div`,{className:`model-empty`,children:[`No collection model is loaded. Open Studio through `,(0,P.jsx)(`code`,{children:`feltdb dev`}),` to load the active project.`]})]})]})}function Un(e){let t=e.trim().replace(/^flow:\/\//,``).split(`/`).filter(Boolean);return e.startsWith(`flow://`)?t.length>=3?{collection:t[t.length-2],id:t[t.length-1]}:null:t.length>=2?{collection:t[t.length-2],id:t[t.length-1]}:null}function Wn({db:e,model:t,namespace:n=`default`}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(),[s,c]=(0,g.useState)(`Enter a reference to resolve live state.`),l=async()=>{let t=Un(r);if(!t||!e){o(void 0),c(e?`Use Collection/id or flow://namespace/Collection/id.`:`Runtime unavailable.`);return}let n=await e.collection(t.collection).get(t.id);o(n),c(n?`Materialized locally`:`Reference is valid but is not materialized locally`)};return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`References`}),(0,P.jsx)(`p`,{children:`Resolve stable Flow references directly into their materialized state.`})]}),(0,P.jsxs)(`div`,{className:`reference-query`,children:[(0,P.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},placeholder:`flow://${n}/Collection/id`}),(0,P.jsx)(`button`,{onClick:()=>void l(),children:`Resolve`})]}),(0,P.jsxs)(`div`,{className:`reference-layout`,children:[(0,P.jsxs)(`article`,{className:`studio-card`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Known collections`}),t?.collections.map(e=>(0,P.jsxs)(`button`,{className:`reference-example`,onClick:()=>i(`flow://${n}/${e.name}/id`),children:[e.name,(0,P.jsxs)(`small`,{children:[e.fields.length,` fields`]})]},e.name))]}),(0,P.jsxs)(`article`,{className:`studio-card reference-result`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Resolution`}),(0,P.jsx)(`h2`,{children:s}),a!==void 0&&(0,P.jsx)(`pre`,{children:JSON.stringify(a,null,2)})]})]})]})}function Gn({db:e,namespace:t=`default`}){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)(`all`);(0,g.useEffect)(()=>{if(!e)return;let t=!0,n=async()=>{let n=await e.auditEvents();t&&r(n.slice().reverse())};n();let i=setInterval(()=>void n(),1e3);return()=>{t=!1,clearInterval(i)}},[e]);let o=n.filter(e=>i===`all`||e.type===i);return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Operations`}),(0,P.jsx)(`p`,{children:`The runtime's durable local mutation log—not a simulated activity feed.`})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[n.length,` recorded`]}),(0,P.jsxs)(`span`,{children:[t,` namespace`]}),(0,P.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,P.jsx)(`option`,{value:`all`,children:`All mutations`}),(0,P.jsx)(`option`,{value:`put`,children:`Writes`}),(0,P.jsx)(`option`,{value:`delete`,children:`Deletes`})]})]}),(0,P.jsx)(`div`,{className:`table-shell`,children:(0,P.jsxs)(`table`,{className:`operations-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Sequence`}),(0,P.jsx)(`th`,{children:`Mutation`}),(0,P.jsx)(`th`,{children:`Collection`}),(0,P.jsx)(`th`,{children:`Key`}),(0,P.jsx)(`th`,{children:`Timestamp`})]})}),(0,P.jsxs)(`tbody`,{children:[o.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:e.sequence}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`span`,{className:`event-pill ${e.type}`,children:e.type})}),(0,P.jsx)(`td`,{children:e.collection}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`code`,{children:e.key})}),(0,P.jsx)(`td`,{children:new Date(e.timestamp).toLocaleString()})]},`${e.sequence}-${e.key}`)),!o.length&&(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{colSpan:5,className:`empty-message`,children:`No matching mutations yet. Create or change application state to populate this stream.`})})]})]})})]})}function Kn({peers:e=[],localInstance:t=`local`}){return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Peers`}),(0,P.jsx)(`p`,{children:`The live topology participating in this application's convergence fabric.`})]}),(0,P.jsxs)(`div`,{className:`peer-topology`,children:[(0,P.jsxs)(`article`,{className:`peer-node local`,children:[(0,P.jsx)(`span`,{children:`this instance`}),(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`small`,{children:`online · authoritative local state`})]}),e.map(e=>(0,P.jsxs)(g.Fragment,{children:[(0,P.jsx)(`i`,{className:`peer-link`}),(0,P.jsxs)(`article`,{className:`peer-node`,children:[(0,P.jsx)(`span`,{children:`connected peer`}),(0,P.jsx)(`h2`,{children:e}),(0,P.jsx)(`small`,{children:`online · exchanging operations`})]})]},e))]}),!e.length&&(0,P.jsx)(`div`,{className:`model-empty`,children:`This embedded runtime is operating independently. Its state remains durable and can converge when a network peer is attached.`})]})}function qn({model:e}){let t=e?.capabilities??[];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Capabilities`}),(0,P.jsxs)(`p`,{children:[`Declared authority available to workflows and autonomous agents in `,e?.app??`this application`,`.`]})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t.length,` declared`]}),(0,P.jsxs)(`span`,{children:[new Set(t.flatMap(e=>e.statements)).size,` permission rules`]})]}),(0,P.jsxs)(`div`,{className:`studio-card-grid`,children:[t.map(e=>(0,P.jsxs)(`article`,{className:`studio-card capability-card`,children:[(0,P.jsx)(`div`,{className:`card-kind`,children:`capability`}),(0,P.jsx)(`h2`,{children:e.name}),(0,P.jsx)(`div`,{className:`statement-list`,children:e.statements.map(e=>{let[t,...n]=e.split(` `);return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:t}),(0,P.jsx)(`code`,{children:n.join(` `)})]},e)})})]},e.name)),!t.length&&(0,P.jsx)(`div`,{className:`model-empty`,children:`No capabilities are declared in the current project model.`})]})]})}function Jn({db:e,name:t,label:n}){let{items:r}=zn(e,t);return r.length?(0,P.jsxs)(`section`,{children:[(0,P.jsxs)(`h2`,{children:[n,(0,P.jsx)(`span`,{children:r.length})]}),(0,P.jsx)(`div`,{className:`execution-list`,children:r.map((e,r)=>(0,P.jsxs)(`article`,{className:`execution-row`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:String(e.name??e.workflow??e.incident_id??e.id??n)}),(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`span`,{className:`event-pill put`,children:String(e.status??e.state??`materialized`)}),(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]},String(e.id??r)))})]}):null}function Yn({db:e,model:t}){return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Executions`}),(0,P.jsx)(`p`,{children:`Capability work, workflow runs, assignments, and agent decisions as inspectable state.`})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.workflows.length??0,` workflow definitions`]}),(0,P.jsxs)(`span`,{children:[t?.agents.length??0,` autonomous agents`]})]}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_executions`,label:`Capability executions`}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_workflow_runs`,label:`Workflow runs`}),(0,P.jsx)(Jn,{db:e??null,name:`Assignment`,label:`Materialized assignments`}),(0,P.jsx)(Jn,{db:e??null,name:`Decision`,label:`Agent decisions`}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_agent_executions`,label:`Agent executions`}),(0,P.jsxs)(`div`,{className:`model-empty execution-empty`,children:[`Execution sections appear as soon as their state is committed. Defined workflows: `,t?.workflows.map(e=>e.name).join(`, `)||`none`,`.`]})]})}function Xn({db:e,diagnostics:t}){let n=e?.sync(),r=n?.conflicts_detected??0;return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Conflicts`}),(0,P.jsx)(`p`,{children:`Concurrent mutations detected while replicas converge.`})]}),(0,P.jsxs)(`div`,{className:`metric-grid`,children:[(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:r}),(0,P.jsx)(`span`,{children:`detected`})]}),(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:n?.pending_operations??0}),(0,P.jsx)(`span`,{children:`pending operations`})]}),(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:n?.connected_peers.length??0}),(0,P.jsx)(`span`,{children:`connected peers`})]})]}),(0,P.jsxs)(`article`,{className:`studio-card`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Convergence`}),(0,P.jsx)(`h2`,{children:r?`Conflict activity detected`:`No conflicts detected`}),(0,P.jsx)(`p`,{children:t?.sync.connected?`The fabric is connected and applying causal ordering.`:`The local replica is independent; conflict detection begins when operations converge with peers.`}),(0,P.jsx)(`code`,{children:`Causal ordering → deterministic materialization → auditable resolution`})]})]})}function Zn({model:e}){let t=e?.workflows??[],[n,r]=(0,g.useState)(),i=t.find(e=>e.name===n)??t[0];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Workflows`}),(0,P.jsx)(`p`,{children:`Durable state transitions declared by the application model.`})]}),(0,P.jsxs)(`div`,{className:`split-browser`,children:[(0,P.jsx)(`aside`,{children:t.map(e=>(0,P.jsxs)(`button`,{className:e.name===i?.name?`active`:``,onClick:()=>r(e.name),children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsxs)(`span`,{children:[e.steps.length,` steps`]})]},e.name))}),(0,P.jsx)(`section`,{children:i?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`card-kind`,children:`workflow`}),(0,P.jsx)(`h2`,{children:i.name}),i.parameters.length>0&&(0,P.jsxs)(`code`,{className:`signature`,children:[`(`,i.parameters,`)`]}),(0,P.jsx)(`div`,{className:`workflow-track`,children:i.steps.map((e,t)=>(0,P.jsxs)(g.Fragment,{children:[(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`span`,{children:t+1}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:e.name}),e.statements.map(e=>(0,P.jsx)(`code`,{children:e},e))]})]}),t<i.steps.length-1&&(0,P.jsx)(`i`,{children:`→`})]},e.name))})]}):(0,P.jsx)(`div`,{className:`model-empty`,children:`No workflows are declared.`})})]})]})}function Qn({model:e}){let t=e?.agents??[],[n,r]=(0,g.useState)(),i=t.find(e=>e.name===n)??t[0];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Agents`}),(0,P.jsx)(`p`,{children:`Autonomous participants whose authority and workflows are part of the model.`})]}),(0,P.jsxs)(`div`,{className:`split-browser`,children:[(0,P.jsx)(`aside`,{children:t.map(e=>(0,P.jsxs)(`button`,{className:e.name===i?.name?`active`:``,onClick:()=>r(e.name),children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsxs)(`span`,{children:[e.statements.length,` bindings`]})]},e.name))}),(0,P.jsx)(`section`,{children:i?(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(`div`,{className:`agent-orbit`,children:[(0,P.jsxs)(`div`,{className:`agent-core`,children:[(0,P.jsx)(`span`,{children:`agent`}),(0,P.jsx)(`strong`,{children:i.name})]}),i.statements.map(e=>(0,P.jsxs)(`div`,{className:`agent-binding`,children:[(0,P.jsx)(`span`,{children:e.split(` `)[0]}),(0,P.jsx)(`strong`,{children:e.split(` `).slice(1).join(` `)})]},e))]})}):(0,P.jsx)(`div`,{className:`model-empty`,children:`No agents are declared.`})})]})]})}function $n({db:e,namespace:t=`default`,reference:n}){let[r,i]=(0,g.useState)(n??``),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(`Enter a Flow reference to trace it.`);(0,g.useEffect)(()=>{n&&i(n)},[n]);let d=async()=>{if(!(!e||!r))try{let t=e.provenance(r);o(t),u(`Causal graph resolved`)}catch{o(null);let t=await e.auditEvents(),n=r.split(`/`),i=n[n.length-1]??``,a=t.filter(e=>e.key.includes(i));c(a),u(a.length?`Local mutation lineage`:`No local lineage found for this reference`)}};return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Provenance`}),(0,P.jsx)(`p`,{children:`Follow why state exists—from durable mutations to causal workflow and agent edges.`})]}),(0,P.jsxs)(`div`,{className:`reference-query`,children:[(0,P.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`flow://${t}/Collection/id`}),(0,P.jsx)(`button`,{onClick:()=>void d(),children:`Trace`})]}),(0,P.jsxs)(`article`,{className:`studio-card provenance-result`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Lineage`}),(0,P.jsx)(`h2`,{children:l}),a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[a.nodes.length,` nodes`]}),(0,P.jsxs)(`span`,{children:[a.edges.length,` edges`]})]}),(0,P.jsx)(`div`,{className:`provenance-nodes`,children:a.nodes.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:e.label}),(0,P.jsx)(`small`,{children:e.type})]},e.id))})]}),!a&&s.map(e=>(0,P.jsxs)(`div`,{className:`provenance-event`,children:[(0,P.jsx)(`span`,{children:e.sequence}),(0,P.jsxs)(`b`,{children:[e.type,` `,e.collection]}),(0,P.jsx)(`code`,{children:e.key}),(0,P.jsx)(`small`,{children:new Date(e.timestamp).toLocaleString()})]},`${e.sequence}-${e.key}`))]})]})}function er({diagnostics:e,model:t}){let n=e?[[`Runtime`,e.runtime.status,e.runtime.reactive?`reactive`:`non-reactive`],[`Storage`,e.storage.status,`${e.storage.backend} · ${e.storage.persistent?`persistent`:`volatile`}`],[`Synchronization`,e.sync.status,`${e.sync.peers} peers · ${e.sync.pendingOperations} pending`],[`Fabric`,e.fabric.status,`${e.fabric.references} references`],[`Capabilities`,e.capabilities.status,`${e.capabilities.available}/${e.capabilities.count} available`],[`Execution`,e.execution.status,`${e.execution.running} running · ${e.execution.failed} failed`],[`Workflows`,e.workflow.status,`${e.workflow.active}/${e.workflow.total} active`]]:[];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Health`}),(0,P.jsx)(`p`,{children:`Runtime diagnostics, not optimistic defaults.`})]}),(0,P.jsx)(`div`,{className:`health-grid`,children:n.map(([e,t,n])=>(0,P.jsxs)(`article`,{className:`health-item status-${t}`,children:[(0,P.jsx)(`span`,{className:`status-icon`,children:t===`healthy`?`✓`:`!`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:e}),(0,P.jsx)(`small`,{children:n})]})]},e))}),!e&&(0,P.jsx)(`div`,{className:`model-empty`,children:`Diagnostics are unavailable until Studio connects to a runtime.`}),e?.issues.map((e,t)=>(0,P.jsxs)(`div`,{className:`health-issue ${e.severity}`,children:[(0,P.jsx)(`b`,{children:e.component}),` `,e.message]},t)),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.collections.length??0,` collections modeled`]}),(0,P.jsxs)(`span`,{children:[t?.workflows.length??0,` workflows modeled`]}),(0,P.jsxs)(`span`,{children:[t?.agents.length??0,` agents modeled`]})]})]})}function tr({db:e,remoteUrl:t=``,token:n=``,onConnect:r}){let[i,a]=(0,g.useState)(t),[o,s]=(0,g.useState)(n),c=e?.runtime();return(0,g.useEffect)(()=>{a(t),s(n)},[t,n]),(0,P.jsxs)(`div`,{className:`settings-panel`,children:[(0,P.jsx)(`h2`,{children:`Settings`}),(0,P.jsxs)(`div`,{className:`settings-content`,children:[(0,P.jsx)(`h3`,{children:`Connection`}),(0,P.jsxs)(`div`,{className:`connection-info`,children:[(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Runtime Environment`}),(0,P.jsx)(`span`,{children:c?.runtime||`unavailable`})]}),(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Storage Backend`}),(0,P.jsx)(`span`,{children:c?.storage||`unavailable`})]}),(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Instance ID`}),(0,P.jsx)(`span`,{className:`monospace`,children:e?.instanceId?.()||`unavailable`})]})]}),(0,P.jsxs)(`form`,{className:`connection-form`,onSubmit:e=>{e.preventDefault(),r?.(i,o)},children:[(0,P.jsxs)(`label`,{children:[`Server or managed endpoint`,(0,P.jsx)(`input`,{type:`url`,value:i,onChange:e=>a(e.target.value),placeholder:`https://your-runtime.example.com`})]}),(0,P.jsxs)(`label`,{children:[`API token`,(0,P.jsx)(`input`,{type:`password`,value:o,onChange:e=>s(e.target.value),placeholder:`fdb_live_…`,autoComplete:`off`})]}),(0,P.jsx)(`p`,{children:`Tokens are kept in this browser session and are never written to the project.`}),(0,P.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,children:`Connect Studio`})]})]})]})}function nr({db:e,model:t,onSearch:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),s=e=>{i(e),n&&n(e)};return(0,g.useEffect)(()=>{let n=!0;return(async()=>{let i=r.trim().toLowerCase();if(!i){o([]);return}let a=[...t?.collections.map(e=>({kind:`collection`,name:e.name,detail:`${e.fields.length} fields`}))??[],...t?.capabilities.map(e=>({kind:`capability`,name:e.name,detail:e.statements.join(` · `)}))??[],...t?.workflows.map(e=>({kind:`workflow`,name:e.name,detail:`${e.steps.length} steps`}))??[],...t?.agents.map(e=>({kind:`agent`,name:e.name,detail:e.statements.join(` · `)}))??[]].filter(e=>JSON.stringify(e).toLowerCase().includes(i)),s=e&&t?(await Promise.all(t.collections.map(async t=>(await e.collection(t.name).all()).filter(e=>JSON.stringify(e).toLowerCase().includes(i)).slice(0,3).map(e=>({kind:`object`,name:`${t.name}/${String(e.id??`record`)}`,detail:JSON.stringify(e)}))))).flat():[];n&&o([...a,...s].slice(0,12))})(),()=>{n=!1}},[e,t,r]),(0,P.jsxs)(`div`,{className:`global-search`,children:[(0,P.jsx)(`input`,{type:`text`,placeholder:`Search: documents/123, flow://, agent/name, etc.`,value:r,onChange:e=>s(e.target.value),className:`search-input global`}),r&&(0,P.jsx)(`div`,{className:`search-results`,children:(0,P.jsxs)(`div`,{className:`results-group`,children:[(0,P.jsx)(`h4`,{children:`Model & runtime`}),a.map((e,t)=>(0,P.jsxs)(`div`,{className:`search-result`,children:[(0,P.jsx)(`b`,{children:e.name}),(0,P.jsx)(`span`,{children:e.kind}),(0,P.jsx)(`small`,{children:e.detail})]},`${e.kind}-${e.name}-${t}`)),!a.length&&(0,P.jsx)(`div`,{className:`empty-message`,children:`No matches`})]})})]})}var rr=class{constructor(){this.dependencies=new Map,this.subscribers=new Map,this.recentChanges=new Map}registerDependency(e,t){this.dependencies.has(e)||this.dependencies.set(e,new Set),this.dependencies.get(e).add(t)}subscribe(e,t){this.subscribers.has(e)||this.subscribers.set(e,new Set);let n=this.subscribers.get(e);return n.add(t),()=>{n.delete(t),n.size===0&&this.subscribers.delete(e)}}async emitChange(e,t){this.recentChanges.has(e)||this.recentChanges.set(e,[]),this.recentChanges.get(e).push(t);let n=this.subscribers.get(e);n&&await Promise.all([...n].map(e=>e(t)));let r=this.dependencies.get(e);if(r)for(let e of r)await this.emitChange(e,t)}getRecentChanges(e){return this.recentChanges.get(e)||[]}clearRecentChanges(e){this.recentChanges.delete(e)}getSubscriberCount(e){return this.subscribers.get(e)?.size??0}hasDependents(e){let t=this.dependencies.get(e);return t!==void 0&&t.size>0}getDependents(e){let t=this.dependencies.get(e);return t?Array.from(t):[]}},ir=null;function ar(){return ir||=new rr,ir}var or=class{constructor(e){this.entries=new Map,this.stats={reads:0,writes:0,selectivity:0},this.field=e}add(e,t){let n=this.normalizeKey(t);this.entries.has(n)||this.entries.set(n,new Set),this.entries.get(n).add(e),this.stats.writes++}remove(e,t){let n=this.normalizeKey(t),r=this.entries.get(n);r&&(r.delete(e),r.size===0&&this.entries.delete(n)),this.stats.writes++}query(e){let t=this.normalizeKey(e);this.stats.reads++;let n=this.entries.get(t);return n?Array.from(n):[]}size(){return this.entries.size}getStats(){return{entries:this.entries.size,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.entries.size>0?1/this.entries.size:0}}normalizeKey(e){return e==null?`__null__`:typeof e==`object`?JSON.stringify(e):String(e)}},sr=class{constructor(e){this.entries=[],this.stats={reads:0,writes:0,selectivity:0},this.field=e}add(e,t){let n=this.entries.find(e=>this.compareKeys(e.key,t)===0);n||(n={key:t,recordIds:new Set},this.entries.push(n),this.entries.sort((e,t)=>this.compareKeys(e.key,t.key))),n.recordIds.add(e),this.stats.writes++}remove(e,t){let n=this.entries.find(e=>this.compareKeys(e.key,t)===0);n&&(n.recordIds.delete(e),n.recordIds.size===0&&(this.entries=this.entries.filter(e=>e!==n))),this.stats.writes++}queryEqual(e){this.stats.reads++;let t=this.entries.find(t=>this.compareKeys(t.key,e)===0);return t?Array.from(t.recordIds):[]}queryRange(e,t,n=!0,r=!0){this.stats.reads++;let i=new Set;for(let a of this.entries){let o=this.compareKeys(a.key,e),s=this.compareKeys(a.key,t);(n?o>=0:o>0)&&(r?s<=0:s<0)&&a.recordIds.forEach(e=>i.add(e))}return Array.from(i)}size(){return this.entries.length}getStats(){return this.entries.reduce((e,t)=>e+t.recordIds.size,0),{entries:this.entries.length,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.entries.length>0?1/this.entries.length:0}}compareKeys(e,t){return e==null?-1:t==null?1:e<t?-1:+(e>t)}},cr=class{constructor(e){this.tokenIndex=new Map,this.stats={reads:0,writes:0,selectivity:0},this.fields=e}add(e,t){let n=this.extractText(t),r=this.tokenize(n);for(let t of r)this.tokenIndex.has(t)||this.tokenIndex.set(t,new Set),this.tokenIndex.get(t).add(e);this.stats.writes++}remove(e,t){let n=this.extractText(t),r=this.tokenize(n);for(let t of r){let n=this.tokenIndex.get(t);n&&(n.delete(e),n.size===0&&this.tokenIndex.delete(t))}this.stats.writes++}query(e){this.stats.reads++;let t=this.tokenize(e);if(t.length===0)return[];let n=this.tokenIndex.get(t[0]);if(!n)return[];n=new Set(n);for(let e=1;e<t.length;e++){let r=this.tokenIndex.get(t[e]);if(!r)return[];n=new Set([...n].filter(e=>r.has(e)))}return Array.from(n)}size(){return this.tokenIndex.size}getStats(){return{entries:this.tokenIndex.size,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.tokenIndex.size>0?1/this.tokenIndex.size:0}}extractText(e){return this.fields.map(t=>{let n=e[t];return n?String(n):``}).join(` `)}tokenize(e){return e.toLowerCase().split(/\s+/).filter(e=>e.length>0)}},lr=class{constructor(){this.indexes=new Map,this.config=new Map,this.indexStats=new Map}createIndex(e){if(this.indexes.has(e.name))throw Error(`Index ${e.name} already exists`);let t;if(e.type===`hash`&&e.field)t=new or(e.field);else if(e.type===`sorted`&&e.field)t=new sr(e.field);else if(e.type===`text`&&e.textFields)t=new cr(e.textFields);else throw Error(`Invalid index config: ${JSON.stringify(e)}`);this.indexes.set(e.name,t),this.config.set(e.name,e),this.indexStats.set(e.name,{name:e.name,type:e.type,entries:0,size:0,lastUpdated:Date.now(),reads:0,writes:0,selectivity:0})}updateRecord(e,t,n){for(let[r,i]of this.indexes){let a=this.config.get(r);t&&(a.type===`hash`&&a.field||a.type===`sorted`&&a.field?i.remove(e,t[a.field]):a.type===`text`&&i.remove(e,t)),a.type===`hash`&&a.field||a.type===`sorted`&&a.field?i.add(e,n[a.field]):a.type===`text`&&i.add(e,n);let o=this.indexStats.get(r);o.lastUpdated=Date.now();let s=i.getStats();Object.assign(o,s)}}queryIndex(e,t){let n=this.indexes.get(e);if(!n)throw Error(`Index ${e} not found`);let r=this.config.get(e);if(r.type===`hash`)return n.query(t.value);if(r.type===`sorted`){let e=n;if(t.operator===`eq`)return e.queryEqual(t.value);if(t.operator===`range`)return e.queryRange(t.min,t.max);if(t.operator===`gte`)return e.queryRange(t.value,Number.MAX_VALUE);if(t.operator===`lte`)return e.queryRange(Number.MIN_VALUE,t.value)}else if(r.type===`text`)return n.query(t.value);return[]}listIndexes(){return Array.from(this.config.values())}getStats(e){return this.indexStats.get(e)||null}planQuery(e){let t=[];for(let n of e)for(let[e,r]of this.config)if(r.field===n||r.fields?.includes(n)){let n=this.indexStats.get(e);t.push({indexName:e,indexType:r.type,estimatedRows:Math.ceil(100/(n.selectivity||1)),cost:n.reads+n.writes,canPruneAll:r.type===`hash`,requiresPostFilter:r.type===`text`||r.type===`sorted`})}if(t.length===0)return{strategy:`full-scan`,indexes:[],estimatedRows:1e3,totalCost:1e3,explanation:`No suitable index found, using full collection scan`};t.sort((e,t)=>e.cost-t.cost);let n=t[0];return{strategy:`index-scan`,indexes:[n],estimatedRows:n.estimatedRows,totalCost:n.cost,explanation:`Using ${n.indexType} index on ${n.indexName}`}}},ur=null;async function dr(){if(ur!==null)return ur;try{let e=await x(()=>import(`./feltdb_wasm-Bb1Pg6qz.js`),[]);return ur=e,e}catch{return null}}var fr=class{constructor(){this.tsBackend=null,this.wasmBackend=null,this.useWasm=!1,this.tsBackend=new lr}async initializeWasm(){if(this.wasmBackend!==null)return;let e=await dr();if(e&&e.WasmIndexManager)try{this.wasmBackend=new e.WasmIndexManager,this.useWasm=!0}catch{this.useWasm=!1}}createIndex(e){if(this.useWasm&&this.wasmBackend)try{this.wasmBackend.create_index(JSON.stringify(e));return}catch{}this.tsBackend?.createIndex(e)}updateRecord(e,t,n){if(this.useWasm&&this.wasmBackend)try{let r=t?JSON.stringify(t):null,i=JSON.stringify(n);this.wasmBackend.update_record(e,r,i);return}catch{}this.tsBackend?.updateRecord(e,t,n)}queryIndex(e,t){if(this.useWasm&&this.wasmBackend)try{let n=this.wasmBackend.query_index(e,t.operator,String(t.value||``));return JSON.parse(n)}catch{}return this.tsBackend?.queryIndex(e,t)||[]}queryCompoundIndex(e,t){if(this.useWasm&&this.wasmBackend)try{let n=Object.values(t).map(e=>String(e)).join(`\0`),r=this.wasmBackend.query_index(e,`eq`,n);return JSON.parse(r)}catch{}return[]}listIndexes(){if(this.useWasm&&this.wasmBackend)try{let e=this.wasmBackend.list_indexes();return JSON.parse(e)}catch{}return this.tsBackend?.listIndexes()||[]}},pr=class{constructor(e,t){this.db=e,this.collectionName=t}async saveIndexConfig(e,t){let n=`__indexes__:${this.collectionName}:${e.name}`,r={config:e,version:1,createdAt:Date.now(),lastUpdated:Date.now(),entryCount:t},i=await this.db.insert(n,JSON.stringify(r));i.success||console.warn(`Failed to save index config for ${e.name}: ${i.error}`)}async loadIndexConfigs(){let e=await this.db.query(`__indexes__:${this.collectionName}`);if(!e.success||!e.data)return[];try{return JSON.parse(e.data).map(e=>e.config)}catch{return console.warn(`Failed to parse index configs for ${this.collectionName}`),[]}}async getIndexConfig(e){let t=`__indexes__:${this.collectionName}:${e}`,n=await this.db.get(t);if(!n.success||!n.data)return null;try{return JSON.parse(n.data).config}catch{return null}}async deleteIndexConfig(e){let t=`__indexes__:${this.collectionName}:${e}`;if(!this.db.delete){console.warn(`Failed to delete index config for ${e}: delete is not supported`);return}let n=this.db.delete(t),r=n instanceof Promise?await n:n;r?.success||console.warn(`Failed to delete index config for ${e}: ${r?.error}`)}async updateIndexStats(e,t){let n=`__indexes__:${this.collectionName}:${e}`,r=await this.db.get(n);if(!(!r.success||!r.data))try{let e=JSON.parse(r.data);e.lastUpdated=Date.now(),e.entryCount=t,await this.db.insert(n,JSON.stringify(e))}catch{console.warn(`Failed to update index stats for ${e}`)}}async getSnapshot(){let e=await this.loadIndexConfigs();return{collectionName:this.collectionName,indexes:e.map(e=>({config:e,version:1,createdAt:Date.now(),lastUpdated:Date.now(),entryCount:0})),timestamp:Date.now()}}},mr=class e{constructor(e,t,n,r){this.predicate=null,this.cache=[],this.subscribers=new Set,this.parent=null,this.parentId=null,this.isInitialized=!1,this.unsubscribeFunctions=new Set,this.graphUnsubscribe=null,this.runtimeUnsubscribe=null,this.indexBackend=new fr,this.indexesLoaded=!1,this.db=e,this.name=t,this.collectionId=`${t}-${Math.random().toString(36).substr(2,9)}`,this.predicate=n||null,this.parent=r||null,this.parentId=r?r.collectionId:null,this.indexStore=new pr(e,t),r&&ar().registerDependency(r.collectionId,this.collectionId),this.loadPersistedIndexes()}async loadPersistedIndexes(){try{let e=await this.indexStore.loadIndexConfigs();for(let t of e)this.indexBackend.createIndex(t);this.indexesLoaded=!0}catch(e){console.warn(`Failed to load persisted indexes for ${this.name}:`,e),this.indexesLoaded=!0}}async all(){return await this.refresh(),[...this.cache]}async find(e={}){let t=await this.all(),n=Object.entries(e);return t.filter(e=>n.every(([t,n])=>e[t]===n))}createIndex(e){this.indexBackend.createIndex(e);for(let e of this.cache){let t=e?.id||JSON.stringify(e);this.indexBackend.updateRecord(t,null,e)}this.indexStore.saveIndexConfig(e,this.cache.length)}listIndexes(){return this.indexBackend.listIndexes()}async rebuildIndexes(){let e=this.indexBackend.listIndexes(),t=await this.all();for(let n of t){let t=n?.id||JSON.stringify(n);for(let r of e)this.indexBackend.updateRecord(t,null,n)}}async validateIndexes(){return this.indexBackend.listIndexes().length===0||(await this.all()).length,!0}async get(e){let t=`${this.name}:${e}`,n=await this.db.get(t);if(n.success&&n.data)try{return JSON.parse(n.data)}catch{return null}return null}where(t){return new e(this.db,this.name,e=>(!this.predicate||this.predicate(e))&&t(e),this.parent||this)}async insert(e,t){let n=t??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,r=`${this.name}:${n}`,i=typeof e==`object`&&e?{...e,id:n}:e,a=await this.db.insert(r,JSON.stringify(i));if(!a.success)throw Error(`Insert failed: ${a.error}`);this.indexBackend.updateRecord(String(n),null,i);let o={type:`insert`,key:r,value:i,timestamp:Date.now()};return await ar().emitChange(this.name,o),String(n)}async update(e,t){let n=await this.get(e);if(!n)throw Error(`Record ${e} not found`);let r={...n,...t},i=`${this.name}:${e}`,a=await(this.db.update?this.db.update(i,JSON.stringify(r)):this.db.insert(i,JSON.stringify(r)));if(!a.success)throw Error(`Update failed: ${a.error}`);this.indexBackend.updateRecord(String(e),n,r);let o={type:`update`,key:i,value:r,timestamp:Date.now()};await ar().emitChange(this.name,o)}async delete(e){let t=`${this.name}:${e}`;if(!this.db.delete)throw Error(`Delete is not supported by this FeltDB runtime`);let n=await this.db.delete(t);if(!n.success)throw Error(`Delete failed: ${n.error}`);let r=await this.get(e);r&&this.indexBackend.updateRecord(String(e),r,{});let i={type:`delete`,key:t,value:null,timestamp:Date.now()};await ar().emitChange(this.name,i)}async count(){return(await this.all()).length}async exists(e){return await this.get(e)!==null}subscribe(e,t){if(this.subscribers.add(e),this.isInitialized||this.refresh().catch(e=>console.error(`Failed to initialize collection:`,e)),!this.graphUnsubscribe){let e=async()=>{await this.refresh();for(let e of this.subscribers)e([...this.cache])},t=ar();this.graphUnsubscribe=t.subscribe(this.name,e),this.db.subscribe_changes&&(this.runtimeUnsubscribe=this.db.subscribe_changes(t=>{t===this.name&&e()}))}return()=>{if(this.subscribers.delete(e),this.subscribers.size===0){this.graphUnsubscribe?.(),this.runtimeUnsubscribe?.(),this.graphUnsubscribe=null,this.runtimeUnsubscribe=null;for(let e of this.unsubscribeFunctions)e();this.unsubscribeFunctions.clear()}}}close(){this.graphUnsubscribe?.(),this.runtimeUnsubscribe?.(),this.graphUnsubscribe=null,this.runtimeUnsubscribe=null,this.subscribers.clear();for(let e of this.unsubscribeFunctions)e();this.unsubscribeFunctions.clear()}async refresh(){try{let e=await this.db.query(this.name);if(e.success&&e.data)try{let t=JSON.parse(e.data);this.predicate&&(t=t.filter(e=>{try{return this.predicate(e)}catch{return!1}})),this.cache=t,this.isInitialized=!0}catch(e){console.error(`Failed to parse query results:`,e)}else e.success||console.error(`Query failed:`,e.error)}catch(e){console.error(`Refresh error:`,e)}}},F;(function(e){e.Created=`Created`,e.Planning=`Planning`,e.Observing=`Observing`,e.Deciding=`Deciding`,e.Acting=`Acting`,e.Waiting=`Waiting`,e.Completed=`Completed`,e.Failed=`Failed`,e.Cancelled=`Cancelled`,e.Blocked=`Blocked`})(F||={});function hr(e,t){return{name:e,version:t,toString(){return`flow://agent/${this.name}@${this.version}`}}}function gr(e){return`exec-${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}var _r=class{constructor(){this.agents=new Map}register(e,t){let n=e.toString(),r={agentRef:e,definition:t,providers:[],compatibleStateVersions:[],registeredAt:Date.now(),updatedAt:Date.now(),active:!0};this.agents.set(n,r)}unregister(e){let t=e.toString();this.agents.delete(t)}get(e){let t=e.toString();return this.agents.get(t)}getByName(e){let t;for(let n of this.agents.values())n.definition.name===e&&(!t||n.agentRef.version>t.agentRef.version)&&(t=n);return t}getAll(){return Array.from(this.agents.values())}addProvider(e,t){let n=e.toString(),r=this.agents.get(n);if(!r)throw Error(`Agent not registered: ${n}`);r.providers=r.providers.filter(e=>e.peerId!==t.peerId),r.providers.push(t),r.updatedAt=Date.now()}removeProvider(e,t){let n=e.toString(),r=this.agents.get(n);if(!r)throw Error(`Agent not registered: ${n}`);r.providers=r.providers.filter(e=>e.peerId!==t),r.updatedAt=Date.now()}getAvailableProviders(e){let t=this.get(e);return t?t.providers.filter(e=>e.available):[]}findByCapability(e){let t=[];for(let n of this.agents.values())n.definition.capabilities.includes(e)&&t.push(n);return t}updateAvailability(e,t,n){let r=this.get(e);if(!r)throw Error(`Agent not registered: ${e.toString()}`);let i=r.providers.find(e=>e.peerId===t);i&&(i.available=n,i.lastHeartbeat=Date.now(),r.updatedAt=Date.now())}clear(){this.agents.clear()}},vr=class{constructor(){this.ownership=new Map,this.locks=new Map}claim(e,t,n){let r=this.ownership.get(e);if(r===t)return!0;if(r)return!1;let i=this.locks.get(e);return i&&i.expiresAt>Date.now()?!1:(this.ownership.set(e,t),this.locks.set(e,{peerId:t,expiresAt:Date.now()+n}),!0)}release(e,t){this.ownership.get(e)===t&&(this.ownership.delete(e),this.locks.delete(e))}getOwner(e){return this.ownership.get(e)}isValid(e){let t=this.locks.get(e);return t?t.expiresAt>Date.now():!1}renew(e,t,n){return this.ownership.get(e)===t&&(this.locks.set(e,{peerId:t,expiresAt:Date.now()+n}),!0)}},yr=class{constructor(e,t){this.handlers=new Map,this.executions=new Map,this.triggers=new Map,this.registry=e,this.config=t,this.ownership=new vr}registerHandler(e,t){this.handlers.set(e,t)}async createExecution(e,t,n,r){let i=gr(t.name),a={executionId:i,agentRef:t,status:F.Created,goal:n,inputs:r,stateVersion:0,observationIds:[],decisionIds:[],actionIds:[],attempt:1,createdMs:Date.now()};return this.executions.set(i,a),a}async start(e,t){if(!this.ownership.claim(e.executionId,t,3e4))throw Error(`Failed to claim ownership of execution ${e.executionId}`);try{return e.status=F.Planning,e.ownedBy=t,e.startedMs=Date.now(),{execution:e,status:F.Planning,resultRef:void 0}}catch(t){return e.status=F.Failed,e.error=String(t),e.completedMs=Date.now(),{execution:e,status:F.Failed,error:String(t)}}}async resume(e,t){if(!this.ownership.claim(e.executionId,t,3e4)&&this.ownership.getOwner(e.executionId)!==t)throw Error(`Cannot resume execution ${e.executionId}: owned by ${this.ownership.getOwner(e.executionId)}`);return e.ownedBy=t,e.status=F.Observing,{execution:e,status:F.Observing}}async transition(e,t){if(!({[F.Created]:[F.Planning],[F.Planning]:[F.Observing],[F.Observing]:[F.Deciding,F.Waiting],[F.Deciding]:[F.Acting],[F.Acting]:[F.Observing,F.Waiting,F.Completed],[F.Waiting]:[F.Observing,F.Blocked],[F.Completed]:[],[F.Failed]:[],[F.Cancelled]:[],[F.Blocked]:[F.Observing]}[e.status]||[]).includes(t))throw Error(`Invalid transition from ${e.status} to ${t}`);e.status=t}async complete(e,t){e.status=F.Completed,e.resultRef=t,e.completedMs=Date.now(),e.ownedBy&&this.ownership.release(e.executionId,e.ownedBy)}async fail(e,t){e.status=F.Failed,e.error=t,e.completedMs=Date.now(),e.ownedBy&&this.ownership.release(e.executionId,e.ownedBy)}getExecution(e){return this.executions.get(e)}getOwner(e){return this.ownership.getOwner(e)}registerTriggers(e,t){this.triggers.set(e,t)}getTriggers(e){return this.triggers.get(e)||[]}},br=new Map,xr=class{constructor(e){this.events=[],this.sequence=0,this.peers=new Set;let t=br.get(e);t||(t=new Map,br.set(e,t)),this.rows=t,this.origin=`memory:${e}`}event(e,t,n,r){this.sequence+=1;let i=Date.now();this.events.push({sequence:this.sequence,collection:e,key:t,type:n,value:r,timestamp:i,origin:this.origin,id:`${this.origin}:${i}:${this.sequence}`})}insert(e,t){try{return this.rows.set(e,JSON.parse(t)),this.event(e.split(`:`)[0],e,`put`,JSON.parse(t)),{success:!0,data:e}}catch(e){return{success:!1,error:String(e)}}}update(e,t){return this.rows.has(e)?this.insert(e,t):{success:!1,error:`Record ${e} not found`}}get(e){let t=this.rows.get(e);return t===void 0?{success:!0}:{success:!0,data:JSON.stringify(t)}}delete(e){return this.rows.delete(e),this.event(e.split(`:`)[0],e,`delete`),{success:!0,data:e}}query(e){let t=`${e}:`,n=[...this.rows].filter(([e])=>e.startsWith(t)).map(([,e])=>e);return{success:!0,data:JSON.stringify(n)}}get_capability_records(e){return this.query(e)}execute_op(){return{success:!1,error:`Raw operations are unavailable in the memory runtime`}}sync_info(){return{success:!0,data:JSON.stringify({instance_id:this.origin,sequence:this.sequence,connected_peers:[...this.peers],pending_operations:0,operations_sent:0,operations_received:0,conflicts_detected:0,last_sync_ms:0,is_connected:this.peers.size>0})}}add_peer(){return{success:!0}}add_sync_peer(e){return this.peers.add(e),{success:!0}}remove_sync_peer(e){return this.peers.delete(e),{success:!0}}acknowledge_peer_operations(){return{success:!0}}get_pending_for_peer(){return{success:!0,data:`[]`}}instance_id(){return this.origin}get_sequence(){return this.sequence}audit_events(){return[...this.events]}export_operations(e){return this.events.filter(t=>t.sequence>e)}apply_remote_operations(e){let t=0,n=0;for(let r of e){if(this.events.some(e=>e.id===r.id)){n++;continue}let e=[...this.events].reverse().find(e=>e.key===r.key),i=`${String(r.timestamp).padStart(16,`0`)}:${r.origin}:${r.id}`,a=e?`${String(e.timestamp).padStart(16,`0`)}:${e.origin}:${e.id}`:``;this.sequence+=1,this.events.push({...r,sequence:this.sequence}),i>=a?(r.type===`delete`?this.rows.delete(r.key):this.rows.set(r.key,r.value),t++):n++}return{applied:t,ignored:n}}},I=class{constructor(e){this.url=e.url.replace(/\/$/,``),this.token=e.token}headers(e=!1){return{Authorization:`Bearer ${this.token}`,"FeltDB-Protocol":`1`,...e?{"Content-Type":`application/json`}:{}}}splitKey(e){let t=e.indexOf(`:`);if(t<1||t===e.length-1)throw Error(`Invalid FeltDB key: ${e}`);return[e.slice(0,t),e.slice(t+1)]}async get(e){try{let[t,n]=this.splitKey(e),r=await fetch(`${this.url}/collections/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,{headers:this.headers()});if(r.status===404)return{success:!0};if(!r.ok)return this.failure(r);let i=await r.json();return{success:!0,data:JSON.stringify(i.value)}}catch(e){return{success:!1,error:String(e)}}}async query(e){try{let t=await fetch(`${this.url}/collections/${encodeURIComponent(e)}`,{headers:this.headers()});if(!t.ok)return this.failure(t);let n=await t.json();return{success:!0,data:JSON.stringify(n.map(e=>e.value))}}catch(e){return{success:!1,error:String(e)}}}async insert(e,t){try{let[n,r]=this.splitKey(e),i=JSON.parse(t),a=await fetch(`${this.url}/collections/${encodeURIComponent(n)}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify({...i,id:r})});return a.ok?{success:!0,data:e}:this.failure(a)}catch(e){return{success:!1,error:String(e)}}}async update(e,t){try{let[n,r]=this.splitKey(e),i=await fetch(`${this.url}/collections/${encodeURIComponent(n)}/${encodeURIComponent(r)}`,{method:`PATCH`,headers:this.headers(!0),body:t});return i.ok?{success:!0,data:e}:this.failure(i)}catch(e){return{success:!1,error:String(e)}}}async delete(e){try{let[t,n]=this.splitKey(e),r=await fetch(`${this.url}/collections/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,{method:`DELETE`,headers:this.headers()});return r.ok?{success:!0,data:e}:this.failure(r)}catch(e){return{success:!1,error:String(e)}}}async acquire(e,t){let n=await fetch(`${this.url}/refs/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{headers:this.headers()});if(n.status===404)return null;if(!n.ok)throw Error((await this.failure(n)).error);return(await n.json()).value}async search(e,t,n=50){let r=await fetch(`${this.url}/capabilities/search/${encodeURIComponent(e)}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify({query:t,limit:n})});if(!r.ok)throw Error((await this.failure(r)).error);return(await r.json()).map(e=>e.value)}async provenance(e,t){let n=await fetch(`${this.url}/provenance/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{headers:this.headers()});if(!n.ok)throw Error((await this.failure(n)).error);return n.json()}async storeContent(e){let t=await fetch(`${this.url}/content`,{method:`PUT`,headers:this.headers(),body:e});if(!t.ok)throw Error((await this.failure(t)).error);return t.json()}async acquireContent(e){let t=await fetch(`${this.url}/content/${encodeURIComponent(e)}`,{headers:this.headers()});if(t.status===404)return null;if(!t.ok)throw Error((await this.failure(t)).error);return new Uint8Array(await t.arrayBuffer())}async command(e,t){let n=await fetch(`${this.url}${e}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify(t)});if(!n.ok)throw Error((await this.failure(n)).error);return n.status===204?void 0:n.json()}subscribe_changes(e){let t=new AbortController;return this.consumeEvents(t,e),()=>t.abort()}async consumeEvents(e,t){for(;!e.signal.aborted;){try{let n=await fetch(`${this.url}/events`,{headers:this.headers(),signal:e.signal});if(!n.ok||!n.body)throw Error(`Event stream failed: HTTP ${n.status}`);let r=n.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:n}=await r.read();if(e)break;a+=i.decode(n,{stream:!0}).replace(/\r\n/g,`
|
|
10
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=pt(),d;if(t){let e=typeof t==`string`?O(t):t;E(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ce(e,{pathname:p});D(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),D(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Et(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Fe([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Fe([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?g.createElement(rt.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function xt(){let e=Nt(),t=Ve(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=g.createElement(g.Fragment,null,g.createElement(`p`,null,`💿 Hey developer 👋`),g.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,g.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,g.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),g.createElement(g.Fragment,null,g.createElement(`h2`,null,`Unexpected Application Error!`),g.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?g.createElement(`pre`,{style:i},n):null,o)}var St=g.createElement(xt,null),Ct=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ut(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:g.createElement(it.Provider,{value:this.props.routeContext},g.createElement(at.Provider,{value:e,children:this.props.component}));return this.context?g.createElement(Tt,{error:e},t):t}};Ct.contextType=Ze;var wt=new WeakMap;function Tt({children:e,error:t}){let{basename:n}=g.useContext(nt);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=lt(t.digest);if(e){let r=wt.get(t);if(r)throw r;let i=We(e.location,n),a=i.absoluteURL||i.to;if(Je(a))throw Error(`Invalid redirect location`);if(Ue&&!wt.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw wt.set(t,n),n}}return g.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function A({routeContext:e,match:t,children:n}){let r=g.useContext(Ye);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(it.Provider,{value:e},n)}function Et(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:He(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||St,o&&(s<0&&c===0?(It(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?g.createElement(n.route.Component,null):n.route.element?n.route.element:e,g.createElement(A,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?g.createElement(Ct,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Dt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ot(e){let t=g.useContext(Ye);return E(t,Dt(e)),t}function kt(e){let t=g.useContext(Xe);return E(t,Dt(e)),t}function At(e){let t=g.useContext(it);return E(t,Dt(e)),t}function jt(e){let t=At(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Mt(){return jt(`useRouteId`)}function Nt(){let e=g.useContext(at),t=kt(`useRouteError`),n=jt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Pt(){let{router:e}=Ot(`useNavigate`),t=jt(`useNavigate`),n=g.useRef(!1);return ht(()=>{n.current=!0}),g.useCallback(async(r,i={})=>{D(n.current,mt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ft={};function It(e,t,n){!t&&!Ft[e]&&(Ft[e]=!0,D(!1,n))}g.memo(Lt);function Lt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return bt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function j(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Rt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){E(!ft(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=g.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=O(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=g.useMemo(()=>{let e=De(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return D(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:g.createElement(nt.Provider,{value:c},g.createElement(rt.Provider,{children:t,value:h}))}function zt({children:e,location:t}){return yt(Bt(e),t)}g.Component;function Bt(e,t=[]){let n=[];return g.Children.forEach(e,(e,r)=>{if(!g.isValidElement(e))return;let i=[...t,r];if(e.type===g.Fragment){n.push.apply(n,Bt(e.props.children,i));return}E(e.type===j,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Bt(e.props.children,i)),n.push(a)}),n}var Vt=`get`,Ht=`application/x-www-form-urlencoded`;function Ut(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Wt(e){return Ut(e)&&e.tagName.toLowerCase()===`button`}function Gt(e){return Ut(e)&&e.tagName.toLowerCase()===`form`}function Kt(e){return Ut(e)&&e.tagName.toLowerCase()===`input`}function qt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Jt(e,t){return e.button===0&&(!t||t===`_self`)&&!qt(e)}var Yt=null;function M(){if(Yt===null)try{new FormData(document.createElement(`form`),0),Yt=!1}catch{Yt=!0}return Yt}var Xt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Zt(e){return e!=null&&!Xt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ht}"`),null):e}function Qt(e,t){let n,r,i,a,o;if(Gt(e)){let o=e.getAttribute(`action`);r=o?De(o,t):null,n=e.getAttribute(`method`)||Vt,i=Zt(e.getAttribute(`enctype`))||Ht,a=new FormData(e)}else if(Wt(e)||Kt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?De(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Vt,i=Zt(e.getAttribute(`formenctype`))||Zt(o.getAttribute(`enctype`))||Ht,a=new FormData(o,e),!M()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Ut(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Vt,r=null,i=Ht,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function $t(e,t){if(e===!1||e==null)throw Error(t)}function en(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&De(i.pathname,t)===`/`?`${Ie(t)}/_root.${r}`:`${Ie(i.pathname)}.${r}`,i}async function tn(e,t){if(e.id in t)return t[e.id];try{let n=await x(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nn(e){return e!=null&&typeof e.page==`string`}function rn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function an(e,t,n){return un((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await tn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(rn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function on(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function sn(e,t,{includeHydrateFallback:n}={}){return cn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function cn(e){return[...new Set(e)]}function ln(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function un(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!nn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ln(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function dn(){let e=g.useContext(Ye);return $t(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function fn(){let e=g.useContext(Xe);return $t(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var pn=g.createContext(void 0);pn.displayName=`FrameworkContext`;function mn(){let e=g.useContext(pn);return $t(e,`You must render this element inside a <HydratedRouter> element`),e}function hn(e,t){let n=g.useContext(pn),[r,i]=g.useState(!1),[a,o]=g.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=g.useRef(null);g.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),g.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:gn(s,p),onBlur:gn(c,m),onMouseEnter:gn(l,p),onMouseLeave:gn(u,m),onTouchStart:gn(d,p)}]:[a,f,{}]:[!1,f,{}]}function gn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _n({page:e,...t}){let n=Qe(),{nonce:r}=mn(),{router:i}=dn(),a=g.useMemo(()=>ce(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?g.createElement(yn,{page:e,matches:a,...t}):g.createElement(bn,{page:e,matches:a,...t})):null}function vn(e){let{manifest:t,routeModules:n}=mn(),[r,i]=g.useState([]);return g.useEffect(()=>{let r=!1;return an(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function yn({page:e,matches:t,...n}){let r=pt(),{future:i}=mn(),{basename:a}=dn(),o=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=en(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return g.createElement(g.Fragment,null,o.map(e=>g.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function bn({page:e,matches:t,...n}){let r=pt(),{future:i,manifest:a,routeModules:o}=mn(),{basename:s}=dn(),{loaderData:c,matches:l}=fn(),u=g.useMemo(()=>on(e,t,l,a,r,`data`),[e,t,l,a,r]),d=g.useMemo(()=>on(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=en(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=g.useMemo(()=>sn(d,a),[d,a]),m=vn(d);return g.createElement(g.Fragment,null,f.map(e=>g.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>g.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>g.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function xn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}g.Component;var Sn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Sn&&(window.__reactRouterVersion=`7.18.2`)}catch{}function Cn({basename:e,children:t,useTransitions:n,window:r}){let i=g.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=g.useState({action:a.action,location:a.location}),c=g.useCallback(e=>{n===!1?s(e):g.startTransition(()=>s(e))},[n]);return g.useLayoutEffect(()=>a.listen(c),[a,c]),g.createElement(Rt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var N=g.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:_,useTransitions:v}=g.useContext(nt),y=typeof l==`string`&&S.test(l),b=We(l,h);l=b.to;let x=dt(l,{relative:r}),C=pt(),w=null;if(o){let e=Ne(o,[],C.mask?C.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Fe([h,e.pathname])),w=_.createHref(e)}let[T,ee,te]=hn(n,p),E=On(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:v});function D(t){e&&e(t),t.defaultPrevented||E(t)}let ne=!(b.isExternal||i),re=g.createElement(`a`,{...p,...te,href:(ne?w:void 0)||b.absoluteURL||x,onClick:ne?D:e,ref:xn(m,ee),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return T&&!y?g.createElement(g.Fragment,null,re,g.createElement(_n,{page:x})):re});N.displayName=`Link`;var wn=g.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=vt(a,{relative:c.relative}),d=pt(),f=g.useContext(Xe),{navigator:p,basename:m}=g.useContext(nt),h=f!=null&&Nn(u)&&o===!0,_=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,v=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&m&&(y=De(y,m)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return g.createElement(N,{...c,"aria-current":w,className:T,ref:l,style:ee,to:a,viewTransition:o},typeof s==`function`?s(C):s)});wn.displayName=`NavLink`;var Tn=g.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Vt,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=g.useContext(nt),_=jn(),v=Mn(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&S.test(s);return g.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?g.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});Tn.displayName=`Form`;function En(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dn(e){let t=g.useContext(Ye);return E(t,En(e)),t}function On(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=gt(),d=pt(),f=vt(e,{relative:o});return g.useCallback(p=>{if(Jt(p,t)){p.preventDefault();let t=n===void 0?ae(d)===ae(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?g.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var kn=0,An=()=>`__${String(++kn)}__`;function jn(){let{router:e}=Dn(`useSubmit`),{basename:t}=g.useContext(nt),n=Mt(),r=e.fetch,i=e.navigate;return g.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Qt(e,t);if(a.navigate===!1){let e=a.fetcherKey||An();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Mn(e,{relative:t}={}){let{basename:n}=g.useContext(nt),r=g.useContext(it);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...vt(e||`.`,{relative:t})},o=pt();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Fe([n,a.pathname])),ae(a)}function Nn(e,{relative:t}={}){let n=g.useContext($e);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Dn(`useViewTransitionState`),i=vt(e,{relative:t});if(!n.isTransitioning)return!1;let a=De(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=De(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ce(i.pathname,o)!=null||Ce(i.pathname,a)!=null}var Pn=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),P=o(((e,t)=>{t.exports=Pn()}))();function Fn({stats:e}){return e?(0,P.jsxs)(`div`,{className:`overview-dashboard`,children:[(0,P.jsxs)(`div`,{className:`dashboard-header`,children:[(0,P.jsx)(`h1`,{children:`FeltDB Studio`}),(0,P.jsx)(`div`,{className:`namespace-badge`,children:e.namespace})]}),(0,P.jsxs)(`div`,{className:`dashboard-grid`,children:[(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Runtime`}),(0,P.jsx)(`div`,{className:`status-indicator ${e.status}`,children:`●`}),(0,P.jsx)(`span`,{children:e.status.charAt(0).toUpperCase()+e.status.slice(1)})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Storage`}),(0,P.jsxs)(`span`,{children:[e.persistence,` / `,e.storageBackend]})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Peers`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.peersCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Objects`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.objectsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Operations`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.operationsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Capabilities`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.capabilitiesCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Executions`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.executionsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Workflows`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.workflowsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Agents`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.agentsCount})]}),(0,P.jsxs)(`div`,{className:`stat-card`,children:[(0,P.jsx)(`label`,{children:`Conflicts`}),(0,P.jsx)(`span`,{className:`stat-number`,children:e.conflictsCount})]})]})]}):(0,P.jsx)(`div`,{className:`overview-dashboard loading`,children:(0,P.jsx)(`p`,{children:`Loading runtime information...`})})}function In(e,t=`default`){let[n,r]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!e){r(null);return}let n=e.runtime(),i=n.runtime===`browser`?`browser`:n.runtime===`node`?`self-hosted`:`remote`;r({db:e,connected:!0,namespace:t,instanceId:e.instanceId?.()||`unknown`,environment:i})},[e,t]),n}function Ln(e,t=null,n=`default`){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!e){i(null);return}let r=async()=>{try{let r=e.runtime(),a=e.health(),o=e.sync?.(),s=t?await Promise.all(t.collections.map(t=>e.collection(t.name).count())):[];i({namespace:n,status:a?.status||`healthy`,storageBackend:r.storage,persistence:r.persistent?`durable`:`volatile`,peersCount:o?.connected_peers?.length||0,objectsCount:s.reduce((e,t)=>e+t,0),operationsCount:o?.sequence||0,capabilitiesCount:t?.capabilities.length||0,executionsCount:await e.collection(`_flow_executions`).count()||await e.collection(`Decision`).count(),workflowsCount:t?.workflows.length||0,agentsCount:t?.agents.length||0,conflictsCount:o?.conflicts_detected||0})}catch(e){console.error(`Failed to fetch dashboard stats:`,e)}};r();let a=setInterval(r,5e3);return()=>clearInterval(a)},[e,t,n]),r}function Rn(e){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null),s=(0,g.useCallback)(async()=>{if(e){i(!0),o(null);try{let t=e.health();n(t)}catch(e){o(e instanceof Error?e.message:`Failed to fetch diagnostics`)}finally{i(!1)}}},[e]);return(0,g.useEffect)(()=>{s()},[e,s]),{diagnostics:t,loading:r,error:a,refresh:s}}function zn(e,t){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)(!0),[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e){a(!0),s(null);try{let n=e.collection(t).subscribe(e=>{r(e),a(!1)});return()=>n()}catch(e){s(e instanceof Error?e.message:`Failed to load collection`),a(!1)}}},[e,t]),{items:n,loading:i,error:o}}function Bn(e){let[t,n]=(0,g.useState)([]);return(0,g.useEffect)(()=>{if(!e){n([]);return}let t=()=>{try{let t=e.sync?.();n(t?.connected_peers||[])}catch(e){console.error(`Failed to fetch peers:`,e)}};t();let r=setInterval(t,2e3);return()=>clearInterval(r)},[e]),t}function Vn({db:e,definition:t,namespace:n,bridgedItems:r}){let{items:i,loading:a,error:o}=zn(e,t.name),s=r??i,[c,l]=(0,g.useState)(null);return(0,P.jsxs)(`article`,{className:`state-collection studio-card`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`collection`}),(0,P.jsx)(`h2`,{children:t.name})]}),(0,P.jsx)(`strong`,{children:r?r.length:a?`…`:i.length})]}),o&&(0,P.jsx)(`p`,{className:`runtime-error`,children:o}),(!a||r)&&!s.length&&(0,P.jsx)(`div`,{className:`model-empty compact`,children:`No records yet. Mutations will appear here live.`}),s.map((e,r)=>{let i=String(e.id??e.key??r);return(0,P.jsxs)(`button`,{className:`state-row`,onClick:()=>l(c===r?null:r),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`b`,{children:i}),(0,P.jsxs)(`small`,{children:[`flow://`,n,`/`,t.name,`/`,i]})]}),(0,P.jsx)(`span`,{children:c===r?`−`:`+`}),c===r&&(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]},i)})]})}function Hn({db:e,model:t,namespace:n=`default`,applicationUrl:r=``}){let i=(0,g.useRef)(null),[a,o]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(!r)return;let e=new URL(r).origin,t=()=>i.current?.contentWindow?.postMessage({type:`feltdb:studio:read`,requestId:`live`},e),n=n=>{n.origin===e&&(n.data?.type===`feltdb:studio:ready`&&t(),n.data?.type===`feltdb:studio:data`&&o(n.data.records))};window.addEventListener(`message`,n);let a=window.setInterval(t,1500);return()=>{window.removeEventListener(`message`,n),window.clearInterval(a)}},[r]),(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Data`}),(0,P.jsx)(`p`,{children:`Live application records grouped by collection. Select a record to inspect every field.`})]}),r&&(0,P.jsx)(`iframe`,{ref:i,className:`studio-data-bridge`,src:r,title:`FeltDB application data bridge`,onLoad:()=>i.current?.contentWindow?.postMessage({type:`feltdb:studio:read`,requestId:`initial`},new URL(r).origin)}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.collections.length??0,` collections`]}),(0,P.jsxs)(`span`,{children:[n,` namespace`]}),(0,P.jsx)(`span`,{children:e?`runtime connected`:`runtime unavailable`})]}),(0,P.jsxs)(`div`,{className:`state-grid`,children:[t?.collections.map(t=>(0,P.jsx)(Vn,{db:e??null,definition:t,namespace:n,bridgedItems:a?.[t.name]},t.name)),!t?.collections.length&&(0,P.jsxs)(`div`,{className:`model-empty`,children:[`No collection model is loaded. Open Studio through `,(0,P.jsx)(`code`,{children:`feltdb dev`}),` to load the active project.`]})]})]})}function Un(e){let t=e.trim().replace(/^flow:\/\//,``).split(`/`).filter(Boolean);return e.startsWith(`flow://`)?t.length>=3?{collection:t[t.length-2],id:t[t.length-1]}:null:t.length>=2?{collection:t[t.length-2],id:t[t.length-1]}:null}function Wn({db:e,model:t,namespace:n=`default`}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(),[s,c]=(0,g.useState)(`Enter a reference to resolve live state.`),l=async()=>{let t=Un(r);if(!t||!e){o(void 0),c(e?`Use Collection/id or flow://namespace/Collection/id.`:`Runtime unavailable.`);return}let n=await e.collection(t.collection).get(t.id);o(n),c(n?`Materialized locally`:`Reference is valid but is not materialized locally`)};return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`References`}),(0,P.jsx)(`p`,{children:`Resolve stable Flow references directly into their materialized state.`})]}),(0,P.jsxs)(`div`,{className:`reference-query`,children:[(0,P.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},placeholder:`flow://${n}/Collection/id`}),(0,P.jsx)(`button`,{onClick:()=>void l(),children:`Resolve`})]}),(0,P.jsxs)(`div`,{className:`reference-layout`,children:[(0,P.jsxs)(`article`,{className:`studio-card`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Known collections`}),t?.collections.map(e=>(0,P.jsxs)(`button`,{className:`reference-example`,onClick:()=>i(`flow://${n}/${e.name}/id`),children:[e.name,(0,P.jsxs)(`small`,{children:[e.fields.length,` fields`]})]},e.name))]}),(0,P.jsxs)(`article`,{className:`studio-card reference-result`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Resolution`}),(0,P.jsx)(`h2`,{children:s}),a!==void 0&&(0,P.jsx)(`pre`,{children:JSON.stringify(a,null,2)})]})]})]})}function Gn({db:e,namespace:t=`default`}){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)(`all`);(0,g.useEffect)(()=>{if(!e)return;let t=!0,n=async()=>{let n=await e.auditEvents();t&&r(n.slice().reverse())};n();let i=setInterval(()=>void n(),1e3);return()=>{t=!1,clearInterval(i)}},[e]);let o=n.filter(e=>i===`all`||e.type===i);return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Operations`}),(0,P.jsx)(`p`,{children:`The runtime's durable local mutation log—not a simulated activity feed.`})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[n.length,` recorded`]}),(0,P.jsxs)(`span`,{children:[t,` namespace`]}),(0,P.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),children:[(0,P.jsx)(`option`,{value:`all`,children:`All mutations`}),(0,P.jsx)(`option`,{value:`put`,children:`Writes`}),(0,P.jsx)(`option`,{value:`delete`,children:`Deletes`})]})]}),(0,P.jsx)(`div`,{className:`table-shell`,children:(0,P.jsxs)(`table`,{className:`operations-table`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Sequence`}),(0,P.jsx)(`th`,{children:`Mutation`}),(0,P.jsx)(`th`,{children:`Collection`}),(0,P.jsx)(`th`,{children:`Key`}),(0,P.jsx)(`th`,{children:`Timestamp`})]})}),(0,P.jsxs)(`tbody`,{children:[o.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{children:e.sequence}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`span`,{className:`event-pill ${e.type}`,children:e.type})}),(0,P.jsx)(`td`,{children:e.collection}),(0,P.jsx)(`td`,{children:(0,P.jsx)(`code`,{children:e.key})}),(0,P.jsx)(`td`,{children:new Date(e.timestamp).toLocaleString()})]},`${e.sequence}-${e.key}`)),!o.length&&(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{colSpan:5,className:`empty-message`,children:`No matching mutations yet. Create or change application state to populate this stream.`})})]})]})})]})}function Kn({peers:e=[],localInstance:t=`local`}){return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Peers`}),(0,P.jsx)(`p`,{children:`The live topology participating in this application's convergence fabric.`})]}),(0,P.jsxs)(`div`,{className:`peer-topology`,children:[(0,P.jsxs)(`article`,{className:`peer-node local`,children:[(0,P.jsx)(`span`,{children:`this instance`}),(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`small`,{children:`online · authoritative local state`})]}),e.map(e=>(0,P.jsxs)(g.Fragment,{children:[(0,P.jsx)(`i`,{className:`peer-link`}),(0,P.jsxs)(`article`,{className:`peer-node`,children:[(0,P.jsx)(`span`,{children:`connected peer`}),(0,P.jsx)(`h2`,{children:e}),(0,P.jsx)(`small`,{children:`online · exchanging operations`})]})]},e))]}),!e.length&&(0,P.jsx)(`div`,{className:`model-empty`,children:`This embedded runtime is operating independently. Its state remains durable and can converge when a network peer is attached.`})]})}function qn({model:e}){let t=e?.capabilities??[];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Capabilities`}),(0,P.jsxs)(`p`,{children:[`Declared authority available to workflows and autonomous agents in `,e?.app??`this application`,`.`]})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t.length,` declared`]}),(0,P.jsxs)(`span`,{children:[new Set(t.flatMap(e=>e.statements)).size,` permission rules`]})]}),(0,P.jsxs)(`div`,{className:`studio-card-grid`,children:[t.map(e=>(0,P.jsxs)(`article`,{className:`studio-card capability-card`,children:[(0,P.jsx)(`div`,{className:`card-kind`,children:`capability`}),(0,P.jsx)(`h2`,{children:e.name}),(0,P.jsx)(`div`,{className:`statement-list`,children:e.statements.map(e=>{let[t,...n]=e.split(` `);return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:t}),(0,P.jsx)(`code`,{children:n.join(` `)})]},e)})})]},e.name)),!t.length&&(0,P.jsx)(`div`,{className:`model-empty`,children:`No capabilities are declared in the current project model.`})]})]})}function Jn({db:e,name:t,label:n}){let{items:r}=zn(e,t);return r.length?(0,P.jsxs)(`section`,{children:[(0,P.jsxs)(`h2`,{children:[n,(0,P.jsx)(`span`,{children:r.length})]}),(0,P.jsx)(`div`,{className:`execution-list`,children:r.map((e,r)=>(0,P.jsxs)(`article`,{className:`execution-row`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:String(e.name??e.workflow??e.incident_id??e.id??n)}),(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`span`,{className:`event-pill put`,children:String(e.status??e.state??`materialized`)}),(0,P.jsx)(`pre`,{children:JSON.stringify(e,null,2)})]},String(e.id??r)))})]}):null}function Yn({db:e,model:t}){return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Executions`}),(0,P.jsx)(`p`,{children:`Capability work, workflow runs, assignments, and agent decisions as inspectable state.`})]}),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.workflows.length??0,` workflow definitions`]}),(0,P.jsxs)(`span`,{children:[t?.agents.length??0,` autonomous agents`]})]}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_executions`,label:`Capability executions`}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_workflow_runs`,label:`Workflow runs`}),(0,P.jsx)(Jn,{db:e??null,name:`Assignment`,label:`Materialized assignments`}),(0,P.jsx)(Jn,{db:e??null,name:`Decision`,label:`Agent decisions`}),(0,P.jsx)(Jn,{db:e??null,name:`_flow_agent_executions`,label:`Agent executions`}),(0,P.jsxs)(`div`,{className:`model-empty execution-empty`,children:[`Execution sections appear as soon as their state is committed. Defined workflows: `,t?.workflows.map(e=>e.name).join(`, `)||`none`,`.`]})]})}function Xn({db:e,diagnostics:t}){let n=(()=>{try{return e?.sync()}catch{return}})(),r=n?.conflicts_detected??0;return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Conflicts`}),(0,P.jsx)(`p`,{children:`Concurrent mutations detected while replicas converge.`})]}),(0,P.jsxs)(`div`,{className:`metric-grid`,children:[(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:r}),(0,P.jsx)(`span`,{children:`detected`})]}),(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:n?.pending_operations??0}),(0,P.jsx)(`span`,{children:`pending operations`})]}),(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`b`,{children:n?.connected_peers.length??0}),(0,P.jsx)(`span`,{children:`connected peers`})]})]}),(0,P.jsxs)(`article`,{className:`studio-card`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Convergence`}),(0,P.jsx)(`h2`,{children:r?`Conflict activity detected`:`No conflicts detected`}),(0,P.jsx)(`p`,{children:t?.sync.connected?`The fabric is connected and applying causal ordering.`:`The local replica is independent; conflict detection begins when operations converge with peers.`}),(0,P.jsx)(`code`,{children:`Causal ordering → deterministic materialization → auditable resolution`})]})]})}function Zn({model:e}){let t=e?.workflows??[],[n,r]=(0,g.useState)(),i=t.find(e=>e.name===n)??t[0];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Workflows`}),(0,P.jsx)(`p`,{children:`Durable state transitions declared by the application model.`})]}),(0,P.jsxs)(`div`,{className:`split-browser`,children:[(0,P.jsx)(`aside`,{children:t.map(e=>(0,P.jsxs)(`button`,{className:e.name===i?.name?`active`:``,onClick:()=>r(e.name),children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsxs)(`span`,{children:[e.steps.length,` steps`]})]},e.name))}),(0,P.jsx)(`section`,{children:i?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`card-kind`,children:`workflow`}),(0,P.jsx)(`h2`,{children:i.name}),i.parameters.length>0&&(0,P.jsxs)(`code`,{className:`signature`,children:[`(`,i.parameters,`)`]}),(0,P.jsx)(`div`,{className:`workflow-track`,children:i.steps.map((e,t)=>(0,P.jsxs)(g.Fragment,{children:[(0,P.jsxs)(`article`,{children:[(0,P.jsx)(`span`,{children:t+1}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:e.name}),e.statements.map(e=>(0,P.jsx)(`code`,{children:e},e))]})]}),t<i.steps.length-1&&(0,P.jsx)(`i`,{children:`→`})]},e.name))})]}):(0,P.jsx)(`div`,{className:`model-empty`,children:`No workflows are declared.`})})]})]})}function Qn({model:e}){let t=e?.agents??[],[n,r]=(0,g.useState)(),i=t.find(e=>e.name===n)??t[0];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Design`}),(0,P.jsx)(`h1`,{children:`Agents`}),(0,P.jsx)(`p`,{children:`Autonomous participants whose authority and workflows are part of the model.`})]}),(0,P.jsxs)(`div`,{className:`split-browser`,children:[(0,P.jsx)(`aside`,{children:t.map(e=>(0,P.jsxs)(`button`,{className:e.name===i?.name?`active`:``,onClick:()=>r(e.name),children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsxs)(`span`,{children:[e.statements.length,` bindings`]})]},e.name))}),(0,P.jsx)(`section`,{children:i?(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(`div`,{className:`agent-orbit`,children:[(0,P.jsxs)(`div`,{className:`agent-core`,children:[(0,P.jsx)(`span`,{children:`agent`}),(0,P.jsx)(`strong`,{children:i.name})]}),i.statements.map(e=>(0,P.jsxs)(`div`,{className:`agent-binding`,children:[(0,P.jsx)(`span`,{children:e.split(` `)[0]}),(0,P.jsx)(`strong`,{children:e.split(` `).slice(1).join(` `)})]},e))]})}):(0,P.jsx)(`div`,{className:`model-empty`,children:`No agents are declared.`})})]})]})}function $n({db:e,namespace:t=`default`,reference:n}){let[r,i]=(0,g.useState)(n??``),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(`Enter a Flow reference to trace it.`);(0,g.useEffect)(()=>{n&&i(n)},[n]);let d=async()=>{if(!(!e||!r))try{let t=e.provenance(r);o(t),u(`Causal graph resolved`)}catch{o(null);let t=await e.auditEvents(),n=r.split(`/`),i=n[n.length-1]??``,a=t.filter(e=>e.key.includes(i));c(a),u(a.length?`Local mutation lineage`:`No local lineage found for this reference`)}};return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Provenance`}),(0,P.jsx)(`p`,{children:`Follow why state exists—from durable mutations to causal workflow and agent edges.`})]}),(0,P.jsxs)(`div`,{className:`reference-query`,children:[(0,P.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`flow://${t}/Collection/id`}),(0,P.jsx)(`button`,{onClick:()=>void d(),children:`Trace`})]}),(0,P.jsxs)(`article`,{className:`studio-card provenance-result`,children:[(0,P.jsx)(`span`,{className:`card-kind`,children:`Lineage`}),(0,P.jsx)(`h2`,{children:l}),a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[a.nodes.length,` nodes`]}),(0,P.jsxs)(`span`,{children:[a.edges.length,` edges`]})]}),(0,P.jsx)(`div`,{className:`provenance-nodes`,children:a.nodes.map(e=>(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:e.label}),(0,P.jsx)(`small`,{children:e.type})]},e.id))})]}),!a&&s.map(e=>(0,P.jsxs)(`div`,{className:`provenance-event`,children:[(0,P.jsx)(`span`,{children:e.sequence}),(0,P.jsxs)(`b`,{children:[e.type,` `,e.collection]}),(0,P.jsx)(`code`,{children:e.key}),(0,P.jsx)(`small`,{children:new Date(e.timestamp).toLocaleString()})]},`${e.sequence}-${e.key}`))]})]})}function er({diagnostics:e,model:t}){let n=e?[[`Runtime`,e.runtime.status,e.runtime.reactive?`reactive`:`non-reactive`],[`Storage`,e.storage.status,`${e.storage.backend} · ${e.storage.persistent?`persistent`:`volatile`}`],[`Synchronization`,e.sync.status,`${e.sync.peers} peers · ${e.sync.pendingOperations} pending`],[`Fabric`,e.fabric.status,`${e.fabric.references} references`],[`Capabilities`,e.capabilities.status,`${e.capabilities.available}/${e.capabilities.count} available`],[`Execution`,e.execution.status,`${e.execution.running} running · ${e.execution.failed} failed`],[`Workflows`,e.workflow.status,`${e.workflow.active}/${e.workflow.total} active`]]:[];return(0,P.jsxs)(`div`,{className:`studio-model-page`,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`span`,{className:`eyebrow`,children:`Observe`}),(0,P.jsx)(`h1`,{children:`Health`}),(0,P.jsx)(`p`,{children:`Runtime diagnostics, not optimistic defaults.`})]}),(0,P.jsx)(`div`,{className:`health-grid`,children:n.map(([e,t,n])=>(0,P.jsxs)(`article`,{className:`health-item status-${t}`,children:[(0,P.jsx)(`span`,{className:`status-icon`,children:t===`healthy`?`✓`:`!`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`b`,{children:e}),(0,P.jsx)(`small`,{children:n})]})]},e))}),!e&&(0,P.jsx)(`div`,{className:`model-empty`,children:`Diagnostics are unavailable until Studio connects to a runtime.`}),e?.issues.map((e,t)=>(0,P.jsxs)(`div`,{className:`health-issue ${e.severity}`,children:[(0,P.jsx)(`b`,{children:e.component}),` `,e.message]},t)),(0,P.jsxs)(`div`,{className:`model-summary`,children:[(0,P.jsxs)(`span`,{children:[t?.collections.length??0,` collections modeled`]}),(0,P.jsxs)(`span`,{children:[t?.workflows.length??0,` workflows modeled`]}),(0,P.jsxs)(`span`,{children:[t?.agents.length??0,` agents modeled`]})]})]})}function tr({db:e,remoteUrl:t=``,token:n=``,onConnect:r}){let[i,a]=(0,g.useState)(t),[o,s]=(0,g.useState)(n),c=e?.runtime();return(0,g.useEffect)(()=>{a(t),s(n)},[t,n]),(0,P.jsxs)(`div`,{className:`settings-panel`,children:[(0,P.jsx)(`h2`,{children:`Settings`}),(0,P.jsxs)(`div`,{className:`settings-content`,children:[(0,P.jsx)(`h3`,{children:`Connection`}),(0,P.jsxs)(`div`,{className:`connection-info`,children:[(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Runtime Environment`}),(0,P.jsx)(`span`,{children:c?.runtime||`unavailable`})]}),(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Storage Backend`}),(0,P.jsx)(`span`,{children:c?.storage||`unavailable`})]}),(0,P.jsxs)(`div`,{className:`info-row`,children:[(0,P.jsx)(`label`,{children:`Instance ID`}),(0,P.jsx)(`span`,{className:`monospace`,children:e?.instanceId?.()||`unavailable`})]})]}),(0,P.jsxs)(`form`,{className:`connection-form`,onSubmit:e=>{e.preventDefault(),r?.(i,o)},children:[(0,P.jsxs)(`label`,{children:[`Server or managed endpoint`,(0,P.jsx)(`input`,{type:`url`,value:i,onChange:e=>a(e.target.value),placeholder:`https://your-runtime.example.com`})]}),(0,P.jsxs)(`label`,{children:[`API token`,(0,P.jsx)(`input`,{type:`password`,value:o,onChange:e=>s(e.target.value),placeholder:`fdb_live_…`,autoComplete:`off`})]}),(0,P.jsx)(`p`,{children:`Tokens are kept in this browser session and are never written to the project.`}),(0,P.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,children:`Connect Studio`})]})]})]})}function nr({db:e,model:t,onSearch:n}){let[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([]),s=e=>{i(e),n&&n(e)};return(0,g.useEffect)(()=>{let n=!0;return(async()=>{let i=r.trim().toLowerCase();if(!i){o([]);return}let a=[...t?.collections.map(e=>({kind:`collection`,name:e.name,detail:`${e.fields.length} fields`}))??[],...t?.capabilities.map(e=>({kind:`capability`,name:e.name,detail:e.statements.join(` · `)}))??[],...t?.workflows.map(e=>({kind:`workflow`,name:e.name,detail:`${e.steps.length} steps`}))??[],...t?.agents.map(e=>({kind:`agent`,name:e.name,detail:e.statements.join(` · `)}))??[]].filter(e=>JSON.stringify(e).toLowerCase().includes(i)),s=e&&t?(await Promise.all(t.collections.map(async t=>(await e.collection(t.name).all()).filter(e=>JSON.stringify(e).toLowerCase().includes(i)).slice(0,3).map(e=>({kind:`object`,name:`${t.name}/${String(e.id??`record`)}`,detail:JSON.stringify(e)}))))).flat():[];n&&o([...a,...s].slice(0,12))})(),()=>{n=!1}},[e,t,r]),(0,P.jsxs)(`div`,{className:`global-search`,children:[(0,P.jsx)(`input`,{type:`text`,placeholder:`Search: documents/123, flow://, agent/name, etc.`,value:r,onChange:e=>s(e.target.value),className:`search-input global`}),r&&(0,P.jsx)(`div`,{className:`search-results`,children:(0,P.jsxs)(`div`,{className:`results-group`,children:[(0,P.jsx)(`h4`,{children:`Model & runtime`}),a.map((e,t)=>(0,P.jsxs)(`div`,{className:`search-result`,children:[(0,P.jsx)(`b`,{children:e.name}),(0,P.jsx)(`span`,{children:e.kind}),(0,P.jsx)(`small`,{children:e.detail})]},`${e.kind}-${e.name}-${t}`)),!a.length&&(0,P.jsx)(`div`,{className:`empty-message`,children:`No matches`})]})})]})}var rr=class{constructor(){this.dependencies=new Map,this.subscribers=new Map,this.recentChanges=new Map}registerDependency(e,t){this.dependencies.has(e)||this.dependencies.set(e,new Set),this.dependencies.get(e).add(t)}subscribe(e,t){this.subscribers.has(e)||this.subscribers.set(e,new Set);let n=this.subscribers.get(e);return n.add(t),()=>{n.delete(t),n.size===0&&this.subscribers.delete(e)}}async emitChange(e,t){this.recentChanges.has(e)||this.recentChanges.set(e,[]),this.recentChanges.get(e).push(t);let n=this.subscribers.get(e);n&&await Promise.all([...n].map(e=>e(t)));let r=this.dependencies.get(e);if(r)for(let e of r)await this.emitChange(e,t)}getRecentChanges(e){return this.recentChanges.get(e)||[]}clearRecentChanges(e){this.recentChanges.delete(e)}getSubscriberCount(e){return this.subscribers.get(e)?.size??0}hasDependents(e){let t=this.dependencies.get(e);return t!==void 0&&t.size>0}getDependents(e){let t=this.dependencies.get(e);return t?Array.from(t):[]}},ir=null;function ar(){return ir||=new rr,ir}var or=class{constructor(e){this.entries=new Map,this.stats={reads:0,writes:0,selectivity:0},this.field=e}add(e,t){let n=this.normalizeKey(t);this.entries.has(n)||this.entries.set(n,new Set),this.entries.get(n).add(e),this.stats.writes++}remove(e,t){let n=this.normalizeKey(t),r=this.entries.get(n);r&&(r.delete(e),r.size===0&&this.entries.delete(n)),this.stats.writes++}query(e){let t=this.normalizeKey(e);this.stats.reads++;let n=this.entries.get(t);return n?Array.from(n):[]}size(){return this.entries.size}getStats(){return{entries:this.entries.size,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.entries.size>0?1/this.entries.size:0}}normalizeKey(e){return e==null?`__null__`:typeof e==`object`?JSON.stringify(e):String(e)}},sr=class{constructor(e){this.entries=[],this.stats={reads:0,writes:0,selectivity:0},this.field=e}add(e,t){let n=this.entries.find(e=>this.compareKeys(e.key,t)===0);n||(n={key:t,recordIds:new Set},this.entries.push(n),this.entries.sort((e,t)=>this.compareKeys(e.key,t.key))),n.recordIds.add(e),this.stats.writes++}remove(e,t){let n=this.entries.find(e=>this.compareKeys(e.key,t)===0);n&&(n.recordIds.delete(e),n.recordIds.size===0&&(this.entries=this.entries.filter(e=>e!==n))),this.stats.writes++}queryEqual(e){this.stats.reads++;let t=this.entries.find(t=>this.compareKeys(t.key,e)===0);return t?Array.from(t.recordIds):[]}queryRange(e,t,n=!0,r=!0){this.stats.reads++;let i=new Set;for(let a of this.entries){let o=this.compareKeys(a.key,e),s=this.compareKeys(a.key,t);(n?o>=0:o>0)&&(r?s<=0:s<0)&&a.recordIds.forEach(e=>i.add(e))}return Array.from(i)}size(){return this.entries.length}getStats(){return this.entries.reduce((e,t)=>e+t.recordIds.size,0),{entries:this.entries.length,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.entries.length>0?1/this.entries.length:0}}compareKeys(e,t){return e==null?-1:t==null?1:e<t?-1:+(e>t)}},cr=class{constructor(e){this.tokenIndex=new Map,this.stats={reads:0,writes:0,selectivity:0},this.fields=e}add(e,t){let n=this.extractText(t),r=this.tokenize(n);for(let t of r)this.tokenIndex.has(t)||this.tokenIndex.set(t,new Set),this.tokenIndex.get(t).add(e);this.stats.writes++}remove(e,t){let n=this.extractText(t),r=this.tokenize(n);for(let t of r){let n=this.tokenIndex.get(t);n&&(n.delete(e),n.size===0&&this.tokenIndex.delete(t))}this.stats.writes++}query(e){this.stats.reads++;let t=this.tokenize(e);if(t.length===0)return[];let n=this.tokenIndex.get(t[0]);if(!n)return[];n=new Set(n);for(let e=1;e<t.length;e++){let r=this.tokenIndex.get(t[e]);if(!r)return[];n=new Set([...n].filter(e=>r.has(e)))}return Array.from(n)}size(){return this.tokenIndex.size}getStats(){return{entries:this.tokenIndex.size,reads:this.stats.reads,writes:this.stats.writes,selectivity:this.tokenIndex.size>0?1/this.tokenIndex.size:0}}extractText(e){return this.fields.map(t=>{let n=e[t];return n?String(n):``}).join(` `)}tokenize(e){return e.toLowerCase().split(/\s+/).filter(e=>e.length>0)}},lr=class{constructor(){this.indexes=new Map,this.config=new Map,this.indexStats=new Map}createIndex(e){if(this.indexes.has(e.name))throw Error(`Index ${e.name} already exists`);let t;if(e.type===`hash`&&e.field)t=new or(e.field);else if(e.type===`sorted`&&e.field)t=new sr(e.field);else if(e.type===`text`&&e.textFields)t=new cr(e.textFields);else throw Error(`Invalid index config: ${JSON.stringify(e)}`);this.indexes.set(e.name,t),this.config.set(e.name,e),this.indexStats.set(e.name,{name:e.name,type:e.type,entries:0,size:0,lastUpdated:Date.now(),reads:0,writes:0,selectivity:0})}updateRecord(e,t,n){for(let[r,i]of this.indexes){let a=this.config.get(r);t&&(a.type===`hash`&&a.field||a.type===`sorted`&&a.field?i.remove(e,t[a.field]):a.type===`text`&&i.remove(e,t)),a.type===`hash`&&a.field||a.type===`sorted`&&a.field?i.add(e,n[a.field]):a.type===`text`&&i.add(e,n);let o=this.indexStats.get(r);o.lastUpdated=Date.now();let s=i.getStats();Object.assign(o,s)}}queryIndex(e,t){let n=this.indexes.get(e);if(!n)throw Error(`Index ${e} not found`);let r=this.config.get(e);if(r.type===`hash`)return n.query(t.value);if(r.type===`sorted`){let e=n;if(t.operator===`eq`)return e.queryEqual(t.value);if(t.operator===`range`)return e.queryRange(t.min,t.max);if(t.operator===`gte`)return e.queryRange(t.value,Number.MAX_VALUE);if(t.operator===`lte`)return e.queryRange(Number.MIN_VALUE,t.value)}else if(r.type===`text`)return n.query(t.value);return[]}listIndexes(){return Array.from(this.config.values())}getStats(e){return this.indexStats.get(e)||null}planQuery(e){let t=[];for(let n of e)for(let[e,r]of this.config)if(r.field===n||r.fields?.includes(n)){let n=this.indexStats.get(e);t.push({indexName:e,indexType:r.type,estimatedRows:Math.ceil(100/(n.selectivity||1)),cost:n.reads+n.writes,canPruneAll:r.type===`hash`,requiresPostFilter:r.type===`text`||r.type===`sorted`})}if(t.length===0)return{strategy:`full-scan`,indexes:[],estimatedRows:1e3,totalCost:1e3,explanation:`No suitable index found, using full collection scan`};t.sort((e,t)=>e.cost-t.cost);let n=t[0];return{strategy:`index-scan`,indexes:[n],estimatedRows:n.estimatedRows,totalCost:n.cost,explanation:`Using ${n.indexType} index on ${n.indexName}`}}},ur=null;async function dr(){if(ur!==null)return ur;try{let e=await x(()=>import(`./feltdb_wasm-Bb1Pg6qz.js`),[]);return ur=e,e}catch{return null}}var fr=class{constructor(){this.tsBackend=null,this.wasmBackend=null,this.useWasm=!1,this.tsBackend=new lr}async initializeWasm(){if(this.wasmBackend!==null)return;let e=await dr();if(e&&e.WasmIndexManager)try{this.wasmBackend=new e.WasmIndexManager,this.useWasm=!0}catch{this.useWasm=!1}}createIndex(e){if(this.useWasm&&this.wasmBackend)try{this.wasmBackend.create_index(JSON.stringify(e));return}catch{}this.tsBackend?.createIndex(e)}updateRecord(e,t,n){if(this.useWasm&&this.wasmBackend)try{let r=t?JSON.stringify(t):null,i=JSON.stringify(n);this.wasmBackend.update_record(e,r,i);return}catch{}this.tsBackend?.updateRecord(e,t,n)}queryIndex(e,t){if(this.useWasm&&this.wasmBackend)try{let n=this.wasmBackend.query_index(e,t.operator,String(t.value||``));return JSON.parse(n)}catch{}return this.tsBackend?.queryIndex(e,t)||[]}queryCompoundIndex(e,t){if(this.useWasm&&this.wasmBackend)try{let n=Object.values(t).map(e=>String(e)).join(`\0`),r=this.wasmBackend.query_index(e,`eq`,n);return JSON.parse(r)}catch{}return[]}listIndexes(){if(this.useWasm&&this.wasmBackend)try{let e=this.wasmBackend.list_indexes();return JSON.parse(e)}catch{}return this.tsBackend?.listIndexes()||[]}},pr=class{constructor(e,t){this.db=e,this.collectionName=t}async saveIndexConfig(e,t){let n=`__indexes__:${this.collectionName}:${e.name}`,r={config:e,version:1,createdAt:Date.now(),lastUpdated:Date.now(),entryCount:t},i=await this.db.insert(n,JSON.stringify(r));i.success||console.warn(`Failed to save index config for ${e.name}: ${i.error}`)}async loadIndexConfigs(){let e=await this.db.query(`__indexes__:${this.collectionName}`);if(!e.success||!e.data)return[];try{return JSON.parse(e.data).map(e=>e.config)}catch{return console.warn(`Failed to parse index configs for ${this.collectionName}`),[]}}async getIndexConfig(e){let t=`__indexes__:${this.collectionName}:${e}`,n=await this.db.get(t);if(!n.success||!n.data)return null;try{return JSON.parse(n.data).config}catch{return null}}async deleteIndexConfig(e){let t=`__indexes__:${this.collectionName}:${e}`;if(!this.db.delete){console.warn(`Failed to delete index config for ${e}: delete is not supported`);return}let n=this.db.delete(t),r=n instanceof Promise?await n:n;r?.success||console.warn(`Failed to delete index config for ${e}: ${r?.error}`)}async updateIndexStats(e,t){let n=`__indexes__:${this.collectionName}:${e}`,r=await this.db.get(n);if(!(!r.success||!r.data))try{let e=JSON.parse(r.data);e.lastUpdated=Date.now(),e.entryCount=t,await this.db.insert(n,JSON.stringify(e))}catch{console.warn(`Failed to update index stats for ${e}`)}}async getSnapshot(){let e=await this.loadIndexConfigs();return{collectionName:this.collectionName,indexes:e.map(e=>({config:e,version:1,createdAt:Date.now(),lastUpdated:Date.now(),entryCount:0})),timestamp:Date.now()}}},mr=class e{constructor(e,t,n,r){this.predicate=null,this.cache=[],this.subscribers=new Set,this.parent=null,this.parentId=null,this.isInitialized=!1,this.unsubscribeFunctions=new Set,this.graphUnsubscribe=null,this.runtimeUnsubscribe=null,this.indexBackend=new fr,this.indexesLoaded=!1,this.db=e,this.name=t,this.collectionId=`${t}-${Math.random().toString(36).substr(2,9)}`,this.predicate=n||null,this.parent=r||null,this.parentId=r?r.collectionId:null,this.indexStore=new pr(e,t),r&&ar().registerDependency(r.collectionId,this.collectionId),this.loadPersistedIndexes()}async loadPersistedIndexes(){try{let e=await this.indexStore.loadIndexConfigs();for(let t of e)this.indexBackend.createIndex(t);this.indexesLoaded=!0}catch(e){console.warn(`Failed to load persisted indexes for ${this.name}:`,e),this.indexesLoaded=!0}}async all(){return await this.refresh(),[...this.cache]}async find(e={}){let t=await this.all(),n=Object.entries(e);return t.filter(e=>n.every(([t,n])=>e[t]===n))}createIndex(e){this.indexBackend.createIndex(e);for(let e of this.cache){let t=e?.id||JSON.stringify(e);this.indexBackend.updateRecord(t,null,e)}this.indexStore.saveIndexConfig(e,this.cache.length)}listIndexes(){return this.indexBackend.listIndexes()}async rebuildIndexes(){let e=this.indexBackend.listIndexes(),t=await this.all();for(let n of t){let t=n?.id||JSON.stringify(n);for(let r of e)this.indexBackend.updateRecord(t,null,n)}}async validateIndexes(){return this.indexBackend.listIndexes().length===0||(await this.all()).length,!0}async get(e){let t=`${this.name}:${e}`,n=await this.db.get(t);if(n.success&&n.data)try{return JSON.parse(n.data)}catch{return null}return null}where(t){return new e(this.db,this.name,e=>(!this.predicate||this.predicate(e))&&t(e),this.parent||this)}async insert(e,t){let n=t??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,r=`${this.name}:${n}`,i=typeof e==`object`&&e?{...e,id:n}:e,a=await this.db.insert(r,JSON.stringify(i));if(!a.success)throw Error(`Insert failed: ${a.error}`);this.indexBackend.updateRecord(String(n),null,i);let o={type:`insert`,key:r,value:i,timestamp:Date.now()};return await ar().emitChange(this.name,o),String(n)}async update(e,t){let n=await this.get(e);if(!n)throw Error(`Record ${e} not found`);let r={...n,...t},i=`${this.name}:${e}`,a=await(this.db.update?this.db.update(i,JSON.stringify(r)):this.db.insert(i,JSON.stringify(r)));if(!a.success)throw Error(`Update failed: ${a.error}`);this.indexBackend.updateRecord(String(e),n,r);let o={type:`update`,key:i,value:r,timestamp:Date.now()};await ar().emitChange(this.name,o)}async delete(e){let t=`${this.name}:${e}`;if(!this.db.delete)throw Error(`Delete is not supported by this FeltDB runtime`);let n=await this.db.delete(t);if(!n.success)throw Error(`Delete failed: ${n.error}`);let r=await this.get(e);r&&this.indexBackend.updateRecord(String(e),r,{});let i={type:`delete`,key:t,value:null,timestamp:Date.now()};await ar().emitChange(this.name,i)}async count(){return(await this.all()).length}async exists(e){return await this.get(e)!==null}subscribe(e,t){if(this.subscribers.add(e),this.isInitialized||this.refresh().catch(e=>console.error(`Failed to initialize collection:`,e)),!this.graphUnsubscribe){let e=async()=>{await this.refresh();for(let e of this.subscribers)e([...this.cache])},t=ar();this.graphUnsubscribe=t.subscribe(this.name,e),this.db.subscribe_changes&&(this.runtimeUnsubscribe=this.db.subscribe_changes(t=>{t===this.name&&e()}))}return()=>{if(this.subscribers.delete(e),this.subscribers.size===0){this.graphUnsubscribe?.(),this.runtimeUnsubscribe?.(),this.graphUnsubscribe=null,this.runtimeUnsubscribe=null;for(let e of this.unsubscribeFunctions)e();this.unsubscribeFunctions.clear()}}}close(){this.graphUnsubscribe?.(),this.runtimeUnsubscribe?.(),this.graphUnsubscribe=null,this.runtimeUnsubscribe=null,this.subscribers.clear();for(let e of this.unsubscribeFunctions)e();this.unsubscribeFunctions.clear()}async refresh(){try{let e=await this.db.query(this.name);if(e.success&&e.data)try{let t=JSON.parse(e.data);this.predicate&&(t=t.filter(e=>{try{return this.predicate(e)}catch{return!1}})),this.cache=t,this.isInitialized=!0}catch(e){console.error(`Failed to parse query results:`,e)}else e.success||console.error(`Query failed:`,e.error)}catch(e){console.error(`Refresh error:`,e)}}},F;(function(e){e.Created=`Created`,e.Planning=`Planning`,e.Observing=`Observing`,e.Deciding=`Deciding`,e.Acting=`Acting`,e.Waiting=`Waiting`,e.Completed=`Completed`,e.Failed=`Failed`,e.Cancelled=`Cancelled`,e.Blocked=`Blocked`})(F||={});function hr(e,t){return{name:e,version:t,toString(){return`flow://agent/${this.name}@${this.version}`}}}function gr(e){return`exec-${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}var _r=class{constructor(){this.agents=new Map}register(e,t){let n=e.toString(),r={agentRef:e,definition:t,providers:[],compatibleStateVersions:[],registeredAt:Date.now(),updatedAt:Date.now(),active:!0};this.agents.set(n,r)}unregister(e){let t=e.toString();this.agents.delete(t)}get(e){let t=e.toString();return this.agents.get(t)}getByName(e){let t;for(let n of this.agents.values())n.definition.name===e&&(!t||n.agentRef.version>t.agentRef.version)&&(t=n);return t}getAll(){return Array.from(this.agents.values())}addProvider(e,t){let n=e.toString(),r=this.agents.get(n);if(!r)throw Error(`Agent not registered: ${n}`);r.providers=r.providers.filter(e=>e.peerId!==t.peerId),r.providers.push(t),r.updatedAt=Date.now()}removeProvider(e,t){let n=e.toString(),r=this.agents.get(n);if(!r)throw Error(`Agent not registered: ${n}`);r.providers=r.providers.filter(e=>e.peerId!==t),r.updatedAt=Date.now()}getAvailableProviders(e){let t=this.get(e);return t?t.providers.filter(e=>e.available):[]}findByCapability(e){let t=[];for(let n of this.agents.values())n.definition.capabilities.includes(e)&&t.push(n);return t}updateAvailability(e,t,n){let r=this.get(e);if(!r)throw Error(`Agent not registered: ${e.toString()}`);let i=r.providers.find(e=>e.peerId===t);i&&(i.available=n,i.lastHeartbeat=Date.now(),r.updatedAt=Date.now())}clear(){this.agents.clear()}},vr=class{constructor(){this.ownership=new Map,this.locks=new Map}claim(e,t,n){let r=this.ownership.get(e);if(r===t)return!0;if(r)return!1;let i=this.locks.get(e);return i&&i.expiresAt>Date.now()?!1:(this.ownership.set(e,t),this.locks.set(e,{peerId:t,expiresAt:Date.now()+n}),!0)}release(e,t){this.ownership.get(e)===t&&(this.ownership.delete(e),this.locks.delete(e))}getOwner(e){return this.ownership.get(e)}isValid(e){let t=this.locks.get(e);return t?t.expiresAt>Date.now():!1}renew(e,t,n){return this.ownership.get(e)===t&&(this.locks.set(e,{peerId:t,expiresAt:Date.now()+n}),!0)}},yr=class{constructor(e,t){this.handlers=new Map,this.executions=new Map,this.triggers=new Map,this.registry=e,this.config=t,this.ownership=new vr}registerHandler(e,t){this.handlers.set(e,t)}async createExecution(e,t,n,r){let i=gr(t.name),a={executionId:i,agentRef:t,status:F.Created,goal:n,inputs:r,stateVersion:0,observationIds:[],decisionIds:[],actionIds:[],attempt:1,createdMs:Date.now()};return this.executions.set(i,a),a}async start(e,t){if(!this.ownership.claim(e.executionId,t,3e4))throw Error(`Failed to claim ownership of execution ${e.executionId}`);try{return e.status=F.Planning,e.ownedBy=t,e.startedMs=Date.now(),{execution:e,status:F.Planning,resultRef:void 0}}catch(t){return e.status=F.Failed,e.error=String(t),e.completedMs=Date.now(),{execution:e,status:F.Failed,error:String(t)}}}async resume(e,t){if(!this.ownership.claim(e.executionId,t,3e4)&&this.ownership.getOwner(e.executionId)!==t)throw Error(`Cannot resume execution ${e.executionId}: owned by ${this.ownership.getOwner(e.executionId)}`);return e.ownedBy=t,e.status=F.Observing,{execution:e,status:F.Observing}}async transition(e,t){if(!({[F.Created]:[F.Planning],[F.Planning]:[F.Observing],[F.Observing]:[F.Deciding,F.Waiting],[F.Deciding]:[F.Acting],[F.Acting]:[F.Observing,F.Waiting,F.Completed],[F.Waiting]:[F.Observing,F.Blocked],[F.Completed]:[],[F.Failed]:[],[F.Cancelled]:[],[F.Blocked]:[F.Observing]}[e.status]||[]).includes(t))throw Error(`Invalid transition from ${e.status} to ${t}`);e.status=t}async complete(e,t){e.status=F.Completed,e.resultRef=t,e.completedMs=Date.now(),e.ownedBy&&this.ownership.release(e.executionId,e.ownedBy)}async fail(e,t){e.status=F.Failed,e.error=t,e.completedMs=Date.now(),e.ownedBy&&this.ownership.release(e.executionId,e.ownedBy)}getExecution(e){return this.executions.get(e)}getOwner(e){return this.ownership.getOwner(e)}registerTriggers(e,t){this.triggers.set(e,t)}getTriggers(e){return this.triggers.get(e)||[]}},br=new Map,xr=class{constructor(e){this.events=[],this.sequence=0,this.peers=new Set;let t=br.get(e);t||(t=new Map,br.set(e,t)),this.rows=t,this.origin=`memory:${e}`}event(e,t,n,r){this.sequence+=1;let i=Date.now();this.events.push({sequence:this.sequence,collection:e,key:t,type:n,value:r,timestamp:i,origin:this.origin,id:`${this.origin}:${i}:${this.sequence}`})}insert(e,t){try{return this.rows.set(e,JSON.parse(t)),this.event(e.split(`:`)[0],e,`put`,JSON.parse(t)),{success:!0,data:e}}catch(e){return{success:!1,error:String(e)}}}update(e,t){return this.rows.has(e)?this.insert(e,t):{success:!1,error:`Record ${e} not found`}}get(e){let t=this.rows.get(e);return t===void 0?{success:!0}:{success:!0,data:JSON.stringify(t)}}delete(e){return this.rows.delete(e),this.event(e.split(`:`)[0],e,`delete`),{success:!0,data:e}}query(e){let t=`${e}:`,n=[...this.rows].filter(([e])=>e.startsWith(t)).map(([,e])=>e);return{success:!0,data:JSON.stringify(n)}}get_capability_records(e){return this.query(e)}execute_op(){return{success:!1,error:`Raw operations are unavailable in the memory runtime`}}sync_info(){return{success:!0,data:JSON.stringify({instance_id:this.origin,sequence:this.sequence,connected_peers:[...this.peers],pending_operations:0,operations_sent:0,operations_received:0,conflicts_detected:0,last_sync_ms:0,is_connected:this.peers.size>0})}}add_peer(){return{success:!0}}add_sync_peer(e){return this.peers.add(e),{success:!0}}remove_sync_peer(e){return this.peers.delete(e),{success:!0}}acknowledge_peer_operations(){return{success:!0}}get_pending_for_peer(){return{success:!0,data:`[]`}}instance_id(){return this.origin}get_sequence(){return this.sequence}audit_events(){return[...this.events]}export_operations(e){return this.events.filter(t=>t.sequence>e)}apply_remote_operations(e){let t=0,n=0;for(let r of e){if(this.events.some(e=>e.id===r.id)){n++;continue}let e=[...this.events].reverse().find(e=>e.key===r.key),i=`${String(r.timestamp).padStart(16,`0`)}:${r.origin}:${r.id}`,a=e?`${String(e.timestamp).padStart(16,`0`)}:${e.origin}:${e.id}`:``;this.sequence+=1,this.events.push({...r,sequence:this.sequence}),i>=a?(r.type===`delete`?this.rows.delete(r.key):this.rows.set(r.key,r.value),t++):n++}return{applied:t,ignored:n}}},I=class{constructor(e){this.url=e.url.replace(/\/$/,``),this.token=e.token}headers(e=!1){return{Authorization:`Bearer ${this.token}`,"FeltDB-Protocol":`1`,...e?{"Content-Type":`application/json`}:{}}}splitKey(e){let t=e.indexOf(`:`);if(t<1||t===e.length-1)throw Error(`Invalid FeltDB key: ${e}`);return[e.slice(0,t),e.slice(t+1)]}async get(e){try{let[t,n]=this.splitKey(e),r=await fetch(`${this.url}/collections/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,{headers:this.headers()});if(r.status===404)return{success:!0};if(!r.ok)return this.failure(r);let i=await r.json();return{success:!0,data:JSON.stringify(i.value)}}catch(e){return{success:!1,error:String(e)}}}async query(e){try{let t=await fetch(`${this.url}/collections/${encodeURIComponent(e)}`,{headers:this.headers()});if(!t.ok)return this.failure(t);let n=await t.json();return{success:!0,data:JSON.stringify(n.map(e=>e.value))}}catch(e){return{success:!1,error:String(e)}}}async insert(e,t){try{let[n,r]=this.splitKey(e),i=JSON.parse(t),a=await fetch(`${this.url}/collections/${encodeURIComponent(n)}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify({...i,id:r})});return a.ok?{success:!0,data:e}:this.failure(a)}catch(e){return{success:!1,error:String(e)}}}async update(e,t){try{let[n,r]=this.splitKey(e),i=await fetch(`${this.url}/collections/${encodeURIComponent(n)}/${encodeURIComponent(r)}`,{method:`PATCH`,headers:this.headers(!0),body:t});return i.ok?{success:!0,data:e}:this.failure(i)}catch(e){return{success:!1,error:String(e)}}}async delete(e){try{let[t,n]=this.splitKey(e),r=await fetch(`${this.url}/collections/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,{method:`DELETE`,headers:this.headers()});return r.ok?{success:!0,data:e}:this.failure(r)}catch(e){return{success:!1,error:String(e)}}}async acquire(e,t){let n=await fetch(`${this.url}/refs/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{headers:this.headers()});if(n.status===404)return null;if(!n.ok)throw Error((await this.failure(n)).error);return(await n.json()).value}async search(e,t,n=50){let r=await fetch(`${this.url}/capabilities/search/${encodeURIComponent(e)}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify({query:t,limit:n})});if(!r.ok)throw Error((await this.failure(r)).error);return(await r.json()).map(e=>e.value)}async provenance(e,t){let n=await fetch(`${this.url}/provenance/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{headers:this.headers()});if(!n.ok)throw Error((await this.failure(n)).error);return n.json()}async storeContent(e){let t=await fetch(`${this.url}/content`,{method:`PUT`,headers:this.headers(),body:e});if(!t.ok)throw Error((await this.failure(t)).error);return t.json()}async acquireContent(e){let t=await fetch(`${this.url}/content/${encodeURIComponent(e)}`,{headers:this.headers()});if(t.status===404)return null;if(!t.ok)throw Error((await this.failure(t)).error);return new Uint8Array(await t.arrayBuffer())}async command(e,t){let n=await fetch(`${this.url}${e}`,{method:`POST`,headers:this.headers(!0),body:JSON.stringify(t)});if(!n.ok)throw Error((await this.failure(n)).error);return n.status===204?void 0:n.json()}subscribe_changes(e){let t=new AbortController;return this.consumeEvents(t,e),()=>t.abort()}async consumeEvents(e,t){for(;!e.signal.aborted;){try{let n=await fetch(`${this.url}/events`,{headers:this.headers(),signal:e.signal});if(!n.ok||!n.body)throw Error(`Event stream failed: HTTP ${n.status}`);let r=n.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:n}=await r.read();if(e)break;a+=i.decode(n,{stream:!0}).replace(/\r\n/g,`
|
|
11
11
|
`);let o=a.split(`
|
|
12
12
|
|
|
13
13
|
`);a=o.pop()??``;for(let e of o){let n=e.split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-DVdvmf69.js"></script>
|
|
2
2
|
<link rel="stylesheet" crossorigin href="/assets/index-C1GWyazR.css">
|
|
3
3
|
</head><body><div id="root"></div></body></html>
|